|
||||||||||
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>
cdx.scorebot.util.swing.binding.delegate.GenericJComponentDelegate<java.util.AbstractList,java.util.AbstractList>
cdx.scorebot.util.swing.binding.delegate.ListBasedComponentDelegate
public abstract class ListBasedComponentDelegate
A delegate for a JList, JComboBox, or other type 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 JList is selected, the relateed bound components will be refreshed with the values from the corresponding Object in the AbstractList.
Field Summary | |
---|---|
protected java.util.Vector<BoundComponent> |
components
components whose bindings are contained within the objects contained in this list |
protected java.util.AbstractList |
myList
|
protected int |
primaryComponentIndex
the index of the subcomponent which determines the names of the entries in the list (-1 [default] => number them instead) |
Constructor Summary | |
---|---|
ListBasedComponentDelegate(BoundComponent owner,
BoundComponent compon)
Instantiates an unbound JList Delegate |
|
ListBasedComponentDelegate(BoundComponent owner,
BoundComponent compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.Object boundItem,
java.lang.String varName)
Instantiates a bound JList Delegate |
|
ListBasedComponentDelegate(BoundComponent owner,
BoundComponent compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName)
Instantiates a bound JList Delegate |
|
ListBasedComponentDelegate(BoundComponent owner,
BoundComponent 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 JList Delegate |
|
ListBasedComponentDelegate(BoundComponent owner,
BoundComponent compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.String varName)
Instantiates a bound JList Delegate |
Method Summary | |
---|---|
void |
addBoundComponent(BoundComponent b)
add bound component to this (b's parent will be set to this) |
void |
addItem(java.lang.Object o)
adds a new item to the list |
java.util.Vector<BoundComponent> |
getBoundComponents()
get bound components this contains |
int |
getPrimaryComponent()
gets the index of the component which whose string value is used as the value to represent that collection, or -1 to just number the sets |
abstract int |
getSelectedIndex()
Returns the smallest selected cell index; the selection when only a single item is selected in the list. |
void |
moveItemDown(int index)
moves the specified item down one (if the index is invalid or is the last item, this does nothing) |
void |
moveItemUp(int index)
moves the specified item up one (if the index is invalid or is the first item, this does nothing) |
void |
moveSelectedItemDown()
moves the selected item down one (if it is the last item, this does nothing) |
void |
moveSelectedItemUp()
moves the selected item up one (if it is the first item, this does nothing) |
void |
removeItem(int index)
removes the specified item from the list (do nothing if the index is invalid) |
void |
removeSelectedItem()
removes the currently selected item from the list (do nothing if nothing is selected) |
void |
save()
tells the boundObject about changes to the AbstractList |
void |
setPrimaryComponent(int primComponIndex)
sets the index of the component which whose string value is used as the value to represent that collection, or -1 to just number the sets |
abstract void |
setSelectedIndex(int index)
Selects a single cell. |
boolean |
swapItems(int index1,
int index2)
swaps two items in the list (if either index is invalid this returns false and does nothing) |
void |
swapItems(int index1,
int index2,
int selectIndex)
swaps two items in the list (if either index is invalid, this does nothing) and selects the specified item |
protected java.lang.String |
updateItemText(int numOn)
|
void |
updateSubcomponentBindings()
update all components within this component |
Methods inherited from class cdx.scorebot.util.swing.binding.delegate.GenericJComponentDelegate |
---|
completeInit, 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, load, 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.BoundDelegateContainer |
---|
notifyBoundComponentChange, selectItem |
Methods inherited from interface cdx.scorebot.util.swing.binding.delegate.BoundDelegateComponent |
---|
addBindingListener, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, changeBinding, getBinding, getBoundParent, highlightOnError, isContainer, isValidated, load, notifyListenersOfBindingChanged, notifyListenersOfBindingChanging, removeBindingListener, setBoundParent, setHighlightOnError |
Field Detail |
---|
protected java.util.Vector<BoundComponent> components
protected int primaryComponentIndex
protected java.util.AbstractList myList
Constructor Detail |
---|
public ListBasedComponentDelegate(BoundComponent owner, BoundComponent compon)
owner
- the BoundComponent which this belongs tocompon
- the component that this works forpublic ListBasedComponentDelegate(BoundComponent owner, BoundComponent 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 ListBasedComponentDelegate(BoundComponent owner, BoundComponent 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 ListBasedComponentDelegate(BoundComponent owner, BoundComponent 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 ListBasedComponentDelegate(BoundComponent owner, BoundComponent 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 |
---|
public final void save()
save
in interface BoundDelegateComponent
save
in class GenericDelegate<java.util.AbstractList,java.util.AbstractList>
protected java.lang.String updateItemText(int numOn)
public abstract int getSelectedIndex()
-1
if there is
no selection.
public abstract 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.
public final void addItem(java.lang.Object o)
public final void moveSelectedItemDown()
public final void moveItemDown(int index)
public final void moveSelectedItemUp()
public final void moveItemUp(int index)
public final boolean swapItems(int index1, int index2)
public final void swapItems(int index1, int index2, int selectIndex)
public final void removeSelectedItem()
public void removeItem(int index)
public final void addBoundComponent(BoundComponent b)
addBoundComponent
in interface BoundDelegateContainer
public final java.util.Vector<BoundComponent> getBoundComponents()
getBoundComponents
in interface BoundDelegateContainer
public final int getPrimaryComponent()
getPrimaryComponent
in interface BoundDelegateContainer
public final void setPrimaryComponent(int primComponIndex)
setPrimaryComponent
in interface BoundDelegateContainer
primComponIndex
- index of the BoundComponent which is the primary component in the
getBoundComponents() vector.public final void updateSubcomponentBindings()
updateSubcomponentBindings
in interface BoundDelegateContainer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |