ilog.cpl.interactor
Class IlpDefaultPopupMenuFactory

java.lang.Object
  extended by ilog.cpl.interactor.IlpDefaultPopupMenuFactory
All Implemented Interfaces:
IlpPopupMenuFactory

public class IlpDefaultPopupMenuFactory
extends Object
implements IlpPopupMenuFactory

This class implements a default pop-up menu factory, that creates a static pop-up menu according to a given configuration.

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';
 }
 

Since:
JTGO 4.0

Constructor Summary
IlpDefaultPopupMenuFactory()
          Default constructor.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpDefaultPopupMenuFactory

public IlpDefaultPopupMenuFactory()
Default constructor.

Method Detail

setLabel

public void setLabel(String l)
Sets the pop-up menu label.

Parameters:
l - Pop-up menu label.

getLabel

public String getLabel()
Returns the pop-up menu label.


setMenuItem

public void setMenuItem(JMenuItem[] items)
Sets the entries present in the pop-up menu created by this factory.

A null entry represents a separator, which is added to the pop-up menu.

See Also:
Action

setMenuItem

public void setMenuItem(int index,
                        JMenuItem mi)
Sets an entry in the pop-up menu created by this factory.

See Also:
Action

getMenuItem

public JMenuItem[] getMenuItem()
Returns the list of menu items present in the pop-up menu created by this factory.

Returns:
vector With all menu items present in the pop-up menu.

getMenuItem

public JMenuItem getMenuItem(int index)
Returns the menu item present in the pop-up menu created by this factory.

Parameters:
index - Index of the menu item in the pop-up menu factory collection.

createPopupMenu

public JPopupMenu createPopupMenu(IlpInteractionContext context)
Creates a pop-up menu for the specified IlpInteractionContext.

This implementation creates a static pop-up menu according to the factory configuration.

Specified by:
createPopupMenu in interface IlpPopupMenuFactory
Parameters:
context - The interaction context that references the view for which the pop-up menu is to be created.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.