summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TTable.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/WebControls/TTable.php')
-rw-r--r--framework/Web/UI/WebControls/TTable.php131
1 files changed, 113 insertions, 18 deletions
diff --git a/framework/Web/UI/WebControls/TTable.php b/framework/Web/UI/WebControls/TTable.php
index 4a5e84b1..4f93f8f1 100644
--- a/framework/Web/UI/WebControls/TTable.php
+++ b/framework/Web/UI/WebControls/TTable.php
@@ -163,6 +163,7 @@ class TTable extends TWebControl
{
if($this->_rows)
{
+ $writer->writeLine();
foreach($this->_rows as $row)
{
$row->renderControl($writer);
@@ -193,23 +194,6 @@ class TTableRow extends TWebControl
return new TTableItemStyle;
}
- protected function addAttributesToRender($writer)
- {
- parent::addAttributesToRender($writer);
- $border=0;
- if($this->getHasStyle())
- {
- if($this->getGridLines()!=='None')
- {
- if(($border=$this->getBorderWidth())==='')
- $border=1;
- else
- $border=(int)$border;
- }
- }
- $writer->addAttribute('border',"$border");
- }
-
public function getCells()
{
if(!$this->_cells)
@@ -247,6 +231,7 @@ class TTableRow extends TWebControl
{
if($this->_cells)
{
+ $writer->writeLine();
foreach($this->_cells as $cell)
{
$cell->renderControl($writer);
@@ -371,7 +356,7 @@ class TTableCell extends TWebControl
parent::addAttributesToRender($writer);
if(($colspan=$this->getColumnSpan())>0)
$writer->addAttribute('colspan',"$colspan");
- if(($rowspan=$this->getColumnSpan())>0)
+ if(($rowspan=$this->getRowSpan())>0)
$writer->addAttribute('rowspan',"$rowspan");
}
@@ -446,4 +431,114 @@ class TTableHeaderCell extends TTableCell
$this->setViewState('CategoryText',$value,'');
}
}
+
+
+class TTableRowCollection extends TList
+{
+ /**
+ * the table that owns this collection.
+ * @var TTable
+ */
+ private $_o;
+
+ /**
+ * Constructor.
+ * @param TTable the table that owns this collection.
+ */
+ public function __construct(TTable $owner)
+ {
+ parent::__construct();
+ $this->_o=$owner;
+ }
+
+ /**
+ * @return TTable the table that owns this collection.
+ */
+ protected function getOwner()
+ {
+ return $this->_o;
+ }
+
+ /**
+ * Overrides the parent implementation with customized processing of the newly added item.
+ * @param mixed the newly added item
+ */
+ protected function addedItem($item)
+ {
+ $this->_o->addedControl($item);
+ }
+
+ /**
+ * Overrides the parent implementation with customized processing of the removed item.
+ * @param mixed the removed item
+ */
+ protected function removedItem($item)
+ {
+ $this->_o->removedControl($item);
+ }
+
+ /**
+ * Only string or instance of TControl can be added into collection.
+ * @param mixed the item to be added
+ */
+ protected function canAddItem($item)
+ {
+ return ($item instanceof TTableRow);
+ }
+}
+
+
+class TTableCellCollection extends TList
+{
+ /**
+ * the table row that owns this collection.
+ * @var TTableRow
+ */
+ private $_o;
+
+ /**
+ * Constructor.
+ * @param TTableRow the table row that owns this collection.
+ */
+ public function __construct(TTableRow $owner)
+ {
+ parent::__construct();
+ $this->_o=$owner;
+ }
+
+ /**
+ * @return TTableRow the table row that owns this collection.
+ */
+ protected function getOwner()
+ {
+ return $this->_o;
+ }
+
+ /**
+ * Overrides the parent implementation with customized processing of the newly added item.
+ * @param mixed the newly added item
+ */
+ protected function addedItem($item)
+ {
+ $this->_o->addedControl($item);
+ }
+
+ /**
+ * Overrides the parent implementation with customized processing of the removed item.
+ * @param mixed the removed item
+ */
+ protected function removedItem($item)
+ {
+ $this->_o->removedControl($item);
+ }
+
+ /**
+ * Only string or instance of TControl can be added into collection.
+ * @param mixed the item to be added
+ */
+ protected function canAddItem($item)
+ {
+ return ($item instanceof TTableCell);
+ }
+}
?> \ No newline at end of file