summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TEditCommandColumn.php
diff options
context:
space:
mode:
authorxue <>2006-09-04 18:12:17 +0000
committerxue <>2006-09-04 18:12:17 +0000
commite83edc3f20163ac25e2307f9c854e7bc9384970c (patch)
treeb5b22b7255a7b56168cea239108958e9a0fd6893 /framework/Web/UI/WebControls/TEditCommandColumn.php
parent85509ff45f9ae8795b7f6ef2c58a45d8a574f939 (diff)
Finished updating code related with enumerable data types.
Diffstat (limited to 'framework/Web/UI/WebControls/TEditCommandColumn.php')
-rw-r--r--framework/Web/UI/WebControls/TEditCommandColumn.php73
1 files changed, 66 insertions, 7 deletions
diff --git a/framework/Web/UI/WebControls/TEditCommandColumn.php b/framework/Web/UI/WebControls/TEditCommandColumn.php
index c742ef11..327e03a2 100644
--- a/framework/Web/UI/WebControls/TEditCommandColumn.php
+++ b/framework/Web/UI/WebControls/TEditCommandColumn.php
@@ -25,7 +25,7 @@ Prado::using('System.Web.UI.WebControls.TDataGridColumn');
* The button captions are specified using {@link setEditText EditText},
* {@link setUpdateText UpdateText}, and {@link setCancelText CancelText}.
*
- * The buttons in the column can be set to display as hyperlinks or push buttons
+ * The buttons in the column can be set to display as hyperlinks, push or image buttons
* by setting the {@link setButtonType ButtonType} property.
*
* When an edit button is clicked, the datagrid will generate an
@@ -54,19 +54,19 @@ Prado::using('System.Web.UI.WebControls.TDataGridColumn');
class TEditCommandColumn extends TDataGridColumn
{
/**
- * @return string the type of command button. Defaults to LinkButton.
+ * @return TButtonColumnType the type of command button. Defaults to TButtonColumnType::LinkButton.
*/
public function getButtonType()
{
- return $this->getViewState('ButtonType','LinkButton');
+ return $this->getViewState('ButtonType',TButtonColumnType::LinkButton);
}
/**
- * @param string the type of command button, LinkButton or PushButton
+ * @param TButtonColumnType the type of command button.
*/
public function setButtonType($value)
{
- $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'LinkButton','PushButton'),'LinkButton');
+ $this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'TButtonColumnType'),TButtonColumnType::LinkButton);
}
/**
@@ -86,6 +86,22 @@ class TEditCommandColumn extends TDataGridColumn
}
/**
+ * @return string the URL of the image file for edit image buttons
+ */
+ public function getEditImageUrl()
+ {
+ return $this->getViewState('EditImageUrl','');
+ }
+
+ /**
+ * @param string the URL of the image file for edit image buttons
+ */
+ public function setEditImageUrl($value)
+ {
+ $this->setViewState('EditImageUrl',$value,'');
+ }
+
+ /**
* @return string the caption of the update button. Defaults to 'Update'.
*/
public function getUpdateText()
@@ -102,6 +118,22 @@ class TEditCommandColumn extends TDataGridColumn
}
/**
+ * @return string the URL of the image file for update image buttons
+ */
+ public function getUpdateImageUrl()
+ {
+ return $this->getViewState('UpdateImageUrl','');
+ }
+
+ /**
+ * @param string the URL of the image file for update image buttons
+ */
+ public function setUpdateImageUrl($value)
+ {
+ $this->setViewState('UpdateImageUrl',$value,'');
+ }
+
+ /**
* @return string the caption of the cancel button. Defaults to 'Cancel'.
*/
public function getCancelText()
@@ -118,6 +150,22 @@ class TEditCommandColumn extends TDataGridColumn
}
/**
+ * @return string the URL of the image file for cancel image buttons
+ */
+ public function getCancelImageUrl()
+ {
+ return $this->getViewState('CancelImageUrl','');
+ }
+
+ /**
+ * @param string the URL of the image file for cancel image buttons
+ */
+ public function setCancelImageUrl($value)
+ {
+ $this->setViewState('CancelImageUrl',$value,'');
+ }
+
+ /**
* @return boolean whether postback event trigger by edit or update button will cause input validation, default is true
*/
public function getCausesValidation()
@@ -191,10 +239,21 @@ class TEditCommandColumn extends TDataGridColumn
*/
protected function createButton($commandName,$text,$causesValidation,$validationGroup)
{
- if($this->getButtonType()==='LinkButton')
+ if($this->getButtonType()===TButtonColumnType::LinkButton)
$button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
- else
+ else if($this->getButtonType()===TButtonColumnType::PushButton)
$button=Prado::createComponent('System.Web.UI.WebControls.TButton');
+ else // image buttons
+ {
+ $button=Prado::createComponent('System.Web.UI.WebControls.TImageButton');
+ if(strcasecmp($commandName,'Update')===0)
+ $url=$this->getUpdateImageUrl();
+ else if(strcasecmp($commandName,'Cancel')===0)
+ $url=$this->getCancelImageUrl();
+ else
+ $url=$this->getEditImageUrl();
+ $button->setImageUrl($url);
+ }
$button->setText($text);
$button->setCommandName($commandName);
$button->setCausesValidation($causesValidation);