mvc
Class ConstantModel<T>

java.lang.Object
  extended by mvc.ConstantModel<T>
All Implemented Interfaces:
Named, CallbackRegistry, Model<T>, NamedModel<T>
Direct Known Subclasses:
LeafCascadedChooser

public class ConstantModel<T>
extends java.lang.Object
implements NamedModel<T>

A ConstantModel is a NamedModel whose value is fixed when it is constructed.


Constructor Summary
ConstantModel(java.lang.String nm, T val)
          new ConstantModel(nm, val) returns a new ConstantModel with name nm and constant value val.
 
Method Summary
 void addCallback(Callback cbk)
          m.addCallback(cbk) registers cbk as an callback of m.
 java.lang.String getName()
          m.getName() returns the name for m.
 T getValue()
          m.getValue() returns the current value of m.
 void removeCallback(Callback cbk)
          m.removeCallback(cbk) unregisters cbk as an callback of m.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantModel

public ConstantModel(java.lang.String nm,
                     T val)
new ConstantModel(nm, val) returns a new ConstantModel with name nm and constant value val.

Method Detail

getName

public java.lang.String getName()
m.getName() returns the name for m.

Specified by:
getName in interface Named
Returns:

getValue

public T getValue()
m.getValue() returns the current value of m. For a ConstantModel, the model value is always the value provided in the constructor.

Specified by:
getValue in interface Model<T>
Returns:
the current value

addCallback

public void addCallback(Callback cbk)
m.addCallback(cbk) registers cbk as an callback of m. For a ConstantModel, the model value never changes so callback registration is ignored.

Specified by:
addCallback in interface CallbackRegistry
Parameters:
cbk - the callback to be added

removeCallback

public void removeCallback(Callback cbk)
m.removeCallback(cbk) unregisters cbk as an callback of m. For a ConstantModel, the model value never changes so callback registration is ignored.

Specified by:
removeCallback in interface CallbackRegistry
Parameters:
cbk - the callback to be removed