|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcdx.scorebot.util.swing.binding.Binding<FROM,TO>
public class Binding<FROM,TO>
Describes a binding which holds a value of type T as a String
Constructor Summary | |
---|---|
Binding(TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String varName)
Instantiates a binding |
|
Binding(TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName)
Instantiates a binding |
|
Binding(TypeTranslator<FROM,TO> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName,
int indexAt)
Instantiates a binding |
Method Summary | |
---|---|
Binding |
bindToNewIndex(int index)
bind to a new index on the same object |
Binding |
bindToNewObject(java.lang.Object newBoundItem)
bind to a new object (no index) |
Binding |
bindToNewObject(java.lang.Object newBoundItem,
int index)
bind to a new object and index |
boolean |
canSetFromTranslatedValue(TO value)
whether or not this value can be used to set the value of the bound object |
java.lang.Object |
getBoundItem()
gets the object this binding is to |
java.lang.String |
getGetterName()
gets the getter's name |
int |
getIndexAt()
get the index in the bounditem which we are looking at |
java.lang.String |
getSetterName()
gets the setter's name |
TO |
getTranslatedValue()
gets the translated value from the value stored in the object |
TypeTranslator<FROM,TO> |
getTranslator()
gets the translator |
FROM |
getValue()
gets the actual value stored in the object |
void |
setFromTranslatedValue(TO value)
sets the actual value from the specified value to be translated |
void |
setValue(FROM value)
sets the value stored in the object to the specified value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Binding(TypeTranslator<FROM,TO> translator, java.lang.Object boundItem, java.lang.String varName)
translator
- 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 Binding(TypeTranslator<FROM,TO> translator, java.lang.Object boundItem, java.lang.String getterName, java.lang.String setterName)
translator
- 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 Binding(TypeTranslator<FROM,TO> translator, java.lang.Object boundItem, java.lang.String getterName, java.lang.String setterName, int indexAt)
translator
- 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 |
---|
public Binding bindToNewIndex(int index)
public Binding bindToNewObject(java.lang.Object newBoundItem, int index)
public Binding bindToNewObject(java.lang.Object newBoundItem)
public java.lang.Object getBoundItem()
public java.lang.String getGetterName()
public java.lang.String getSetterName()
public int getIndexAt()
public FROM getValue() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- thrown if the value could not be set to the specified value because the getter threw an exceptionpublic TO getTranslatedValue() throws java.lang.IllegalArgumentException, TranslationFailedException
java.lang.IllegalArgumentException
- thrown if the value could not be set to the specified value because the getter threw an exception
TranslationFailedException
- thrown if the value cannot be translatedpublic void setValue(FROM value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
- thrown if the value could not be set to the specified value because the setter threw an exceptionpublic void setFromTranslatedValue(TO value) throws java.lang.IllegalArgumentException, TranslationFailedException
java.lang.IllegalArgumentException
- thrown if the value could not be set to the specified value because the setter threw an exception
TranslationFailedException
- thrown if the value cannot be translatedpublic boolean canSetFromTranslatedValue(TO value)
public TypeTranslator<FROM,TO> getTranslator()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |