System.Web.UI.WebControls
[ class tree: System.Web.UI.WebControls ] [ index: System.Web.UI.WebControls ] [ all elements ]

Class: TDataListItemCollection

Source Location: /Web/UI/WebControls/TDataList.php

Class Overview

TCollection
   |
   --TDataListItemCollection

TCollection class

Class Details

[line 1118]
TCollection class

TCollection implements basic collection functionalities. It requires SPL support of PHP 5. You can use a TCollection object like an array with cardinal indexes starting from 0. For example,

  1. $collection=new TCollection;
  2. $collection[]='item 1';
  3. $collection[]='item 2';
  4. unset($collection[0]);
Note, if you unset any element in the collection, the rest elements will be re-indexed. It is recommended you use TCollection in OO fashion, i.e.,
  1. $collection=new TCollection;
  2. $collection->add('item 1');
  3. $collection->addAt(0,'item 2');
  4. $collection->removeAt(0);
  5. $collection->clear();
You can use a TCollection object in foreach() like following,
  1. foreach($collection as $item)
  2. { }
Note, to get the number of items in a collection, use $collection->length(). Calling count($collection) will always return 1.




version:  v1.0, last update on 2005/01/17 21:44:52
author:  Qiang Xue <qiang.xue@gmail.com>


[ Top ]

Variables

Methods


Inherited Variables

Inherited Methods

Class: TCollection

TCollection::__construct()
Constructor.
TCollection::add()
Appends an item at the end of the collection.
TCollection::addAt()
Inserts an item at the specified position.
TCollection::clear()
Removes all items in the collection.
TCollection::contains()
TCollection::current()
Returns the current array element.
TCollection::getArray()
TCollection::indexOf()
TCollection::isReadOnly()
TCollection::key()
Returns the key of the current array element.
TCollection::length()
TCollection::next()
Moves the internal pointer to the next array element.
TCollection::offsetExists()
Returns whether there is an element at the specified offset.
TCollection::offsetGet()
Returns the element at the specified offset.
TCollection::offsetSet()
Required by interface.
TCollection::offsetUnset()
Required by interface.
TCollection::onAddItem()
This method will be invoked when an item is being added to the collection.
TCollection::onRemoveItem()
This method will be invoked when an item is being removed from the collection.
TCollection::remove()
Removes an item from the collection.
TCollection::removeAt()
Removes an item at the specified position.
TCollection::rewind()
Rewinds internal array pointer.
TCollection::valid()
Returns whether there is an element at current position.

Class Variables

$list = null

[line 1120]



access:  protected

Type:   mixed


[ Top ]



Class Methods


constructor __construct [line 1122]

TDataListItemCollection __construct( mixed $list)



access:  public


Overrides TCollection::__construct() (Constructor.)

[ Top ]

method onAddItem [line 1128]

void onAddItem( mixed $item)



access:  protected


Overrides TCollection::onAddItem() (This method will be invoked when an item is being added to the collection.)

[ Top ]

method onRemoveItem [line 1139]

void onRemoveItem( mixed $item)



access:  protected


Overrides TCollection::onRemoveItem() (This method will be invoked when an item is being removed from the collection.)

[ Top ]


© 2004-2005 PRADO Software Group. All Rights Reserved.