Changeset 2210

Show
Ignore:
Timestamp:
09/06/2007 11:32:44 AM
Author:
tof
Message:

TSlider: Add handle as a child control instead of just rendering it

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/framework/Web/UI/WebControls/TSlider.php

    r2202 r2210  
    210210                $this->setViewState('Values', TPropertyValue::ensureArray($value), array()); 
    211211        } 
    212  
    213         /** 
    214          * @return TSliderHandle the control for the slider's handle. 
     212         
     213        /** 
     214         * Create the child controls 
     215         * Override parent implementation to create the handle control 
     216         */ 
     217        public function createChildControls() 
     218        { 
     219                $this->_handle=prado::createComponent($this->getHandleClass(), $this); 
     220                if (!$this->_handle instanceof TSliderHandle) 
     221                { 
     222                                throw new TInvalidDataTypeException('slider_handle_class_invalid', get_class($this->_handle)); 
     223                } 
     224                $this->getControls()->add($this->_handle); 
     225        } 
     226         
     227        /** 
     228         * This method will return the handle control. 
     229         * @return TSliderHandle the control for the slider's handle (must inherit from TSliderHandle} 
    215230         */ 
    216231        public function getHandle () 
    217232        { 
    218                 if ($this->_handle==null) 
    219                 { 
    220                         $this->_handle=prado::createComponent($this->getHandleClass(), $this); 
    221                         if (!$this->_handle instanceof TSliderHandle) 
    222                         { 
    223                                 throw new TInvalidDataTypeException('slider_handle_class_invalid', get_class($this->_handle)); 
    224                         } 
    225                 } 
     233                $this->ensureChildControls(); 
    226234                return $this->_handle; 
    227235        } 
     236         
    228237 
    229238        /** 
     
    359368        { 
    360369                return "div"; 
    361         } 
    362  
    363         /** 
    364          * Renders body content. 
    365          * This method renders the handle of slider 
    366          * This method overrides parent implementation 
    367          * @param THtmlWriter writer 
    368          */ 
    369         public function renderContents($writer) 
    370         { 
    371                 // Render the handle 
    372                 $this->getHandle()->render ($writer); 
    373370        } 
    374371