Class NavTreeImpl

  • All Implemented Interfaces:
    NavTree

    @Portable
    public class NavTreeImpl
    extends Object
    implements NavTree
    • Constructor Detail

      • NavTreeImpl

        public NavTreeImpl()
      • NavTreeImpl

        public NavTreeImpl​(NavGroup root)
    • Method Detail

      • getRootItems

        public List<NavItem> getRootItems()
        Description copied from interface: NavTree
        The list of items belonging to the first tree level
        Specified by:
        getRootItems in interface NavTree
        Returns:
        A list of NavItem instances
      • getItemById

        public NavItem getItemById​(String id)
        Description copied from interface: NavTree
        Get an item given its id. All the tree nodes are compared, no matter its level.
        Specified by:
        getItemById in interface NavTree
        Parameters:
        id - The unique identifier of the item
        Returns:
        The first instance found
      • getItemAsTree

        public NavTree getItemAsTree​(String id)
        Description copied from interface: NavTree
        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.
        Specified by:
        getItemAsTree in interface NavTree
        Parameters:
        id - The unique identifier of the item
        Returns:
        The first instance found
      • searchItems

        public List<NavItem> searchItems​(NavItemContext ctx)
        Description copied from interface: NavTree
        Get the items that match the given context
        Specified by:
        searchItems in interface NavTree
        Parameters:
        ctx - The context to search for
        Returns:
        The list of nav items that match the target context
      • addGroup

        public NavGroup addGroup​(String id,
                                 String name,
                                 String description,
                                 String parentId,
                                 boolean modifiable)
        Description copied from interface: NavTree
        Creates and register a brand new NavGroup item.
        Specified by:
        addGroup in interface NavTree
        Parameters:
        id - The unique id of the item
        name - The item's name
        description - A brief description of the item
        parentId - The identifier of an existing node in the tree where to append the newly created item as a child
        modifiable - 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: NavTree
        Creates and register a brand new NavItem item.
        Specified by:
        addItem in interface NavTree
        Parameters:
        id - The unique id of the item
        name - The item's name
        description - A brief description of the item
        parentId - The identifier of an existing node in the tree where to append the newly created item as a child
        modifiable - Flag indicating if the item can be modified once added
        context - 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: NavTree
        Creates and register a brand new NavDivider item.
        Specified by:
        addDivider in interface NavTree
        Parameters:
        parentId - The identifier of an existing node in the tree where to append the newly created item as a child
        modifiable - 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: NavTree
        Delete an existing item including all its children.
        Specified by:
        deleteItem in interface NavTree
        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: NavTree
        Updates the name attribute of an existing item
        Specified by:
        setItemName in interface NavTree
        Parameters:
        id - The unique id of the item
        name - A brief description of the item
        Returns:
        The instance being updated
      • setItemDescription

        public NavItem setItemDescription​(String id,
                                          String description)
        Description copied from interface: NavTree
        Updates the description attribute of an existing item
        Specified by:
        setItemDescription in interface NavTree
        Parameters:
        id - The unique id of the item
        description - A brief description of the item
        Returns:
        The instance being updated
      • setItemModifiable

        public NavItem setItemModifiable​(String id,
                                         boolean modifiable)
        Description copied from interface: NavTree
        Updates the modifiable flag attribute of an existing item
        Specified by:
        setItemModifiable in interface NavTree
        Parameters:
        id - The unique id of the item
        modifiable - 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: NavTree
        Updates the perspective attached to an existing perspective link
        Specified by:
        setItemContext in interface NavTree
        Parameters:
        id - The unique id of the item
        context - The item's context
        Returns:
        The item being updated
      • moveItem

        public NavItem moveItem​(String id,
                                String newParentId)
        Description copied from interface: NavTree
        Changes the location of an item in the tree
        Specified by:
        moveItem in interface NavTree
        Parameters:
        id - The unique id of the item
        newParentId - The identifier of an existing node in the tree where to move the item
        Returns:
        The instance being updated
      • moveItemFirst

        public void moveItemFirst​(String id)
        Description copied from interface: NavTree
        Move the specified item to the first position within its parent's children list
        Specified by:
        moveItemFirst in interface NavTree
        Parameters:
        id - The unique id of the item
      • moveItemLast

        public void moveItemLast​(String id)
        Description copied from interface: NavTree
        Move the specified item to the last position within its parent's children list
        Specified by:
        moveItemLast in interface NavTree
        Parameters:
        id - The unique id of the item
      • moveItemUp

        public void moveItemUp​(String id)
        Description copied from interface: NavTree
        Move an item one position up in its parent's children list
        Specified by:
        moveItemUp in interface NavTree
        Parameters:
        id - The unique id of the item
      • moveItemDown

        public void moveItemDown​(String id)
        Description copied from interface: NavTree
        Move an item one position down in its parent's children list
        Specified by:
        moveItemDown in interface NavTree
        Parameters:
        id - The unique id of the item
      • changePosition

        public void changePosition​(String id,
                                   boolean up,
                                   Integer npositions)
      • accept

        public void accept​(NavItemVisitor visitor)
        Description copied from interface: NavTree
        Entry point for visitor interfaces
        Specified by:
        accept in interface NavTree
      • cloneTree

        public NavTree cloneTree()
        Description copied from interface: NavTree
        Creates a brand new copy of this tree
        Specified by:
        cloneTree in interface NavTree