|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.vaadin.data.util.AbstractContainer
com.vaadin.data.util.AbstractInMemoryContainer<Object,Object,Item>
com.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
(deprecated, might be removed in the future)
Container
,
Serialized FormNested Class Summary | |
---|---|
class |
IndexedContainer.ItemSetChangeEvent
An event object specifying the list whose Item set has
changed. |
Nested classes/interfaces inherited from class com.vaadin.data.util.AbstractContainer |
---|
AbstractContainer.BaseItemSetChangeEvent, AbstractContainer.BasePropertySetChangeEvent |
Nested classes/interfaces inherited from interface com.vaadin.data.Container |
---|
Container.Editor, Container.Filter, Container.Filterable, Container.Hierarchical, Container.Indexed, Container.ItemSetChangeListener, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeEvent, Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Container.Viewer |
Constructor Summary | |
---|---|
IndexedContainer()
|
|
IndexedContainer(Collection<?> itemIds)
|
Method Summary | |
---|---|
void |
addContainerFilter(Container.Filter filter)
Adds a filter for the container. |
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 in the Container. |
Object |
addItemAfter(Object previousItemId)
Adds a new item after the given item. |
Item |
addItemAfter(Object previousItemId,
Object newItemId)
Adds a new item after the given item. |
Object |
addItemAt(int index)
Adds a new item at given index (in the filtered view). |
Item |
addItemAt(int index,
Object newItemId)
Adds a new item at given index (in the filtered view). |
void |
addListener(Container.PropertySetChangeListener listener)
Implementation of the corresponding method in PropertySetChangeNotifier , override with the corresponding public
method and implement the interface to use this. |
void |
addListener(Property.ValueChangeListener listener)
Registers a new value change listener for this Property. |
Object |
clone()
Deprecated. cloning support might be removed from IndexedContainer in the future |
protected void |
fireItemAdded(int position,
Object itemId,
Item item)
Notify item set change listeners that an item has been added to the container. |
protected void |
fireItemSetChange()
Sends a simple Item set change event to all interested listeners, indicating that anything in the contents may have changed (items added, removed etc.). |
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. |
ItemSorter |
getItemSorter()
Returns the ItemSorter used for comparing items in a sort. |
Collection<?> |
getListeners(Class<?> eventType)
|
Collection<?> |
getSortableContainerPropertyIds()
Gets the container property IDs which can be used to sort the items. |
Class<?> |
getType(Object propertyId)
Gets the type of a Property stored in the list. |
protected Item |
getUnfilteredItem(Object itemId)
Get an item even if filtered out. |
protected void |
registerNewItem(int index,
Object newItemId,
Item item)
Registers a new item as having been added to the container. |
void |
removeAllContainerFilters()
Remove all active filters from the container. |
boolean |
removeAllItems()
Removes all Items from the Container. |
void |
removeContainerFilter(Container.Filter filter)
Removes a filter from the container. |
void |
removeContainerFilters(Object propertyId)
Remove all filters from the 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.PropertySetChangeListener listener)
Implementation of the corresponding method in PropertySetChangeNotifier , override with the corresponding public
method and implement the interface to use this. |
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. |
void |
sort(Object[] propertyId,
boolean[] ascending)
Sort method. |
Methods inherited from class com.vaadin.data.util.AbstractContainer |
---|
fireContainerPropertySetChange, fireContainerPropertySetChange, fireItemSetChange, getItemSetChangeListeners, getPropertySetChangeListeners, setItemSetChangeListeners, setPropertySetChangeListeners |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.vaadin.data.Container.Ordered |
---|
firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId |
Methods inherited from interface com.vaadin.data.Container |
---|
containsId, getItem, getItemIds, size |
Constructor Detail |
---|
public IndexedContainer()
public IndexedContainer(Collection<?> itemIds)
Method Detail |
---|
protected Item getUnfilteredItem(Object itemId)
AbstractInMemoryContainer
getUnfilteredItem
in class AbstractInMemoryContainer<Object,Object,Item>
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 visible Item which contains the PropertypropertyId
- ID of the Property to retrieve
null
public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue)
Container
addContainerProperty
in interface Container
addContainerProperty
in class AbstractInMemoryContainer<Object,Object,Item>
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
removeAllItems
in class AbstractInMemoryContainer<Object,Object,Item>
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
addItem
in class AbstractInMemoryContainer<Object,Object,Item>
null
in case of a
failurepublic Item addItem(Object itemId)
Container
The new 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
addItem
in class AbstractInMemoryContainer<Object,Object,Item>
itemId
- ID of the Item to be created
null
in case of a failurepublic boolean removeItem(Object itemId)
Container
ItemId
from the Container.
Containers that support filtering should also allow removing an item that is currently filtered out.
This functionality is optional.
removeItem
in interface Container
removeItem
in class AbstractInMemoryContainer<Object,Object,Item>
itemId
- ID of the Item to remove
true
if the operation succeeded, false
if notpublic boolean removeContainerProperty(Object propertyId)
Container
removeContainerProperty
in interface Container
removeContainerProperty
in class AbstractInMemoryContainer<Object,Object,Item>
propertyId
- ID of the Property to remove
true
if the operation succeeded, 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
addItemAfter
in class AbstractInMemoryContainer<Object,Object,Item>
previousItemId
- Id of the visible item in ordered container after which to
insert the new item.newItemId
- Id of the new item to be added.
Ordered: adding items in filtered or sorted containers
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
addItemAfter
in class AbstractInMemoryContainer<Object,Object,Item>
previousItemId
- Id of the visible item in ordered container after which to
insert the new item.
Ordered: adding items in filtered or sorted containers
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.
This method should apply filters to the added item after inserting
it, possibly hiding it immediately. If the container is being sorted,
the item may be added at the correct sorted position instead of the
given position. See Container.Indexed
, Container.SimpleFilterable
and
Container.Sortable
for more information.
addItemAt
in interface Container.Indexed
addItemAt
in class AbstractInMemoryContainer<Object,Object,Item>
index
- Index (in the filtered and sorted view) at which to add
the new item.newItemId
- Id of the new item to be added.
Item
or null if the operation fails.public Object addItemAt(int index)
Container.Indexed
The indices of the item currently in the given position and all the following items are incremented.
This method should apply filters to the added item after inserting
it, possibly hiding it immediately. If the container is being sorted,
the item may be added at the correct sorted position instead of the
given position. See Container.Indexed
, Container.Ordered
,
Container.SimpleFilterable
and Container.Sortable
for more information.
addItemAt
in interface Container.Indexed
addItemAt
in class AbstractInMemoryContainer<Object,Object,Item>
index
- Index (in the filtered and sorted view) to add the new
item.
protected void registerNewItem(int index, Object newItemId, Item item)
AbstractInMemoryContainer
AbstractInMemoryContainer
has already
been updated to reflect the new item when this method is called.
registerNewItem
in class AbstractInMemoryContainer<Object,Object,Item>
public void addListener(Container.PropertySetChangeListener listener)
AbstractContainer
PropertySetChangeNotifier
, override with the corresponding public
method and implement the interface to use this.
addListener
in interface Container.PropertySetChangeNotifier
addListener
in class AbstractContainer
listener
- The new Listener to be registeredPropertySetChangeNotifier#addListener(com.vaadin.data.Container.PropertySetChangeListener)
public void removeListener(Container.PropertySetChangeListener listener)
AbstractContainer
PropertySetChangeNotifier
, override with the corresponding public
method and implement the interface to use this.
removeListener
in interface Container.PropertySetChangeNotifier
removeListener
in class AbstractContainer
listener
- Listener to be removedPropertySetChangeNotifier#removeListener(com.vaadin.data.Container.
PropertySetChangeListener)
public 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 removedpublic Collection<?> getListeners(Class<?> eventType)
getListeners
in class AbstractContainer
protected void fireItemAdded(int position, Object itemId, Item item)
AbstractInMemoryContainer
fireItemAdded
in class AbstractInMemoryContainer<Object,Object,Item>
itemId
- id of the added itemitem
- the added itemprotected void fireItemSetChange()
AbstractContainer
fireItemSetChange
in class AbstractContainer
public void sort(Object[] propertyId, boolean[] ascending)
Container.Sortable
sort
in interface Container.Sortable
propertyId
- Array of container property IDs, whose 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
Container.Sortable.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.public Collection<?> getSortableContainerPropertyIds()
Container.Sortable
getSortableContainerPropertyIds
in interface Container.Sortable
public ItemSorter getItemSorter()
AbstractInMemoryContainer
AbstractInMemoryContainer.setItemSorter(ItemSorter)
for more information.
getItemSorter
in class AbstractInMemoryContainer<Object,Object,Item>
public void setItemSorter(ItemSorter itemSorter)
AbstractInMemoryContainer
ItemSorter.compare(Object, Object)
method is called with item ids
to perform the sorting. A default ItemSorter is used if this is not
explicitly set.
setItemSorter
in class AbstractInMemoryContainer<Object,Object,Item>
itemSorter
- The ItemSorter used for comparing two items in a sort (not
null).@Deprecated 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.SimpleFilterable
Filterable#addContainerFilter(Filter)
is recommended
instead of this method. A SimpleStringFilter
can be used with
the new API to implement the old string filtering functionality.
The filter accepts items for which toString() of the value of the
given property contains or starts with given filterString. Other
items are not visible in the container when filtered.
If a container has multiple filters, only items accepted by all
filters are visible.
addContainerFilter
in interface Container.SimpleFilterable
propertyId
- Property for which the filter is applied to.filterString
- String that must match the value 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
removeAllContainerFilters
in interface Container.SimpleFilterable
public void removeContainerFilters(Object propertyId)
Container.SimpleFilterable
removeContainerFilters
in interface Container.SimpleFilterable
propertyId
- for which to remove filterspublic void addContainerFilter(Container.Filter filter) throws UnsupportedFilterException
Container.Filterable
addContainerFilter
in interface Container.Filterable
UnsupportedFilterException
- if the filter is not supported by the containerpublic void removeContainerFilter(Container.Filter filter)
Container.Filterable
removeContainerFilter
in interface Container.Filterable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |