and Qiang Xue * @link http://www.pradosoft.com/ * @copyright Copyright © 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ * @package Prado\Web\UI\WebControls * @since 3.1.1 */ namespace Prado\Web\UI\WebControls; use Prado\Exceptions\TInvalidDataTypeException; /** * TTabViewCollection class. * * TTabViewCollection is used to maintain a list of views belong to a {@link TTabPanel}. * * @author Tomasz Wolny and Qiang Xue * @package Prado\Web\UI\WebControls * @since 3.1.1 */ class TTabViewCollection extends \Prado\Web\UI\TControlCollection { /** * Inserts an item at the specified position. * This overrides the parent implementation by performing sanity check on the type of new item. * @param integer the speicified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is not a {@link TTabView} object. */ public function insertAt($index,$item) { if($item instanceof TTabView) parent::insertAt($index,$item); else throw new TInvalidDataTypeException('tabviewcollection_tabview_required'); } /** * Finds the index of the tab view whose ID is the same as the one being looked for. * @param string the explicit ID of the tab view to be looked for * @return integer the index of the tab view found, -1 if not found. */ public function findIndexByID($id) { foreach($this as $index=>$view) { if($view->getID(false)===$id) return $index; } return -1; } }