Class ContainerHierarchicalWrapper

    • Constructor Detail

      • ContainerHierarchicalWrapper

        public ContainerHierarchicalWrapper​(Container toBeWrapped)
        Deprecated.
        Constructs a new hierarchical wrapper for an existing Container. Works even if the to-be-wrapped container already implements the Container.Hierarchical interface.
        Parameters:
        toBeWrapped - the container that needs to be accessed hierarchically
        See Also:
        updateHierarchicalWrapper()
    • Method Detail

      • updateHierarchicalWrapper

        public void updateHierarchicalWrapper()
        Deprecated.
        Updates the wrapper's internal hierarchy data to include all Items in the underlying container. If the contents of the wrapped container change without the wrapper's knowledge, this method needs to be called to update the hierarchy information of the Items.
      • areChildrenAllowed

        public boolean areChildrenAllowed​(Object itemId)
        Deprecated.
        Description copied from interface: Container.Hierarchical
        Tests if the Item with given ID can have children.
        Specified by:
        areChildrenAllowed in interface Container.Hierarchical
        Parameters:
        itemId - ID of the Item in the container whose child capability is to be tested
        Returns:
        true if the specified Item exists in the Container and it can have children, false if it's not found from the container or it can't have children.
      • getChildren

        public Collection<?> getChildren​(Object itemId)
        Deprecated.
        Description copied from interface: Container.Hierarchical
        Gets the IDs of all Items that are children of the specified Item. The returned collection is unmodifiable.
        Specified by:
        getChildren in interface Container.Hierarchical
        Parameters:
        itemId - ID of the Item whose children the caller is interested in
        Returns:
        An unmodifiable collection containing the IDs of all other Items that are children in the container hierarchy; null if item does not have any children.
      • getParent

        public Object getParent​(Object itemId)
        Deprecated.
        Description copied from interface: Container.Hierarchical
        Gets the ID of the parent Item of the specified Item.
        Specified by:
        getParent in interface Container.Hierarchical
        Parameters:
        itemId - ID of the Item whose parent the caller wishes to find out.
        Returns:
        the ID of the parent Item. Will be null if the specified Item is a root element.
      • hasChildren

        public boolean hasChildren​(Object itemId)
        Deprecated.
        Description copied from interface: Container.Hierarchical

        Tests if the Item specified with itemId has child Items or if it is a leaf. The Container.Hierarchical.getChildren(Object itemId) method always returns null for leaf Items.

        Note that being a leaf does not imply whether or not an Item is allowed to have children.

        Specified by:
        hasChildren in interface Container.Hierarchical
        Parameters:
        itemId - ID of the Item to be tested
        Returns:
        true if the specified Item has children, false if not (is a leaf)
      • isRoot

        public boolean isRoot​(Object itemId)
        Deprecated.
        Description copied from interface: Container.Hierarchical
        Tests if the Item specified with itemId is a root Item. The hierarchical container can have more than one root and must have at least one unless it is empty. The Container.Hierarchical.getParent(Object itemId) method always returns null for root Items.
        Specified by:
        isRoot in interface Container.Hierarchical
        Parameters:
        itemId - ID of the Item whose root status is to be tested
        Returns:
        true if the specified Item is a root, false if not
      • rootItemIds

        public Collection<?> rootItemIds()
        Deprecated.
        Description copied from interface: Container.Hierarchical
        Gets the IDs of all Items in the container that don't have a parent. Such items are called root Items. The returned collection is unmodifiable.
        Specified by:
        rootItemIds in interface Container.Hierarchical
        Returns:
        An unmodifiable collection containing IDs of all root elements of the container
      • setChildrenAllowed

        public boolean setChildrenAllowed​(Object itemId,
                                          boolean childrenAllowed)
        Deprecated.

        Sets the given Item's capability to have children. If the Item identified with the itemId already has children and the areChildrenAllowed is false this method fails and false is returned; the children must be first explicitly removed with setParent(Object itemId, Object newParentId) or Container.removeItem(Object itemId).

        Specified by:
        setChildrenAllowed in interface Container.Hierarchical
        Parameters:
        itemId - the ID of the Item in the container whose child capability is to be set.
        childrenAllowed - the boolean value specifying if the Item can have children or not.
        Returns:
        true if the operation succeeded, false if not
      • setParent

        public boolean setParent​(Object itemId,
                                 Object newParentId)
        Deprecated.

        Sets the parent of an Item. The new parent item must exist and be able to have children. (canHaveChildren(newParentId) == true). It is also possible to detach a node from the hierarchy (and thus make it root) by setting the parent null.

        Specified by:
        setParent in interface Container.Hierarchical
        Parameters:
        itemId - the ID of the item to be set as the child of the Item identified with newParentId.
        newParentId - the ID of the Item that's to be the new parent of the Item identified with itemId.
        Returns:
        true if the operation succeeded, false if not
      • removeItemRecursively

        public boolean removeItemRecursively​(Object itemId)
        Deprecated.
        Removes the Item identified by given itemId and all its children.
        Parameters:
        itemId - the identifier of the Item to be removed
        Returns:
        true if the operation succeeded
        See Also:
        removeItem(Object)
      • addContainerProperty

        public boolean addContainerProperty​(Object propertyId,
                                            Class<?> type,
                                            Object defaultValue)
                                     throws UnsupportedOperationException
        Deprecated.
        Adds a new Property to all Items in the Container.
        Specified by:
        addContainerProperty in interface Container
        Parameters:
        propertyId - the ID of the new Property.
        type - the Data type of the new Property.
        defaultValue - the value all created Properties are initialized to.
        Returns:
        true if the operation succeeded, false if not
        Throws:
        UnsupportedOperationException - if the addContainerProperty is not supported.
      • removeContainerProperty

        public boolean removeContainerProperty​(Object propertyId)
                                        throws UnsupportedOperationException
        Deprecated.
        Removes the specified Property from the underlying container and from the hierarchy.

        Note : The Property will be removed from all Items in the Container.

        Specified by:
        removeContainerProperty in interface Container
        Parameters:
        propertyId - the ID of the Property to remove.
        Returns:
        true if the operation succeeded, false if not
        Throws:
        UnsupportedOperationException - if the removeContainerProperty is not supported.
      • containsId

        public boolean containsId​(Object itemId)
        Deprecated.
        Description copied from interface: Container
        Tests if the Container contains the specified Item.

        Filtering can hide items so that they will not be visible through the container API, and this method should respect visibility of items (i.e. only indicate visible items as being in the container) if feasible for the container.

        Specified by:
        containsId in interface Container
        Parameters:
        itemId - ID the of Item to be tested
        Returns:
        boolean indicating if the Container holds the specified Item
      • getItem

        public Item getItem​(Object itemId)
        Deprecated.
        Description copied from interface: Container
        Gets the Item with the given Item ID from the Container. If the Container does not contain the requested Item, null is returned.

        Containers should not return Items that are filtered out.

        Specified by:
        getItem in interface Container
        Parameters:
        itemId - ID of the Item to retrieve
        Returns:
        the Item with the given ID or null if the Item is not found in the Container
      • getItemIds

        public Collection<?> getItemIds()
        Deprecated.
        Description copied from interface: Container
        Gets the ID's of all visible (after filtering and sorting) Items stored in the Container. The ID's cannot be modified through the returned collection.

        If the container is Container.Ordered, the collection returned by this method should follow that order. If the container is Container.Sortable, the items should be in the sorted order.

        Calling this method for large lazy containers can be an expensive operation and should be avoided when practical.

        Specified by:
        getItemIds in interface Container
        Returns:
        unmodifiable collection of Item IDs
      • getContainerProperty

        public Property getContainerProperty​(Object itemId,
                                             Object propertyId)
        Deprecated.
        Description copied from interface: Container
        Gets the Property identified by the given itemId and propertyId from the Container. If the Container does not contain the item or it is filtered out, or the Container does not have the Property, null is returned.
        Specified by:
        getContainerProperty in interface Container
        Parameters:
        itemId - ID of the visible Item which contains the Property
        propertyId - ID of the Property to retrieve
        Returns:
        Property with the given ID or null
      • getContainerPropertyIds

        public Collection<?> getContainerPropertyIds()
        Deprecated.
        Description copied from interface: Container
        Gets the ID's of all Properties stored in the Container. The ID's cannot be modified through the returned collection.
        Specified by:
        getContainerPropertyIds in interface Container
        Returns:
        unmodifiable collection of Property IDs
      • getType

        public Class<?> getType​(Object propertyId)
        Deprecated.
        Description copied from interface: Container
        Gets the data type of all Properties identified by the given Property ID.
        Specified by:
        getType in interface Container
        Parameters:
        propertyId - ID identifying the Properties
        Returns:
        data type of the Properties
      • size

        public int size()
        Deprecated.
        Description copied from interface: Container
        Gets the number of visible Items in the Container.

        Filtering can hide items so that they will not be visible through the container API.

        Specified by:
        size in interface Container
        Returns:
        number of Items in the Container