From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- framework/Web/UI/WebControls/TKeyboard.php | 378 ++++++++++++++--------------- 1 file changed, 189 insertions(+), 189 deletions(-) (limited to 'framework/Web/UI/WebControls/TKeyboard.php') diff --git a/framework/Web/UI/WebControls/TKeyboard.php b/framework/Web/UI/WebControls/TKeyboard.php index 27cb55c5..58c80e26 100644 --- a/framework/Web/UI/WebControls/TKeyboard.php +++ b/framework/Web/UI/WebControls/TKeyboard.php @@ -1,189 +1,189 @@ - and Qiang Xue - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2012 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id$ - * @package System.Web.UI.WebControls - * @since 3.1.1 - */ - -/** - * Class TKeyboard. - * - * TKeyboard displays a virtual keyboard that users can click on to enter input in - * an associated text box. It helps to reduce the keyboard recording hacking. - * - * To use TKeyboard, write a template like following: - * - * - * - * - * - * A TKeyboard control is associated with a {@link TTextBox} control by specifying {@link setForControl ForControl} - * to be the ID of that control. When the textbox is in focus, a virtual keyboard will pop up; and when - * the text box is losing focus, the keyboard will hide automatically. Set {@link setAutoHide AutoHide} to - * false to keep the keyboard showing all the time. - * - * The appearance of the keyboard can also be changed by specifying a customized CSS file via - * {@link setCssUrl CssUrl}. By default, the CSS class name for the keyboard is 'Keyboard'. This may - * also be changed by specifying {@link setKeyboardCssClass KeyboardCssClass}. - * - * @author Sergey Morkovkin and Qiang Xue - * @version $Id$ - * @package System.Web.UI.WebControls - * @since 3.1.1 - */ -class TKeyboard extends TWebControl -{ - /** - * @return string the ID path of the {@link TTextBox} control - */ - public function getForControl() - { - return $this->getViewState('ForControl',''); - } - - /** - * Sets the ID path of the {@link TTextBox} control. - * The ID path is the dot-connected IDs of the controls reaching from - * the keyboard's naming container to the target control. - * @param string the ID path - */ - public function setForControl($value) - { - $this->setViewState('ForControl', TPropertyValue::ensureString($value)); - } - - /** - * @return boolean whether the keyboard should be hidden when the textbox is not in focus. Defaults to true. - */ - public function getAutoHide() - { - return $this->getViewState('AutoHide', true); - } - - /** - * @param boolean whether the keyboard should be hidden when the textbox is not in focus. - */ - public function setAutoHide($value) - { - $this->setViewState('AutoHide', TPropertyValue::ensureBoolean($value), true); - } - - /** - * @return string the CSS class name for the keyboard
element. Defaults to 'Keyboard'. - */ - public function getKeyboardCssClass() - { - return $this->getViewState('KeyboardCssClass', 'Keyboard'); - } - - /** - * Sets a value indicating the CSS class name for the keyboard
element. - * Note, if you change this property, make sure you also supply a customized CSS file - * by specifying {@link setCssUrl CssUrl} which uses the new CSS class name for styling. - * @param string the CSS class name for the keyboard
element. - */ - public function setKeyboardCssClass($value) - { - $this->setViewState('KeyboardCssClass', $value, 'Keyboard'); - } - - /** - * @return string the URL for the CSS file to customize the appearance of the keyboard. - */ - public function getCssUrl() - { - return $this->getViewState('CssUrl', ''); - } - - /** - * @param string the URL for the CSS file to customize the appearance of the keyboard. - */ - public function setCssUrl($value) - { - $this->setViewState('CssUrl', $value, ''); - } - - /** - * Registers CSS and JS. - * This method is invoked right before the control rendering, if the control is visible. - * @param mixed event parameter - */ - public function onPreRender($param) - { - parent::onPreRender($param); - if($this->getPage()->getClientSupportsJavaScript()) - { - $this->registerStyleSheet(); - $this->registerClientScript(); - } - } - - /** - * Adds attribute name-value pairs to renderer. - * This method overrides the parent implementation with additional TKeyboard specific attributes. - * @param THtmlWriter the writer used for the rendering purpose - */ - protected function addAttributesToRender($writer) - { - parent::addAttributesToRender($writer); - if($this->getPage()->getClientSupportsJavaScript()) - $writer->addAttribute('id',$this->getClientID()); - } - - /** - * Registers the CSS relevant to the TKeyboard. - * It will register the CSS file specified by {@link getCssUrl CssUrl}. - * If that is not set, it will use the default CSS. - */ - protected function registerStyleSheet() - { - if(($url=$this->getCssUrl())==='') - $url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'keyboard.css'); - $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); - } - - /** - * Registers the relevant JavaScript. - */ - protected function registerClientScript() - { - $options=TJavaScript::encode($this->getClientOptions()); - $className=$this->getClientClassName(); - $cs=$this->getPage()->getClientScript(); - $cs->registerPradoScript('keyboard'); - $cs->registerEndScript('prado:'.$this->getClientID(), "new $className($options);"); - } - - /** - * @return string the Javascript class name for this control - */ - protected function getClientClassName() - { - return 'Prado.WebUI.TKeyboard'; - } - - /** - * @return array the JavaScript options for this control - */ - protected function getClientOptions() - { - if(($forControl=$this->getForControl())==='') - throw new TConfigurationException('keyboard_forcontrol_required'); - if(($target=$this->findControl($forControl))===null) - throw new TConfigurationException('keyboard_forcontrol_invalid',$forControl); - - $options['ID'] = $this->getClientID(); - $options['ForControl'] = $target->getClientID(); - $options['AutoHide'] = $this->getAutoHide(); - $options['CssClass'] = $this->getKeyboardCssClass(); - - return $options; - } -} - + and Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2012 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @package System.Web.UI.WebControls + * @since 3.1.1 + */ + +/** + * Class TKeyboard. + * + * TKeyboard displays a virtual keyboard that users can click on to enter input in + * an associated text box. It helps to reduce the keyboard recording hacking. + * + * To use TKeyboard, write a template like following: + * + * + * + * + * + * A TKeyboard control is associated with a {@link TTextBox} control by specifying {@link setForControl ForControl} + * to be the ID of that control. When the textbox is in focus, a virtual keyboard will pop up; and when + * the text box is losing focus, the keyboard will hide automatically. Set {@link setAutoHide AutoHide} to + * false to keep the keyboard showing all the time. + * + * The appearance of the keyboard can also be changed by specifying a customized CSS file via + * {@link setCssUrl CssUrl}. By default, the CSS class name for the keyboard is 'Keyboard'. This may + * also be changed by specifying {@link setKeyboardCssClass KeyboardCssClass}. + * + * @author Sergey Morkovkin and Qiang Xue + * @version $Id$ + * @package System.Web.UI.WebControls + * @since 3.1.1 + */ +class TKeyboard extends TWebControl +{ + /** + * @return string the ID path of the {@link TTextBox} control + */ + public function getForControl() + { + return $this->getViewState('ForControl',''); + } + + /** + * Sets the ID path of the {@link TTextBox} control. + * The ID path is the dot-connected IDs of the controls reaching from + * the keyboard's naming container to the target control. + * @param string the ID path + */ + public function setForControl($value) + { + $this->setViewState('ForControl', TPropertyValue::ensureString($value)); + } + + /** + * @return boolean whether the keyboard should be hidden when the textbox is not in focus. Defaults to true. + */ + public function getAutoHide() + { + return $this->getViewState('AutoHide', true); + } + + /** + * @param boolean whether the keyboard should be hidden when the textbox is not in focus. + */ + public function setAutoHide($value) + { + $this->setViewState('AutoHide', TPropertyValue::ensureBoolean($value), true); + } + + /** + * @return string the CSS class name for the keyboard
element. Defaults to 'Keyboard'. + */ + public function getKeyboardCssClass() + { + return $this->getViewState('KeyboardCssClass', 'Keyboard'); + } + + /** + * Sets a value indicating the CSS class name for the keyboard
element. + * Note, if you change this property, make sure you also supply a customized CSS file + * by specifying {@link setCssUrl CssUrl} which uses the new CSS class name for styling. + * @param string the CSS class name for the keyboard
element. + */ + public function setKeyboardCssClass($value) + { + $this->setViewState('KeyboardCssClass', $value, 'Keyboard'); + } + + /** + * @return string the URL for the CSS file to customize the appearance of the keyboard. + */ + public function getCssUrl() + { + return $this->getViewState('CssUrl', ''); + } + + /** + * @param string the URL for the CSS file to customize the appearance of the keyboard. + */ + public function setCssUrl($value) + { + $this->setViewState('CssUrl', $value, ''); + } + + /** + * Registers CSS and JS. + * This method is invoked right before the control rendering, if the control is visible. + * @param mixed event parameter + */ + public function onPreRender($param) + { + parent::onPreRender($param); + if($this->getPage()->getClientSupportsJavaScript()) + { + $this->registerStyleSheet(); + $this->registerClientScript(); + } + } + + /** + * Adds attribute name-value pairs to renderer. + * This method overrides the parent implementation with additional TKeyboard specific attributes. + * @param THtmlWriter the writer used for the rendering purpose + */ + protected function addAttributesToRender($writer) + { + parent::addAttributesToRender($writer); + if($this->getPage()->getClientSupportsJavaScript()) + $writer->addAttribute('id',$this->getClientID()); + } + + /** + * Registers the CSS relevant to the TKeyboard. + * It will register the CSS file specified by {@link getCssUrl CssUrl}. + * If that is not set, it will use the default CSS. + */ + protected function registerStyleSheet() + { + if(($url=$this->getCssUrl())==='') + $url=$this->getApplication()->getAssetManager()->publishFilePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'keyboard.css'); + $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); + } + + /** + * Registers the relevant JavaScript. + */ + protected function registerClientScript() + { + $options=TJavaScript::encode($this->getClientOptions()); + $className=$this->getClientClassName(); + $cs=$this->getPage()->getClientScript(); + $cs->registerPradoScript('keyboard'); + $cs->registerEndScript('prado:'.$this->getClientID(), "new $className($options);"); + } + + /** + * @return string the Javascript class name for this control + */ + protected function getClientClassName() + { + return 'Prado.WebUI.TKeyboard'; + } + + /** + * @return array the JavaScript options for this control + */ + protected function getClientOptions() + { + if(($forControl=$this->getForControl())==='') + throw new TConfigurationException('keyboard_forcontrol_required'); + if(($target=$this->findControl($forControl))===null) + throw new TConfigurationException('keyboard_forcontrol_invalid',$forControl); + + $options['ID'] = $this->getClientID(); + $options['ForControl'] = $target->getClientID(); + $options['AutoHide'] = $this->getAutoHide(); + $options['CssClass'] = $this->getKeyboardCssClass(); + + return $options; + } +} + -- cgit v1.2.3