3 * TTableRow and TTableCellCollection class file
5 * @author Qiang Xue <qiang.xue@gmail.com>
6 * @link http://www.pradosoft.com/
7 * @copyright Copyright © 2005-2013 PradoSoft
8 * @license http://www.pradosoft.com/license/
9 * @version $Id: TTableRow.php 3245 2013-01-07 20:23:32Z ctrlaltca $
10 * @package System.Web.UI.WebControls
14 * Includes TTableCell class
16 Prado::using('System.Web.UI.WebControls.TTableCell');
21 * TTableRow displays a table row. The table cells in the row can be accessed
22 * via {@link getCells Cells}. The horizontal and vertical alignments of the row
23 * are specified via {@link setHorizontalAlign HorizontalAlign} and
24 * {@link setVerticalAlign VerticalAlign} properties, respectively.
26 * @author Qiang Xue <qiang.xue@gmail.com>
27 * @version $Id: TTableRow.php 3245 2013-01-07 20:23:32Z ctrlaltca $
28 * @package System.Web.UI.WebControls
31 class TTableRow extends TWebControl
34 * @return string tag name for the table
36 protected function getTagName()
42 * Adds object parsed from template to the control.
43 * This method adds only {@link TTableCell} objects into the {@link getCells Cells} collection.
44 * All other objects are ignored.
45 * @param mixed object parsed from template
47 public function addParsedObject($object)
49 if($object instanceof TTableCell)
50 $this->getCells()->add($object);
54 * Creates a style object for the control.
55 * This method creates a {@link TTableItemStyle} to be used by the table row.
56 * @return TStyle control style to be used
58 protected function createStyle()
60 return new TTableItemStyle;
64 * Creates a control collection object that is to be used to hold child controls
65 * @return TTableCellCollection control collection
68 protected function createControlCollection()
70 return new TTableCellCollection($this);
74 * @return TTableCellCollection list of {@link TTableCell} controls
76 public function getCells()
78 return $this->getControls();
82 * @return string the horizontal alignment of the contents within the table item, defaults to 'NotSet'.
84 public function getHorizontalAlign()
86 if($this->getHasStyle())
87 return $this->getStyle()->getHorizontalAlign();
93 * Sets the horizontal alignment of the contents within the table item.
94 * Valid values include 'NotSet', 'Justify', 'Left', 'Right', 'Center'
95 * @param string the horizontal alignment
97 public function setHorizontalAlign($value)
99 $this->getStyle()->setHorizontalAlign($value);
103 * @return string the vertical alignment of the contents within the table item, defaults to 'NotSet'.
105 public function getVerticalAlign()
107 if($this->getHasStyle())
108 return $this->getStyle()->getVerticalAlign();
114 * Sets the vertical alignment of the contents within the table item.
115 * Valid values include 'NotSet','Top','Bottom','Middle'
116 * @param string the horizontal alignment
118 public function setVerticalAlign($value)
120 $this->getStyle()->setVerticalAlign($value);
124 * @return TTableRowSection location of a row in a table. Defaults to TTableRowSection::Body.
126 public function getTableSection()
128 return $this->getViewState('TableSection',TTableRowSection::Body);
132 * @param TTableRowSection location of a row in a table.
134 public function setTableSection($value)
136 $this->setViewState('TableSection',TPropertyValue::ensureEnum($value,'TTableRowSection'),TTableRowSection::Body);
140 * Renders body contents of the table row
141 * @param THtmlWriter writer for the rendering purpose
143 public function renderContents($writer)
145 if($this->getHasControls())
147 $writer->writeLine();
148 foreach($this->getControls() as $cell)
150 $cell->renderControl($writer);
151 $writer->writeLine();
158 * TTableCellCollection class.
160 * TTableCellCollection is used to maintain a list of cells belong to a table row.
162 * @author Qiang Xue <qiang.xue@gmail.com>
163 * @version $Id: TTableRow.php 3245 2013-01-07 20:23:32Z ctrlaltca $
164 * @package System.Web.UI.WebControls
167 class TTableCellCollection extends TControlCollection
170 * Inserts an item at the specified position.
171 * This overrides the parent implementation by performing additional
172 * operations for each newly added table cell.
173 * @param integer the speicified position.
174 * @param mixed new item
175 * @throws TInvalidDataTypeException if the item to be inserted is not a TTableCell object.
177 public function insertAt($index,$item)
179 if($item instanceof TTableCell)
180 parent::insertAt($index,$item);
182 throw new TInvalidDataTypeException('tablecellcollection_tablecell_required');
188 * TTableRowSection class.
189 * TTableRowSection defines the enumerable type for the possible table sections
190 * that a {@link TTableRow} can be within.
192 * The following enumerable values are defined:
193 * - Header: in table header
194 * - Body: in table body
195 * - Footer: in table footer
197 * @author Qiang Xue <qiang.xue@gmail.com>
198 * @version $Id: TTableRow.php 3245 2013-01-07 20:23:32Z ctrlaltca $
199 * @package System.Web.UI.WebControls
202 class TTableRowSection extends TEnumerable
204 const Header='Header';
206 const Footer='Footer';