|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JMenuItem
javax.swing.JMenu
ilog.views.diagrammer.application.IlvDiagrammerMenu
public class IlvDiagrammerMenu
The IlvDiagrammerMenu class is a menu that can be attached
to a diagram component, IlvDiagrammer.
An IlvDiagrammerMenu instance contains buttons linked to IlvDiagrammerActions.
The contents of the menu are specified through an array of actions (either in the
constructor, or through the setActions(javax.swing.Action[]) method).
You can use this class directly and populate it with the actions of your choice,
or you can use the subclasses that are already populated with predefined action sets:
IlvDiagrammerFileMenu, IlvDiagrammerEditMenu, and so on.
Note that this class is only a convenient way to create menus attached to
a diagram component. You can also use a standard JMenu and add
Diagrammer actions to it using the standard Swing API.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JMenu |
|---|
JMenu.AccessibleJMenu, JMenu.WinListener |
| Nested classes/interfaces inherited from class javax.swing.JMenuItem |
|---|
JMenuItem.AccessibleJMenuItem |
| Nested classes/interfaces inherited from class javax.swing.AbstractButton |
|---|
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.JMenu |
|---|
popupListener |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
IlvDiagrammerMenu(ResourceBundle bundle,
String key,
Action[] actions)
Creates a new Diagrammer menu containing the specified actions. |
|
IlvDiagrammerMenu(String key)
Creates a new, empty Diagrammer menu using the default resource bundle. |
|
IlvDiagrammerMenu(String key,
Action[] actions)
Creates a new Diagrammer menu using the default resource bundle, such that it contains the specified actions. |
|
| Method Summary | |
|---|---|
AbstractButton |
addAction(Action action)
Adds a button linked to a specified action to this menu. |
void |
addActions(Action[] actions)
Adds a set of actions. |
Action[] |
getActions()
Returns the actions contained in this menu. |
int |
indexOf(Action action)
Returns the index of the menu item associated with the specified action. |
AbstractButton |
insertAction(Action action,
int index)
Inserts a button linked to a specified action to this menu. |
void |
removeAction(Action action)
Removes the button linked to the specified action from this menu. |
void |
setActions(Action[] actions)
Sets the actions contained in this menu. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface javax.swing.MenuElement |
|---|
processKeyEvent, processMouseEvent |
| Constructor Detail |
|---|
public IlvDiagrammerMenu(ResourceBundle bundle,
String key,
Action[] actions)
bundle - The resource bundle used to retrieve menu names and mnemonics.
If null, the default resource bundle
ilog.views.diagrammer.application.menus is read.key - The key used to retrieved the name and mnemonic of the new menu.
For example, if the key is "Diagrammer.Menu.File", the menu name
will be read from the property file using the key "Diagrammer.Menu.File.Name",
and the mnemonic will be read using the key "Diagrammer.Menu.File.Mnemonic".actions - The actions contained in the menu.
This parameter can be null: in that case, you must populate the menu
by calling setActions(javax.swing.Action[]) or addAction(javax.swing.Action).
public IlvDiagrammerMenu(String key,
Action[] actions)
key - The key used to retrieve the name and mnemonic of the new menu.
For example, if the key is "Diagrammer.Menu.File", the menu name
will be read from the property file using the key "Diagrammer.Menu.File.Name",
and the mnemonic will be read using the key "Diagrammer.Menu.File.Mnemonic".actions - The actions contained in the menu.
This parameter can be null: in that case, you must populate the menu
by calling setActions(javax.swing.Action[]) or addAction(javax.swing.Action).public IlvDiagrammerMenu(String key)
setActions(javax.swing.Action[]) or {#link #addAction}.
| Method Detail |
|---|
public void setActions(Action[] actions)
JCheckBoxMenuItem
or a JMenuItem, depending on whether ComponentAction.isSelectable()
returns true or false.
All the existing
buttons are removed from the menu before adding the new actions.
actions - The actions that will be added to the menu.public Action[] getActions()
setActions(javax.swing.Action[])public AbstractButton addAction(Action action)
JCheckBoxMenuItem
or a JMenuItem, depending on whether ComponentAction.isSelectable()
returns true or false.
action - The action to perform when the button is pressed.
public AbstractButton insertAction(Action action,
int index)
JCheckBoxMenuItem
or a JMenuItem, depending on whether ComponentAction.isSelectable()
returns true or false.
This method is similar to addAction(javax.swing.Action), but it lets you specify the position
of the new menu item.
action - The action to perform when the button is pressed.index - The index at which the new menu item must be inserted.public void addActions(Action[] actions)