|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fsmvis.gui.SelectionHandler
Field Summary | |
protected java.util.List |
all
|
protected java.util.LinkedList |
listeners
|
protected java.util.LinkedList |
selectables
|
protected java.util.List |
selected
|
protected java.util.Set |
selectedIndices
|
protected int |
size
|
Constructor Summary | |
SelectionHandler()
constructor: Creates a new emepty Selection handler with an initial size of 0 |
|
SelectionHandler(int size)
constructor: Creates a new selection handler that can initially handle up to size elements |
Method Summary | |
void |
addSelectableObject(Selectable s)
|
void |
addSelectionChangedListener(SelectionChangedListener s)
Adds a selection changed listener |
void |
addToSelected(java.util.List newSelect)
Adds all of the indices in the newSelect array to the current selection |
java.util.List |
getSelected()
returns the arrayList of selected states |
java.util.HashSet |
getSelectedIndices()
returns the selected indices, uses the hashset class because it guarantees constant time, add, remove and importantly contains. |
boolean |
getState(int index)
Returns the status of the data item located at index index. |
protected void |
notifyListeners()
Method to be called whenever a change occurs in the selection, notifies all the listeners of this. |
void |
removeFromSelected(java.util.List newDeselect)
Removes the indices specified in newDeselect from the currently selected indices. |
void |
removeSelectableObject(Selectable s)
|
void |
removeSelectionChangedListener(SelectionChangedListener s)
Removes a selection changed listener |
void |
selectAll()
Selects all of the items in the selection. |
void |
selectNone()
Selects none of the items, deselects all |
protected void |
setAllStates(boolean state)
sets all of the states to the state indicated by the parameter, this can be used to select all items or to deselect all items |
protected void |
setStates(java.util.List indices,
boolean state)
Sets the states of the indices stored in indices to be state, internal method used by removefrom selected and add to selected. |
void |
updateSelection()
method to be called by a selectable object when the selection has changed. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected int size
protected java.util.List selected
protected java.util.Set selectedIndices
protected java.util.List all
protected java.util.LinkedList selectables
protected java.util.LinkedList listeners
Constructor Detail |
public SelectionHandler()
public SelectionHandler(int size)
size
- The initial size of the selectionMethod Detail |
public java.util.List getSelected()
public java.util.HashSet getSelectedIndices()
public boolean getState(int index)
index
- The location in the selected arraypublic void updateSelection()
public void addToSelected(java.util.List newSelect)
newSelect
- The arraylist of indices to be addedpublic void removeFromSelected(java.util.List newDeselect)
newDeselect
- The items to be deselectedpublic void selectAll()
public void selectNone()
protected void setStates(java.util.List indices, boolean state)
indices
- the indices that require their state setstate
- The state to set them toprotected void setAllStates(boolean state)
state
- The new desired state for allpublic void addSelectableObject(Selectable s)
public void removeSelectableObject(Selectable s)
public void addSelectionChangedListener(SelectionChangedListener s)
s
- public void removeSelectionChangedListener(SelectionChangedListener s)
s
- protected void notifyListeners()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |