Extension SDK

oracle.ide
Class AbstractMenuManager

java.lang.Object
  extended byoracle.ide.AbstractMenuManager
All Implemented Interfaces:
MenuManager
Direct Known Subclasses:
ContextMenu, Menubar

public abstract class AbstractMenuManager
extends java.lang.Object
implements MenuManager

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
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, 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.
 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.
 
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:
#insertMenu, JMenu

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:
#insertMenu, JMenu

createMenuItem

public javax.swing.JMenuItem createMenuItem(IdeAction action)
Specified by:
createMenuItem in interface MenuManager

createMenuItem

public javax.swing.JMenuItem createMenuItem(ToggleAction action)
Description copied from interface: MenuManager
Creates a new menu item suitable for insertion into a JDeveloper menu.

Specified by:
createMenuItem in interface MenuManager
Parameters:
action - the Action to associate with the menu item.
Returns:
a new menu item.
See Also:
#insertMenuItem, JMenuItem

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 be inserted.

insert

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

Specified by:
insert in interface MenuManager
Parameters:
child - the child to be inserted.
index - the insertion location.

insert

public void insert(java.awt.Component child,
                   java.awt.Component after)
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 MenuManger'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.

insert

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

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

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

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

ensureSeparatorAfter

public void ensureSeparatorAfter(java.awt.Component child,
                                 javax.swing.JMenu parent)
Description copied from interface: MenuManager
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.

Specified by:
ensureSeparatorAfter in interface MenuManager

ensureSeparatorBefore

public void ensureSeparatorBefore(java.awt.Component child,
                                  javax.swing.JMenu parent)
Description copied from interface: MenuManager
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.

Specified by:
ensureSeparatorBefore in interface MenuManager

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.

Extension SDK

 

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