From ca22da21b0cedab985e698f4dedf3ac1158a1487 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Tue, 20 Jan 2015 23:42:12 +0100 Subject: one class per file: framework/Web/UI/WebControls --- .../Web/UI/WebControls/TTabViewCollection.php | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 framework/Web/UI/WebControls/TTabViewCollection.php (limited to 'framework/Web/UI/WebControls/TTabViewCollection.php') diff --git a/framework/Web/UI/WebControls/TTabViewCollection.php b/framework/Web/UI/WebControls/TTabViewCollection.php new file mode 100644 index 00000000..bece3ed6 --- /dev/null +++ b/framework/Web/UI/WebControls/TTabViewCollection.php @@ -0,0 +1,53 @@ + and Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2014 PradoSoft + * @license http://www.pradosoft.com/license/ + * @package System.Web.UI.WebControls + * @since 3.1.1 + */ + +/** + * TTabViewCollection class. + * + * TTabViewCollection is used to maintain a list of views belong to a {@link TTabPanel}. + * + * @author Tomasz Wolny and Qiang Xue + * @package System.Web.UI.WebControls + * @since 3.1.1 + */ +class TTabViewCollection extends 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; + } +} \ No newline at end of file -- cgit v1.2.3