Extension SDK

oracle.ide
Interface MenuManager

All Known Implementing Classes:
AbstractMenuManager

public interface MenuManager

Manages the JDeveloper IDE's menus. The MenuManager can be used to retrieve, create, insert, and remove menus and menu items. Integrators may use this API when working with menus in order shield themselves from any impact brought on by future JDeveloper menu management changes.


Field Summary
static int LAST_POSITION
          Index to indicate that a child should be appended during an insert
 
Method Summary
 void add(java.awt.Component child)
          Appends a component into the MenuManager's GUI.
 void add(java.awt.Component child, javax.swing.JMenu parent)
          Appends a component into the given parent.
 javax.swing.JMenu createMenu(java.lang.String caption, java.lang.Integer mnemonic)
          Creates a new menu suitable for insertion into JDeveloper's top level menu bar
 javax.swing.JMenuItem createMenuItem(IdeAction action)
           
 javax.swing.JMenuItem createMenuItem(ToggleAction action)
          Creates a new menu item suitable for insertion into a JDeveloper menu.
 javax.swing.JMenu createSubMenu(java.lang.String caption, java.lang.Integer mnemonic)
          Creates a new menu suitable for insertion into JDeveloper's menu bar or into another menu.
 void ensureSeparatorAfter(java.awt.Component child, javax.swing.JMenu parent)
          Ensures that a menu separator appears after the specified menu Component on the specified parent JMenu.
 void ensureSeparatorBefore(java.awt.Component child, javax.swing.JMenu parent)
          Ensures that a menu separator appears before the specified menu Component on the specified parent JMenu.
 java.awt.Component getChildById(java.awt.Container parent, int commandId)
          Returns the child with the specified command id.
 java.awt.Container getGUI(boolean create)
          Gets the MenuManger's GUI.
 int getIndexOfChild(java.awt.Container parent, java.awt.Component child)
          Returns the index of the specified component.
 int getIndexOfCommandId(java.awt.Container parent, int commandId)
          Returns the index of the specified command.
 void insert(java.awt.Component child, java.awt.Component after)
          Inserts a component into the MenuManager's GUI after the given sibling.
 void insert(java.awt.Component child, int index)
          Inserts a component into the MenuManager's GUI at the given index.
 void insert(java.awt.Component child, javax.swing.JMenu parent, java.awt.Component after)
          Inserts a component into the given parent after the given sibling.
 void insert(java.awt.Component child, javax.swing.JMenu parent, java.awt.Component sibling, boolean before, boolean ensureSeparator)
          Inserts a component into the given parent relative to a specified sibling.
 void insert(java.awt.Component child, javax.swing.JMenu parent, int index)
          Inserts a component into the given parent at the given index.
 void remove(java.awt.Component child)
          Removes a child from the MenuManager's GUI.
 void remove(java.awt.Component child, javax.swing.JMenu parent)
          Removes a child from the given parent.
 

Field Detail

LAST_POSITION

public static final int LAST_POSITION
Index to indicate that a child should be appended during an insert

See Also:
Constant Field Values
Method Detail

createMenu

public javax.swing.JMenu createMenu(java.lang.String caption,
                                    java.lang.Integer mnemonic)
Creates a new menu suitable for insertion into JDeveloper's top level menu bar

Parameters:
caption - the localized string to be displayed in the menu bar or supermenu.
mnemonic - the mnemonic to associate with the resulting JMenu.
Returns:
a new menu.
See Also:
#insertMenu, JMenu

createSubMenu

public javax.swing.JMenu createSubMenu(java.lang.String caption,
                                       java.lang.Integer mnemonic)
Creates a new menu suitable for insertion into JDeveloper's menu bar or into another menu. This will add the required padding to compensate for lack of an Icon for this menu item (which is a sub menu).

Parameters:
caption - the localized string to be displayed in the menu bar or supermenu.
mnemonic - the mnemonic to associate with the resulting JMenu.
Returns:
a new menu.
See Also:
#insertMenu, JMenu

createMenuItem

public javax.swing.JMenuItem createMenuItem(ToggleAction action)
Creates a new menu item suitable for insertion into a JDeveloper menu.

Parameters:
action - the Action to associate with the menu item.
Returns:
a new menu item.
See Also:
#insertMenuItem, JMenuItem

createMenuItem

public javax.swing.JMenuItem createMenuItem(IdeAction action)

add

public void add(java.awt.Component child)
Appends a component into the MenuManager's GUI.

Parameters:
child - the child to be inserted.

insert

public void insert(java.awt.Component child,
                   int index)
Inserts a component into the MenuManager's GUI at the given index. Appends the component if the given index is out of bounds.

Parameters:
child - the child to be inserted.
index - the insertion location.

insert

public void insert(java.awt.Component child,
                   java.awt.Component after)
Inserts a component into the MenuManager's GUI after the given sibling. Appends the component if the given sibling is not an immediate child of the MenuManger's GUI.

Parameters:
child - the child to be inserted.
after - the sibling after which the child should be inserted.

add

public void add(java.awt.Component child,
                javax.swing.JMenu parent)
Appends a component into the given parent.

Parameters:
child - the child to be inserted.
parent - the parent in which to insert the child.

insert

public void insert(java.awt.Component child,
                   javax.swing.JMenu parent,
                   int index)
Inserts a component into the given parent at the given index. Behaves exactly as though parent.add(child, index) were called directly.

Parameters:
child - the child to be inserted.
parent - the parent in which to insert the child.

insert

public void insert(java.awt.Component child,
                   javax.swing.JMenu parent,
                   java.awt.Component after)
Inserts a component into the given parent after the given sibling. Appends the child if the given sibling is not an immediate child of the given parent.

Parameters:
child - the child to be inserted.
parent - the menu in which to insert the child.
after - the sibling after which the child should be inserted.

insert

public void insert(java.awt.Component child,
                   javax.swing.JMenu parent,
                   java.awt.Component sibling,
                   boolean before,
                   boolean ensureSeparator)
Inserts a component into the given parent relative to a specified sibling. If the specified sibling is null or is not a child of the parent, then the new child is inserted at the beginning or end of the parent menu. If the ensureSeparator flag is true, the MenuManager will check to see if a separator already exists immediately before or after the sibling, based on the value of the before flag. If the separator does not exist, one will be created and inserted.

Parameters:
child - the new child to insert
parent - the parent menu into which the child is to be inserted.
sibling - an existing child relative to which the new child should be inserted.
before - whether the new child should be inserted before or after the sibling; or, if sibling is null or not a child of parent, whether the new child should be inserted at the beginning or end of the parent menu.
ensureSeparator - whether a separator should be placed between the sibling and the new child.

remove

public void remove(java.awt.Component child)
Removes a child from the MenuManager's GUI.

Parameters:
child - the child to be removed.

remove

public void remove(java.awt.Component child,
                   javax.swing.JMenu parent)
Removes a child from the given parent. Behaves exactly as though parent.remove(child) were called directly.

Parameters:
child - the child to remove.
parent - the parent from which to remove the child.

ensureSeparatorAfter

public void ensureSeparatorAfter(java.awt.Component child,
                                 javax.swing.JMenu parent)
Ensures that a menu separator appears after the specified menu Component on the specified parent JMenu. If a separator is already present or if the Component is not a child of the JMenu, then no action is taken.


ensureSeparatorBefore

public void ensureSeparatorBefore(java.awt.Component child,
                                  javax.swing.JMenu parent)
Ensures that a menu separator appears before the specified menu Component on the specified parent JMenu. If a separator is already present or if the Component is not a child of the JMenu, then no action is taken.


getGUI

public java.awt.Container getGUI(boolean create)
Gets the MenuManger's GUI. Typically the return value would be either a JMenuBar or a JPopupMenu, though any Container is valid.

Parameters:
create - force a creation of the GUI if it does not yet exist.
Returns:
the GUI of the MenuManager implementation.

getIndexOfChild

public int getIndexOfChild(java.awt.Container parent,
                           java.awt.Component child)
Returns the index of the specified component.

Parameters:
parent - the Container to search for the child component
child - the Component to find
Returns:
an int giving the component's position, where 0 = first

getIndexOfCommandId

public int getIndexOfCommandId(java.awt.Container parent,
                               int commandId)
Returns the index of the specified command.

Parameters:
parent - the Container in which to search for the child command
commandId - the commandId to find
Returns:
an int giving the command's position, where 0 = first

getChildById

public java.awt.Component getChildById(java.awt.Container parent,
                                       int commandId)
Returns the child with the specified command id.

Parameters:
parent - the Container in which to search for the child command
commandId - the command id to find
Returns:
the child Component with the specified command id, or null if no child with that id exists in the parent container.

Extension SDK

 

Copyright ©1997, 2003, Oracle. All rights reserved.