|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.data.RpcDataProviderExtension.DataProviderKeyMapper
public class RpcDataProviderExtension.DataProviderKeyMapper
ItemId to Key to ItemId mapper.
This class is used when transmitting information about items in container related to Grid. It introduces a consistent way of mapping ItemIds and its container to a String that can be mapped back to ItemId.
Technical note: This class also keeps tabs on which indices are being shown/selected, and is able to clean up after itself once the itemId ⇆ key mapping is not needed anymore. In other words, this doesn't leak memory.
| Method Summary | |
|---|---|
java.util.Collection<java.lang.Object> |
getItemIds(java.util.Collection<java.lang.String> keys)
Gets corresponding item ids for each of the keys in a collection. |
java.util.List<java.lang.String> |
getKeys(java.util.Collection<java.lang.Object> itemIds)
Gets keys for a collection of item ids. |
boolean |
isPinned(java.lang.Object itemId)
Checks whether an item id is pinned or not. |
void |
pin(java.lang.Object itemId)
Pin an item id to be cached indefinitely. |
void |
unpin(java.lang.Object itemId)
Unpin an item id. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public java.util.List<java.lang.String> getKeys(java.util.Collection<java.lang.Object> itemIds)
If the itemIds are currently cached, the existing keys will be used. Otherwise new ones will be created.
itemIds - the item ids for which to get keys
itemIds
public java.util.Collection<java.lang.Object> getItemIds(java.util.Collection<java.lang.String> keys)
throws java.lang.IllegalStateException
keys - the keys for which to retrieve item ids
keys
java.lang.IllegalStateException - if one or more of keys don't have a corresponding item id
in the cache
public void pin(java.lang.Object itemId)
throws java.lang.IllegalStateException
Normally when an itemId is not an active row, it is discarded from the cache. Pinning an item id will make sure that it is kept in the cache.
In effect, while an item id is pinned, it always has the same key.
itemId - the item id to pin
java.lang.IllegalStateException - if itemId was already pinnedunpin(Object),
isPinned(Object),
getItemIds(Collection)
public void unpin(java.lang.Object itemId)
throws java.lang.IllegalStateException
This cancels the effect of pinning an item id. If the item id is currently inactive, it will be immediately removed from the cache.
itemId - the item id to unpin
java.lang.IllegalStateException - if itemId was not pinnedpin(Object),
isPinned(Object),
getItemIds(Collection)public boolean isPinned(java.lang.Object itemId)
itemId - the item id to check for pin status
true iff the item id is currently pinned
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||