Class OptionEnumModel<T extends java.lang.Enum<T>>

  extended by de.matthiasmann.twl.model.AbstractOptionModel
      extended by de.matthiasmann.twl.model.OptionEnumModel<T>
Type Parameters:
T - The enum class
All Implemented Interfaces:
BooleanModel, WithRunnableCallback

public class OptionEnumModel<T extends java.lang.Enum<T>>
extends AbstractOptionModel

A BooleanModel which is true when the underlying EnumModel has the specified option code. This can be used for radio/option buttons. It is not possible to set this BooleanModel to false. It can only be set to false by setting the underlying EnumModel to another value. Eg by setting another OptionEnumModel working on the same EnumModel to true.

Field Summary
protected  T optionCode
protected  EnumModel<T> optionState
Constructor Summary
OptionEnumModel(EnumModel<T> optionState, T optionCode)
Method Summary
 boolean getValue()
protected  void installSrcCallback(java.lang.Runnable cb)
protected  void removeSrcCallback(java.lang.Runnable cb)
 void setValue(boolean value)
          If value is true, then the underlying EnumModel is set to the option code of this OptionEnumModel.
Methods inherited from class de.matthiasmann.twl.model.AbstractOptionModel
addCallback, removeCallback
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected final EnumModel<T extends java.lang.Enum<T>> optionState


protected final T extends java.lang.Enum<T> optionCode
Constructor Detail


public OptionEnumModel(EnumModel<T> optionState,
                       T optionCode)
Method Detail


public boolean getValue()


public void setValue(boolean value)
If value is true, then the underlying EnumModel is set to the option code of this OptionEnumModel. if value if false then nothing happens.

value - the new value of this BooleanModel


protected void installSrcCallback(java.lang.Runnable cb)
Specified by:
installSrcCallback in class AbstractOptionModel


protected void removeSrcCallback(java.lang.Runnable cb)
Specified by:
removeSrcCallback in class AbstractOptionModel