|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcdx.scorebot.util.swing.binding.delegate.GenericDelegate<FROM,TO>
public abstract class GenericDelegate<FROM,TO>
Binds some Object of type FROM to a component which requires type TO
Constructor Summary | |
---|---|
GenericDelegate(boolean isContainer,
BoundComponent owner,
BoundComponent compon,
TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String varName)
Instantiates a bound Object Delegate |
|
GenericDelegate(boolean isContainer,
BoundComponent owner,
BoundComponent compon,
TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName)
Instantiates a bound Object Delegate |
|
GenericDelegate(boolean isContainer,
BoundComponent owner,
BoundComponent compon,
TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName,
int indexAt)
Instantiates a bound Object Delegate |
|
GenericDelegate(boolean isContainer,
BoundComponent owner,
BoundComponent compon,
TypeTranslator<FROM,TO> translator,
java.lang.String varName)
Instantiates an unbound Object Delegate |
|
GenericDelegate(BoundComponent owner,
BoundComponent compon)
Instantiates an unbound Object Delegate |
Method Summary | |
---|---|
void |
addBindingListener(BindingListener listener)
Register a listener for this object |
void |
changeBinding(Binding b)
change what this object is bound to (will save the current value to its currently bound object) |
void |
changeBinding(int index)
change what this object is bound to (will save the current value to its currently bound object) |
void |
changeBinding(java.lang.Object newBoundItem)
change what this object is bound to (will save the current value to its currently bound object) |
void |
changeBinding(java.lang.Object newBoundItem,
int index)
change what this object is bound to (will save the current value to its currently bound object) |
void |
changeBinding(java.lang.Object boundItem,
java.lang.String varName)
change what this object is bound to (will save the current value to its currently bound object) |
void |
changeBinding(java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName)
change what this object is bound to (will save the current value to its currently bound object) |
void |
changeBinding(java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName,
int indexAt)
change what this object is bound to (will save the current value to its currently bound object) |
protected abstract void |
completeInit()
suggested that this is used to load the component with its initial values after the constructor is done |
Binding<FROM,TO> |
getBinding()
gets the binding for this component |
BoundDelegateContainer |
getBoundParent()
gets the parent container for this component |
protected java.lang.String |
getFormattedValidationErrorMsg()
gets the validation error message prefaced by "\nError: " if there is an error message. |
BoundComponent |
getMe()
gets a reference to the Object this works for |
BoundComponent |
getOwner()
gets a reference to the BoundComponent this works for |
protected java.lang.String |
getValidationErrorMsg()
gets the validation error message |
protected abstract void |
handleValidationState()
draw the border to reflect the specified validation state |
boolean |
highlightOnError()
whether or not to highlight with a red border on error |
boolean |
isContainer()
whether or not this bound component is a container of other bound components |
boolean |
isValidated()
whether or not a validation error has occurred |
abstract void |
load()
load the current text for this component from the bound object |
void |
notifyListenersOfBindingChanged()
Notifies all listeners that the binding has changed |
void |
notifyListenersOfBindingChanging()
Notifies all listeners that the binding is about to change |
void |
notifyListenersOfBindingLoaded()
Notifies all listeners that the binding has changed and been loaded |
void |
removeBindingListener(BindingListener listener)
Remove a registered listener from this object |
abstract void |
save()
save the current text in this component to the bound object |
void |
setBoundParent(BoundDelegateContainer c)
sets the parent container for this component |
void |
setHighlightOnError(boolean highlightOnError)
whether or not to highlight with a red border on error |
protected void |
setValidationError(boolean validationError)
sets whether or not a validation error has occurred and clears the validation error message |
protected void |
setValidationError(boolean validationError,
java.lang.String validationErrorMsg)
sets whether or not a validation error has occurred (also sets a validation error message too) |
boolean |
validationError()
gets whether or not a validation error has occurred |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericDelegate(BoundComponent owner, BoundComponent compon)
owner
- the BoundComponent which this belongs tocompon
- the component that this works forpublic GenericDelegate(boolean isContainer, BoundComponent owner, BoundComponent compon, TypeTranslator<FROM,TO> translator, java.lang.String varName)
owner
- the BoundComponent which this belongs toisContainer
- whether or not this component can contain otherscompon
- 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).public GenericDelegate(boolean isContainer, BoundComponent owner, BoundComponent compon, TypeTranslator<FROM,TO> translator, java.lang.Object boundItem, java.lang.String varName)
owner
- the BoundComponent which this belongs toisContainer
- whether or not this component can contain otherscompon
- 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).public GenericDelegate(boolean isContainer, BoundComponent owner, BoundComponent compon, TypeTranslator<FROM,TO> translator, java.lang.Object boundItem, java.lang.String getterName, java.lang.String setterName)
owner
- the BoundComponent which this belongs toisContainer
- whether or not this component can contain otherscompon
- 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 objectpublic GenericDelegate(boolean isContainer, BoundComponent owner, BoundComponent compon, TypeTranslator<FROM,TO> translator, java.lang.Object boundItem, java.lang.String getterName, java.lang.String setterName, int indexAt)
owner
- the BoundComponent which this belongs toisContainer
- whether or not this component can contain otherscompon
- 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 -1Method Detail |
---|
protected abstract void completeInit()
public void addBindingListener(BindingListener listener)
addBindingListener
in interface BoundDelegateComponent
listener
- the object which is listeningpublic void notifyListenersOfBindingChanging()
notifyListenersOfBindingChanging
in interface BoundDelegateComponent
public void notifyListenersOfBindingChanged()
notifyListenersOfBindingChanged
in interface BoundDelegateComponent
public void notifyListenersOfBindingLoaded()
public void removeBindingListener(BindingListener listener)
removeBindingListener
in interface BoundDelegateComponent
listener
- the object which is listening to be removedpublic final void changeBinding(Binding b)
changeBinding
in interface BoundDelegateComponent
b
- the new bindingpublic void changeBinding(java.lang.Object newBoundItem)
changeBinding
in interface BoundDelegateComponent
newBoundItem
- the object this is bound to (contains the value to be modified as specified by varName)public final void changeBinding(java.lang.Object newBoundItem, int index)
changeBinding
in interface BoundDelegateComponent
newBoundItem
- the object this is bound to (contains the value to be modified as specified by varName)index
- the new index to bind topublic final void changeBinding(int index)
changeBinding
in interface BoundDelegateComponent
index
- the new index to bind topublic final void changeBinding(java.lang.Object boundItem, java.lang.String varName)
changeBinding
in interface BoundDelegateComponent
boundItem
- 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).public final void changeBinding(java.lang.Object boundItem, java.lang.String getterName, java.lang.String setterName)
changeBinding
in interface BoundDelegateComponent
boundItem
- 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 objectpublic final void changeBinding(java.lang.Object boundItem, java.lang.String getterName, java.lang.String setterName, int indexAt)
changeBinding
in interface BoundDelegateComponent
boundItem
- 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 -1public abstract void load()
load
in interface BoundDelegateComponent
public abstract void save()
save
in interface BoundDelegateComponent
public final BoundComponent getOwner()
public BoundComponent getMe()
public final Binding<FROM,TO> getBinding()
getBinding
in interface BoundDelegateComponent
public final BoundDelegateContainer getBoundParent()
getBoundParent
in interface BoundDelegateComponent
public final void setBoundParent(BoundDelegateContainer c)
setBoundParent
in interface BoundDelegateComponent
public final boolean isContainer()
isContainer
in interface BoundDelegateComponent
public final boolean isValidated()
isValidated
in interface BoundDelegateComponent
protected abstract void handleValidationState()
public final boolean highlightOnError()
highlightOnError
in interface BoundDelegateComponent
public final void setHighlightOnError(boolean highlightOnError)
setHighlightOnError
in interface BoundDelegateComponent
public final boolean validationError()
protected final void setValidationError(boolean validationError)
protected final void setValidationError(boolean validationError, java.lang.String validationErrorMsg)
protected final java.lang.String getValidationErrorMsg()
protected final java.lang.String getFormattedValidationErrorMsg()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |