summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TControl.php
diff options
context:
space:
mode:
authorxue <>2006-01-31 00:01:49 +0000
committerxue <>2006-01-31 00:01:49 +0000
commit01bc363ac789cfb9d644ce82a949da5cd7e1c220 (patch)
treea059046856645d59cf0cb1badee83eb5c73671e9 /framework/Web/UI/TControl.php
parent265b7e85766ba403ca0a8b58648dd091e483cf38 (diff)
Modified TList and TMap implementation so that they can be more easily extended.
Diffstat (limited to 'framework/Web/UI/TControl.php')
-rw-r--r--framework/Web/UI/TControl.php43
1 files changed, 25 insertions, 18 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index 7b9fee4e..ee1b8e11 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -1487,32 +1487,39 @@ class TControlList extends TList
}
/**
- * Overrides the parent implementation with customized processing of the newly added item.
- * @param mixed the newly added item
- */
- protected function addedItem($item)
- {
- if($item instanceof TControl)
+ * Inserts an item at the specified position.
+ * This overrides the parent implementation by performing additional
+ * operations for each newly added child control.
+ * @param integer the speicified position.
+ * @param mixed new item
+ * @throws TInvalidDataTypeException if the item to be inserted is neither a string nor a TControl.
+ */
+ public function insertAt($index,$item)
+ {
+ if(is_string($item))
+ parent::insertAt($index,$item);
+ else if($item instanceof TControl)
+ {
+ parent::insertAt($index,$item);
$this->_o->addedControl($item);
+ }
+ else
+ throw new TInvalidDataTypeException('controllist_control_required');
}
/**
- * Overrides the parent implementation with customized processing of the removed item.
- * @param mixed the removed item
+ * Removes an item at the specified position.
+ * This overrides the parent implementation by performing additional
+ * cleanup work when removing a child control.
+ * @param integer the index of the item to be removed.
+ * @return mixed the removed item.
*/
- protected function removedItem($item)
+ public function removeAt($index)
{
+ $item=parent::removeAt($index);
if($item instanceof TControl)
$this->_o->removedControl($item);
- }
-
- /**
- * Only string or instance of TControl can be added into collection.
- * @param mixed the item to be added
- */
- protected function canAddItem($item)
- {
- return is_string($item) || ($item instanceof TControl);
+ return $item;
}
/**