From bf66ad7bb36e881f53437491333940d74d77139e Mon Sep 17 00:00:00 2001 From: wei <> Date: Wed, 25 Jan 2006 11:34:58 +0000 Subject: Changed AssociatedControlID to ForControl --- .../protected/pages/Controls/Samples/TLabel/Home.page | 2 +- framework/Web/UI/WebControls/TBaseValidator.php | 6 +++--- framework/Web/UI/WebControls/TLabel.php | 14 +++++++------- .../FunctionalTests/protected/pages/UI/LabeledTextBox.php | 6 ++++++ .../FunctionalTests/protected/pages/UI/LabeledTextBox.tpl | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/demos/quickstart/protected/pages/Controls/Samples/TLabel/Home.page b/demos/quickstart/protected/pages/Controls/Samples/TLabel/Home.page index 8b3a2714..b3861863 100644 --- a/demos/quickstart/protected/pages/Controls/Samples/TLabel/Home.page +++ b/demos/quickstart/protected/pages/Controls/Samples/TLabel/Home.page @@ -18,7 +18,7 @@
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php index 5110230b..eeb5d0e8 100644 --- a/framework/Web/UI/WebControls/TBaseValidator.php +++ b/framework/Web/UI/WebControls/TBaseValidator.php @@ -180,13 +180,13 @@ abstract class TBaseValidator extends TLabel implements IValidator } /** - * This method overrides the parent implementation to forbid setting AssociatedControlID. + * This method overrides the parent implementation to forbid setting ForControl. * @param string the associated control ID * @throws TNotSupportedException whenever this method is called */ - public function setAssociatedControlID($value) + public function setForControl($value) { - throw new TNotSupportedException('basevalidator_associatedcontrolid_unsupported',get_class($this)); + throw new TNotSupportedException('basevalidator_forcontrol_unsupported',get_class($this)); } /** diff --git a/framework/Web/UI/WebControls/TLabel.php b/framework/Web/UI/WebControls/TLabel.php index 5a53def4..89783bd5 100644 --- a/framework/Web/UI/WebControls/TLabel.php +++ b/framework/Web/UI/WebControls/TLabel.php @@ -18,7 +18,7 @@ * TLabel will render the contents enclosed within its component tag * if {@link setText Text} is empty. * To use TLabel as a form label, associate it with a control by setting the - * {@link setAssociatedControlID AssociatedControlID} property. + * {@link setForControl ForControl} property. * The associated control must be locatable within the label's naming container. * * Note, {@link setText Text} will NOT be encoded for rendering. @@ -36,7 +36,7 @@ class TLabel extends TWebControl */ protected function getTagName() { - return ($this->getAssociatedControlID()==='')?'span':'label'; + return ($this->getForControl()==='')?'span':'label'; } /** @@ -46,7 +46,7 @@ class TLabel extends TWebControl */ protected function addAttributesToRender($writer) { - if(($aid=$this->getAssociatedControlID())!=='') + if(($aid=$this->getForControl())!=='') { if($control=$this->findControl($aid)) $writer->addAttribute('for',$control->getClientID()); @@ -87,9 +87,9 @@ class TLabel extends TWebControl /** * @return string the associated control ID */ - public function getAssociatedControlID() + public function getForControl() { - return $this->getViewState('AssociatedControlID',''); + return $this->getViewState('ForControl',''); } /** @@ -97,9 +97,9 @@ class TLabel extends TWebControl * The control must be locatable via {@link TControl::findControl} using the ID. * @param string the associated control ID */ - public function setAssociatedControlID($value) + public function setForControl($value) { - $this->setViewState('AssociatedControlID',$value,''); + $this->setViewState('ForControl',$value,''); } } diff --git a/tests/FunctionalTests/protected/pages/UI/LabeledTextBox.php b/tests/FunctionalTests/protected/pages/UI/LabeledTextBox.php index 7cebc483..3a3eba2d 100644 --- a/tests/FunctionalTests/protected/pages/UI/LabeledTextBox.php +++ b/tests/FunctionalTests/protected/pages/UI/LabeledTextBox.php @@ -10,11 +10,17 @@ */ class LabeledTextBox extends TTemplateControl { + /** + * @return TTextBox textbox instance + */ public function getTextBox() { return $this->textbox; } + /** + * @return TLabel textbox label + */ public function getLabel() { return $this->label; diff --git a/tests/FunctionalTests/protected/pages/UI/LabeledTextBox.tpl b/tests/FunctionalTests/protected/pages/UI/LabeledTextBox.tpl index 6eda63a5..3c8cc11f 100644 --- a/tests/FunctionalTests/protected/pages/UI/LabeledTextBox.tpl +++ b/tests/FunctionalTests/protected/pages/UI/LabeledTextBox.tpl @@ -1,2 +1,2 @@ - + \ No newline at end of file -- cgit v1.2.3