Ejemplo n.º 1
0
 /**
  * Inserts an item into the collection.
  * @param integer the location where the item will be inserted.
  * The current item at the place and the following ones will be moved backward.
  * @param TListItem the item to be inserted.
  * @throws TInvalidDataTypeException if the item being inserted is neither a string nor TListItem
  */
 public function insertAt($index, $item)
 {
     if (is_string($item)) {
         $item = $this->createNewListItem($item);
     }
     if (!$item instanceof TListItem) {
         throw new TInvalidDataTypeException('listitemcollection_item_invalid', get_class($this));
     }
     parent::insertAt($index, $item);
 }
Ejemplo n.º 2
0
 public function insertAt($index, $item)
 {
     if ($item instanceof TControl) {
         parent::insertAt($index, $item);
         $this->_o->addedControl($item);
     } else {
         if (is_string($item) || $item instanceof IRenderable) {
             parent::insertAt($index, $item);
         } else {
             throw new TInvalidDataTypeException('controlcollection_control_required');
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by performing additional type checking
  * for each newly added item.
  * @param integer the specified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a dependency instance
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof ICacheDependency) {
         parent::insertAt($index, $item);
     } else {
         throw new TInvalidDataTypeException('cachedependencylist_cachedependency_required');
     }
 }
Ejemplo n.º 4
0
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by performing additional
  * operations for each newly added THttpCookie object.
  * @param integer the specified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a THttpCookie object.
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof THttpCookie) {
         parent::insertAt($index, $item);
         if ($this->_o instanceof THttpResponse) {
             $this->_o->addCookie($item);
         }
     } else {
         throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required');
     }
 }
Ejemplo n.º 5
0
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by performing type
  * check on the item being added.
  * @param integer the speicified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a {@link TMetaTag}
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof TMetaTag) {
         parent::insertAt($index, $item);
     } else {
         throw new TInvalidDataTypeException('metatagcollection_metatag_invalid');
     }
 }
Ejemplo n.º 6
0
 /**
  * Inserts an item at the specified position.
  * This method overrides the parent implementation by checking if
  * the item being added is a {@link TWizardStep}.
  * @param integer the speicified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item being added is not TWizardStep.
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof TWizardStep) {
         parent::insertAt($index, $item);
         $this->_wizard->getMultiView()->getViews()->insertAt($index, $item);
         $this->_wizard->addedWizardStep($item);
     } else {
         throw new TInvalidDataTypeException('wizardstepcollection_wizardstep_required');
     }
 }
Ejemplo n.º 7
0
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by inserting only TDataGridColumn.
  * @param integer the speicified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a TDataGridColumn.
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof TDataGridColumn) {
         $item->setOwner($this->_o);
         parent::insertAt($index, $item);
     } else {
         throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required');
     }
 }
Ejemplo n.º 8
0
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by performing type
  * check on the item being added.
  * @param integer the speicified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a {@link CMultiStateButtonState}
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof CContextMenuItem) {
         parent::insertAt($index, $item);
     } else {
         throw new TInvalidDataTypeException('Invalid context menu item');
     }
 }
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by performing additional
  * operations for each newly added TAuthorizationRule object.
  * @param integer the specified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a TAuthorizationRule object.
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof TAuthorizationRule) {
         parent::insertAt($index, $item);
     } else {
         throw new TInvalidDataTypeException('authorizationrulecollection_authorizationrule_required');
     }
 }
Ejemplo n.º 10
0
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by inserting only objects that are descendant of {@link TControl}.
  * @param integer the speicified position.
  * @param TControl new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a control.
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof TControl) {
         parent::insertAt($index, $item);
     } else {
         throw new TInvalidDataTypeException('repeateritemcollection_item_invalid');
     }
 }
Ejemplo n.º 11
0
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by inserting only TControl descendants.
  * @param integer the speicified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a TControl descendant.
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof TControl) {
         parent::insertAt($index, $item);
     } else {
         throw new TInvalidDataTypeException('datalistitemcollection_datalistitem_required');
     }
 }
Ejemplo n.º 12
0
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by inserting only {@link THotSpot}.
  * @param integer the speicified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a THotSpot.
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof THotSpot) {
         parent::insertAt($index, $item);
     } else {
         throw new TInvalidDataTypeException('hotspotcollection_hotspot_required');
     }
 }
Ejemplo n.º 13
0
 /**
  * Inserts an item at the specified position.
  * This overrides the parent implementation by performing additional
  * operations for each newly added TXmlElement object.
  * @param integer the specified position.
  * @param mixed new item
  * @throws TInvalidDataTypeException if the item to be inserted is not a TXmlElement object.
  */
 public function insertAt($index, $item)
 {
     if ($item instanceof TXmlElement) {
         parent::insertAt($index, $item);
         if ($item->getParent() !== null) {
             $item->getParent()->getElements()->remove($item);
         }
         $item->setParent($this->_o);
     } else {
         throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required');
     }
 }
Ejemplo n.º 14
0
 public function testCanNotInsertAtWhenReadOnly()
 {
     $list = new TList(array(), true);
     try {
         $list->insertAt(1, 2);
         self::fail('An expected TInvalidOperationException was not raised');
     } catch (TInvalidOperationException $e) {
     }
     try {
         $list->insertAt(0, 2);
         self::fail('An expected TInvalidOperationException was not raised');
     } catch (TInvalidOperationException $e) {
     }
 }