com.tonbeller.wcf.selection
Class DefaultSelectionModel

java.lang.Object
  extended bycom.tonbeller.wcf.selection.DefaultSelectionModel
All Implemented Interfaces:
SelectionModel, SingleSelectionModel

public class DefaultSelectionModel
extends java.lang.Object
implements SelectionModel

default SelectionModel for Tree and Table

Author:
av

Field Summary
 
Fields inherited from interface com.tonbeller.wcf.selection.SelectionModel
MULTIPLE_SELECTION, MULTIPLE_SELECTION_BUTTON, MULTIPLE_SELECTION_HREF, NO_SELECTION, SINGLE_SELECTION, SINGLE_SELECTION_BUTTON, SINGLE_SELECTION_HREF
 
Constructor Summary
DefaultSelectionModel()
           
DefaultSelectionModel(int mode)
           
 
Method Summary
 void add(java.lang.Object obj)
           
 void addAll(java.util.Collection c)
           
 void addSelectionListener(SelectionChangeListener l)
           
 void clear()
          clears the selection
 boolean contains(java.lang.Object obj)
           
 void fireSelectionChanged(RequestContext context)
          fires a SelectionChangeEvent.
 int getMode()
           
 SelectableFilter getSelectableFilter()
          returns the current SelectableFilter
 java.util.Set getSelection()
           
 java.lang.Object getSingleSelection()
          return the only selected object or null if the selection is empty.
 boolean isEmpty()
           
 boolean isSelectable(java.lang.Object item)
          return false if item implements the tagging Unselectable interface true if no SelectableFilter is set or if the SelectableFilter accepts the item.
 void remove(java.lang.Object obj)
           
 void removeSelectionListener(SelectionChangeListener l)
           
 void setComparator(java.util.Comparator comp)
           
 void setMode(int mode)
           
 void setSelectableFilter(SelectableFilter filter)
          sets the current SelectableFilter.
 void setSelection(java.util.Collection newSelection)
           
 void setSingleSelection(java.lang.Object selectedObject)
          sets the only selected element
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSelectionModel

public DefaultSelectionModel()

DefaultSelectionModel

public DefaultSelectionModel(int mode)
Method Detail

setComparator

public void setComparator(java.util.Comparator comp)

add

public void add(java.lang.Object obj)
Specified by:
add in interface SelectionModel

remove

public void remove(java.lang.Object obj)
Specified by:
remove in interface SelectionModel

clear

public void clear()
Description copied from interface: SingleSelectionModel
clears the selection

Specified by:
clear in interface SingleSelectionModel

contains

public boolean contains(java.lang.Object obj)
Specified by:
contains in interface SelectionModel

getMode

public int getMode()
Specified by:
getMode in interface SelectionModel

getSelection

public java.util.Set getSelection()
Specified by:
getSelection in interface SelectionModel

setMode

public void setMode(int mode)
Specified by:
setMode in interface SelectionModel

setSelection

public void setSelection(java.util.Collection newSelection)

addAll

public void addAll(java.util.Collection c)
Specified by:
addAll in interface SelectionModel

isSelectable

public boolean isSelectable(java.lang.Object item)
return false if item implements the tagging Unselectable interface true if no SelectableFilter is set or if the SelectableFilter accepts the item.

Specified by:
isSelectable in interface SingleSelectionModel
See Also:
SelectableFilter, setSelectableFilter(com.tonbeller.wcf.selection.SelectableFilter), getSelectableFilter(), Unselectable

getSingleSelection

public java.lang.Object getSingleSelection()
Description copied from interface: SingleSelectionModel
return the only selected object or null if the selection is empty.

Specified by:
getSingleSelection in interface SingleSelectionModel

setSingleSelection

public void setSingleSelection(java.lang.Object selectedObject)
Description copied from interface: SingleSelectionModel
sets the only selected element

Specified by:
setSingleSelection in interface SingleSelectionModel

getSelectableFilter

public SelectableFilter getSelectableFilter()
returns the current SelectableFilter

See Also:
SelectableFilter, isSelectable(java.lang.Object)

setSelectableFilter

public void setSelectableFilter(SelectableFilter filter)
sets the current SelectableFilter.

Parameters:
filter - the new filter or null to accept all nodes
See Also:
SelectableFilter, isSelectable(java.lang.Object)

fireSelectionChanged

public void fireSelectionChanged(RequestContext context)
Description copied from interface: SingleSelectionModel
fires a SelectionChangeEvent. This is not fired automatically so clients may choose when to notify the listeners (e.g. after a couple of changes have been made).

Specified by:
fireSelectionChanged in interface SingleSelectionModel
Parameters:
context -

addSelectionListener

public void addSelectionListener(SelectionChangeListener l)
Specified by:
addSelectionListener in interface SingleSelectionModel

removeSelectionListener

public void removeSelectionListener(SelectionChangeListener l)
Specified by:
removeSelectionListener in interface SingleSelectionModel

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface SingleSelectionModel