From 5af330b442f15be0f0535a9e3c053b8e6eb5a202 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 15 Jan 2006 06:14:10 +0000 Subject: Added TDataGridColumn. --- framework/Web/UI/WebControls/TDataGrid.php | 220 +++++++++++++++++------------ 1 file changed, 132 insertions(+), 88 deletions(-) (limited to 'framework/Web/UI/WebControls/TDataGrid.php') diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index 23b45842..205b97a0 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -96,96 +96,10 @@ * * An OnItemCreated event will be raised right after each item is created in the datagrid. * - * Namespace: System.Web.UI.WebControls - * - * Properties - * - Items, TDataGridItemCollection, read-only - *
Gets the list of TDataGridItem controls that correspond to each data item. - * - Columns, TCollection, read-only - *
Gets the list of TDataGridColumn controls that are manually specified or created. - * - AutoGenerateColumns, boolean, default=true, kept in viewstate - *
Gets or sets the value indicating whether columns should be generated automatically based on the data in datasource. - * - AllowSorting, boolean, default=false, kept in viewstate - *
Gets or sets the value indicating whether sorting should be enabled. - * - AllowPaging, boolean, default=false, kept in viewstate - *
Gets or sets the value indicating whether paging should be enabled. - * - AllowCustomPaging, boolean, default=false, kept in viewstate - *
Gets or sets the value indicating whether custom paging should be enabled. - * - CurrentPageIndex, integer, default=0, stored in viewstate - *
Gets or sets the index for the page to be displayed - * - PageSize, integer, default=10, stored in viewstate - *
Gets or sets the number of data items to be displayed in each page. - * - PageCount, integer, read-only - *
Gets the number of pages to be displayed. - * - VirtualItemCount, integer, default=0, stored in viewstate - *
Gets or sets the number of data items available for paging purpose when custom paging is enabled. - * - PagerButtonCount, integer, default=10, stored in viewstate - *
Gets or sets the number of buttons to be displayed in pager for navigating among pages. - * - PagerDisplay, string (None,Top,Bottom,TopAndBottom), default=Bottom, stored in viewstate - *
Gets or sets where the pager should be displayed. - * - EditItemIndex, integer, default=-1, stored in viewstate - *
Gets or sets the index for edit item. - * - EditItem, TDataGridItem, read-only - *
Gets the edit item, null if none - * - EditItemStyle, string, stored in viewstate - *
Gets or sets the css style for the edit item - * - EditItemCssClass, string, stored in viewstate - *
Gets or sets the css classs for the edit item - * - SelectedItemIndex, integer, default=-1, stored in viewstate - *
Gets or sets the index for selected item. - * - SelectedItem, TDataGridItem, read-only - *
Gets the selected item, null if none - * - SelectedItemStyle, string, stored in viewstate - *
Gets or sets the css style for the selected item - * - SelectedItemCssClass, string, stored in viewstate - *
Gets or sets the css class for the selected item - * - ItemStyle, string, stored in viewstate - *
Gets or sets the css style for each item - * - ItemCssClass, string, stored in viewstate - *
Gets or sets the css class for each item - * - AlternatingItemStyle, string, stored in viewstate - *
Gets or sets the css style for each alternating item - * - AlternatingItemCssClass, string, stored in viewstate - *
Gets or sets the css class for each alternating item - * - HeaderStyle, string, stored in viewstate - *
Gets or sets the css style for the header - * - HeaderCssClass, string, stored in viewstate - *
Gets or sets the css class for the header - * - FooterStyle, string, stored in viewstate - *
Gets or sets the css style for the footer - * - FooterCssClass, string, stored in viewstate - *
Gets or sets the css class for the footer - * - PagerStyle, string, stored in viewstate - *
Gets or sets the css style for the pager - * - PagerCssClass, string, stored in viewstate - *
Gets or sets the css class for the pager - * - ShowHeader, boolean, default=true, stored in viewstate - *
Gets or sets the value whether to show header - * - ShowFooter, boolean, default=true, stored in viewstate - *
Gets or sets the value whether to show footer - * - Header, TDataGridItem - *
Gets the header of the data grid. - * - Footer, TDataGridItem - *
Gets the footer of the data grid. - * - Pager, TDataGridItem - *
Gets the pager of the data grid. - * - BackImageUrl, string, kept in viewstate - *
Gets or sets the URL of the background image to display behind the datagrid. - * - * Events - * - OnEditCommand, raised when a button control raises an OnCommand event with 'edit' command. - * - OnSelectCommand, raised when a button control raises an OnCommand event with 'select' command. - * - OnUpdateCommand, raised when a button control raises an OnCommand event with 'update' command. - * - OnCancelCommand, raised when a button control raises an OnCommand event with 'cancel' command. - * - OnDeleteCommand, raised when a button control raises an OnCommand event with 'delete' command. - * - OnPageCommand, raised when a button control raises an OnCommand event with 'page' command. - * - OnSortCommand, raised when a button control raises an OnCommand event with 'sort' command. - * - OnItemCommand, raised when a button control raises an OnCommand event. - * - OnItemCreatedCommand, raised right after an item is created. - * * @author Qiang Xue - * @version $Revision: 1.25 $ $Date: 2005/12/17 06:11:28 $ + * @version $Revision: $ $Date: $ * @package System.Web.UI.WebControls + * @since 3.0 */ class TDataGrid extends TBaseDataList { @@ -1152,6 +1066,136 @@ class TDataGridColumnCollection extends TList class TDataGridPagerStyle extends TTableItemStyle { + private $_mode=null; + private $_nextText=null; + private $_prevText=null; + private $_buttonCount=null; + private $_position=null; + private $_visible=null; + + public function getMode() + { + return $this->_mode===null?'NextPrev':$this->_mode; + } + + public function setMode($value) + { + $this->_mode=TPropertyValue::ensureEnum($value,'NextPrev','NumericPages'); + } + + public function getNextPageText() + { + return $this->_nextText===null?'>':$this->_nextText; + } + + public function setNextPageText($value) + { + $this->_nextText=$value; + } + + public function getPrevPageText() + { + return $this->_prevText===null?'<':$this->_prevText; + } + + public function setPrevPageText($value) + { + $this->_prevText=$value; + } + + public function getPageButtonCount() + { + return $this->_buttonCount===null?10:$this->_buttonCount; + } + + public function setPageButtonCount($value) + { + if(($value=TPropertyValue::ensureInteger($value))<1) + throw new TInvalidDataValueException('datagridpagerstyle_pagebuttoncount_invalid'); + $this->_buttonCount=$value; + } + + public function getPosition() + { + return $this->_position===null?'Bottom':$this->_position; + } + + public function setPosition($value) + { + $this->_position=TPropertyValue::ensureEnum($value,'Bottom','Top','TopAndBottom'); + } + + public function getVisible() + { + return $this->_visible===null?true:$this->_visible; + } + + public function setVisible($value) + { + $this->_visible=TPropertyValue::ensureBoolean($value); + } + + /** + * Resets the style to the original empty state. + */ + public function reset() + { + parent::reset(); + $this->_visible=null; + $this->_position=null; + $this->_buttonCount=null; + $this->_prevText=null; + $this->_nextText=null; + $this->_mode=null; + } + + /** + * Copies the style content from an existing style + * This method overrides the parent implementation by + * adding additional TDataGridPagerStyle specific attributes. + * @param TStyle source style + */ + public function copyFrom($style) + { + parent::copyFrom($style); + if($style instanceof TDataGridPagerStyle) + { + $this->_visible=$style->_visible; + $this->_position=$style->_position; + $this->_buttonCount=$style->_buttonCount; + $this->_prevText=$style->_prevText; + $this->_nextText=$style->_nextText; + $this->_mode=$style->_mode; + } + } + + /** + * Merges with a style. + * If a style field is not set in the current style but set in the new style + * it will take the value from the new style. + * This method overrides the parent implementation by + * merging with additional TDataGridPagerStyle specific attributes. + * @param TStyle the new style + */ + public function mergeWith($style) + { + parent::mergeWith($style); + if($style instanceof TDataGridPagerStyle) + { + if($style->_visible!==null && $this->_visible===null) + $this->_visible=$style->_visible; + if($style->_position!==null && $this->_position===null) + $this->_position=$style->_position; + if($style->_buttonCount!==null && $this->_buttonCount===null) + $this->_buttonCount=$style->_buttonCount; + if($style->_prevText!==null && $this->_prevText===null) + $this->_prevText=$style->_prevText; + if($style->_nextText!==null && $this->_nextText===null) + $this->_nextText=$style->_nextText; + if($style->_mode!==null && $this->_mode===null) + $this->_mode=$style->_mode; + } + } } ?> \ No newline at end of file -- cgit v1.2.3