summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
authorxue <>2006-02-20 16:45:58 +0000
committerxue <>2006-02-20 16:45:58 +0000
commit8e5627918e7f0c437df1a47af27545132a1c3cbc (patch)
tree7c3e922407ecb3dc9a5cd9f646cdc7e7d10c7b04 /framework/Web/UI
parentee43ef11c96e8d3f7065243ace88d8abfef0147c (diff)
some more refactoring.
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/WebControls/TEditCommandColumn.php35
1 files changed, 14 insertions, 21 deletions
diff --git a/framework/Web/UI/WebControls/TEditCommandColumn.php b/framework/Web/UI/WebControls/TEditCommandColumn.php
index 954ef8f7..abc372a0 100644
--- a/framework/Web/UI/WebControls/TEditCommandColumn.php
+++ b/framework/Web/UI/WebControls/TEditCommandColumn.php
@@ -154,43 +154,36 @@ class TEditCommandColumn extends TDataGridColumn
{
parent::initializeCell($cell,$columnIndex,$itemType);
if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem')
- $this->addButtonToCell($cell,'Edit',$this->getEditText(),false,'');
+ $cell->getControls()->add($this->createButton('Edit',$this->getEditText(),false,''));
else if($itemType==='EditItem')
{
- $this->addButtonToCell($cell,'Update',$this->getUpdateText(),$this->getCausesValidation(),$this->getValidationGroup());
- $cell->getControls()->add('&nbsp;');
- $this->addButtonToCell($cell,'Cancel',$this->getCancelText(),false,'');
+ $controls=$cell->getControls();
+ $controls->add($this->createButton('Update',$this->getUpdateText(),$this->getCausesValidation(),$this->getValidationGroup()));
+ $controls->add('&nbsp;');
+ $controls->add($this->createButton('Cancel',$this->getCancelText(),false,''));
}
}
/**
- * Creates a button and adds it to the cell.
- * @param TTableCell the cell that the button is created within
+ * Creates a button and initializes its properties.
+ * The button type is determined by {@link getButtonType ButtonType}.
* @param string command name associated with the button
* @param string button caption
* @param boolean whether the button should cause validation
* @param string the validation group that the button belongs to
+ * @return mixed the newly created button.
*/
- protected function addButtonToCell($cell,$commandName,$text,$causesValidation,$validationGroup)
+ protected function createButton($commandName,$text,$causesValidation,$validationGroup)
{
- $button=$this->createButton();
+ if($this->getButtonType()==='LinkButton')
+ $button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
+ else
+ $button=Prado::createComponent('System.Web.UI.WebControls.TButton');
$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');
+ return $button;
}
}