|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cdx.scorebot.util.swing.binding.delegate.GenericDelegate<FROM,TO> cdx.scorebot.util.swing.binding.delegate.GenericJComponentDelegate<java.util.AbstractList,java.util.AbstractList> cdx.scorebot.util.swing.binding.delegate.ListBasedComponentDelegate cdx.scorebot.util.swing.binding.delegate.JComboBoxComponentDelegate
public class JComboBoxComponentDelegate
A delegate for a JComboBox which is bound to an AbstractList. Other related bound components may be bound to this ListBasedComponentDelegate. Such related components would be member variables of the Objects in the AbstractList. When a particular item in the JComboBox is selected, the relateed bound components will be refreshed with the values from the corresponding Object in the AbstractList.
Field Summary |
---|
Fields inherited from class cdx.scorebot.util.swing.binding.delegate.ListBasedComponentDelegate |
---|
components, myList, primaryComponentIndex |
Constructor Summary | |
---|---|
JComboBoxComponentDelegate(BoundComponent owner,
JComboBoxBound compon)
Instantiates an unbound JComboBox Delegate |
|
JComboBoxComponentDelegate(BoundComponent owner,
JComboBoxBound compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.Object boundItem,
java.lang.String varName)
Instantiates a bound JComboBox Delegate |
|
JComboBoxComponentDelegate(BoundComponent owner,
JComboBoxBound compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName)
Instantiates a bound JComboBox Delegate |
|
JComboBoxComponentDelegate(BoundComponent owner,
JComboBoxBound compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName,
int indexAt)
Instantiates a bound JComboBox Delegate |
|
JComboBoxComponentDelegate(BoundComponent owner,
JComboBoxBound compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.String varName)
Instantiates a bound JComboBox Delegate |
Method Summary | |
---|---|
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 |
javax.swing.ListModel |
getModel()
Returns the data model that holds the list of items displayed by the JComboBox component. |
int |
getSelectedIndex()
Returns the smallest selected cell index; the selection when only a single item is selected in the list. |
void |
load()
load the current contents for this component from the bound object |
void |
notifyBoundComponentChange(BoundComponent c)
notify the parent of a bound component change in value |
void |
selectItem(int index)
selects the item at the specified index (if the index does not exist, this is ignored) |
void |
setModel(javax.swing.ListModel model)
Sets the model that represents the contents or "value" of the list, notifies property change listeners, and then clears the list's selection. |
protected void |
setOrAddToModel(javax.swing.DefaultComboBoxModel model,
int index,
java.lang.String text)
sets the specified element in the model to the specified text |
void |
setSelectedIndex(int index)
Selects a single cell. |
Methods inherited from class cdx.scorebot.util.swing.binding.delegate.ListBasedComponentDelegate |
---|
addBoundComponent, addItem, getBoundComponents, getPrimaryComponent, moveItemDown, moveItemUp, moveSelectedItemDown, moveSelectedItemUp, removeItem, removeSelectedItem, save, setPrimaryComponent, swapItems, swapItems, updateItemText, updateSubcomponentBindings |
Methods inherited from class cdx.scorebot.util.swing.binding.delegate.GenericJComponentDelegate |
---|
handleValidationState |
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 |
Constructor Detail |
---|
public JComboBoxComponentDelegate(BoundComponent owner, JComboBoxBound compon)
owner
- the BoundComponent which this belongs tocompon
- the component that this works forpublic JComboBoxComponentDelegate(BoundComponent owner, JComboBoxBound compon, TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator, java.lang.String varName)
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).public JComboBoxComponentDelegate(BoundComponent owner, JComboBoxBound compon, TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator, java.lang.Object boundItem, java.lang.String varName)
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).public JComboBoxComponentDelegate(BoundComponent owner, JComboBoxBound compon, TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator, java.lang.Object boundItem, java.lang.String getterName, java.lang.String setterName)
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 objectpublic JComboBoxComponentDelegate(BoundComponent owner, JComboBoxBound compon, TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator, java.lang.Object boundItem, java.lang.String getterName, java.lang.String setterName, int indexAt)
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 -1Method Detail |
---|
protected void completeInit()
completeInit
in class GenericJComponentDelegate<java.util.AbstractList,java.util.AbstractList>
public void load()
load
in interface BoundDelegateComponent
load
in class GenericDelegate<java.util.AbstractList,java.util.AbstractList>
public final javax.swing.ListModel getModel()
JComboBox
component.
ListModel
that provides the displayed
list of itemspublic void setModel(javax.swing.ListModel model)
model
- the ListModel
that provides the
list of items for displaypublic final int getSelectedIndex()
-1
if there is
no selection.
getSelectedIndex
in class ListBasedComponentDelegate
public final void setSelectedIndex(int index)
setSelectionInterval
on the selection model. Refer to the
documentation for the selection model class being used for details on
how values less than 0
are handled.
setSelectedIndex
in class ListBasedComponentDelegate
protected final void setOrAddToModel(javax.swing.DefaultComboBoxModel model, int index, java.lang.String text)
public final void notifyBoundComponentChange(BoundComponent c)
public final void selectItem(int index)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |