setAdapter(new TActiveControlAdapter($this)); parent::__construct(); } /** * @return TBaseActiveCallbackControl standard callback control options. */ public function getActiveControl() { return $this->getAdapter()->getBaseActiveControl(); } /** * @return TCallbackClientSide client side request options. */ public function getClientSide() { return $this->getAdapter()->getBaseActiveControl()->getClientSide(); } /** * Raises the callback event. This method is required by {@link * ICallbackEventHandler} interface. * This method is mainly used by framework and control developers. * @param TCallbackEventParameter the event parameter */ public function raiseCallbackEvent($param) { $this->onCallback($param); } /** * This method is invoked when a callback is requested. The method raises * 'OnCallback' event to fire up the event handlers. If you override this * method, be sure to call the parent implementation so that the event * handler can be invoked. * @param TCallbackEventParameter event parameter to be passed to the event handlers */ public function onCallback($param) { $this->raiseEvent('OnCallback', $this, $param); } /** * Gets the name of the javascript class responsible for performing postback for this control. * This method overrides the parent implementation. * @return string the javascript class name */ protected function getClientClassName() { return 'MyDraggable'; } /** * Override parent implementation, no javascript is rendered here instead * the javascript required for active control is registered in {@link addAttributesToRender}. */ protected function renderClientControlScript($writer) { } /** * Ensure that the ID attribute is rendered and registers the javascript code * for initializing the active control. */ protected function addAttributesToRender($writer) { parent::addAttributesToRender($writer); $writer->addAttribute('id',$this->getClientID()); $this->getActiveControl()->registerCallbackClientScript( $this->getClientClassName(), $this->getPostBackOptions()); } /** * Determine if draggable element should revert to it orginal position * upon release in an non-droppable container. * @return boolean true to revert */ public function getRevert() { return $this->getViewState('revert', true); } /** * Sets whether the draggable element should revert to it orginal position * upon release in an non-droppable container. * @param boolean true to revert */ public function setRevert($value) { $this->setViewState('revert', $value, true); } /** * @return boolean a value indicating whether an automatic postback to the server * will occur whenever the user modifies the text in the TTextBox control and * then tabs out of the component. Defaults to false. */ public function getAutoPostBack() { return $this->getViewState('AutoPostBack',false); } /** * Sets the value indicating if postback automatically. * An automatic postback to the server will occur whenever the user * modifies the text in the TTextBox control and then tabs out of the component. * @param boolean the value indicating if postback automatically */ public function setAutoPostBack($value) { $this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false); } /** * Gets the post back options for this textbox. * @return array */ protected function getPostBackOptions() { $options['ID'] = $this->getClientID(); $options['EventTarget'] = $this->getUniqueID(); $options['AutoPostBack'] = $this->getAutoPostBack(); return $options; } } ?>