This is a trait that presents an interface for managing an item list. It is used by the QListControl, QHListControl,
and the QHListItem classes, the latter because a QHListItem can itself contain a list of other items.
Note that some abstract methods are declared here that must be implemented by the using class:
GetId() - returns the id
MarkAsModified() - marks the object as modified. Optional.
Methods summary
public
|
|
public
|
#
AddItemAt( integer $intIndex, QListItemBase $objListItem )
Allows you to add a ListItem at a certain index
Unlike AddItem, this will insert the ListItem at whatever index is passed to the function. Additionally,
only a ListItem object can be passed (as opposed to an object or strings)
Allows you to add a ListItem at a certain index
Unlike AddItem, this will insert the ListItem at whatever index is passed to the function. Additionally,
only a ListItem object can be passed (as opposed to an object or strings)
Parameters
- $intIndex
- index at which the item should be inserted
- $objListItem
- the ListItem which shall be inserted
Throws
|
public
|
#
Reindex( )
Reindex the ids of the items based on the current item. We manage all the ids in the list internally
to be able to get to an item in the list quickly, and to make sure the ids are unique.
Reindex the ids of the items based on the current item. We manage all the ids in the list internally
to be able to get to an item in the list quickly, and to make sure the ids are unique.
|
abstract public
|
#
MarkAsModified( )
Stub function. The including function needs to implement this.
Stub function. The including function needs to implement this.
|
abstract public
string
|
#
GetId( )
Returns the id of the item, however the item stores it.
Returns the id of the item, however the item stores it.
Returns
string
|
public
|
#
AddListItems( array $objListItemArray )
Adds an array of items,
Parameters
- $objListItemArray
- Array of QListItems or key=>val pairs.
Throws
|
public
QListItem
|
#
GetItem( integer $intIndex )
Retrieve the ListItem at the specified index location
Retrieve the ListItem at the specified index location
Parameters
Returns
Throws
|
public
QListItem[]
|
#
GetAllItems( )
This will return an array of ALL the QListItems associated with this QListControl.
Please note that while each individual item can be altered, altering the array, itself,
will not affect any change on the QListControl. So existing QListItems may be modified,
but to add / remove items from the QListControl, you should use AddItem() and RemoveItem().
This will return an array of ALL the QListItems associated with this QListControl.
Please note that while each individual item can be altered, altering the array, itself,
will not affect any change on the QListControl. So existing QListItems may be modified,
but to add / remove items from the QListControl, you should use AddItem() and RemoveItem().
Returns
|
public
|
#
RemoveAllItems( )
Removes all the items in objListItemArray
Removes all the items in objListItemArray
|
public
|
#
RemoveItem( integer $intIndex )
Removes a ListItem at the specified index location
Removes a ListItem at the specified index location
Parameters
Throws
|
public
|
#
ReplaceItem( integer $intIndex, QListItem $objListItem )
Replaces a QListItem at $intIndex. This combines the RemoveItem() and AddItemAt() operations.
Replaces a QListItem at $intIndex. This combines the RemoveItem() and AddItemAt() operations.
Parameters
Throws
|
public
integer
|
#
GetItemCount( )
Return the count of the items.
Return the count of the items.
Returns
integer
|
public
null|QListItem
|
#
FindItem( string $strId )
Finds the item by id recursively. Makes use of the fact that we maintain the ids in order to efficiently
find the item.
Finds the item by id recursively. Makes use of the fact that we maintain the ids in order to efficiently
find the item.
Parameters
- $strId
- If this is a sub-item, it will be an id fragment
Returns
|
public
null|QListItemBase
|
#
FindItemByValue( $strValue )
Returns the first tiem found with the given value.
Returns the first tiem found with the given value.
Parameters
Returns
|