Class MultiMutableSelectedState<T>
- java.lang.Object
-
- org.jungrapht.visualization.selection.AbstractMutableSelectedState<T>
-
- org.jungrapht.visualization.selection.MultiMutableSelectedState<T>
-
- All Implemented Interfaces:
ItemSelectable,MutableSelectedState<T>,MutableSelectedStateSink<T>,SelectedState<T>
public class MultiMutableSelectedState<T> extends AbstractMutableSelectedState<T> implements MutableSelectedStateSink<T>
Maintains the state of what has been 'selected' in the graph. TheSetsare constructed so that their iterators will traverse them in the order in which they are selected.- Author:
- Tom Nelson
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jungrapht.visualization.selection.SelectedState
SelectedState.StateChangeListener<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<T>selectedthe 'selected' items-
Fields inherited from class org.jungrapht.visualization.selection.AbstractMutableSelectedState
listenerList
-
-
Constructor Summary
Constructors Constructor Description MultiMutableSelectedState()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the "selected" state from all elements.voidclear(boolean fireEvents)Clears the "selected" state from all elements.booleandeselect(Collection<T> elements)deselect a collection of elementsbooleandeselect(Collection<T> elements, boolean fireEvents)deselect a collection of elementsbooleandeselect(T element)deselect one elementbooleandeselect(T t, boolean fireEvents)if t is was already selected, remove itSet<T>getSelected()T[]getSelectedObjects()for the ItemSelectable interface contractbooleanisSelected(T t)booleanselect(Collection<T> elements)select a collection of elements to be the only selected elementsbooleanselect(Collection<T> elements, boolean fireEvents)select a collection of elements to be the only selected elementsbooleanselect(T element)Select an elementbooleanselect(T element, boolean fireEvents)select one element.-
Methods inherited from class org.jungrapht.visualization.selection.AbstractMutableSelectedState
addItemListener, fireItemStateChanged, removeItemListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.awt.ItemSelectable
addItemListener, removeItemListener
-
-
-
-
Method Detail
-
select
public boolean select(T element)
Select an element- Specified by:
selectin interfaceMutableSelectedState<T>- Parameters:
element- the element to select- Returns:
- true if the collection of selected changed
-
select
public boolean select(T element, boolean fireEvents)
Description copied from interface:MutableSelectedStateSinkselect one element.- Specified by:
selectin interfaceMutableSelectedState<T>- Specified by:
selectin interfaceMutableSelectedStateSink<T>- Parameters:
element- the element to selectfireEvents- if false, act as a sink, if true, do not fire events- Returns:
- true if the collection of selected elements was changed
-
deselect
public boolean deselect(T t, boolean fireEvents)
if t is was already selected, remove it- Specified by:
deselectin interfaceMutableSelectedState<T>- Specified by:
deselectin interfaceMutableSelectedStateSink<T>- Parameters:
t- item to de-selectfireEvents- act as a sink, if true, do not fire events- Returns:
- true if the collection of selected things was modified
-
deselect
public boolean deselect(T element)
Description copied from interface:MutableSelectedStatedeselect one element- Specified by:
deselectin interfaceMutableSelectedState<T>- Parameters:
element- the element to deselect- Returns:
- true is the collection of selected elements was changed
-
select
public boolean select(Collection<T> elements, boolean fireEvents)
Description copied from interface:MutableSelectedStateSinkselect a collection of elements to be the only selected elements- Specified by:
selectin interfaceMutableSelectedState<T>- Specified by:
selectin interfaceMutableSelectedStateSink<T>fireEvents- if false, act as a sink, if true, do not fire events- Returns:
- true if the collection of selected elements was changed
-
select
public boolean select(Collection<T> elements)
Description copied from interface:MutableSelectedStateselect a collection of elements to be the only selected elements- Specified by:
selectin interfaceMutableSelectedState<T>- Returns:
- true if the collection of selected elements was changed
-
deselect
public boolean deselect(Collection<T> elements, boolean fireEvents)
Description copied from interface:MutableSelectedStateSinkdeselect a collection of elements- Specified by:
deselectin interfaceMutableSelectedState<T>- Specified by:
deselectin interfaceMutableSelectedStateSink<T>- Parameters:
elements- the elements to deselectfireEvents- if false, act as a sink, if true, do not fire events- Returns:
- true if the collection of selected elements was changed
-
deselect
public boolean deselect(Collection<T> elements)
Description copied from interface:MutableSelectedStatedeselect a collection of elements- Specified by:
deselectin interfaceMutableSelectedState<T>- Parameters:
elements- the elements to deselect- Returns:
- true if the collection of selected elements was changed
-
clear
public void clear(boolean fireEvents)
Description copied from interface:MutableSelectedStateSinkClears the "selected" state from all elements.- Specified by:
clearin interfaceMutableSelectedState<T>- Specified by:
clearin interfaceMutableSelectedStateSink<T>- Parameters:
fireEvents- if false, act as a sink, if true, do not fire events
-
clear
public void clear()
Description copied from interface:MutableSelectedStateClears the "selected" state from all elements.- Specified by:
clearin interfaceMutableSelectedState<T>
-
getSelected
public Set<T> getSelected()
- Specified by:
getSelectedin interfaceSelectedState<T>- Returns:
- all selected elements.
-
isSelected
public boolean isSelected(T t)
- Specified by:
isSelectedin interfaceSelectedState<T>
-
getSelectedObjects
public T[] getSelectedObjects()
for the ItemSelectable interface contract- Specified by:
getSelectedObjectsin interfaceItemSelectable
-
-