Interface NavTree

  • All Known Implementing Classes:
    NavTreeImpl

    public interface NavTree
    A tree like structure containing a list of parent and children nodes where every node is a NavItem instance.
    • Method Detail

      • getRootItems

        List<NavItem> getRootItems()
        The list of items belonging to the first tree level
        Returns:
        A list of NavItem instances
      • getItemById

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

        NavTree getItemAsTree​(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.
        Parameters:
        id - The unique identifier of the item
        Returns:
        The first instance found
      • searchItems

        List<NavItem> searchItems​(NavItemContext ctx)
        Get the items that match the given context
        Parameters:
        ctx - The context to search for
        Returns:
        The list of nav items that match the target context
      • addGroup

        NavGroup addGroup​(String id,
                          String name,
                          String description,
                          String groupId,
                          boolean modifiable)
        Creates and register a brand new NavGroup item.
        Parameters:
        id - The unique id of the item
        name - The item's name
        description - A brief description of the item
        groupId - 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

        NavItem addItem​(String id,
                        String name,
                        String description,
                        String groupId,
                        boolean modifiable,
                        String context)
        Creates and register a brand new NavItem item.
        Parameters:
        id - The unique id of the item
        name - The item's name
        description - A brief description of the item
        groupId - 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

        NavDivider addDivider​(String groupId,
                              boolean modifiable)
        Creates and register a brand new NavDivider item.
        Parameters:
        groupId - 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

        NavItem deleteItem​(String id)
        Delete an existing item including all its children.
        Parameters:
        id - The unique identifier of the item
        Returns:
        The instance removed or null if the instance is not found
      • setItemName

        NavItem setItemName​(String id,
                            String name)
        Updates the name attribute of an existing item
        Parameters:
        id - The unique id of the item
        name - A brief description of the item
        Returns:
        The instance being updated
      • setItemDescription

        NavItem setItemDescription​(String id,
                                   String description)
        Updates the description attribute of an existing item
        Parameters:
        id - The unique id of the item
        description - A brief description of the item
        Returns:
        The instance being updated
      • setItemModifiable

        NavItem setItemModifiable​(String id,
                                  boolean modifiable)
        Updates the modifiable flag attribute of an existing item
        Parameters:
        id - The unique id of the item
        modifiable - Flag indicating if the item can be modified
        Returns:
        The instance being updated
      • setItemContext

        NavItem setItemContext​(String id,
                               String context)
        Updates the perspective attached to an existing perspective link
        Parameters:
        id - The unique id of the item
        context - The item's context
        Returns:
        The item being updated
      • moveItem

        NavItem moveItem​(String id,
                         String newParentId)
        Changes the location of an item in the tree
        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

        void moveItemFirst​(String id)
        Move the specified item to the first position within its parent's children list
        Parameters:
        id - The unique id of the item
      • moveItemLast

        void moveItemLast​(String id)
        Move the specified item to the last position within its parent's children list
        Parameters:
        id - The unique id of the item
      • moveItemUp

        void moveItemUp​(String id)
        Move an item one position up in its parent's children list
        Parameters:
        id - The unique id of the item
      • moveItemDown

        void moveItemDown​(String id)
        Move an item one position down in its parent's children list
        Parameters:
        id - The unique id of the item
      • accept

        void accept​(NavItemVisitor visitor)
        Entry point for visitor interfaces
      • cloneTree

        NavTree cloneTree()
        Creates a brand new copy of this tree