public class IndexedContainer extends AbstractInMemoryContainer<Object,Object,Item> implements Container.PropertySetChangeNotifier, Property.ValueChangeNotifier, Container.Sortable, Cloneable, Container.Filterable, Container.SimpleFilterable
Container.Indexed interface
with all important features.
Features:
Container.Indexed
Container.Ordered
Container.Sortable
Container.Filterable
Cloneable (deprecated, might be removed in the future)
Container,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
IndexedContainer.ItemSetChangeEvent
An
event object specifying the list whose Item set has
changed. |
AbstractInMemoryContainer.BaseItemAddEvent, AbstractInMemoryContainer.BaseItemRemoveEventAbstractContainer.BaseItemSetChangeEvent, AbstractContainer.BasePropertySetChangeEventContainer.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.ViewerContainer.Indexed.ItemAddEvent, Container.Indexed.ItemRemoveEvent| Constructor and Description |
|---|
IndexedContainer() |
IndexedContainer(Collection<?> itemIds) |
| Modifier and Type | Method and Description |
|---|---|
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)
Deprecated.
As of 7.0, replaced by
addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener) |
void |
addListener(Property.ValueChangeListener listener)
Deprecated.
As of 7.0, replaced by
addValueChangeListener(com.vaadin.data.Property.ValueChangeListener) |
void |
addPropertySetChangeListener(Container.PropertySetChangeListener listener)
Implementation of the corresponding method in
PropertySetChangeNotifier, override with the corresponding public
method and implement the interface to use this. |
void |
addValueChangeListener(Property.ValueChangeListener listener)
Registers a new value change listener for this Property.
|
Object |
clone()
Deprecated.
As of 6.6. 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.).
|
Collection<Container.Filter> |
getContainerFilters()
Returns the filters which have been applied to 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.
|
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.
|
boolean |
hasContainerFilters()
Returns true if any filters have been applied to the container.
|
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)
Deprecated.
As of 7.0, replaced by
removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener) |
void |
removeListener(Property.ValueChangeListener listener)
Deprecated.
As of 7.0, replaced by
removeValueChangeListener(com.vaadin.data.Property.ValueChangeListener) |
void |
removePropertySetChangeListener(Container.PropertySetChangeListener listener)
Implementation of the corresponding method in
PropertySetChangeNotifier, override with the corresponding public
method and implement the interface to use this. |
void |
removeValueChangeListener(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)
Sorts the container items.
|
addFilter, addItemSetChangeListener, addListener, containsId, doFilterContainer, doSort, filterAll, fireItemRemoved, fireItemsAdded, fireItemsRemoved, firstItemId, getAllItemIds, getFilteredItemIds, getFilters, getFirstVisibleItem, getIdByIndex, getItem, getItemIds, getItemIds, getSortablePropertyIds, getVisibleItemIds, indexOfId, internalAddItemAfter, internalAddItemAt, internalAddItemAtEnd, internalRemoveAllItems, internalRemoveItem, isFiltered, isFirstId, isLastId, isPropertyFiltered, lastItemId, nextItemId, passesFilters, prevItemId, removeAllFilters, removeFilter, removeFilters, removeItemSetChangeListener, removeListener, setAllItemIds, setFilteredItemIds, setFilters, size, sortContainerfireContainerPropertySetChange, fireContainerPropertySetChange, fireItemSetChange, getItemSetChangeListeners, getPropertySetChangeListeners, setItemSetChangeListeners, setPropertySetChangeListenersequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfirstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemIdcontainsId, getItem, getItemIds, sizepublic IndexedContainer()
public IndexedContainer(Collection<?> itemIds)
protected Item getUnfilteredItem(Object itemId)
AbstractInMemoryContainergetUnfilteredItem in class AbstractInMemoryContainer<Object,Object,Item>public Collection<?> getContainerPropertyIds()
ContainergetContainerPropertyIds in interface Containerpublic Property getContainerProperty(Object itemId, Object propertyId)
Containernull is
returned.getContainerProperty in interface ContaineritemId - ID of the visible Item which contains the PropertypropertyId - ID of the Property to retrievenullpublic boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue)
ContainerThis functionality is optional.
addContainerProperty in interface ContaineraddContainerProperty in class AbstractInMemoryContainer<Object,Object,Item>propertyId - ID of the Propertytype - Data type of the new PropertydefaultValue - The value all created Properties are initialized totrue if the operation succeeded, false
if notpublic boolean removeAllItems()
ContainerNote that Property ID and type information is preserved. This functionality is optional.
removeAllItems in interface ContainerremoveAllItems in class AbstractInMemoryContainer<Object,Object,Item>true if the operation succeeded, false
if notpublic Object addItem()
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.
The item ID is generated from a sequence of Integers. The id of the first added item is 1.
public 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.
public boolean removeItem(Object itemId)
ContainerItemId 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 ContainerremoveItem in class AbstractInMemoryContainer<Object,Object,Item>itemId - ID of the Item to removetrue if the operation succeeded, false
if notpublic boolean removeContainerProperty(Object propertyId)
ContainerThis functionality is optional.
removeContainerProperty in interface ContainerremoveContainerProperty in class AbstractInMemoryContainer<Object,Object,Item>propertyId - ID of the Property to removetrue if the operation succeeded, false
if notpublic Item addItemAfter(Object previousItemId, Object newItemId)
Container.OrderedAdding an item after null item adds the item as first item of the ordered container.
addItemAfter in interface Container.OrderedaddItemAfter 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 containerspublic Object addItemAfter(Object previousItemId)
Adding an item after null item adds the item as first item of the ordered container.
The item ID is generated from a sequence of Integers. The id of the first added item is 1.
addItemAfter in interface Container.OrderedaddItemAfter 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 containerspublic Item addItemAt(int index, Object newItemId)
Container.IndexedThe 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.Filterable and
Container.Sortable for more information.
addItemAt in interface Container.IndexedaddItemAt 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)
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.Filterable and Container.Sortable for more information.
The item ID is generated from a sequence of Integers. The id of the first added item is 1.
addItemAt in interface Container.IndexedaddItemAt 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)
AbstractInMemoryContainerAbstractInMemoryContainer has already
been updated to reflect the new item when this method is called.registerNewItem in class AbstractInMemoryContainer<Object,Object,Item>public void addPropertySetChangeListener(Container.PropertySetChangeListener listener)
AbstractContainerPropertySetChangeNotifier, override with the corresponding public
method and implement the interface to use this.addPropertySetChangeListener in interface Container.PropertySetChangeNotifieraddPropertySetChangeListener in class AbstractContainerlistener - The new Listener to be registeredPropertySetChangeNotifier#addListener(com.vaadin.data.Container.PropertySetChangeListener)@Deprecated public void addListener(Container.PropertySetChangeListener listener)
addPropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)addListener in interface Container.PropertySetChangeNotifieraddListener in class AbstractContainerpublic void removePropertySetChangeListener(Container.PropertySetChangeListener listener)
AbstractContainerPropertySetChangeNotifier, override with the corresponding public
method and implement the interface to use this.removePropertySetChangeListener in interface Container.PropertySetChangeNotifierremovePropertySetChangeListener in class AbstractContainerlistener - Listener to be removedPropertySetChangeNotifier#removeListener(com.vaadin.data.Container.
PropertySetChangeListener)@Deprecated public void removeListener(Container.PropertySetChangeListener listener)
removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)removeListener in interface Container.PropertySetChangeNotifierremoveListener in class AbstractContainerpublic void addValueChangeListener(Property.ValueChangeListener listener)
Property.ValueChangeNotifieraddValueChangeListener in interface Property.ValueChangeNotifierlistener - the new Listener to be registered@Deprecated public void addListener(Property.ValueChangeListener listener)
addValueChangeListener(com.vaadin.data.Property.ValueChangeListener)addListener in interface Property.ValueChangeNotifierpublic void removeValueChangeListener(Property.ValueChangeListener listener)
Property.ValueChangeNotifierremoveValueChangeListener in interface Property.ValueChangeNotifierlistener - listener to be removed@Deprecated public void removeListener(Property.ValueChangeListener listener)
removeValueChangeListener(com.vaadin.data.Property.ValueChangeListener)removeListener in interface Property.ValueChangeNotifierpublic Collection<?> getListeners(Class<?> eventType)
getListeners in class AbstractContainerprotected void fireItemAdded(int position,
Object itemId,
Item item)
AbstractInMemoryContainerfireItemAdded in class AbstractInMemoryContainer<Object,Object,Item>position - position of the added item in the viewitemId - id of the added itemitem - the added itemprotected void fireItemSetChange()
AbstractContainerfireItemSetChange in class AbstractContainerpublic void sort(Object[] propertyId, boolean[] ascending)
Container.SortableSorting a container can irreversibly change the order of its items or only change the order temporarily, depending on the container.
sort in interface Container.SortablepropertyId - 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.SortablegetSortableContainerPropertyIds in interface Container.Sortablepublic ItemSorter getItemSorter()
AbstractInMemoryContainerAbstractInMemoryContainer.setItemSorter(ItemSorter) for more information.getItemSorter in class AbstractInMemoryContainer<Object,Object,Item>public void setItemSorter(ItemSorter itemSorter)
AbstractInMemoryContainerItemSorter.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 ObjectCloneNotSupportedException - if an object cannot be cloned. .public void addContainerFilter(Object propertyId, String filterString, boolean ignoreCase, boolean onlyMatchPrefix)
Container.SimpleFilterable
The API 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.SimpleFilterablepropertyId - 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.FilterableremoveAllContainerFilters in interface Container.FilterableremoveAllContainerFilters in interface Container.SimpleFilterablepublic void removeContainerFilters(Object propertyId)
Container.SimpleFilterableremoveContainerFilters in interface Container.SimpleFilterablepropertyId - for which to remove filterspublic void addContainerFilter(Container.Filter filter) throws UnsupportedFilterException
Container.FilterableIf a container has multiple filters, only items accepted by all filters are visible.
addContainerFilter in interface Container.FilterableUnsupportedFilterException - if the filter is not supported by the containerpublic void removeContainerFilter(Container.Filter filter)
Container.FilterableThis requires that the equals() method considers the filters as equivalent (same instance or properly implemented equals() method).
removeContainerFilter in interface Container.Filterablepublic boolean hasContainerFilters()
AbstractInMemoryContainerhasContainerFilters in class AbstractInMemoryContainer<Object,Object,Item>public Collection<Container.Filter> getContainerFilters()
Container.FilterablegetContainerFilters in interface Container.FilterablegetContainerFilters in class AbstractInMemoryContainer<Object,Object,Item>Copyright © 2016 Vaadin Ltd. All rights reserved.