Class TreeBranch

    • Constructor Detail

      • TreeBranch

        public TreeBranch()
      • TreeBranch

        public TreeBranch​(Image icon)
      • TreeBranch

        public TreeBranch​(java.lang.String text)
      • TreeBranch

        public TreeBranch​(Image icon,
                          java.lang.String text)
      • TreeBranch

        public TreeBranch​(Image icon,
                          Image expandedIcon,
                          java.lang.String text)
    • Method Detail

      • getExpandedIcon

        public Image getExpandedIcon()
      • setExpandedIcon

        public void setExpandedIcon​(Image expandedIcon)
      • setExpandedIcon

        public void setExpandedIcon​(java.net.URL iconURL)
        Sets the tree branch's expanded icon by URL.

        If the icon already exists in the application context resource cache, the cached value will be used. Otherwise, the icon will be loaded synchronously and added to the cache.

        Parameters:
        iconURL - The location of the expanded icon to set.
      • setExpandedIcon

        public void setExpandedIcon​(java.lang.String expandedIconName)
        Sets the tree branch's expanded icon by resource name.
        Parameters:
        expandedIconName - The resource name of the expanded icon to set.
        See Also:
        setExpandedIcon(URL)
      • add

        public int add​(TreeNode treeNode)
        Description copied from interface: List
        Adds an item to the list. If the list is unsorted, the item is appended to the end of the list. Otherwise, it is inserted at the appropriate index.
        Specified by:
        add in interface List<TreeNode>
        Specified by:
        add in interface Sequence<TreeNode>
        Parameters:
        treeNode - The item to be added to the sequence.
        Returns:
        The index at which the item was added.
        See Also:
        ListListener.itemInserted(List, int)
      • insert

        public void insert​(TreeNode treeNode,
                           int index)
        Description copied from interface: List
        Inserts an item into the list.
        Specified by:
        insert in interface List<TreeNode>
        Specified by:
        insert in interface Sequence<TreeNode>
        Parameters:
        treeNode - The item to be added to the list.
        index - The index at which the item should be inserted. Must be a value between 0 and getLength().
        See Also:
        ListListener.itemInserted(List, int)
      • remove

        public int remove​(TreeNode treeNode)
        Description copied from interface: Sequence
        Removes the first occurrence of the given item from the sequence.
        Specified by:
        remove in interface Sequence<TreeNode>
        Parameters:
        treeNode - The item to remove.
        Returns:
        The index of the item that was removed, or -1 if the item could not be found.
        See Also:
        Sequence.remove(int, int)
      • get

        public TreeNode get​(int index)
        Description copied from interface: Sequence
        Retrieves the item at the given index.
        Specified by:
        get in interface Sequence<TreeNode>
        Parameters:
        index - The index of the item to retrieve.
        Returns:
        The item at this index in the sequence.
      • indexOf

        public int indexOf​(TreeNode treeNode)
        Description copied from interface: Sequence
        Returns the index of an item in the sequence.
        Specified by:
        indexOf in interface Sequence<TreeNode>
        Parameters:
        treeNode - The item to locate.
        Returns:
        The index of first occurrence of the item if it exists in the sequence; -1, otherwise.
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: Collection
        Tests the emptiness of the collection.
        Specified by:
        isEmpty in interface Collection<TreeNode>
        Returns:
        true if the collection contains no elements; false, otherwise.
      • getLength

        public int getLength()
        Description copied from interface: List
        Returns the length of the list.
        Specified by:
        getLength in interface List<TreeNode>
        Specified by:
        getLength in interface Sequence<TreeNode>
        Returns:
        The number of items in the list, or -1 if the list's length is not known. In this case, the iterator must be used to retrieve the contents of the list.
      • setComparator

        public void setComparator​(java.util.Comparator<TreeNode> comparator)
        Description copied from interface: Collection
        Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.

        Calling this method more than once with the same comparator will re-sort the collection.

        Specified by:
        setComparator in interface Collection<TreeNode>
        Specified by:
        setComparator in interface List<TreeNode>
        Parameters:
        comparator - The comparator used to order elements in the collection, or null if the collection is unsorted.
        See Also:
        ListListener.comparatorChanged(List, Comparator)
      • iterator

        public java.util.Iterator<TreeNode> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<TreeNode>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class TreeNode