summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TTable.php
diff options
context:
space:
mode:
authorxue <>2006-01-17 23:58:54 +0000
committerxue <>2006-01-17 23:58:54 +0000
commit54900d0145dfda07bde40dc6e1f0b31935b55444 (patch)
treec34892281f5ffa9f3c907e5ef48c05720707ef5d /framework/Web/UI/WebControls/TTable.php
parent3ea0de54c63f5f9ed02e259a789b01952041cfbd (diff)
Diffstat (limited to 'framework/Web/UI/WebControls/TTable.php')
-rw-r--r--framework/Web/UI/WebControls/TTable.php72
1 files changed, 70 insertions, 2 deletions
diff --git a/framework/Web/UI/WebControls/TTable.php b/framework/Web/UI/WebControls/TTable.php
index 13cbd0b1..3ca3d51d 100644
--- a/framework/Web/UI/WebControls/TTable.php
+++ b/framework/Web/UI/WebControls/TTable.php
@@ -124,7 +124,7 @@ class TTable extends TWebControl
public function getRows()
{
if(!$this->_rows)
- $this->_rows=new TTableRowCollection();
+ $this->_rows=new TTableRowCollection($this);
return $this->_rows;
}
@@ -352,7 +352,7 @@ class TTableRow extends TWebControl
public function getCells()
{
if(!$this->_cells)
- $this->_cells=new TTableCellCollection();
+ $this->_cells=new TTableCellCollection($this);
return $this->_cells;
}
@@ -698,6 +698,20 @@ class TTableHeaderCell extends TTableCell
class TTableRowCollection extends TList
{
/**
+ * @var mixed row collection owner
+ */
+ private $_owner=null;
+
+ /**
+ * Constructor.
+ * @param mixed row collection owner
+ */
+ public function __construct($owner=null)
+ {
+ $this->_owner=$owner;
+ }
+
+ /**
* Only string or instance of TControl can be added into collection.
* @param mixed the item to be added
*/
@@ -705,6 +719,26 @@ class TTableRowCollection extends TList
{
return ($item instanceof TTableRow);
}
+
+ /**
+ * Overrides the parent implementation with customized processing of the newly added item.
+ * @param mixed the newly added item
+ */
+ protected function addedItem($item)
+ {
+ if($this->_owner)
+ $this->_owner->getControls()->add($item);
+ }
+
+ /**
+ * Overrides the parent implementation with customized processing of the removed item.
+ * @param mixed the removed item
+ */
+ protected function removedItem($item)
+ {
+ if($this->_owner)
+ $this->_owner->getControls()->remove($item);
+ }
}
@@ -721,6 +755,20 @@ class TTableRowCollection extends TList
class TTableCellCollection extends TList
{
/**
+ * @var mixed cell collection owner
+ */
+ private $_owner=null;
+
+ /**
+ * Constructor.
+ * @param mixed cell collection owner
+ */
+ public function __construct($owner=null)
+ {
+ $this->_owner=$owner;
+ }
+
+ /**
* Only string or instance of TTableCell can be added into collection.
* @param mixed the item to be added
*/
@@ -728,5 +776,25 @@ class TTableCellCollection extends TList
{
return ($item instanceof TTableCell);
}
+
+ /**
+ * Overrides the parent implementation with customized processing of the newly added item.
+ * @param mixed the newly added item
+ */
+ protected function addedItem($item)
+ {
+ if($this->_owner)
+ $this->_owner->getControls()->add($item);
+ }
+
+ /**
+ * Overrides the parent implementation with customized processing of the removed item.
+ * @param mixed the removed item
+ */
+ protected function removedItem($item)
+ {
+ if($this->_owner)
+ $this->_owner->getControls()->remove($item);
+ }
}
?> \ No newline at end of file