blob: 6e4b181f1083ef0323689510dfdfe0f41eafc6b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<?php
/**
* TTabPanel class file.
*
* @author Tomasz Wolny <tomasz.wolny@polecam.to.pl> and Qiang Xue <qiang.xue@gmail.com>
* @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;
/**
* TTabViewCollection class.
*
* TTabViewCollection is used to maintain a list of views belong to a {@link TTabPanel}.
*
* @author Tomasz Wolny <tomasz.wolny@polecam.to.pl> and Qiang Xue <qiang.xue@gmail.com>
* @package Prado\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;
}
}
|