summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
authorxue <>2006-02-20 16:36:47 +0000
committerxue <>2006-02-20 16:36:47 +0000
commitee43ef11c96e8d3f7065243ace88d8abfef0147c (patch)
tree22950ab7beae04712d2e993f70b8ab6bd40f030a /framework/Web/UI/WebControls
parent3dcb3c4188c8d5836a2db0847d2fc43bc7e7e4d8 (diff)
Refactored TEditCommandColumn to make it easier for being extended.
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TEditCommandColumn.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/framework/Web/UI/WebControls/TEditCommandColumn.php b/framework/Web/UI/WebControls/TEditCommandColumn.php
index 6cb93a39..954ef8f7 100644
--- a/framework/Web/UI/WebControls/TEditCommandColumn.php
+++ b/framework/Web/UI/WebControls/TEditCommandColumn.php
@@ -153,7 +153,6 @@ class TEditCommandColumn extends TDataGridColumn
public function initializeCell($cell,$columnIndex,$itemType)
{
parent::initializeCell($cell,$columnIndex,$itemType);
- $buttonType=$this->getButtonType()=='LinkButton'?'TLinkButton':'TButton';
if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem')
$this->addButtonToCell($cell,'Edit',$this->getEditText(),false,'');
else if($itemType==='EditItem')
@@ -174,16 +173,25 @@ class TEditCommandColumn extends TDataGridColumn
*/
protected function addButtonToCell($cell,$commandName,$text,$causesValidation,$validationGroup)
{
- if($this->getButtonType()==='LinkButton')
- $button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
- else
- $button=Prado::createComponent('System.Web.UI.WebControls.TButton');
+ $button=$this->createButton();
$button->setText($text);
$button->setCommandName($commandName);
$button->setCausesValidation($causesValidation);
$button->setValidationGroup($validationGroup);
$cell->getControls()->add($button);
}
+
+ /**
+ * Creates a button by {@link getButtonType ButtonType}.
+ * @return mixed the newly created button.
+ */
+ protected function createButton()
+ {
+ if($this->getButtonType()==='LinkButton')
+ return Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
+ else
+ return Prado::createComponent('System.Web.UI.WebControls.TButton');
+ }
}
?> \ No newline at end of file