|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.data.util.IndexedContainer
public class IndexedContainer
An implementation of the
interface
with all important features.Container.Indexed
Container.Indexed
Container.Ordered
Container.Sortable
Container.Filterable
Cloneable
Container
,
Serialized FormNested Class Summary | |
---|---|
class |
IndexedContainer.ItemSetChangeEvent
An event object specifying the list whose Item set has
changed. |
Nested classes/interfaces inherited from interface com.vaadin.data.Container |
---|
Container.Editor, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Sortable, Container.Viewer |
Nested classes/interfaces inherited from interface com.vaadin.data.Container |
---|
Container.Editor, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.Sortable, Container.Viewer |
Constructor Summary | |
---|---|
IndexedContainer()
|
|
IndexedContainer(Collection itemIds)
|
Method Summary | |
---|---|
void |
addContainerFilter(Object propertyId,
String filterString,
boolean ignoreCase,
boolean onlyMatchPrefix)
Add a filter for given property. |
boolean |
addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
Adds a new Property to all Items in the Container. |
Object |
addItem()
Creates a new Item into the Container, and assign it an automatic ID. |
Item |
addItem(Object itemId)
Creates a new Item with the given ID into the Container. |
Object |
addItemAfter(Object previousItemId)
Adds new item after the given item. |
Item |
addItemAfter(Object previousItemId,
Object newItemId)
Adds new item after the given item. |
Object |
addItemAt(int index)
Adds new item at given index. |
Item |
addItemAt(int index,
Object newItemId)
Adds new item at given index. |
void |
addListener(Container.ItemSetChangeListener listener)
Adds an Item set change listener for the object. |
void |
addListener(Container.PropertySetChangeListener listener)
Registers a new Property set change listener for this Container. |
void |
addListener(Property.ValueChangeListener listener)
Registers a new value change listener for this Property. |
Object |
clone()
Supports cloning of the IndexedContainer cleanly. |
boolean |
containsId(Object itemId)
Tests if the Container contains the specified Item |
protected boolean |
doFilterContainer(boolean hasFilters)
Filters the data in the container and updates internal data structures. |
protected void |
doSort()
Perform the sorting of the data structures in the container. |
protected void |
fireContentsChange(int addedItemIndex)
Sends Item set change event to all registered interested listeners. |
Object |
firstItemId()
Gets the ID of the first Item in the Container. |
Property |
getContainerProperty(Object itemId,
Object propertyId)
Gets the Property identified by the given itemId and propertyId from the Container. |
Collection |
getContainerPropertyIds()
Gets the ID's of all Properties stored in the Container. |
Object |
getIdByIndex(int index)
Gets the ID of an Item by an index number. |
Item |
getItem(Object itemId)
Gets the Item with the given Item ID from the Container. |
Collection |
getItemIds()
Gets the ID's of all Items stored in the Container. |
ItemSorter |
getItemSorter()
Returns the ItemSorter used for comparing items in a sort. |
Collection<?> |
getSortableContainerPropertyIds()
Gets the container property IDs, which can be used to sort the item. |
Class |
getType(Object propertyId)
Gets the type of a Property stored in the list. |
int |
indexOfId(Object itemId)
Gets the index of the Item corresponding to the itemId. |
boolean |
isFirstId(Object itemId)
Tests if the Item corresponding to the given Item ID is the first Item in the Container. |
boolean |
isLastId(Object itemId)
Tests if the Item corresponding to the given Item ID is the last Item in the Container. |
Object |
lastItemId()
Gets the ID of the last Item in the Container.. |
Object |
nextItemId(Object itemId)
Gets the ID of the Item following the Item that corresponds to itemId . |
protected boolean |
passesFilters(Object itemId)
Checks if the given itemId passes the filters set for the container. |
Object |
prevItemId(Object itemId)
Gets the ID of the Item preceding the Item that corresponds to itemId . |
void |
removeAllContainerFilters()
Remove all filters from all properties. |
boolean |
removeAllItems()
Removes all Items from the Container. |
void |
removeContainerFilters(Object propertyId)
Remove all filters from given property. |
boolean |
removeContainerProperty(Object propertyId)
Removes a Property specified by the given Property ID from the Container. |
boolean |
removeItem(Object itemId)
Removes the Item identified by ItemId from the Container. |
void |
removeListener(Container.ItemSetChangeListener listener)
Removes the Item set change listener from the object. |
void |
removeListener(Container.PropertySetChangeListener listener)
Removes a previously registered Property set change listener. |
void |
removeListener(Property.ValueChangeListener listener)
Removes a previously registered value change listener. |
void |
setItemSorter(ItemSorter itemSorter)
Sets the ItemSorter used for comparing items in a sort. |
int |
size()
Gets the number of Items in the Container. |
void |
sort(Object[] propertyId,
boolean[] ascending)
Sort method. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IndexedContainer()
public IndexedContainer(Collection itemIds)
Method Detail |
---|
public Item getItem(Object itemId)
Container
null
is returned.
getItem
in interface Container
itemId
- ID of the Item to retrieve
null
if the Item is
not found in the Containerpublic Collection getItemIds()
Container
getItemIds
in interface Container
public Collection getContainerPropertyIds()
Container
getContainerPropertyIds
in interface Container
public Class getType(Object propertyId)
getType
in interface Container
id
- the ID of the Property.
public Property getContainerProperty(Object itemId, Object propertyId)
Container
null
is returned.
getContainerProperty
in interface Container
itemId
- ID of the Item which contains the PropertypropertyId
- ID of the Property to retrieve
null
public int size()
Container
size
in interface Container
public boolean containsId(Object itemId)
Container
containsId
in interface Container
itemId
- ID the of Item to be tested
public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue)
Container
addContainerProperty
in interface Container
propertyId
- ID of the Propertytype
- Data type of the new PropertydefaultValue
- The value all created Properties are initialized to
true
if the operation succeeded, false
if notpublic boolean removeAllItems()
Container
Note that Property ID and type information is preserved. This functionality is optional.
removeAllItems
in interface Container
true
if the operation succeeded, false
if notpublic Object addItem()
Container
The new ID is returned, or null
if the operation fails.
After a successful call you can use the
method to fetch the Item.
getItem
This functionality is optional.
addItem
in interface Container
null
in case of a
failurepublic Item addItem(Object itemId)
Container
Item is returned, and it is ready to have its Properties modified.
Returns null
if the operation fails or the Container already
contains a Item with the given ID.
This functionality is optional.
addItem
in interface Container
itemId
- ID of the Item to be created
null
in case of a failurepublic boolean removeItem(Object itemId)
Container
ItemId
from the Container.
This functionality is optional.
removeItem
in interface Container
itemId
- ID of the Item to remove
true
if the operation succeeded, false
if notpublic boolean removeContainerProperty(Object propertyId)
Container
removeContainerProperty
in interface Container
propertyId
- ID of the Property to remove
true
if the operation succeeded, false
if notpublic Object firstItemId()
Container.Ordered
firstItemId
in interface Container.Ordered
public Object lastItemId()
Container.Ordered
lastItemId
in interface Container.Ordered
public Object nextItemId(Object itemId)
Container.Ordered
itemId
. If the given Item is the last or not found in
the Container, null
is returned.
nextItemId
in interface Container.Ordered
itemId
- ID of an Item in the Container
null
public Object prevItemId(Object itemId)
Container.Ordered
itemId
. If the given Item is the first or not found in
the Container, null
is returned.
prevItemId
in interface Container.Ordered
itemId
- ID of an Item in the Container
null
public boolean isFirstId(Object itemId)
Container.Ordered
isFirstId
in interface Container.Ordered
itemId
- ID of an Item in the Container
true
if the Item is first in the Container,
false
if notpublic boolean isLastId(Object itemId)
Container.Ordered
isLastId
in interface Container.Ordered
true
if the Item is last in the Container,
false
if notpublic Item addItemAfter(Object previousItemId, Object newItemId)
Container.Ordered
Adding an item after null item adds the item as first item of the ordered container.
addItemAfter
in interface Container.Ordered
previousItemId
- Id of the previous item in ordered container.newItemId
- Id of the new item to be added.
public Object addItemAfter(Object previousItemId)
Container.Ordered
Adding an item after null item adds the item as first item of the ordered container.
addItemAfter
in interface Container.Ordered
previousItemId
- Id of the previous item in ordered container.
public Object getIdByIndex(int index)
Container.Indexed
getIdByIndex
in interface Container.Indexed
index
- Index of the requested id in the Container
public int indexOfId(Object itemId)
Container.Indexed
true
for the returned index: 0 <= index < size().
indexOfId
in interface Container.Indexed
itemId
- ID of an Item in the Container
public Item addItemAt(int index, Object newItemId)
Container.Indexed
The indexes of the item currently in the given position and all the following items are incremented.
addItemAt
in interface Container.Indexed
index
- Index to add the new item.newItemId
- Id of the new item to be added.
public Object addItemAt(int index)
Container.Indexed
The indexes of the item currently in the given position and all the following items are incremented.
addItemAt
in interface Container.Indexed
index
- Index to add the new item.
public void addListener(Container.PropertySetChangeListener listener)
Container.PropertySetChangeNotifier
addListener
in interface Container.PropertySetChangeNotifier
listener
- The new Listener to be registeredpublic void removeListener(Container.PropertySetChangeListener listener)
Container.PropertySetChangeNotifier
removeListener
in interface Container.PropertySetChangeNotifier
listener
- Listener to be removedpublic void addListener(Container.ItemSetChangeListener listener)
Container.ItemSetChangeNotifier
addListener
in interface Container.ItemSetChangeNotifier
listener
- listener to be addedpublic void removeListener(Container.ItemSetChangeListener listener)
Container.ItemSetChangeNotifier
removeListener
in interface Container.ItemSetChangeNotifier
listener
- listener to be removedpublic void addListener(Property.ValueChangeListener listener)
Property.ValueChangeNotifier
addListener
in interface Property.ValueChangeNotifier
listener
- the new Listener to be registeredpublic void removeListener(Property.ValueChangeListener listener)
Property.ValueChangeNotifier
removeListener
in interface Property.ValueChangeNotifier
listener
- listener to be removedprotected void fireContentsChange(int addedItemIndex)
addedItemIndex
- index of new item if change event was an item additionpublic void sort(Object[] propertyId, boolean[] ascending)
Container.Sortable
sort
in interface Container.Sortable
propertyId
- Array of container property IDs, which values are used to
sort the items in container as primary, secondary, ...
sorting criterion. All of the item IDs must be in the
collection returned by
getSortableContainerPropertyIds
ascending
- Array of sorting order flags corresponding to each
property ID used in sorting. If this array is shorter than
propertyId array, ascending order is assumed for items
where the order is not specified. Use true
to
sort in ascending order, false
to use
descending order.protected void doSort()
itemSorter
has been prepared for the sort
operation. Typically this method calls
Collections.sort(aCollection, getItemSorter())
on all arrays
(containing item ids) that need to be sorted.
public Collection<?> getSortableContainerPropertyIds()
Container.Sortable
getSortableContainerPropertyIds
in interface Container.Sortable
public ItemSorter getItemSorter()
setItemSorter(ItemSorter)
for more information.
public void setItemSorter(ItemSorter itemSorter)
itemSorter
- The ItemSorter used for comparing two items in a sort.public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
- if an object cannot be cloned. .public void addContainerFilter(Object propertyId, String filterString, boolean ignoreCase, boolean onlyMatchPrefix)
Container.Filterable
addContainerFilter
in interface Container.Filterable
propertyId
- Property for which the filter is applied to.filterString
- String that must match contents of the propertyignoreCase
- Determine if the casing can be ignored when comparing
strings.onlyMatchPrefix
- Only match prefixes; no other matches are included.public void removeAllContainerFilters()
Container.Filterable
removeAllContainerFilters
in interface Container.Filterable
public void removeContainerFilters(Object propertyId)
Container.Filterable
removeContainerFilters
in interface Container.Filterable
protected boolean doFilterContainer(boolean hasFilters)
getItemIds()
and other methods only return the filtered
items.
hasFilters
- true if filters has been set for the container, false
otherwise
protected boolean passesFilters(Object itemId)
itemId
- An itemId that exists in the container.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |