cdx.scorebot.util.swing.binding.delegate
Class ButtonGroupDelegate<FROM,TO>
java.lang.Object
cdx.scorebot.util.swing.binding.delegate.GenericDelegate<FROM,TO>
cdx.scorebot.util.swing.binding.delegate.ButtonGroupDelegate<FROM,TO>
- All Implemented Interfaces:
- BoundDelegateComponent
public class ButtonGroupDelegate<FROM,TO>
- extends GenericDelegate<FROM,TO>
- implements BoundDelegateComponent
A delegate for a ButtonGroup which is bound to a value of type FROM which can be represented as some
type TO. This ButtonGroup may ONLY contain JRadioButtonBound.
- Author:
- David Underhill
Constructor Summary |
ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon)
Instantiates an unbound ButtonGroup Delegate |
ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon,
TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String varName)
Instantiates a bound ButtonGroup Delegate |
ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon,
TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName)
Instantiates a bound ButtonGroup Delegate |
ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon,
TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName,
int indexAt)
Instantiates a bound ButtonGroup Delegate |
ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon,
TypeTranslator<FROM,TO> translator,
java.lang.String varName)
Instantiates an unbound ButtonGroup Delegate |
Method Summary |
void |
add(JRadioButtonBound<TO> b)
Adds the button to the group. |
protected void |
completeInit()
adds a focus listener which binds any changes in the component to the object it is bound to when focus is lost |
protected void |
handleValidationState()
draw the border to reflect the specified validation state |
void |
load()
load the current text for this component from the bound object |
void |
save()
save the current text in this component to the bound object |
void |
setSelected(TO value)
Sets the bound item with the the specified value |
Methods inherited from class cdx.scorebot.util.swing.binding.delegate.GenericDelegate |
addBindingListener, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, getBinding, getBoundParent, getFormattedValidationErrorMsg, getMe, getOwner, getValidationErrorMsg, highlightOnError, isContainer, isValidated, notifyListenersOfBindingChanged, notifyListenersOfBindingChanging, notifyListenersOfBindingLoaded, removeBindingListener, setBoundParent, setHighlightOnError, setValidationError, setValidationError, validationError |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cdx.scorebot.util.swing.binding.delegate.BoundDelegateComponent |
addBindingListener, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, getBinding, getBoundParent, highlightOnError, isContainer, isValidated, notifyListenersOfBindingChanged, notifyListenersOfBindingChanging, removeBindingListener, setBoundParent, setHighlightOnError |
ButtonGroupDelegate
public ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon)
- Instantiates an unbound ButtonGroup Delegate
- Parameters:
owner
- the BoundComponent which this belongs tocompon
- the component that this works for
ButtonGroupDelegate
public ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon,
TypeTranslator<FROM,TO> translator,
java.lang.String varName)
- Instantiates an unbound ButtonGroup Delegate
- Parameters:
owner
- the BoundComponent which this belongs tocompon
- the component that this works fortranslator
- how to translate between the value in the boundItem (type FROM) a another value of type TOvarName
- the name of the variable; assumes the getter and setter name will
be get and set followed by varName with its first letter capitalized
(ex: if varName is "value" then the getter will be getValue).
ButtonGroupDelegate
public ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon,
TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String varName)
- Instantiates a bound ButtonGroup Delegate
- Parameters:
owner
- the BoundComponent which this belongs tocompon
- the component that this works fortranslator
- how to translate between the value in the boundItem (type FROM) a another value of type TOboundItem
- the object this is bound to (contains the value to be modified as specified by varName)varName
- the name of the variable; assumes the getter and setter name will
be get and set followed by varName with its first letter capitalized
(ex: if varName is "value" then the getter will be getValue).
ButtonGroupDelegate
public ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon,
TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName)
- Instantiates a bound ButtonGroup Delegate
- Parameters:
owner
- the BoundComponent which this belongs tocompon
- the component that this works fortranslator
- how to translate between the value in the boundItem (type FROM) a another value of type TOboundItem
- the object this is bound to (contains the value to be modified as specified by the getter and setter name)getterName
- how to get the bound value from the bound objectsetterName
- how to set the bound value from the bound object
ButtonGroupDelegate
public ButtonGroupDelegate(BoundComponent owner,
ButtonGroupBound compon,
TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName,
int indexAt)
- Instantiates a bound ButtonGroup Delegate
- Parameters:
owner
- the BoundComponent which this belongs tocompon
- the component that this works fortranslator
- how to translate between the value in the boundItem (type FROM) a another value of type TOboundItem
- the object this is bound to (contains the value to be modified as specified by the getter and setter name)getterName
- how to get the bound value from the bound objectsetterName
- how to set the bound value from the bound objectindexAt
- if bound value is stored within a container with get(index) and
set(index, Object) methods, then indexAt should be the index to
use; otherwise, indexAt should be -1
completeInit
protected void completeInit()
- adds a focus listener which binds any changes in the component to the object it is bound to when focus is lost
- Specified by:
completeInit
in class GenericDelegate<FROM,TO>
load
public void load()
- load the current text for this component from the bound object
- Specified by:
load
in interface BoundDelegateComponent
- Specified by:
load
in class GenericDelegate<FROM,TO>
save
public void save()
- save the current text in this component to the bound object
- Specified by:
save
in interface BoundDelegateComponent
- Specified by:
save
in class GenericDelegate<FROM,TO>
add
public void add(JRadioButtonBound<TO> b)
- Adds the button to the group.
- Parameters:
b
- the button to be added
handleValidationState
protected void handleValidationState()
- draw the border to reflect the specified validation state
- Specified by:
handleValidationState
in class GenericDelegate<FROM,TO>
setSelected
public void setSelected(TO value)
- Sets the bound item with the the specified value
- Parameters:
value
- the new value to be set