Extension SDK 10.1.2

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 java.lang.String ALPHA_SORT_SECTION_KEY
           
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, float sectionId)
          Adds a component into the MenuManager's GUI.
 void add(java.awt.Component child, javax.swing.JMenu parent)
          Appends a component into the given parent.
 void add(java.awt.Component child, javax.swing.JMenu parent, float sectionId)
          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.JMenu createMenu(java.lang.String caption, java.lang.Integer mnemonic, float weight)
          Creates a new menu suitable for insertion into JDeveloper's top level menu bar.
 javax.swing.JMenu createMenu(java.lang.String caption, java.lang.Integer mnemonic, float weight, float sectionId)
          Creates a new menu suitable for insertion into JDeveloper's top level menu bar.
 javax.swing.JMenuItem createMenuItem(ToggleAction action)
          Creates a new menu item suitable for insertion into a JDeveloper menu.
 javax.swing.JMenuItem createMenuItem(ToggleAction action, float menuWeight)
          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.
 javax.swing.JMenu createSubMenu(java.lang.String caption, java.lang.Integer mnemonic, float weight)
          Creates a new menu suitable for insertion into JDeveloper's menu bar or into another menu.
 javax.swing.JMenu createSubMenu(java.lang.String caption, java.lang.Integer mnemonic, float weight, float sectionId)
          Creates a new menu suitable for insertion into JDeveloper's menu bar or into another menu.
 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 MenuManager'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)
          Deprecated. Use preferred method add(Component, float) or add(Component).
 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.
 void sortSectionByName(javax.swing.JMenu menu, float sectionID)
          Sorts the commands in the specified section alphabetically by the menu item name, rather than sorting by weight.
 

Field Detail

ALPHA_SORT_SECTION_KEY

public static final java.lang.String ALPHA_SORT_SECTION_KEY
See Also:
Constant Field Values

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:
add(java.awt.Component), JMenu

createMenu

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

Parameters:
caption - localized string to be displayed in the bar or supermenu.
mnemonic - mnemonic to associate with the resulting JMenu.
weight - a float used to indicate the menu's position in the menu bar. Menus are sorted in ascending order from the left to right.
Returns:
a new menu.
See Also:
insert(java.awt.Component, java.awt.Component), JMenu

createMenu

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

Parameters:
caption - localized string to be displayed in the bar or supermenu.
mnemonic - mnemonic to associate with the resulting JMenu.
weight - a float used to indicate the menu's position in the menu bar. Menus are sorted in ascending order from the left to right.
sectionId - menu items which are not explicitly added to a menu section are added to this section.
Returns:
a new menu.
See Also:
insert(java.awt.Component, java.awt.Component), 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:
insert(java.awt.Component, java.awt.Component), JMenu

createSubMenu

public javax.swing.JMenu createSubMenu(java.lang.String caption,
                                       java.lang.Integer mnemonic,
                                       float weight)
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 - localized string to be displayed in the bar or supermenu.
mnemonic - mnemonic to associate with the resulting JMenu.
weight - a float used to indicate the menu's position in the menu bar. Menus are sorted in ascending order from the left to right.
Returns:
a new menu.
See Also:
insert(java.awt.Component, java.awt.Component), JMenu

createSubMenu

public javax.swing.JMenu createSubMenu(java.lang.String caption,
                                       java.lang.Integer mnemonic,
                                       float weight,
                                       float sectionId)
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 - localized string to be displayed in the bar or supermenu.
mnemonic - mnemonic to associate with the resulting JMenu.
weight - a float used to indicate the menu's position in the menu bar. Menus are sorted in ascending order from the left to right.
sectionId - menu items which are not explicitly added to a menu section are added to this section.
Returns:
a new menu.
See Also:
insert(java.awt.Component, java.awt.Component), 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:
insert(java.awt.Component, java.awt.Component), JMenuItem

createMenuItem

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

Parameters:
action - the Action to associate with the menu item.
menuWeight - a Float used to determine the order of commands in the menu. Weights are sorted in ascending order from the top to the bottom of the menu.
Returns:
a new menu item.
See Also:
insert(java.awt.Component, java.awt.Component), JMenuItem

add

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

Parameters:
child - the child to add.

add

public void add(java.awt.Component child,
                float sectionId)
Adds a component into the MenuManager's GUI.

Parameters:
child - the child to add.
sectionId - the menu section to which to add the child. Menu sections are automatically split by JSeparators.

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.

add

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

Parameters:
child - the child to add.
parent - the parent in which to insert the child.
sectionId - a float which indicates the menu section to which the child will be added. Menu sections are automatically split by JSeparators. Menu section constants are defined in the MenuConstants interface.
See Also:
MenuConstants

insert

public void insert(java.awt.Component child,
                   java.awt.Component after)
Deprecated. Use preferred method add(Component, float) or add(Component).

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 MenuManager's GUI.

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

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.

getGUI

public java.awt.Container getGUI(boolean create)
Gets the MenuManager'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.

sortSectionByName

public void sortSectionByName(javax.swing.JMenu menu,
                              float sectionID)
Sorts the commands in the specified section alphabetically by the menu item name, rather than sorting by weight.

Parameters:
menu - The menu container
sectionID - The section that contains the commands commands to sort alphabetically. If none of the commands the menu are in the specified section, the commands will be sorted in the default order.

Extension SDK

 

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