be.ugent.caagt.swirl
Interface GenericSelectionModel<E>

All Known Implementing Classes:
DefaultGenericSelectionModel

public interface GenericSelectionModel<E>

Model which keeps track of a single element selected from a group. The element is represented by an object type E. Classes that satisfy this interface can be used to implement a GenericSelectionGroup.

Models of this type are used by the MenuBuilder to implement radio button groups.


Method Summary
 void addChangeListener(javax.swing.event.ChangeListener listener)
          Adds a listener which should be notified of all changes in the model.
 void clearSelection()
          Clears the selection.
 E getSelection()
          Returns the current selection or null if nothing is currently selected.
 boolean isSelected()
          Check whether an element is currently selected.
 void removeChangeListener(javax.swing.event.ChangeListener listener)
          Removes a listener previously registered with addChangeListener(javax.swing.event.ChangeListener).
 void setSelection(E element)
          Set the current selection and notify any listeners in case of changes.
 

Method Detail

getSelection

E getSelection()
Returns the current selection or null if nothing is currently selected.


setSelection

void setSelection(E element)
Set the current selection and notify any listeners in case of changes.

Parameters:
element - object which represents the selected element, or null if the selection should be cleared

clearSelection

void clearSelection()
Clears the selection. Short for
    setSelection(null);
 


isSelected

boolean isSelected()
Check whether an element is currently selected. Short for
    getSelection() != null
 


addChangeListener

void addChangeListener(javax.swing.event.ChangeListener listener)
Adds a listener which should be notified of all changes in the model.


removeChangeListener

void removeChangeListener(javax.swing.event.ChangeListener listener)
Removes a listener previously registered with addChangeListener(javax.swing.event.ChangeListener).