KEYTYPE - The type of the ID.DATATYPE - The type of the value.ITEMTYPE - The implementation type.public interface ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>> extends IBasicTreeItem<DATATYPE,ITEMTYPE>, IHasID<KEYTYPE>
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsChildItemWithDataID(KEYTYPE aDataID)
Check if a direct child item with the given ID is present
|
ITEMTYPE |
createChildItem(KEYTYPE aDataID,
DATATYPE aData)
Add a direct child item to this item.
|
ITEMTYPE |
createChildItem(KEYTYPE aDataID,
DATATYPE aData,
boolean bAllowOverwrite)
Add a direct child item to this item.
|
ICommonsSet<KEYTYPE> |
getAllChildDataIDs() |
ITEMTYPE |
getChildItemOfDataID(KEYTYPE aDataID)
Find the direct child item with the given ID
|
ITreeItemWithIDFactory<KEYTYPE,DATATYPE,ITEMTYPE> |
getFactory() |
KEYTYPE |
getID()
Get the unique ID of this object.
|
KEYTYPE |
getParentID() |
EChange |
internalAddChild(KEYTYPE aDataID,
ITEMTYPE aChild,
boolean bAllowOverwrite)
Add an existing direct child to this tree item.
|
EChange |
removeAllChildren()
Remove all children from this node.
|
EChange |
removeChild(KEYTYPE aDataID)
Remove the passed node as a direct child node from this node.
|
void |
reorderChildrenByItems(Comparator<? super ITEMTYPE> aComparator)
Reorder the child items based on the item itself.
|
changeParent, getAllChildDatas, getData, getLevel, getParentData, isRootItem, isSameOrChildOf, setDatagetParentgetAllChildren, getChildAtIndex, getFirstChild, getLastChildgetChildCount, hasChildren, hasNoChildrenthisAsTgetComparatorID@Nonnull ITreeItemWithIDFactory<KEYTYPE,DATATYPE,ITEMTYPE> getFactory()
KEYTYPE getID()
IHasIDString than the
returned value must match an XML NMToken expression (so e.g. no ':' in the
ID)!KEYTYPE getParentID()
null if no
parent is present or depending on the validator.@Nullable @ReturnsMutableCopy ICommonsSet<KEYTYPE> getAllChildDataIDs()
null if returned.boolean containsChildItemWithDataID(@Nullable KEYTYPE aDataID)
aDataID - The ID to search. May be null.true if this item has a child with the given ID,
false otherwise@Nullable ITEMTYPE getChildItemOfDataID(@Nullable KEYTYPE aDataID)
aDataID - The ID to search. May be null.null if this item has no child with the given ID. The
item otherwise.@Nonnull EChange internalAddChild(@Nonnull KEYTYPE aDataID, @Nonnull ITEMTYPE aChild, boolean bAllowOverwrite)
aDataID - The data ID to use. May not be null.aChild - The child to be added. May not be null.bAllowOverwrite - if true existing elements are overwritten.EChange@Nonnull ITEMTYPE createChildItem(@Nullable KEYTYPE aDataID, @Nullable DATATYPE aData)
aDataID - ID of the item to generate. May be null in rare
circumstances.aData - The data associated with this item.@Nullable ITEMTYPE createChildItem(KEYTYPE aDataID, DATATYPE aData, boolean bAllowOverwrite)
aDataID - ID of the item to generate. May not be null.aData - The data associated with this item.bAllowOverwrite - If true a potential existing child item with the same
ID is overwritten.null if the data ID is
already in use and bAllowOverwrite is false@Nonnull EChange removeChild(@Nullable KEYTYPE aDataID)
aDataID - The ID of the element to be removed. May not be null.EChange@Nonnull EChange removeAllChildren()
EChangevoid reorderChildrenByItems(@Nonnull Comparator<? super ITEMTYPE> aComparator)
aComparator - The comparator use. May not be null.Copyright © 2014–2016 Philip Helger. All rights reserved.