info.joseluismartin.vaadin.data
Class IndexedItemIdStrategy

java.lang.Object
  extended by info.joseluismartin.vaadin.data.IndexedItemIdStrategy
All Implemented Interfaces:
com.vaadin.data.Container.ItemSetChangeListener, ItemIdStrategy, Serializable

public class IndexedItemIdStrategy
extends Object
implements ItemIdStrategy

Indexed ItemIdStragy use the index on the item in container as itemId. The itemId of a item will change when filtering, sorting, adding or removing items. If this is not a trouble, this is the faster ItemIdStrategy to use.

Author:
Jose Luis Martin - (jlm@joseluismartin.info)
See Also:
Serialized Form

Constructor Summary
IndexedItemIdStrategy()
           
 
Method Summary
 void containerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent event)
          
 Object firstItemId()
          
 Object getIdByIndex(int index)
          Get an id by index
 Collection<?> getItemIds()
          Gets a collection of all itemIds
 int indexOfId(Object itemId)
          Gets the index of an itemId
 boolean isFirstId(Object itemId)
          Test for first itemId
 boolean isLastId(Object itemId)
          Test for last itemId
 void itemLoaded(int index, com.vaadin.data.Item item)
          
 Object lastItemId()
          
 Object nextItemId(Object itemId)
          Return the next itemId
 Object prevItemId(Object itemId)
          Gets the previous itemId
 void setContainerDataSource(ContainerDataSource<?> containerDataSource)
          Set the containerDataSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedItemIdStrategy

public IndexedItemIdStrategy()
Method Detail

firstItemId

public Object firstItemId()

Specified by:
firstItemId in interface ItemIdStrategy
Returns:
the first itemId

isFirstId

public boolean isFirstId(Object itemId)
Test for first itemId

Parameters:
itemId - the itemId
Returns:
true is itemId is the first

isLastId

public boolean isLastId(Object itemId)
Test for last itemId

Parameters:
itemId - the itemId
Returns:
true if the itemId is the last

lastItemId

public Object lastItemId()

Specified by:
lastItemId in interface ItemIdStrategy
Returns:
the las itemId

nextItemId

public Object nextItemId(Object itemId)
Return the next itemId

Parameters:
itemId - the itemId
Returns:
the next itemId

prevItemId

public Object prevItemId(Object itemId)
Gets the previous itemId

Parameters:
itemId -

getItemIds

public Collection<?> getItemIds()
Gets a collection of all itemIds

Specified by:
getItemIds in interface ItemIdStrategy
Returns:
collection with all itemIds

indexOfId

public int indexOfId(Object itemId)
Gets the index of an itemId

Specified by:
indexOfId in interface ItemIdStrategy
Parameters:
itemId - the itemId

getIdByIndex

public Object getIdByIndex(int index)
Get an id by index

Specified by:
getIdByIndex in interface ItemIdStrategy
Parameters:
index - the index
Returns:
Id

setContainerDataSource

public void setContainerDataSource(ContainerDataSource<?> containerDataSource)
Set the containerDataSource

Specified by:
setContainerDataSource in interface ItemIdStrategy

itemLoaded

public void itemLoaded(int index,
                       com.vaadin.data.Item item)

Specified by:
itemLoaded in interface ItemIdStrategy

containerItemSetChange

public void containerItemSetChange(com.vaadin.data.Container.ItemSetChangeEvent event)

Specified by:
containerItemSetChange in interface com.vaadin.data.Container.ItemSetChangeListener


Copyright © 2012 JDAL. All Rights Reserved.