|
||||||||||
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.JMenuComponentDelegate
public class JMenuComponentDelegate
A delegate for a JMenu 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 submenu in the JMenu 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 | |
---|---|
JMenuComponentDelegate(BoundComponent owner,
JMenuBound compon)
Instantiates an unbound JMenu Delegate |
|
JMenuComponentDelegate(BoundComponent owner,
JMenuBound compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.Object boundItem,
java.lang.String varName)
Instantiates a bound JMenu Delegate |
|
JMenuComponentDelegate(BoundComponent owner,
JMenuBound compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.Object boundItem,
java.lang.String getterName,
java.lang.String setterName)
Instantiates a bound JMenu Delegate |
|
JMenuComponentDelegate(BoundComponent owner,
JMenuBound 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 JMenu Delegate |
|
JMenuComponentDelegate(BoundComponent owner,
JMenuBound compon,
TypeTranslator<java.util.AbstractList,java.util.AbstractList> translator,
java.lang.String varName)
Instantiates a bound JMenu Delegate |
Method Summary | |
---|---|
void |
addMenuAtBottom(javax.swing.JMenuItem ti)
Adds a JMenuItem to the bottom of this menu |
void |
addMenuAtTop(javax.swing.JMenuItem ti)
Adds a JMenuItem to the top of this menu |
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.JMenuItem |
getMenuAtBottom(int index)
Gets the specified JMenuItem from the bottom of this menu |
javax.swing.JMenuItem |
getMenuAtTop(int index)
Gets the specified JMenuItem from the top of this menu |
java.util.Vector<javax.swing.JMenuItem> |
getMenusAtBottom()
gets the JMenuItems being added at the bottom of the JMenu |
java.util.Vector<javax.swing.JMenuItem> |
getMenusAtTop()
gets the JMenuItems being added at the top of the JMenu |
int |
getSelectedIndex()
Returns the index of the menu item which is selected, or -1 if there is no selected item. |
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 |
removeItem(int index)
removes the specified item from the list (do nothing if the index is invalid) |
void |
removeMenuAtBottom(int index)
Removes the JMenuItem from the bottom of this menu |
void |
removeMenuAtTop(int index)
Removes the JMenuItem from the top of this menu |
void |
selectItem(int index)
selects the item at the specified index (if the index does not exist, this is ignored) |
protected void |
setOrAddToModel(javax.swing.JMenu menu,
int index,
java.lang.String text)
sets the specified element in the model to the specified text |
void |
setSelectedIndex(int index)
Sets a single menu item as selected (deselects any other menu items) |
Methods inherited from class cdx.scorebot.util.swing.binding.delegate.ListBasedComponentDelegate |
---|
addBoundComponent, addItem, getBoundComponents, getPrimaryComponent, moveItemDown, moveItemUp, moveSelectedItemDown, moveSelectedItemUp, 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 JMenuComponentDelegate(BoundComponent owner, JMenuBound compon)
owner
- the BoundComponent which this belongs tocompon
- the component that this works forpublic JMenuComponentDelegate(BoundComponent owner, JMenuBound 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 JMenuComponentDelegate(BoundComponent owner, JMenuBound 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 JMenuComponentDelegate(BoundComponent owner, JMenuBound 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 JMenuComponentDelegate(BoundComponent owner, JMenuBound 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 void addMenuAtTop(javax.swing.JMenuItem ti)
ti
- the JMenuItem to add to this JMenupublic void removeMenuAtTop(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- remove the MenuAtTop at the specified index.
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public javax.swing.JMenuItem getMenuAtTop(int index) throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public java.util.Vector<javax.swing.JMenuItem> getMenusAtTop()
public void addMenuAtBottom(javax.swing.JMenuItem ti)
ti
- the JMenuItem to add to this JMenupublic void removeMenuAtBottom(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- remove the MenuAtBottom at the specified index.
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public javax.swing.JMenuItem getMenuAtBottom(int index) throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public java.util.Vector<javax.swing.JMenuItem> getMenusAtBottom()
public int getSelectedIndex()
getSelectedIndex
in class ListBasedComponentDelegate
public void setSelectedIndex(int index)
setSelectedIndex
in class ListBasedComponentDelegate
public void removeItem(int index)
removeItem
in class ListBasedComponentDelegate
protected final void setOrAddToModel(javax.swing.JMenu menu, 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 |