Home / Development / Documentation / 2.0.44 / TreeSelection
TreeGraph 2
 


info.bioinfweb.treegraph.gui.treeframe
Class TreeSelection

java.lang.Object
  extended by info.bioinfweb.treegraph.gui.treeframe.TreeSelection

public class TreeSelection
extends Object

This class manages the selection of multiple elements in an tree view panel.

Author:
Ben Stöver

Field Summary
private  HashSet<ConcretePaintableElement> elements
           
private  TreeViewPanel owner
           
private  boolean valueIsAdjusting
           
 
Constructor Summary
TreeSelection(TreeViewPanel owner)
           
 
Method Summary
 void add(ConcretePaintableElement element)
           
 boolean addAll(Collection<? extends ConcretePaintableElement> collection)
           
 void clear()
           
 String[] containedLabelIDs()
          Returns a list of the IDs of the labels that are currently selected.
 boolean contains(ConcretePaintableElement element)
           
 boolean containsOnlyType(Class<? extends PaintableElement> elementClass)
          Tests if only elements of the specified type are selected.
 boolean containsType(Class<? extends PaintableElement> elementClass)
          Tests if at least one elements of the specified type is selected.
 int elementCount(Class<? extends PaintableElement> elementClass)
          Returns the number of all selected elements of the specified type.
 ConcretePaintableElement first()
           
<T extends PaintableElement>
T[]
getAllElementsOfType(Class<T> elementClass)
          Returns all selected elements of the specified type.
<T extends PaintableElement>
T
getFirstElementOfType(Class<T> elementClass)
          Returns the first selected element of the specified type.
 Node getFirstLeaf()
           
 boolean getValueIsAdjusting()
           
 boolean isEmpty()
           
 Iterator<ConcretePaintableElement> iterator()
           
 void remove(ConcretePaintableElement element)
           
 void set(ConcretePaintableElement element)
          Sets the specified element as the only selected element.
 void setValueIsAdjusting(boolean valueIsAdjusting)
          Sets the valueIsAdjusting property, which indicates whether or not upcoming selection changes should be considered part of a single change.
 int size()
          Returns the number of selected elements.
<T> T[]
toArray(T[] arr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

private TreeViewPanel owner

elements

private HashSet<ConcretePaintableElement> elements

valueIsAdjusting

private boolean valueIsAdjusting
Constructor Detail

TreeSelection

public TreeSelection(TreeViewPanel owner)
Method Detail

first

public ConcretePaintableElement first()

iterator

public Iterator<ConcretePaintableElement> iterator()

toArray

public <T> T[] toArray(T[] arr)

getValueIsAdjusting

public boolean getValueIsAdjusting()

setValueIsAdjusting

public void setValueIsAdjusting(boolean valueIsAdjusting)
Sets the valueIsAdjusting property, which indicates whether or not upcoming selection changes should be considered part of a single change. If this property is set to true no changes are reported to the registered listeners until it is set to false again. (The listeners are informed directly of the property is set back to false.)

Parameters:
valueIsAdjusting - the new value of the property

set

public void set(ConcretePaintableElement element)
Sets the specified element as the only selected element.

Parameters:
element - the element to select or nil if no element should be# selected

add

public void add(ConcretePaintableElement element)

addAll

public boolean addAll(Collection<? extends ConcretePaintableElement> collection)

remove

public void remove(ConcretePaintableElement element)

clear

public void clear()

size

public int size()
Returns the number of selected elements.

See Also:
elementCount(Class)

isEmpty

public boolean isEmpty()

contains

public boolean contains(ConcretePaintableElement element)

containsType

public boolean containsType(Class<? extends PaintableElement> elementClass)
Tests if at least one elements of the specified type is selected.

Parameters:
elementClass - defines the element type
Returns:
true at least one is selected
Since:
2.0.43
See Also:
isEmpty()

containsOnlyType

public boolean containsOnlyType(Class<? extends PaintableElement> elementClass)
Tests if only elements of the specified type are selected.

Parameters:
elementClass - defines the element type
Returns:
true if no other elements are selected
Since:
2.0.43

getFirstElementOfType

public <T extends PaintableElement> T getFirstElementOfType(Class<T> elementClass)
Returns the first selected element of the specified type.

Type Parameters:
T - the class of the returned element (determined by elementClass)
Parameters:
elementClass - the class of the sought-after element
Returns:
the sought-after element or null of none of this type is selected
Since:
2.0.43

getFirstLeaf

public Node getFirstLeaf()

getAllElementsOfType

public <T extends PaintableElement> T[] getAllElementsOfType(Class<T> elementClass)
Returns all selected elements of the specified type.

Type Parameters:
T - the class of the returned elements (determined by elementClass)
Parameters:
elementClass - the class of the sought-after elements
Returns:
an array of the sought-after elements
Since:
2.0.43

containedLabelIDs

public String[] containedLabelIDs()
Returns a list of the IDs of the labels that are currently selected. If a label without an ID is selected "" is included in the result.

Returns:
the list of IDs (Every ID is included only once.)

elementCount

public int elementCount(Class<? extends PaintableElement> elementClass)
Returns the number of all selected elements of the specified type.

Parameters:
elementClass - the class of the elements to be counted
Returns:
the number of elements
Since:
2.0.43
See Also:
size()