com.arsdigita.bebop
Class AbstractSingleSelectionModel

java.lang.Object
  extended bycom.arsdigita.bebop.AbstractSingleSelectionModel
All Implemented Interfaces:
Lockable, SingleSelectionModel
Direct Known Subclasses:
DecimalSingleSelectionModel, DefaultSingleSelectionModel, ParameterSingleSelectionModel, RequestLocalSelectionModel, UserSingleSelectionModel

public abstract class AbstractSingleSelectionModel
extends Object
implements SingleSelectionModel, Lockable

A standard implementation of SingleSelectionModel and Lockable. Those wishing to define a SingleSelectionModel will ordinarily want to extend this class.

Version:
$Id: //core-platform/dev/src/com/arsdigita/bebop/AbstractSingleSelectionModel.java#6 $

Field Summary
static String versionId
           
 
Constructor Summary
AbstractSingleSelectionModel()
          Creates a new AbstractSingleSelectionModel.
 
Method Summary
 void addChangeListener(ChangeListener l)
          Adds a change listener to the model.
 void clearSelection(PageState state)
          Clears the selection.
protected  void fireStateChanged(PageState state)
           
abstract  Object getSelectedKey(PageState state)
          Returns the key that identifies the selected element.
 boolean isLocked()
          Return whether an object is locked and thus immutable, or can still be modified.
 boolean isSelected(PageState state)
          Returns true if there is a selected element.
 void lock()
          Lock an object.
 void removeChangeListener(ChangeListener l)
          Removes a change listener from the model.
abstract  void setSelectedKey(PageState state, Object key)
          Sets the selected key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.arsdigita.bebop.SingleSelectionModel
getStateParameter
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

AbstractSingleSelectionModel

public AbstractSingleSelectionModel()
Creates a new AbstractSingleSelectionModel.

Method Detail

isSelected

public boolean isSelected(PageState state)
Returns true if there is a selected element.

Specified by:
isSelected in interface SingleSelectionModel
Parameters:
state - the state of the current request
Returns:
true if there is a selected component; false otherwise.

getSelectedKey

public abstract Object getSelectedKey(PageState state)
Description copied from interface: SingleSelectionModel
Returns the key that identifies the selected element.

Specified by:
getSelectedKey in interface SingleSelectionModel
Parameters:
state - a PageState value
Returns:
a String value.

setSelectedKey

public abstract void setSelectedKey(PageState state,
                                    Object key)
Description copied from interface: SingleSelectionModel
Sets the selected key. If key is not in the collection of objects underlying this model, an IllegalArgumentException is thrown.

Specified by:
setSelectedKey in interface SingleSelectionModel
Parameters:
state - the state of the current request
key - the selected key

clearSelection

public void clearSelection(PageState state)
Description copied from interface: SingleSelectionModel
Clears the selection.

Specified by:
clearSelection in interface SingleSelectionModel
Parameters:
state - the state of the current request

addChangeListener

public void addChangeListener(ChangeListener l)
Description copied from interface: SingleSelectionModel
Adds a change listener to the model. The listener's stateChanged method is called whenever the selected key changes.

Specified by:
addChangeListener in interface SingleSelectionModel
Parameters:
l - a listener to notify when the selected key changes

removeChangeListener

public void removeChangeListener(ChangeListener l)
Description copied from interface: SingleSelectionModel
Removes a change listener from the model.

Specified by:
removeChangeListener in interface SingleSelectionModel
Parameters:
l - the listener to remove

fireStateChanged

protected void fireStateChanged(PageState state)

lock

public void lock()
Description copied from interface: Lockable
Lock an object. Locked objects are to be considered immutable. Any attempt to modify them, e.g., through a setXXX method should lead to an exception.

Most lockable Bebop classes throw an IllegalStateException if an attempt is made to modify a locked instance.

Specified by:
lock in interface Lockable

isLocked

public final boolean isLocked()
Description copied from interface: Lockable
Return whether an object is locked and thus immutable, or can still be modified.

Specified by:
isLocked in interface Lockable


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC