LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing
Class LySwingPopupMenu

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.win.swing.LySwingObject
          extended by leon.view.win.swing.LySwingPopupMenu
All Implemented Interfaces:
LyActionListener, LyEventTransmitter, LyGraphicalComponent, LyGraphicalPopupMenu, LyViewComponent, LyFreeInterface, LySetEnabledInterface, LySwingComponent

public class LySwingPopupMenu
extends LySwingObject
implements LyGraphicalPopupMenu, LyActionListener, LyEventTransmitter

This class implements the Popup Menu object (as described in the dtd) for swing viewer.

A context-sensitive menu is a menu which positioning and content depends on the context that made possible to display it. This context depends, most of the time, of an element belonging to a high-level graphical object (tree node, element of a map, line of a list,...). If need be, this context is used as context for the launched action. The context-sensitive menus are available only with the heavy clients viewers.

See Also:
LySwingMenuBar, LyMenu

Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LySwingPopupMenu(LyPopupMenu popupMenu)
          Class constructor of a Popup menu object for the Swing target.
 
Method Summary
 void actionPerformed(LyActionEvent actionEvent)
          (non-Javadoc).
 void addComponent(LyComponent component, int pos)
          Inserts a sub-component components at given position.
 void addItem(java.lang.Object item)
          Adds an item at the end of this menu.
 void addMenu(java.lang.Object menu)
          Adds a menu at the end of the menu.
 void addSeparator()
          Adds a separator at the end of the menu.
 java.lang.Object createPopupMenu()
          Create a new popup menu.
 LyActionTransmitter getActionTransmitter()
          (non-Javadoc).
 java.lang.Object getMenu()
          Gets the menu component.
 LySelectionTransmitter getSelectionTransmitter()
          This popup menu doesn't handle selection events, so it has no selection transmitter.
 void initialize()
          Initializes the popup menu component.
 void insertItem(java.lang.Object item, int pos)
          Adds an item at the specified position in this menu.
 void insertMenu(java.lang.Object menu, int pos)
          Adds a sub-menu at the specified position in this menu.
 void insertSeparator(int pos)
          Inserts a separator at the specified position in this menu.
 void removeComponent(LyComponent component)
          Removes a sub-component components.
 void removeItem(java.lang.Object item)
          Removes an item from this menu.
 void removeMenu(java.lang.Object menu)
          Removes a menu from this menu.
 void setContent()
          Sets the popup menu content by adding the current menu items and the associated event listeners.
 void setEnabled(boolean enabled)
          Enables or disables this popup menu.
 
Methods inherited from class leon.view.win.swing.LySwingObject
getBounds, getChildrenBounds, getComponent, getDefaultFrame
 
Methods inherited from class leon.view.graphic.LyGraphicalObject
expand, free, getController, getEnv, getEnvironment, getIdCode, getIntResource, getMessage, getMessage, getResource, getString, getString, getString, getViewComponent, getViewManager, isFreed, isFreeing, isImageAnimated, processDemand, processDemand, testResource, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface leon.view.graphic.LyGraphicalComponent
free, getViewComponent
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values
Constructor Detail

LySwingPopupMenu

public LySwingPopupMenu(LyPopupMenu popupMenu)
Class constructor of a Popup menu object for the Swing target.

Parameters:
popupMenu - a POPUP_MENU component defined for every type of view targets. This popup menu component is initialized specificaly for the Swing view.
Method Detail

initialize

public void initialize()
Initializes the popup menu component.


setContent

public void setContent()
Sets the popup menu content by adding the current menu items and the associated event listeners.


createPopupMenu

public java.lang.Object createPopupMenu()
Create a new popup menu.

Returns:
the new popup menu

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this popup menu.

Specified by:
setEnabled in interface LyGraphicalPopupMenu
Specified by:
setEnabled in interface LySetEnabledInterface
Parameters:
enabled - the enabled status
See Also:
LySetEnabledInterface.setEnabled(boolean)

addItem

public void addItem(java.lang.Object item)
Adds an item at the end of this menu.

Parameters:
item - the new item to add

addMenu

public void addMenu(java.lang.Object menu)
Adds a menu at the end of the menu.

Parameters:
menu - the new menu to add

addSeparator

public void addSeparator()
Adds a separator at the end of the menu.


insertSeparator

public void insertSeparator(int pos)
Inserts a separator at the specified position in this menu.

Parameters:
pos - the position where the separator will be inserted
See Also:
JMenu.insertSeparator(int)

getMenu

public java.lang.Object getMenu()
Gets the menu component.

Returns:
the popup menu component

actionPerformed

public void actionPerformed(LyActionEvent actionEvent)
(non-Javadoc).

Specified by:
actionPerformed in interface LyActionListener
See Also:
LyActionListener.actionPerformed(leon.view.event.LyActionEvent)

getActionTransmitter

public LyActionTransmitter getActionTransmitter()
(non-Javadoc).

Specified by:
getActionTransmitter in interface LyEventTransmitter
Returns:
the action transmitter of this component
See Also:
LyEventTransmitter.getActionTransmitter()

getSelectionTransmitter

public LySelectionTransmitter getSelectionTransmitter()
This popup menu doesn't handle selection events, so it has no selection transmitter.

Specified by:
getSelectionTransmitter in interface LyEventTransmitter
Returns:
null
See Also:
LyEventTransmitter.getSelectionTransmitter()

addComponent

public void addComponent(LyComponent component,
                         int pos)
Description copied from interface: LyGraphicalPopupMenu
Inserts a sub-component components at given position.

Specified by:
addComponent in interface LyGraphicalPopupMenu
Parameters:
component - The components to add to components list.
pos - Position where the sub-component is inserted.

insertMenu

public void insertMenu(java.lang.Object menu,
                       int pos)
Adds a sub-menu at the specified position in this menu.

Parameters:
menu - the sub-menu to add in this menu
pos - the position where the sub-component is inserted
See Also:
JMenu.insert(javax.swing.JMenuItem, int)

insertItem

public void insertItem(java.lang.Object item,
                       int pos)
Adds an item at the specified position in this menu.

Parameters:
item - the menu item to add to this menu
pos - the position where the sub-component is inserted
See Also:
JMenu.insert(javax.swing.JMenuItem, int)

removeComponent

public void removeComponent(LyComponent component)
Description copied from interface: LyGraphicalPopupMenu
Removes a sub-component components.

Specified by:
removeComponent in interface LyGraphicalPopupMenu
Parameters:
component - The components to remove to components list.

removeItem

public void removeItem(java.lang.Object item)
Removes an item from this menu.

Parameters:
item - the menu item to remove
See Also:
JMenu.remove(javax.swing.JMenuItem)

removeMenu

public void removeMenu(java.lang.Object menu)
Removes a menu from this menu.

Parameters:
menu - the menu to remove
See Also:
JMenu.remove(javax.swing.JMenuItem)

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com