ListDataProvider
@Deprecated 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 FormModifier and Type | Class and Description |
---|---|
static class |
IndexedContainer.ItemSetChangeEvent
Deprecated.
|
AbstractInMemoryContainer.BaseItemAddEvent, AbstractInMemoryContainer.BaseItemRemoveEvent
AbstractContainer.BaseItemSetChangeEvent, AbstractContainer.BasePropertySetChangeEvent
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
Container.Indexed.ItemAddEvent, Container.Indexed.ItemRemoveEvent
Constructor and Description |
---|
IndexedContainer()
Deprecated.
|
IndexedContainer(Collection<?> itemIds)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
addContainerFilter(Container.Filter filter)
Deprecated.
Adds a filter for the container.
|
void |
addContainerFilter(Object propertyId,
String filterString,
boolean ignoreCase,
boolean onlyMatchPrefix)
Deprecated.
Add a filter for given property.
|
boolean |
addContainerProperty(Object propertyId,
Class<?> type,
Object defaultValue)
Deprecated.
Adds a new Property to all Items in the Container.
|
Object |
addItem()
Deprecated.
Creates a new Item into the Container, and assign it an automatic ID.
|
Item |
addItem(Object itemId)
Deprecated.
Creates a new Item with the given ID in the Container.
|
Object |
addItemAfter(Object previousItemId)
Deprecated.
Adds a new item after the given item.
|
Item |
addItemAfter(Object previousItemId,
Object newItemId)
Deprecated.
Adds a new item after the given item.
|
Object |
addItemAt(int index)
Deprecated.
Adds a new item at given index (in the filtered view).
|
Item |
addItemAt(int index,
Object newItemId)
Deprecated.
Adds a new item at given index (in the filtered view).
|
void |
addListener(Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
addPropertySetChangeListener(Container.PropertySetChangeListener) |
void |
addListener(Property.ValueChangeListener listener)
Deprecated.
As of 7.0, replaced by
addValueChangeListener(Property.ValueChangeListener) |
void |
addPropertySetChangeListener(Container.PropertySetChangeListener listener)
Deprecated.
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)
Deprecated.
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)
Deprecated.
Notify item set change listeners that an item has been added to the
container.
|
protected void |
fireItemSetChange()
Deprecated.
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()
Deprecated.
Returns the filters which have been applied to the container.
|
Property |
getContainerProperty(Object itemId,
Object propertyId)
Deprecated.
Gets the Property identified by the given itemId and propertyId from the
Container.
|
Collection<?> |
getContainerPropertyIds()
Deprecated.
Gets the ID's of all Properties stored in the Container.
|
ItemSorter |
getItemSorter()
Deprecated.
Returns the ItemSorter used for comparing items in a sort.
|
Collection<?> |
getListeners(Class<?> eventType)
Deprecated.
|
Collection<?> |
getSortableContainerPropertyIds()
Deprecated.
Gets the container property IDs which can be used to sort the items.
|
Class<?> |
getType(Object propertyId)
Deprecated.
Gets the type of a Property stored in the list.
|
protected Item |
getUnfilteredItem(Object itemId)
Deprecated.
Get an item even if filtered out.
|
boolean |
hasContainerFilters()
Deprecated.
Returns true if any filters have been applied to the container.
|
protected void |
registerNewItem(int index,
Object newItemId,
Item item)
Deprecated.
Registers a new item as having been added to the container.
|
void |
removeAllContainerFilters()
Deprecated.
Remove all active filters from the container.
|
boolean |
removeAllItems()
Deprecated.
Removes all Items from the Container.
|
void |
removeContainerFilter(Container.Filter filter)
Deprecated.
Removes a filter from the container.
|
void |
removeContainerFilters(Object propertyId)
Deprecated.
Remove all filters from the given property.
|
boolean |
removeContainerProperty(Object propertyId)
Deprecated.
Removes a Property specified by the given Property ID from the Container.
|
boolean |
removeItem(Object itemId)
Deprecated.
Removes the Item identified by
ItemId from the Container. |
void |
removeListener(Container.PropertySetChangeListener listener)
Deprecated.
As of 7.0, replaced by
removePropertySetChangeListener(Container.PropertySetChangeListener) |
void |
removeListener(Property.ValueChangeListener listener)
Deprecated.
As of 7.0, replaced by
removeValueChangeListener(Property.ValueChangeListener) |
void |
removePropertySetChangeListener(Container.PropertySetChangeListener listener)
Deprecated.
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)
Deprecated.
Removes a previously registered value change listener.
|
void |
setItemSorter(ItemSorter itemSorter)
Deprecated.
Sets the ItemSorter used for comparing items in a sort.
|
void |
sort(Object[] propertyId,
boolean[] ascending)
Deprecated.
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, sortContainer
fireContainerPropertySetChange, fireContainerPropertySetChange, fireItemSetChange, getItemSetChangeListeners, getPropertySetChangeListeners, setItemSetChangeListeners, setPropertySetChangeListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
firstItemId, isFirstId, isLastId, lastItemId, nextItemId, prevItemId
containsId, getItem, getItemIds, size
public IndexedContainer()
public IndexedContainer(Collection<?> itemIds)
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)
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 retrievenull
public boolean addContainerProperty(Object propertyId, Class<?> type, Object defaultValue)
Container
This functionality is optional.
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 totrue
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()
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)
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 removetrue
if the operation succeeded, false
if notpublic boolean removeContainerProperty(Object propertyId)
Container
This functionality is optional.
removeContainerProperty
in interface Container
removeContainerProperty
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.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)
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.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.Filterable
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)
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.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 addPropertySetChangeListener(Container.PropertySetChangeListener listener)
AbstractContainer
PropertySetChangeNotifier
, override with the corresponding public
method and implement the interface to use this.addPropertySetChangeListener
in interface Container.PropertySetChangeNotifier
addPropertySetChangeListener
in class AbstractContainer
listener
- The new Listener to be registeredPropertySetChangeNotifier#addListener(Container.PropertySetChangeListener)
@Deprecated public void addListener(Container.PropertySetChangeListener listener)
addPropertySetChangeListener(Container.PropertySetChangeListener)
addListener
in interface Container.PropertySetChangeNotifier
addListener
in class AbstractContainer
public void removePropertySetChangeListener(Container.PropertySetChangeListener listener)
AbstractContainer
PropertySetChangeNotifier
, override with the corresponding public
method and implement the interface to use this.removePropertySetChangeListener
in interface Container.PropertySetChangeNotifier
removePropertySetChangeListener
in class AbstractContainer
listener
- Listener to be removedPropertySetChangeNotifier#removeListener(Container.
PropertySetChangeListener)
@Deprecated public void removeListener(Container.PropertySetChangeListener listener)
removePropertySetChangeListener(Container.PropertySetChangeListener)
removeListener
in interface Container.PropertySetChangeNotifier
removeListener
in class AbstractContainer
public void addValueChangeListener(Property.ValueChangeListener listener)
Property.ValueChangeNotifier
addValueChangeListener
in interface Property.ValueChangeNotifier
listener
- the new Listener to be registered@Deprecated public void addListener(Property.ValueChangeListener listener)
addValueChangeListener(Property.ValueChangeListener)
addListener
in interface Property.ValueChangeNotifier
public void removeValueChangeListener(Property.ValueChangeListener listener)
Property.ValueChangeNotifier
removeValueChangeListener
in interface Property.ValueChangeNotifier
listener
- listener to be removed@Deprecated public void removeListener(Property.ValueChangeListener listener)
removeValueChangeListener(Property.ValueChangeListener)
removeListener
in interface Property.ValueChangeNotifier
public 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>
position
- position of the added item in the viewitemId
- id of the added itemitem
- the added itemprotected void fireItemSetChange()
AbstractContainer
fireItemSetChange
in class AbstractContainer
public void sort(Object[] propertyId, boolean[] ascending)
Container.Sortable
Sorting a container can irreversibly change the order of its items or only change the order temporarily, depending on the container.
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
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.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
If a container has multiple filters, only items accepted by all filters are visible.
addContainerFilter
in interface Container.Filterable
UnsupportedFilterException
- if the filter is not supported by the containerpublic void removeContainerFilter(Container.Filter filter)
Container.Filterable
This requires that the equals() method considers the filters as equivalent (same instance or properly implemented equals() method).
removeContainerFilter
in interface Container.Filterable
public boolean hasContainerFilters()
AbstractInMemoryContainer
hasContainerFilters
in class AbstractInMemoryContainer<Object,Object,Item>
public Collection<Container.Filter> getContainerFilters()
Container.Filterable
getContainerFilters
in interface Container.Filterable
getContainerFilters
in class AbstractInMemoryContainer<Object,Object,Item>
Copyright © 2020 Vaadin Ltd. All rights reserved.