Extension SDK 10.1.2

oracle.ide
Class AbstractMenuManager

java.lang.Object
  extended byoracle.ide.AbstractMenuManager
All Implemented Interfaces:
java.awt.event.ContainerListener, java.util.EventListener, javax.swing.event.MenuListener, MenuManager
Direct Known Subclasses:
ContextMenu, Menubar

public abstract class AbstractMenuManager
extends java.lang.Object
implements java.awt.event.ContainerListener, MenuManager, javax.swing.event.MenuListener

AbstractMenuManager class. Abstract implementation of MenuManager interface. Extensions need not extend this class. They should directly use framework provided implementations, such as the ContextMenu and Menubar classes to add menu items to context menus and pull down menus, respectively.


Field Summary
protected  java.awt.event.ContainerListener containerListener
           
protected  javax.swing.event.MenuListener menuListener
           
 
Fields inherited from interface oracle.ide.MenuManager
ALPHA_SORT_SECTION_KEY, LAST_POSITION
 
Constructor Summary
protected AbstractMenuManager()
          Default constructor.
 
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.
 void componentAdded(java.awt.event.ContainerEvent e)
           
 void componentRemoved(java.awt.event.ContainerEvent e)
           
 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 addinSectionId)
          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, float addinSectionId)
           
 javax.swing.JMenuItem createMenuItem(ToggleAction action)
          Creates a new menu item for the supplied ToggleAction.
 javax.swing.JMenuItem createMenuItem(ToggleAction action, float menuWeight)
          Creates a new menu item suitable for insertion into a JDeveloper menu. Creates a new menu item for the supplied ToggleAction with the supplied menu weight.
 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.
 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)
          Deprecated. Use preferred method add(Component, float) or add(Component).
 void menuCanceled(javax.swing.event.MenuEvent e)
           
 void menuDeselected(javax.swing.event.MenuEvent e)
           
 void menuSelected(javax.swing.event.MenuEvent e)
           
 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.
protected  void setErrorWeight(java.awt.Component component)
           
protected  void sortContainer(java.awt.Container container)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.ide.MenuManager
getGUI
 

Field Detail

menuListener

protected javax.swing.event.MenuListener menuListener

containerListener

protected java.awt.event.ContainerListener containerListener
Constructor Detail

AbstractMenuManager

protected AbstractMenuManager()
Default constructor.

Method Detail

createMenu

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

Specified by:
createMenu in interface MenuManager
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:
MenuManager.add(java.awt.Component), JMenu

createMenu

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

Specified by:
createMenu in interface MenuManager
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:
MenuManager.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 addinSectionId)
Description copied from interface: MenuManager
Creates a new menu suitable for insertion into JDeveloper's top level menu bar.

Specified by:
createMenu in interface MenuManager
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.
addinSectionId - menu items which are not explicitly added to a menu section are added to this section.
Returns:
a new menu.
See Also:
MenuManager.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,
                                    float addinSectionId)

createSubMenu

public javax.swing.JMenu createSubMenu(java.lang.String caption,
                                       java.lang.Integer mnemonic)
Description copied from interface: MenuManager
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).

Specified by:
createSubMenu in interface MenuManager
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:
MenuManager.insert(java.awt.Component, java.awt.Component), JMenu

createSubMenu

public javax.swing.JMenu createSubMenu(java.lang.String caption,
                                       java.lang.Integer mnemonic,
                                       float weight)
Description copied from interface: MenuManager
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).

Specified by:
createSubMenu in interface MenuManager
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:
MenuManager.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)
Description copied from interface: MenuManager
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).

Specified by:
createSubMenu in interface MenuManager
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:
MenuManager.insert(java.awt.Component, java.awt.Component), JMenu

createMenuItem

public javax.swing.JMenuItem createMenuItem(ToggleAction action)
Creates a new menu item for the supplied ToggleAction. By default, the menu weight is MenuConstants.WEIGHT_UNDEFINED unless the action has a defined menu weight, in which case that value is used.

Specified by:
createMenuItem in interface MenuManager
Parameters:
action - the Action to associate with the menu item.
Returns:
a new menu item.
See Also:
ToggleAction, ToggleAction.setMenuWeight(float)

createMenuItem

public javax.swing.JMenuItem createMenuItem(ToggleAction action,
                                            float menuWeight)
Creates a new menu item suitable for insertion into a JDeveloper menu. Creates a new menu item for the supplied ToggleAction with the supplied menu weight. If the ToggleAction has a defined menu weight, the supplied weight overwrites it, except in the case where the supplied menu weight is MenuConstants.WEIGHT_UNDEFINED then the menu weight stored in the ToggleAction, if any, is set in the menu item.

Specified by:
createMenuItem in interface MenuManager
Parameters:
action - The action for this menu item
menuWeight - The menu weight to use to sort this item when it is added to a menu
Returns:
a new menu item.
See Also:
createMenuItem(ToggleAction), ToggleAction, ToggleAction.setMenuWeight(float)

add

public void add(java.awt.Component child)
Description copied from interface: MenuManager
Appends a component into the MenuManager's GUI.

Specified by:
add in interface MenuManager
Parameters:
child - the child to add.

add

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

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

insert

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


insert

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

Description copied from interface: MenuManager
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.

Specified by:
insert in interface MenuManager
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)
Description copied from interface: MenuManager
Appends a component into the given parent.

Specified by:
add in interface MenuManager
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)
Description copied from interface: MenuManager
Appends a component into the given parent.

Specified by:
add in interface MenuManager
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

remove

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

Specified by:
remove in interface MenuManager
Parameters:
child - the child to be removed.

remove

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

Specified by:
remove in interface MenuManager
Parameters:
child - the child to remove.
parent - the parent from which to remove the child.

getIndexOfChild

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

Specified by:
getIndexOfChild in interface MenuManager
Parameters:
parent - the Container to search for the child param
child - the Component to find
Returns:
an int giving the component's position, where 0 = first

getIndexOfCommandId

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

Specified by:
getIndexOfCommandId in interface MenuManager
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)
Description copied from interface: MenuManager
Returns the child with the specified command id.

Specified by:
getChildById in interface MenuManager
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)
Description copied from interface: MenuManager
Sorts the commands in the specified section alphabetically by the menu item name, rather than sorting by weight.

Specified by:
sortSectionByName in interface MenuManager
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.

setErrorWeight

protected void setErrorWeight(java.awt.Component component)

sortContainer

protected void sortContainer(java.awt.Container container)

menuSelected

public void menuSelected(javax.swing.event.MenuEvent e)
Specified by:
menuSelected in interface javax.swing.event.MenuListener

menuDeselected

public void menuDeselected(javax.swing.event.MenuEvent e)
Specified by:
menuDeselected in interface javax.swing.event.MenuListener

menuCanceled

public void menuCanceled(javax.swing.event.MenuEvent e)
Specified by:
menuCanceled in interface javax.swing.event.MenuListener

componentAdded

public void componentAdded(java.awt.event.ContainerEvent e)
Specified by:
componentAdded in interface java.awt.event.ContainerListener

componentRemoved

public void componentRemoved(java.awt.event.ContainerEvent e)
Specified by:
componentRemoved in interface java.awt.event.ContainerListener

Extension SDK

 

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