LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing
Class LySwingMenu

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

public class LySwingMenu
extends LySwingObject
implements LyGraphicalMenu, LyActionListener, LyEventTransmitter

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

A menu contains a set of menu, sub-menus entries and separators. The menus are available only with the heavy clients (Swing and SWT) viewers.

See Also:
LySwingMenuBar, LyMenu

Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LySwingMenu(LyMenu menu)
          Class constructor of a Menu object for the Swing target.
 
Method Summary
 void actionPerformed(LyActionEvent actionEvent)
          (non-Javadoc).
 void addComponent(LyComponent component, int pos)
          Adds a new menu item at the specified position.
 void addItem(java.lang.Object item)
          Adds an item at the end of this menu.
 void addMenu(java.lang.Object menu)
          Adds a sub-menu at the end of this menu.
 void addSeparator()
          Adds a separator at the end of this menu.
 java.lang.Object createMenu()
          Creates and configures the component that display this menu.
 LyActionTransmitter getActionTransmitter()
          (non-Javadoc).
 java.lang.Object getMenu()
          Gets the menu component.
 LySelectionTransmitter getSelectionTransmitter()
          This menu doesn't handle selection events, so it has no selection transmitter.
 void initialize()
          Initializes the current menu.
 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)
          (non-Javadoc).
 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 menu items of this menu.
 void setEnabled(boolean enabled)
          Enables or disables this menu.
 void setLabel(java.lang.String label)
          Sets the menu label of this menu.
 void setMnemonic(char mnemonic)
          Sets the mnemonic of this 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

LySwingMenu

public LySwingMenu(LyMenu menu)
Class constructor of a Menu object for the Swing target.

Parameters:
menu - a MENU component defined for every type of view targets. This menu is initialized for the swing view and its attributes are configured with the default values.
Method Detail

initialize

public void initialize()
Initializes the current menu.


setContent

public void setContent()
Sets the menu items of this menu.


createMenu

public java.lang.Object createMenu()
Creates and configures the component that display this menu.

Returns:
the new menu component

getMenu

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

Returns:
the component for the menu

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 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)
Adds a new menu item at the specified position.

Specified by:
addComponent in interface LyGraphicalMenu
Parameters:
component - a menu item to add to this menu. null adds a separator.
pos - the position of this menu item in the menu
See Also:
LyGraphicalMenu.addComponent(leon.view.LyComponent, int)

removeComponent

public void removeComponent(LyComponent component)
(non-Javadoc).

Specified by:
removeComponent in interface LyGraphicalMenu
Parameters:
component - The components to remove to components list.
See Also:
LyGraphicalMenu.removeComponent(leon.view.LyComponent)

setEnabled

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

Specified by:
setEnabled in interface LyGraphicalMenu
Specified by:
setEnabled in interface LySetEnabledInterface
Parameters:
enabled - Indicates if the menu is enabled or not
See Also:
LyGraphicalMenu.setEnabled(boolean), JMenuItem.setEnabled(boolean)

setLabel

public void setLabel(java.lang.String label)
Sets the menu label of this menu.

Parameters:
label - the new value of the menu label
See Also:
AbstractButton.setText(String)

setMnemonic

public void setMnemonic(char mnemonic)
Sets the mnemonic of this menu.

Parameters:
mnemonic - the new value of the mnemonic
See Also:
AbstractButton.setMnemonic(char)

addItem

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

Parameters:
item - the menu item to add to this menu
See Also:
JMenu.add(JMenuItem)

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)

addMenu

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

Parameters:
menu - the sub-menu to add in this menu
See Also:
JMenu.add(JMenuItem)

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)

addSeparator

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

See Also:
JMenu.addSeparator()

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)

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