From 979430b5bf60e5857846ecb561404a89c02cefcd Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 3 Feb 2006 22:17:33 +0000 Subject: Completed datagrid tutorial part one and added a new datagrid sample. --- framework/Web/UI/WebControls/TBoundColumn.php | 12 ------------ framework/Web/UI/WebControls/TDataGridColumn.php | 12 ++++++++++++ framework/Web/UI/WebControls/TFont.php | 20 ++++++++++---------- framework/Web/UI/WebControls/TStyle.php | 2 +- framework/Web/UI/WebControls/TTemplateColumn.php | 2 ++ 5 files changed, 25 insertions(+), 23 deletions(-) (limited to 'framework/Web/UI/WebControls') diff --git a/framework/Web/UI/WebControls/TBoundColumn.php b/framework/Web/UI/WebControls/TBoundColumn.php index c30d3ff6..6ad578d7 100644 --- a/framework/Web/UI/WebControls/TBoundColumn.php +++ b/framework/Web/UI/WebControls/TBoundColumn.php @@ -131,18 +131,6 @@ class TBoundColumn extends TDataGridColumn if(($sender instanceof TTableCell) || ($sender instanceof TTextBox)) $sender->setText($value); } - - /** - * Formats the text value according to format string. - * This method is invoked when setting the text to a cell. - * This method can be overriden. - * @param mixed the data associated with the cell - * @return string the formatted result - */ - protected function formatDataValue($formatString,$value) - { - return $formatString===''?TPropertyValue::ensureString($value):sprintf($formatString,$value); - } } ?> \ No newline at end of file diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php index a5e939ef..41d11946 100644 --- a/framework/Web/UI/WebControls/TDataGridColumn.php +++ b/framework/Web/UI/WebControls/TDataGridColumn.php @@ -308,6 +308,18 @@ abstract class TDataGridColumn extends TComponent break; } } + + /** + * Formats the text value according to format string. + * This method is invoked when setting the text to a cell. + * This method can be overriden. + * @param mixed the data associated with the cell + * @return string the formatted result + */ + protected function formatDataValue($formatString,$value) + { + return $formatString===''?TPropertyValue::ensureString($value):sprintf($formatString,$value); + } } ?> \ No newline at end of file diff --git a/framework/Web/UI/WebControls/TFont.php b/framework/Web/UI/WebControls/TFont.php index 51d864c3..2f95e2bd 100644 --- a/framework/Web/UI/WebControls/TFont.php +++ b/framework/Web/UI/WebControls/TFont.php @@ -56,7 +56,7 @@ class TFont extends TComponent private $_size=''; /** - * @return boolean whether the font is in bold face + * @return boolean whether the font is in bold face. Defaults to false. */ public function getBold() { @@ -69,14 +69,14 @@ class TFont extends TComponent public function setBold($value) { $this->_flags |= self::IS_SET_BOLD; - if($value) + if(TPropertyValue::ensureBoolean($value)) $this->_flags |= self::IS_BOLD; else $this->_flags &= ~self::IS_BOLD; } /** - * @return boolean whether the font is in italic face + * @return boolean whether the font is in italic face. Defaults to false. */ public function getItalic() { @@ -89,14 +89,14 @@ class TFont extends TComponent public function setItalic($value) { $this->_flags |= self::IS_SET_ITALIC; - if($value) + if(TPropertyValue::ensureBoolean($value)) $this->_flags |= self::IS_ITALIC; else $this->_flags &= ~self::IS_ITALIC; } /** - * @return boolean whether the font is overlined + * @return boolean whether the font is overlined. Defaults to false. */ public function getOverline() { @@ -109,7 +109,7 @@ class TFont extends TComponent public function setOverline($value) { $this->_flags |= self::IS_SET_OVERLINE; - if($value) + if(TPropertyValue::ensureBoolean($value)) $this->_flags |= self::IS_OVERLINE; else $this->_flags &= ~self::IS_OVERLINE; @@ -133,7 +133,7 @@ class TFont extends TComponent } /** - * @return boolean whether the font is strikeout + * @return boolean whether the font is strikeout. Defaults to false. */ public function getStrikeout() { @@ -146,14 +146,14 @@ class TFont extends TComponent public function setStrikeout($value) { $this->_flags |= self::IS_SET_STRIKEOUT; - if($value) + if(TPropertyValue::ensureBoolean($value)) $this->_flags |= self::IS_STRIKEOUT; else $this->_flags &= ~self::IS_STRIKEOUT; } /** - * @return boolean whether the font is underlined + * @return boolean whether the font is underlined. Defaults to false. */ public function getUnderline() { @@ -166,7 +166,7 @@ class TFont extends TComponent public function setUnderline($value) { $this->_flags |= self::IS_SET_UNDERLINE; - if($value) + if(TPropertyValue::ensureBoolean($value)) $this->_flags |= self::IS_UNDERLINE; else $this->_flags &= ~self::IS_UNDERLINE; diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php index dac862a6..ab7e8568 100644 --- a/framework/Web/UI/WebControls/TStyle.php +++ b/framework/Web/UI/WebControls/TStyle.php @@ -645,7 +645,7 @@ class TTableItemStyle extends TStyle public function addAttributesToRender($writer) { if(!$this->getWrap()) - $writer->addStyleAttribute('nowrap','nowrap'); + $writer->addStyleAttribute('white-space','nowrap'); if(($horizontalAlign=$this->getHorizontalAlign())!=='NotSet') $writer->addAttribute('align',strtolower($horizontalAlign)); diff --git a/framework/Web/UI/WebControls/TTemplateColumn.php b/framework/Web/UI/WebControls/TTemplateColumn.php index 9c386543..8d852d68 100644 --- a/framework/Web/UI/WebControls/TTemplateColumn.php +++ b/framework/Web/UI/WebControls/TTemplateColumn.php @@ -155,6 +155,8 @@ class TTemplateColumn extends TDataGridColumn $cell->getControls()->clear(); $template->instantiateIn($cell); } + else + $cell->setText(' '); } } -- cgit v1.2.3