public class IlvPopupMenuManager extends Object implements SwingConstants
Each graphic object contained in the manager associated with the view can have its own pop-up menu. There are three ways to implement Swing pop-up menus on graphic objects.
IlvGraphic.setPopupMenu(javax.swing.JPopupMenu)
.
registerMenu(String, javax.swing.JPopupMenu)
and
the name of the pop-up menu is set on the graphic object using the
method IlvGraphic.setPopupMenuName(java.lang.String)
.
IlvGraphic.getPopupMenu(IlvPoint, IlvTransformer, IlvManagerView, IlvPopupMenuManager)
in a graphic object subclass.
To enable Swing pop-up menus in a view, call the static
method registerView(ilog.views.IlvManagerView)
. To disable tooltips in a view,
call unregisterView(ilog.views.IlvManagerView)
.
The pop-up menu manager can also be used to enable pop-up menus on arbitrary
Swing component, via
setPopupMenu(JComponent, JPopupMenu)
.
IlvGraphic
,
IlvManagerView
Modifier and Type | Field and Description |
---|---|
static String |
JCOMPONENT_POPUP_MENU_CONTEXT_KEY
The key of the client property of a
JPopupMenu used to store
the pop-up menu context via JComponent.setClientProperty . |
static String |
JCOMPONENT_POPUP_MENU_KEY
The key of the client property of Swing components used to store
a Swing pop-up menu or its name via
JComponent.setClientProperty . |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Modifier and Type | Method and Description |
---|---|
static void |
doPopup(IlvManagerView view,
IlvGraphic g)
Shows a pop-up menu for the input graphic object on the input view.
|
static JPopupMenu |
getPopupMenu(JComponent component)
Returns a Swing pop-up menu of a Swing component.
|
static IlvPopupMenuContext |
getPopupMenuContext(MenuElement element)
Returns the pop-up menu context of a pop-up menu element (for instance, the
pop-up menu itself or a menu item or a submenu).
|
static JPopupMenu |
getRegisteredMenu(String name)
Returns the Swing pop-up menu registered for a given name.
|
static void |
registerMenu(String name,
JPopupMenu popupMenu)
Registers a Swing pop-up menu with a given name.
|
static void |
registerView(IlvManagerView view)
Enables the Swing pop-up menus of graphic objects in a manager view.
|
static void |
setPopupMenu(JComponent component,
JPopupMenu popupMenu)
Stores a Swing pop-up menu of a Swing component.
|
static void |
setPopupMenuContext(MenuElement element,
IlvPopupMenuContext context)
Stores the pop-up menu context of a pop-up menu element (for instance, the
pop-up menu itself or a menu item or a submenu).
|
static void |
setPopupMenuName(JComponent component,
String popupMenuName)
Stores the name of a Swing pop-up menu of a Swing component.
|
static void |
unregisterMenu(String name)
Removes the name of a Swing pop-up menu from the register.
|
static void |
unregisterView(IlvManagerView view)
Disables the Swing pop-up menus of graphic objects in a manager view.
|
public static final String JCOMPONENT_POPUP_MENU_KEY
JComponent.setClientProperty
.public static final String JCOMPONENT_POPUP_MENU_CONTEXT_KEY
JPopupMenu
used to store
the pop-up menu context via JComponent.setClientProperty
.public static void registerView(IlvManagerView view)
view
- The manager view.IlvGraphic.setPopupMenu(javax.swing.JPopupMenu)
,
unregisterView(ilog.views.IlvManagerView)
public static void unregisterView(IlvManagerView view)
view
- The manager view.registerView(ilog.views.IlvManagerView)
public static void registerMenu(String name, JPopupMenu popupMenu)
IlvGraphic.setPopupMenuName(java.lang.String)
.name
- The name of the pop-up menu.popupMenu
- The pop-up menu.IlvGraphic.setPopupMenuName(java.lang.String).
,
unregisterMenu(java.lang.String)
public static void unregisterMenu(String name)
name
- The name of the pop-up menu.IlvGraphic.setPopupMenuName(java.lang.String).
,
registerMenu(java.lang.String, javax.swing.JPopupMenu)
public static JPopupMenu getRegisteredMenu(String name)
public static void setPopupMenu(JComponent component, JPopupMenu popupMenu)
component
- The Swing component.popupMenu
- The pop-up menu. If null
, the pop-up menu
will be removed from the component.getPopupMenu(javax.swing.JComponent)
public static void setPopupMenuName(JComponent component, String popupMenuName)
registerMenu(String name, javax.swing.JPopupMenu)
and use the name to specify the pop-up menu of the
input component.
This can be used to enable pop-up menus in Swing components that don't
contain a manager view.component
- The Swing component.popupMenuName
- The name of the registered Swing pop-up menu to be used
for the input component.
If popupName
is null
, the pop-up menu
will be removed from the component.getPopupMenu(javax.swing.JComponent)
public static JPopupMenu getPopupMenu(JComponent component)
public static void setPopupMenuContext(MenuElement element, IlvPopupMenuContext context)
public static IlvPopupMenuContext getPopupMenuContext(MenuElement element)
public static void doPopup(IlvManagerView view, IlvGraphic g)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.