diff options
author | xue <> | 2006-05-04 02:52:23 +0000 |
---|---|---|
committer | xue <> | 2006-05-04 02:52:23 +0000 |
commit | 49ccf41324a2c87b20b84f72355b79d92d6f3d0c (patch) | |
tree | 7ed04c5b14efdd62f4619b9a894a47e272420742 /framework/Web/UI/WebControls/TTableRow.php | |
parent | a14913019919d7b6c2d13769b151a645b5226e02 (diff) |
Refactored TTable and TTableRow.
Diffstat (limited to 'framework/Web/UI/WebControls/TTableRow.php')
-rw-r--r-- | framework/Web/UI/WebControls/TTableRow.php | 62 |
1 files changed, 15 insertions, 47 deletions
diff --git a/framework/Web/UI/WebControls/TTableRow.php b/framework/Web/UI/WebControls/TTableRow.php index 6a3f196a..daf921ce 100644 --- a/framework/Web/UI/WebControls/TTableRow.php +++ b/framework/Web/UI/WebControls/TTableRow.php @@ -32,11 +32,6 @@ Prado::using('System.Web.UI.WebControls.TTableHeaderCell'); class TTableRow extends TWebControl
{
/**
- * @var TTableCellCollection cell collection
- */
- private $_cells=null;
-
- /**
* @return string tag name for the table
*/
protected function getTagName()
@@ -67,13 +62,21 @@ class TTableRow extends TWebControl }
/**
+ * Creates a control collection object that is to be used to hold child controls
+ * @return TTableCellCollection control collection
+ * @see getControls
+ */
+ protected function createControlCollection()
+ {
+ return new TTableCellCollection($this);
+ }
+
+ /**
* @return TTableCellCollection list of {@link TTableCell} controls
*/
public function getCells()
{
- if(!$this->_cells)
- $this->_cells=new TTableCellCollection($this);
- return $this->_cells;
+ return $this->getControls();
}
/**
@@ -124,10 +127,10 @@ class TTableRow extends TWebControl */
public function renderContents($writer)
{
- if($this->_cells)
+ if($this->getHasControls())
{
$writer->writeLine();
- foreach($this->_cells as $cell)
+ foreach($this->getControls() as $cell)
{
$cell->renderControl($writer);
$writer->writeLine();
@@ -136,8 +139,6 @@ class TTableRow extends TWebControl }
}
-
-
/**
* TTableCellCollection class.
*
@@ -148,24 +149,9 @@ class TTableRow extends TWebControl * @package System.Web.UI.WebControls
* @since 3.0
*/
-class TTableCellCollection extends TList
+class TTableCellCollection extends TControlCollection
{
/**
- * @var mixed cell collection owner
- */
- private $_owner=null;
-
- /**
- * Constructor.
- * @param mixed cell collection owner
- */
- public function __construct($owner=null)
- {
- $this->_owner=$owner;
- }
-
-
- /**
* Inserts an item at the specified position.
* This overrides the parent implementation by performing additional
* operations for each newly added table cell.
@@ -176,28 +162,10 @@ class TTableCellCollection extends TList public function insertAt($index,$item)
{
if($item instanceof TTableCell)
- {
parent::insertAt($index,$item);
- if($this->_owner)
- $this->_owner->getControls()->insertAt($index,$item);
- }
else
throw new TInvalidDataTypeException('tablecellcollection_tablecell_required');
}
-
- /**
- * Removes an item at the specified position.
- * This overrides the parent implementation by performing additional
- * cleanup work when removing a table cell.
- * @param integer the index of the item to be removed.
- * @return mixed the removed item.
- */
- public function removeAt($index)
- {
- $item=parent::removeAt($index);
- if($item instanceof TTableCell)
- $this->_owner->getControls()->remove($item);
- return $item;
- }
}
+
?>
\ No newline at end of file |