public class AwtMenuWrapper extends MenuWrapper
| Modifier and Type | Field | Description |
|---|---|---|
private MenuItem[] |
items |
|
private ActionListener |
listener |
|
private MenuBar |
menuBar |
| Constructor | Description |
|---|---|
AwtMenuWrapper(Strings strings,
ActionListener actionListener) |
Internally creates a MenuBar object and provides methods to update that
menu bar.
|
| Modifier and Type | Method | Description |
|---|---|---|
private Menu |
createMenu(Strings strings,
int stringIndex) |
|
private MenuShortcut |
createMenuShortcut(int menuIndex) |
|
int |
findIndex(Object o) |
Attempts to find one of the menu items in the internal list.
|
MenuBar |
getMenuBar() |
Returns the encapsulated MenuBar object.
|
private void |
init(Strings strings) |
Initializes an object of type MenuBar.
|
void |
setEnabled(int index,
boolean enabled) |
Changes the enabled status of one of the MenuItem objects,
given by its index.
|
void |
setLabel(int index,
String text) |
Changes the label text of one of the MenuItem objects,
given by its index.
|
void |
updateEnabled(OperationProcessor op) |
Changes the enabled status of all MenuItem objects
using the argument OperationProcessor object (more
precisely, its isAvailable(int) method).
|
void |
updateLabels(Strings strings) |
Sets the label text of all MenuItem objects to
new values using the argument Strings information.
|
getStringIndexprivate ActionListener listener
private MenuItem[] items
private MenuBar menuBar
public AwtMenuWrapper(Strings strings, ActionListener actionListener)
strings - String resource used to initialize menu itemsactionListener - a listener which will be registered with all menu itemsprivate MenuShortcut createMenuShortcut(int menuIndex)
public int findIndex(Object o)
findIndex in class MenuWrappero - some object representing part of the menuMenuIndexConstants on success
or -1 on failurepublic MenuBar getMenuBar()
private void init(Strings strings)
public void setEnabled(int index,
boolean enabled)
setEnabled in class MenuWrapperindex - menu index of the component whose status is to be resetenabled - boolean with the new valuepublic void setLabel(int index,
String text)
setLabel in class MenuWrapperindex - integer index of the menu elementtext - new text value to be used for this elementpublic void updateEnabled(OperationProcessor op)
public void updateLabels(Strings strings)