KEYTYPE - Tree key typeVALUETYPE - Tree value typepublic abstract class SessionApplicationSingletonTreeWithUniqueID<KEYTYPE,VALUETYPE> extends SessionApplicationSingleton implements ITreeWithGlobalUniqueID<KEYTYPE,VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>
SessionApplicationSingleton wrapping a
DefaultTreeWithGlobalUniqueID with the same API.| Modifier and Type | Field and Description |
|---|---|
protected DefaultTreeWithGlobalUniqueID<KEYTYPE,VALUETYPE> |
m_aTree |
| Constructor and Description |
|---|
SessionApplicationSingletonTreeWithUniqueID() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsItemWithID(KEYTYPE aDataID)
Check if a tree item corresponding to the given ID is present.
|
Collection<? extends DefaultTreeItemWithID<KEYTYPE,VALUETYPE>> |
getAllChildren(DefaultTreeItemWithID<KEYTYPE,VALUETYPE> aCurrent)
Get the children of the passed object.
|
Collection<VALUETYPE> |
getAllItemDatas() |
Collection<DefaultTreeItemWithID<KEYTYPE,VALUETYPE>> |
getAllItems() |
int |
getChildCount(DefaultTreeItemWithID<KEYTYPE,VALUETYPE> aCurrent) |
DefaultTreeItemWithID<KEYTYPE,VALUETYPE> |
getChildWithID(DefaultTreeItemWithID<KEYTYPE,VALUETYPE> aCurrent,
KEYTYPE aID)
Retrieve the objects with the passed ID or
null if no such
object. |
int |
getItemCount() |
VALUETYPE |
getItemDataWithID(KEYTYPE aDataID)
Get the data of the tree item that corresponds to the given ID.
|
DefaultTreeItemWithID<KEYTYPE,VALUETYPE> |
getItemWithID(KEYTYPE aDataID)
Get the
ITreeItemWithID that corresponds to the given ID. |
DefaultTreeItemWithID<KEYTYPE,VALUETYPE> |
getRootItem() |
boolean |
hasChildren(DefaultTreeItemWithID<KEYTYPE,VALUETYPE> aCurrent)
Check if an item has children.
|
boolean |
isItemSameOrDescendant(KEYTYPE aParentItemID,
KEYTYPE aChildItemID)
Check if one item is equal or a child of the other item.
|
EChange |
removeItemWithID(KEYTYPE aDataID)
Remove the item with the specified ID
|
getAllSessionApplicationSingletons, getSessionApplicationSingleton, getSessionApplicationSingletonIfInstantiated, isSessionApplicationSingletonInstantiatedgetAllSingletons, getSingleton, getSingletonIfInstantiated, getSingletonScopeKey, isDestroyed, isInDestruction, isInInstantiation, isInstantiated, isSingletonInstantiated, isUsableObject, onAfterInstantiation, onDestroy, onScopeDestruction, readAbstractSingletonFields, setDestroyed, setInDestruction, setInInstantiation, setInstantiated, toString, writeAbstractSingletonFieldsprotected final DefaultTreeWithGlobalUniqueID<KEYTYPE,VALUETYPE> m_aTree
public SessionApplicationSingletonTreeWithUniqueID()
@Nonnull public DefaultTreeItemWithID<KEYTYPE,VALUETYPE> getRootItem()
getRootItem in interface IBasicTree<VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>null. The root item
should not be displayed but it is the parent node of all displayed
root items and therefore cannot be removed.@Nullable public DefaultTreeItemWithID<KEYTYPE,VALUETYPE> getChildWithID(@Nullable DefaultTreeItemWithID<KEYTYPE,VALUETYPE> aCurrent, @Nullable KEYTYPE aID)
IChildrenProviderWithIDnull if no such
object.getChildWithID in interface IChildrenProviderWithID<KEYTYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>aCurrent - The object to determine the children of. No null or
non- null constraint possible.aID - the ID of the object in question. No null or non-
null constraint possible.nullpublic boolean hasChildren(@Nullable DefaultTreeItemWithID<KEYTYPE,VALUETYPE> aCurrent)
IChildrenProviderhasChildren in interface IChildrenProvider<DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>aCurrent - The object to determine the children of. No null or
non- null constraint possible.true if this item has children, false
otherwise.@Nonnegative public int getChildCount(@Nullable DefaultTreeItemWithID<KEYTYPE,VALUETYPE> aCurrent)
getChildCount in interface IChildrenProvider<DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>aCurrent - The object to determine the children count of. No null
or non- null constraint possible.@Nullable public Collection<? extends DefaultTreeItemWithID<KEYTYPE,VALUETYPE>> getAllChildren(@Nullable DefaultTreeItemWithID<KEYTYPE,VALUETYPE> aCurrent)
IChildrenProvidergetAllChildren in interface IChildrenProvider<DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>aCurrent - The object to determine the children of. No null or
non- null constraint possible.null if there are no children.
If null is passed, the resolver is expected to return
any possible top level (root) elements. This method may NOT return
null if the call to IChildrenProvider.hasChildren(Object) with
the same object returned true.@Nullable public DefaultTreeItemWithID<KEYTYPE,VALUETYPE> getItemWithID(@Nullable KEYTYPE aDataID)
ITreeWithGlobalUniqueIDITreeItemWithID that corresponds to the given ID.getItemWithID in interface IChildrenProviderWithUniqueID<KEYTYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>getItemWithID in interface ITreeWithGlobalUniqueID<KEYTYPE,VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>aDataID - The ID of the tree item to search.null if no such tree item exists.@Nonnegative public int getItemCount()
getItemCount in interface ITreeWithGlobalUniqueID<KEYTYPE,VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>@Nonnull public Collection<DefaultTreeItemWithID<KEYTYPE,VALUETYPE>> getAllItems()
getAllItems in interface ITreeWithGlobalUniqueID<KEYTYPE,VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>null collection of all items.public boolean isItemSameOrDescendant(@Nullable KEYTYPE aParentItemID, @Nullable KEYTYPE aChildItemID)
ITreeWithGlobalUniqueIDisItemSameOrDescendant in interface ITreeWithGlobalUniqueID<KEYTYPE,VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>aParentItemID - The parent item ID to a validate.aChildItemID - The item ID to check whether it is a child of the passed parent
folder.true if the child item is the same or a child of the
parent item, false if one of the IDs could not be
resolved or they are not in a parent-child-relationship.public boolean containsItemWithID(@Nullable KEYTYPE aDataID)
ITreeWithGlobalUniqueIDcontainsItemWithID in interface ITreeWithGlobalUniqueID<KEYTYPE,VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>aDataID - The ID of the tree item to search.true if such an item is present@Nullable public VALUETYPE getItemDataWithID(@Nullable KEYTYPE aDataID)
ITreeWithGlobalUniqueIDgetItemDataWithID in interface ITreeWithGlobalUniqueID<KEYTYPE,VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>aDataID - The ID of the tree item to search.null if no such tree item exists.@Nonnull public Collection<VALUETYPE> getAllItemDatas()
getAllItemDatas in interface ITreeWithGlobalUniqueID<KEYTYPE,VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>null collection of all item datas.@Nonnull public EChange removeItemWithID(@Nullable KEYTYPE aDataID)
ITreeWithGlobalUniqueIDremoveItemWithID in interface ITreeWithGlobalUniqueID<KEYTYPE,VALUETYPE,DefaultTreeItemWithID<KEYTYPE,VALUETYPE>>aDataID - The ID of the item to be removedEChange.CHANGED if the item was removed,
EChange.UNCHANGED otherwise. Never null.Copyright © 2014–2015 Philip Helger. All rights reserved.