LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.win.swing
Class LySwingItem

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.win.swing.LySwingObject
          extended by leon.view.win.swing.LySwingItem
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.util.EventListener, LyEventTransmitter, LyGraphicalComponent, LyGraphicalItem, LyViewComponent, LyFreeInterface, LySetEnabledInterface, LySetImageInterface, LySetLabelInterface, LySwingComponent

public class LySwingItem
extends LySwingObject
implements LyGraphicalItem, java.awt.event.ActionListener, java.awt.event.ItemListener, LyEventTransmitter

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

A menu entry allows to execute an action like, as when using an action button. The entry can be of check box type (checkbox attribute) and can open a dialog window (dialog attribute).

See Also:
LySwingMenu, LyItem

Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LySwingItem(LyItem item)
          Class constructor of an Item object for the Swing target.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Invoked when a menu item is activated.
 java.lang.Object createItem(boolean isCheckBox)
          Creates a menu item with a checkbox if the item needs one.
 LyActionTransmitter getActionTransmitter()
          (non-Javadoc).
 java.lang.Object getItem()
          Gets the item component.
 LySelectionTransmitter getSelectionTransmitter()
          This menu item doesn't handle selection events, so it has no selection transmitter.
 void initialize()
          Initializes the item and sets its action listeners.
 void itemStateChanged(java.awt.event.ItemEvent event)
          Invoked when a checkboxed menu item is selected or unselected.
 void registerListeners()
          Registers for item events.
 void setChecked(boolean checked)
          Sets the checked state of the checkbox menu item without triggering the action listener.
 void setContent()
          Initializes the item content info.
 void setEnabled(boolean enabled)
          Sets the status of the menu.
 void setImage(java.lang.String image)
          Sets the image icon for the menu item.
 void setLabel(java.lang.String label)
          Sets the text label of this item.
 void setMnemonic(char mnemonic)
          Sets the keyboard mnemonic for this item.
 void setShortCut(java.lang.String shortcut)
          Sets the keyboard shortcut for this item.
 
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

LySwingItem

public LySwingItem(LyItem item)
Class constructor of an Item object for the Swing target.

Parameters:
item - an ITEM component defined for every type of view targets. This item is initialized for the Swing view specificaly and filled with the default values.
Method Detail

initialize

public void initialize()
Initializes the item and sets its action listeners. If this item has a checkbox, the menu item is created accordingly.


setContent

public void setContent()
Initializes the item content info.


createItem

public java.lang.Object createItem(boolean isCheckBox)
Creates a menu item with a checkbox if the item needs one.

Parameters:
isCheckBox - specify if this item has a checkBox or no
Returns:
the menu item

getItem

public java.lang.Object getItem()
Gets the item component.

Returns:
the item of the component

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent event)
Invoked when a checkboxed menu item is selected or unselected.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener

registerListeners

public void registerListeners()
Registers for item events.


setShortCut

public void setShortCut(java.lang.String shortcut)
Sets the keyboard shortcut for this item.

Parameters:
shortcut - a String representing the sequence of keys to press

setMnemonic

public void setMnemonic(char mnemonic)
Sets the keyboard mnemonic for this item.

Parameters:
mnemonic - a character used as mnemonic for the item

setLabel

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

Specified by:
setLabel in interface LyGraphicalItem
Specified by:
setLabel in interface LySetLabelInterface
Parameters:
label - New value of label.
See Also:
LyGraphicalItem.setLabel(String)

setChecked

public void setChecked(boolean checked)
Sets the checked state of the checkbox menu item without triggering the action listener. If not a checkbox menu item, the method does nothing.

Specified by:
setChecked in interface LyGraphicalItem
Parameters:
checked - new state
See Also:
LyGraphicalItem.setChecked(boolean)

setEnabled

public void setEnabled(boolean enabled)
Sets the status of the menu. If disabled, the menu is grayed and inactive.

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

setImage

public void setImage(java.lang.String image)
Sets the image icon for the menu item.

Specified by:
setImage in interface LyGraphicalItem
Specified by:
setImage in interface LySetImageInterface
Parameters:
image - Image of the item.
See Also:
LyGraphicalItem.setImage(String)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Invoked when a menu item is activated.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

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 item doesn't handle selection events, so it has no selection transmitter.

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

(c) January 2013 - W4 S.A.

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