public class IlpDefaultPopupMenuFactory extends Object implements IlpPopupMenuFactory
This implementation can be used with the default interactor implementation to support interactor CSS customization.
A pop-up menu is created according to the menu items configured in this
factory. A null
menu item represents a separator that is added
to the pop-up menu in the defined position.
The following example illustrates how you can create a pop-up menu using a CSS:
Subobject#viewInteractor { class: 'ilog.cpl.interactor.IlpDefaultViewInteractor'; popupMenuFactory: @=popupMenuFactory; } Subobject#popupMenuFactory { class: 'ilog.cpl.interactor.IlpDefaultPopupMenuFactory'; menuItem[0]: @=item0; menuItem[1]: ''; menuItem[2]: @=item2; } Subobject#item0 { class: 'javax.swing.JMenuItem'; label: 'Item 0'; } Subobject#item2 { class: 'javax.swing.JMenuItem'; label: 'Item 2'; }
Constructor and Description |
---|
IlpDefaultPopupMenuFactory()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
JPopupMenu |
createPopupMenu(IlpInteractionContext context)
Creates a pop-up menu for the specified
IlpInteractionContext . |
String |
getLabel()
Returns the pop-up menu label.
|
JMenuItem[] |
getMenuItem()
Returns the list of menu items present in the pop-up menu created by this
factory.
|
JMenuItem |
getMenuItem(int index)
Returns the menu item present in the pop-up menu created by this factory.
|
void |
setLabel(String l)
Sets the pop-up menu label.
|
void |
setMenuItem(int index,
JMenuItem mi)
Sets an entry in the pop-up menu created by this factory.
|
void |
setMenuItem(JMenuItem[] items)
Sets the entries present in the pop-up menu created by this factory.
|
public IlpDefaultPopupMenuFactory()
public void setLabel(String l)
l
- Pop-up menu label.public String getLabel()
public void setMenuItem(JMenuItem[] items)
A null
entry represents a separator,
which is added to the pop-up menu.
Action
public void setMenuItem(int index, JMenuItem mi)
Action
public JMenuItem[] getMenuItem()
public JMenuItem getMenuItem(int index)
index
- Index of the menu item in the pop-up menu factory collection.public JPopupMenu createPopupMenu(IlpInteractionContext context)
IlpInteractionContext
.
This implementation creates a static pop-up menu according to the factory configuration.
createPopupMenu
in interface IlpPopupMenuFactory
context
- The interaction context that references the view for which
the pop-up menu is to be created.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.