diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2015-01-20 22:34:11 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2015-01-20 22:34:11 +0100 |
commit | 7369988330bf8796d9cf2564756baf4eb46871ba (patch) | |
tree | 60a0bac5467b76ab6ed45328ed8c4e65703400b7 /framework/Web/UI/ActiveControls/TActiveBoundColumn.php | |
parent | ef4d964de440970b76ab48fcbd6748f43675efa3 (diff) |
one class per file: framework/Web/UI/ActiveControls
Diffstat (limited to 'framework/Web/UI/ActiveControls/TActiveBoundColumn.php')
-rw-r--r-- | framework/Web/UI/ActiveControls/TActiveBoundColumn.php | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/framework/Web/UI/ActiveControls/TActiveBoundColumn.php b/framework/Web/UI/ActiveControls/TActiveBoundColumn.php new file mode 100644 index 00000000..47300ca4 --- /dev/null +++ b/framework/Web/UI/ActiveControls/TActiveBoundColumn.php @@ -0,0 +1,87 @@ +<?php +/** + * TActiveDataGrid class file + * + * @author LANDWEHR Computer und Software GmbH <programmierung@landwehr-software.de> + * @link http://www.landwehr-software.de/ + * @copyright Copyright © 2009 LANDWEHR Computer und Software GmbH + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.ActiveControls + */ + + +/** + * TActiveBoundColumn class + * + * TActiveBoundColumn represents a column that is bound to a field in a data source. + * The cells in the column will be displayed using the data indexed by + * {@link setDataField DataField}. You can customize the display by + * setting {@link setDataFormatString DataFormatString}. + * + * This is the active counterpart to the {@link TBoundColumn} control. For that purpose, + * if sorting is allowed, the header links/buttons are replaced by active controls. + * + * Please refer to the original documentation of the {@link TBoundColumn} for usage. + * + * @author LANDWEHR Computer und Software GmbH <programmierung@landwehr-software.de> + * @package System.Web.UI.ActiveControls + * @since 3.1.9 + */ +class TActiveBoundColumn extends TBoundColumn { + protected function initializeHeaderCell($cell,$columnIndex) { + $text=$this->getHeaderText(); + + if(($classPath=$this->getHeaderRenderer())!=='') { + $control=Prado::createComponent($classPath); + if($control instanceof IDataRenderer) { + if($control instanceof IItemDataRenderer) { + $item=$cell->getParent(); + $control->setItemIndex($item->getItemIndex()); + $control->setItemType($item->getItemType()); + } + $control->setData($text); + } + $cell->getControls()->add($control); + } + else if($this->getAllowSorting()) { + $sortExpression=$this->getSortExpression(); + if(($url=$this->getHeaderImageUrl())!=='') { + $button=Prado::createComponent('System.Web.UI.WebControls.TActiveImageButton'); + $button->setImageUrl($url); + $button->setCommandName(TDataGrid::CMD_SORT); + $button->setCommandParameter($sortExpression); + if($text!=='') { + $button->setAlternateText($text); + $button->setToolTip($text); + } + $button->setCausesValidation(false); + $cell->getControls()->add($button); + } + else if($text!=='') { + $button=Prado::createComponent('System.Web.UI.WebControls.TActiveLinkButton'); + $button->setText($text); + $button->setCommandName(TDataGrid::CMD_SORT); + $button->setCommandParameter($sortExpression); + $button->setCausesValidation(false); + $cell->getControls()->add($button); + } + else + $cell->setText(' '); + } + else { + if(($url=$this->getHeaderImageUrl())!=='') { + $image=Prado::createComponent('System.Web.UI.WebControls.TActiveImage'); + $image->setImageUrl($url); + if($text!=='') { + $image->setAlternateText($text); + $image->setToolTip($text); + } + $cell->getControls()->add($image); + } + else if($text!=='') + $cell->setText($text); + else + $cell->setText(' '); + } + } +}
\ No newline at end of file |