Package org.dashbuilder.navigation.impl
Class NavTreeImpl
- java.lang.Object
-
- org.dashbuilder.navigation.impl.NavTreeImpl
-
-
Constructor Summary
Constructors Constructor Description NavTreeImpl()NavTreeImpl(NavGroup root)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(NavItemVisitor visitor)Entry point for visitor interfacesNavDivideraddDivider(String parentId, boolean modifiable)Creates and register a brand newNavDivideritem.NavGroupaddGroup(String id, String name, String description, String parentId, boolean modifiable)Creates and register a brand newNavGroupitem.NavItemaddItem(String id, String name, String description, String parentId, boolean modifiable, String context)Creates and register a brand newNavItemitem.voidchangePosition(String id, boolean up, Integer npositions)NavTreecloneTree()Creates a brand new copy of this treeNavItemdeleteItem(String id)Delete an existing item including all its children.NavTreegetItemAsTree(String id)Given an existing item, it creates a brand new subtree where the item (or its children in case of groups) is taken as the root node.NavItemgetItemById(String id)Get an item given its id.List<NavItem>getRootItems()The list of items belonging to the first tree levelNavItemmoveItem(String id, String newParentId)Changes the location of an item in the treevoidmoveItemDown(String id)Move an item one position down in its parent's children listvoidmoveItemFirst(String id)Move the specified item to the first position within its parent's children listvoidmoveItemLast(String id)Move the specified item to the last position within its parent's children listvoidmoveItemUp(String id)Move an item one position up in its parent's children listList<NavItem>searchItems(NavItemContext ctx)Get the items that match the given contextList<NavItem>searchItems(NavItemContext ctx, List<NavItem> navItemList)NavItemsetItemContext(String id, String context)Updates the perspective attached to an existing perspective linkNavItemsetItemDescription(String id, String description)Updates the description attribute of an existing itemNavItemsetItemModifiable(String id, boolean modifiable)Updates the modifiable flag attribute of an existing itemNavItemsetItemName(String id, String name)Updates the name attribute of an existing item
-
-
-
Constructor Detail
-
NavTreeImpl
public NavTreeImpl()
-
NavTreeImpl
public NavTreeImpl(NavGroup root)
-
-
Method Detail
-
getRootItems
public List<NavItem> getRootItems()
Description copied from interface:NavTreeThe list of items belonging to the first tree level- Specified by:
getRootItemsin interfaceNavTree- Returns:
- A list of
NavIteminstances
-
getItemById
public NavItem getItemById(String id)
Description copied from interface:NavTreeGet an item given its id. All the tree nodes are compared, no matter its level.- Specified by:
getItemByIdin interfaceNavTree- Parameters:
id- The unique identifier of the item- Returns:
- The first instance found
-
getItemAsTree
public NavTree getItemAsTree(String id)
Description copied from interface:NavTreeGiven an existing item, it creates a brand new subtree where the item (or its children in case of groups) is taken as the root node.- Specified by:
getItemAsTreein interfaceNavTree- Parameters:
id- The unique identifier of the item- Returns:
- The first instance found
-
searchItems
public List<NavItem> searchItems(NavItemContext ctx)
Description copied from interface:NavTreeGet the items that match the given context- Specified by:
searchItemsin interfaceNavTree- Parameters:
ctx- The context to search for- Returns:
- The list of nav items that match the target context
-
searchItems
public List<NavItem> searchItems(NavItemContext ctx, List<NavItem> navItemList)
-
addGroup
public NavGroup addGroup(String id, String name, String description, String parentId, boolean modifiable)
Description copied from interface:NavTreeCreates and register a brand newNavGroupitem.- Specified by:
addGroupin interfaceNavTree- Parameters:
id- The unique id of the itemname- The item's namedescription- A brief description of the itemparentId- The identifier of an existing node in the tree where to append the newly created item as a childmodifiable- Flag indicating if the item can be modified once added- Returns:
- The instance just created
-
addItem
public NavItem addItem(String id, String name, String description, String parentId, boolean modifiable, String context)
Description copied from interface:NavTreeCreates and register a brand newNavItemitem.- Specified by:
addItemin interfaceNavTree- Parameters:
id- The unique id of the itemname- The item's namedescription- A brief description of the itemparentId- The identifier of an existing node in the tree where to append the newly created item as a childmodifiable- Flag indicating if the item can be modified once addedcontext- An string that contains item related information, like an external reference for instance.- Returns:
- The instance just created
-
addDivider
public NavDivider addDivider(String parentId, boolean modifiable)
Description copied from interface:NavTreeCreates and register a brand newNavDivideritem.- Specified by:
addDividerin interfaceNavTree- Parameters:
parentId- The identifier of an existing node in the tree where to append the newly created item as a childmodifiable- Flag indicating if the item can be modified once added- Returns:
- The instance just created
-
deleteItem
public NavItem deleteItem(String id)
Description copied from interface:NavTreeDelete an existing item including all its children.- Specified by:
deleteItemin interfaceNavTree- Parameters:
id- The unique identifier of the item- Returns:
- The instance removed or null if the instance is not found
-
setItemName
public NavItem setItemName(String id, String name)
Description copied from interface:NavTreeUpdates the name attribute of an existing item- Specified by:
setItemNamein interfaceNavTree- Parameters:
id- The unique id of the itemname- A brief description of the item- Returns:
- The instance being updated
-
setItemDescription
public NavItem setItemDescription(String id, String description)
Description copied from interface:NavTreeUpdates the description attribute of an existing item- Specified by:
setItemDescriptionin interfaceNavTree- Parameters:
id- The unique id of the itemdescription- A brief description of the item- Returns:
- The instance being updated
-
setItemModifiable
public NavItem setItemModifiable(String id, boolean modifiable)
Description copied from interface:NavTreeUpdates the modifiable flag attribute of an existing item- Specified by:
setItemModifiablein interfaceNavTree- Parameters:
id- The unique id of the itemmodifiable- Flag indicating if the item can be modified- Returns:
- The instance being updated
-
setItemContext
public NavItem setItemContext(String id, String context)
Description copied from interface:NavTreeUpdates the perspective attached to an existing perspective link- Specified by:
setItemContextin interfaceNavTree- Parameters:
id- The unique id of the itemcontext- The item's context- Returns:
- The item being updated
-
moveItem
public NavItem moveItem(String id, String newParentId)
Description copied from interface:NavTreeChanges the location of an item in the tree
-
moveItemFirst
public void moveItemFirst(String id)
Description copied from interface:NavTreeMove the specified item to the first position within its parent's children list- Specified by:
moveItemFirstin interfaceNavTree- Parameters:
id- The unique id of the item
-
moveItemLast
public void moveItemLast(String id)
Description copied from interface:NavTreeMove the specified item to the last position within its parent's children list- Specified by:
moveItemLastin interfaceNavTree- Parameters:
id- The unique id of the item
-
moveItemUp
public void moveItemUp(String id)
Description copied from interface:NavTreeMove an item one position up in its parent's children list- Specified by:
moveItemUpin interfaceNavTree- Parameters:
id- The unique id of the item
-
moveItemDown
public void moveItemDown(String id)
Description copied from interface:NavTreeMove an item one position down in its parent's children list- Specified by:
moveItemDownin interfaceNavTree- Parameters:
id- The unique id of the item
-
accept
public void accept(NavItemVisitor visitor)
Description copied from interface:NavTreeEntry point for visitor interfaces
-
-