From 58f7aa0ebe9920d33a22b95c3f73fc4b70a75426 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 5 Aug 2006 03:18:53 +0000 Subject: Fixed #313. --- framework/Web/UI/WebControls/TDataGrid.php | 1 + framework/Web/UI/WebControls/TDataList.php | 2 +- framework/Web/UI/WebControls/TPanelStyle.php | 2 +- framework/Web/UI/WebControls/TStyle.php | 33 ++++++++++++++++++++++++---- 4 files changed, 32 insertions(+), 6 deletions(-) (limited to 'framework') diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index 2687ac35..e27f6ead 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -278,6 +278,7 @@ class TDataGrid extends TBaseDataList implements INamingContainer $style=new TTableStyle; $style->setGridLines('Both'); $style->setCellSpacing(0); + $style->setBorderCollapse(true); return $style; } diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php index 42c47f86..22bec07e 100644 --- a/framework/Web/UI/WebControls/TDataList.php +++ b/framework/Web/UI/WebControls/TDataList.php @@ -1357,7 +1357,7 @@ class TDataListItem extends TWebControl implements INamingContainer /** * Creates a style object for the control. - * This method creates a {@link TTableStyle} to be used by checkbox list. + * This method creates a {@link TTableItemStyle} to be used by a datalist item. * @return TStyle control style to be used */ protected function createStyle() diff --git a/framework/Web/UI/WebControls/TPanelStyle.php b/framework/Web/UI/WebControls/TPanelStyle.php index 02f366b8..dc20806e 100644 --- a/framework/Web/UI/WebControls/TPanelStyle.php +++ b/framework/Web/UI/WebControls/TPanelStyle.php @@ -171,7 +171,7 @@ class TPanelStyle extends TStyle /** * Sets the style attributes to default values. * This method overrides the parent implementation by - * resetting additional TTableStyle specific attributes. + * resetting additional TPanelStyle specific attributes. */ public function reset() { diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php index 6bc413e4..cdc4cbe4 100644 --- a/framework/Web/UI/WebControls/TStyle.php +++ b/framework/Web/UI/WebControls/TStyle.php @@ -370,6 +370,10 @@ class TTableStyle extends TStyle * @var string grid line setting of the table */ private $_gridLines=null; + /** + * @var boolean whether the table border should be collapsed + */ + private $_borderCollapse=null; /** * Sets the style attributes to default values. @@ -383,6 +387,7 @@ class TTableStyle extends TStyle $this->_cellPadding=null; $this->_cellSpacing=null; $this->_gridLines=null; + $this->_borderCollapse=null; } /** @@ -406,6 +411,8 @@ class TTableStyle extends TStyle $this->_cellSpacing=$style->_cellSpacing; if($style->_gridLines!==null) $this->_gridLines=$style->_gridLines; + if($style->_borderCollapse!==null) + $this->_borderCollapse=$style->_borderCollapse; } } @@ -430,6 +437,8 @@ class TTableStyle extends TStyle $this->_cellSpacing=$style->_cellSpacing; if($this->_gridLines===null && $style->_gridLines!==null) $this->_gridLines=$style->_gridLines; + if($this->_borderCollapse===null && $style->_borderCollapse!==null) + $this->_borderCollapse=$style->_borderCollapse; } } @@ -451,11 +460,10 @@ class TTableStyle extends TStyle $writer->addAttribute('cellpadding',"$cellPadding"); if(($cellSpacing=$this->getCellSpacing())>=0) - { $writer->addAttribute('cellspacing',"$cellSpacing"); - if($this->getCellSpacing()===0) - $writer->addStyleAttribute('border-collapse','collapse'); - } + + if($this->getBorderCollapse()) + $writer->addStyleAttribute('border-collapse','collapse'); switch($this->getGridLines()) { @@ -555,6 +563,23 @@ class TTableStyle extends TStyle { $this->_gridLines=TPropertyValue::ensureEnum($value,array('None', 'Horizontal', 'Vertical', 'Both')); } + + + /** + * @return boolean whether the table borders should be collapsed. Defaults to false. + */ + public function getBorderCollapse() + { + return $this->_borderCollapse===null?false:$this->_borderCollapse; + } + + /** + * @param boolean whether the table borders should be collapsed. + */ + public function setBorderCollapse($value) + { + $this->_borderCollapse=TPropertyValue::ensureBoolean($value); + } } /** -- cgit v1.2.3