Package org.apache.pivot.wtk.content
Class TreeBranch
- java.lang.Object
-
- org.apache.pivot.wtk.content.BaseContent
-
- org.apache.pivot.wtk.content.UserContent
-
- org.apache.pivot.wtk.content.TreeNode
-
- org.apache.pivot.wtk.content.TreeBranch
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.pivot.collections.List
List.ItemIterator<T>, List.ListListenerList<T>
-
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
-
-
Field Summary
-
Fields inherited from class org.apache.pivot.wtk.content.UserContent
userData
-
Fields inherited from class org.apache.pivot.wtk.content.BaseContent
icon, text
-
-
Constructor Summary
Constructors Constructor Description TreeBranch()TreeBranch(java.lang.String text)TreeBranch(Image icon)TreeBranch(Image icon, java.lang.String text)TreeBranch(Image icon, Image expandedIcon, java.lang.String text)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intadd(TreeNode treeNode)Adds an item to the list.voidclear()Removes all elements from the collection.TreeNodeget(int index)Retrieves the item at the given index.java.util.Comparator<TreeNode>getComparator()Returns the collection's sort order.ImagegetExpandedIcon()intgetLength()Returns the length of the list.ListenerList<ListListener<TreeNode>>getListListeners()Returns the list listener list.intindexOf(TreeNode treeNode)Returns the index of an item in the sequence.voidinsert(TreeNode treeNode, int index)Inserts an item into the list.booleanisEmpty()Tests the emptiness of the collection.java.util.Iterator<TreeNode>iterator()Sequence<TreeNode>remove(int index, int count)Removes one or more items from the sequence.intremove(TreeNode treeNode)Removes the first occurrence of the given item from the sequence.voidsetComparator(java.util.Comparator<TreeNode> comparator)Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.voidsetExpandedIcon(java.lang.String expandedIconName)Sets the tree branch's expanded icon by resource name.voidsetExpandedIcon(java.net.URL iconURL)Sets the tree branch's expanded icon by URL.voidsetExpandedIcon(Image expandedIcon)java.lang.StringtoString()TreeNodeupdate(int index, TreeNode treeNode)Updates the item at the given index.-
Methods inherited from class org.apache.pivot.wtk.content.UserContent
getUserData, setUserData
-
Methods inherited from class org.apache.pivot.wtk.content.BaseContent
getIcon, getText, setIcon, setIcon, setIcon, setText
-
-
-
-
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:ListAdds 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.
-
insert
public void insert(TreeNode treeNode, int index)
Description copied from interface:ListInserts an item into the list.- Specified by:
insertin interfaceList<TreeNode>- Specified by:
insertin interfaceSequence<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 between0andgetLength().- See Also:
ListListener.itemInserted(List, int)
-
update
public TreeNode update(int index, TreeNode treeNode)
Description copied from interface:ListUpdates the item at the given index.- Specified by:
updatein interfaceList<TreeNode>- Specified by:
updatein interfaceSequence<TreeNode>- Parameters:
index- The index of the item to update.treeNode- The item that will replace any existing value at the given index.- Returns:
- The item that was previously stored at the given index.
- See Also:
ListListener.itemUpdated(List, int, Object)
-
remove
public int remove(TreeNode treeNode)
Description copied from interface:SequenceRemoves the first occurrence of the given item from the sequence.- Specified by:
removein interfaceSequence<TreeNode>- Parameters:
treeNode- The item to remove.- Returns:
- The index of the item that was removed, or
-1if the item could not be found. - See Also:
Sequence.remove(int, int)
-
remove
public Sequence<TreeNode> remove(int index, int count)
Description copied from interface:SequenceRemoves one or more items from the sequence.- Specified by:
removein interfaceList<TreeNode>- Specified by:
removein interfaceSequence<TreeNode>- Parameters:
index- The starting index to remove.count- The number of items to remove, beginning withindex.- Returns:
- A sequence containing the items that were removed.
- See Also:
ListListener.itemsRemoved(List, int, Sequence)
-
clear
public void clear()
Description copied from interface:CollectionRemoves all elements from the collection.- Specified by:
clearin interfaceCollection<TreeNode>- Specified by:
clearin interfaceList<TreeNode>- See Also:
ListListener.itemsRemoved(List, int, Sequence)
-
get
public TreeNode get(int index)
Description copied from interface:SequenceRetrieves the item at the given index.
-
indexOf
public int indexOf(TreeNode treeNode)
Description copied from interface:SequenceReturns the index of an item in the sequence.
-
isEmpty
public boolean isEmpty()
Description copied from interface:CollectionTests the emptiness of the collection.- Specified by:
isEmptyin interfaceCollection<TreeNode>- Returns:
trueif the collection contains no elements;false, otherwise.
-
getLength
public int getLength()
Description copied from interface:ListReturns the length of the list.
-
getComparator
public java.util.Comparator<TreeNode> getComparator()
Description copied from interface:CollectionReturns the collection's sort order.- Specified by:
getComparatorin interfaceCollection<TreeNode>- Returns:
- The comparator used to order elements in the collection, or
nullif the sort order is undefined. - See Also:
Collection.setComparator(Comparator)
-
setComparator
public void setComparator(java.util.Comparator<TreeNode> comparator)
Description copied from interface:CollectionSets 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:
setComparatorin interfaceCollection<TreeNode>- Specified by:
setComparatorin interfaceList<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:
iteratorin interfacejava.lang.Iterable<TreeNode>
-
getListListeners
public ListenerList<ListListener<TreeNode>> getListListeners()
Description copied from interface:ListReturns the list listener list.- Specified by:
getListListenersin interfaceList<TreeNode>- Returns:
- The list of listeners for this list.
-
-