SalesPoint Framework v3.0

sale
Class MenuSheetItem

java.lang.Object
  |
  +--sale.MenuSheetObject
        |
        +--sale.MenuSheetItem

public class MenuSheetItem
extends MenuSheetObject
implements ActionListener

A MenuSheetItem that has a label and an associated action.

Hooks:
Create a MenuSheet element
Since:
v1.0
Version:
2.0 20/05/1999
Author:
Steffen Zschaler
See Also:
Action, MenuSheet, MenuSheetSeparator, Serialized Form

Field Summary
protected  Action m_aAction
          The action associated with this MenuSheetItem.
protected  ImageIcon[] m_aiImages
          The Images associated with the icons of this MenuSheetItem( [0]:DefaultImage, [1]:PressedImage, [2]:DisabledImage, [3]:PressedDiabledImage ).
protected  char m_cMnemonic
          The Mnemonic of this MenuSheetItem.
protected  JMenuItem m_jmiPeer
          The JMenuItem peer.
protected  JMenu m_jmMenuPeer
          The JMenu peer.
protected  KeyStroke m_ksKeyStroke
          The KeyStroke of this MenuSheetItem.
protected  String m_sToolTip
          The ToolTip of this MenuSheeItemt.
 
Fields inherited from class sale.MenuSheetObject
m_msParent, m_pAttached, m_spAttached
 
Constructor Summary
MenuSheetItem(String sCaption, Action aAction)
          Create a new MenuSheetItem with caption and action.
MenuSheetItem(String sCaption, String sTag, Action aAction)
          Create a new MenuSheetItem with caption, tag and action; initially enabled.
MenuSheetItem(String sCaption, String sTag, Action aAction, char cMnemonic)
          Create a new MenuSheetItem with caption, tag, an action, and a mnemonic.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Hook method called whenever the user selects the MenuSheetItem.
 KeyStroke getAccelerator()
          Get the accelerator of this MenuSheetItem.
protected  Object getActionLock()
          Return the monitor used to synchronized access to the m_aAction.
 ImageIcon getDefaultIcon()
          Get the default icon of this MenuSheetItem.
 ImageIcon getDisabledIcon()
          Get the disabled item of this MenuSheetItem.
 ImageIcon getDisabledSelectedIcon()
          Get the disabled selected item of this MenuSheetItem.
 JMenu getMenuPeer()
          Return the JMenu peer for this MenuSheetItem.
 char getMnemonic()
          Get the Mnemonic of this MenuSheetItem.
 JMenuItem getPeer()
          Get the JMenuItem peer of the MenuSheetItem.
protected  Object getPeerLock()
          Return the monitor used to synchronized access to the peers.
 ImageIcon getSelectedIcon()
          Get the selected icon of this MenuSheetItem.
 String getToolTipText()
          Get the ToolTip of this MenuSheetItem.
 boolean isEnabled()
          Return the current enabled state of this MenuSheetItem.
 void setAccelerator(KeyStroke ks)
          Set the accelerator of this MenuSheetItem.
 Action setAction(Action aAction)
          Set the action to perform when this item is selected.
 void setCaption(String sCaption)
          Set the caption of this MenuSheetItem.
 void setDefaultIcon(ImageIcon iiImageIcon)
          Set the default icon of this MenuSheetItem.
 void setDisabledIcon(ImageIcon iiImageIcon)
          Set the disabled icon of this MenuSheetItem.
 void setDisabledSelectedIcon(ImageIcon iiImageIcon)
          Set the disabled selected icon of this MenuSheetItem.
 void setEnabled(boolean fEnabled)
          Set the enabled state of this MenuSheetItem.
 void setMnemonic(char cMnemonic)
          Set the mnemonic of this MenuSheetItem.
 void setSelectedIcon(ImageIcon iiImageIcon)
          Set the selected icon of this MenuSheetItem.
 void setToolTipText(String s)
          Set the ToolTip of this MenuSheetItem.
 void setVisible(boolean fVisible)
          Mark the item visible or invisible.
 
Methods inherited from class sale.MenuSheetObject
attach, attach, detachSaleProcess, detachSalesPoint, equals, getCaption, getParent, getTag, getTaggedItem, getTaggedItem, isSeparator, isVisible
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_jmiPeer

protected transient JMenuItem m_jmiPeer
The JMenuItem peer.

m_jmMenuPeer

protected transient JMenu m_jmMenuPeer
The JMenu peer.

m_aAction

protected Action m_aAction
The action associated with this MenuSheetItem.

m_aiImages

protected ImageIcon[] m_aiImages
The Images associated with the icons of this MenuSheetItem( [0]:DefaultImage, [1]:PressedImage, [2]:DisabledImage, [3]:PressedDiabledImage ).

m_cMnemonic

protected char m_cMnemonic
The Mnemonic of this MenuSheetItem.

m_ksKeyStroke

protected KeyStroke m_ksKeyStroke
The KeyStroke of this MenuSheetItem.

m_sToolTip

protected String m_sToolTip
The ToolTip of this MenuSheeItemt.
Constructor Detail

MenuSheetItem

public MenuSheetItem(String sCaption,
                     String sTag,
                     Action aAction,
                     char cMnemonic)
Create a new MenuSheetItem with caption, tag, an action, and a mnemonic.
Parameters:
sCaption - the caption of the new MenuSheetItem.
sTag - the tag that will identify this MenuSheetItem.
aAction - the action to perform when this MenuSheetItem is selected.
cMnemonic - the mnemonic of the new MenuSheetItem

MenuSheetItem

public MenuSheetItem(String sCaption,
                     String sTag,
                     Action aAction)
Create a new MenuSheetItem with caption, tag and action; initially enabled.
Parameters:
sCaption - the caption of the new MenuSheetItem.
sTag - the tag that will identify this MenuSheetItem.
aAction - the action to perform when this MenuSheetItem is selected.

MenuSheetItem

public MenuSheetItem(String sCaption,
                     Action aAction)
Create a new MenuSheetItem with caption and action. The MenuSheetItem will have a default, unique tag.
Parameters:
sCaption - the caption of the new MenuSheetItem.
aAction - the action to perform when this MenuSheetItem is selected.
Method Detail

getPeerLock

protected Object getPeerLock()
Return the monitor used to synchronized access to the peers.
Override:
Never.

getActionLock

protected Object getActionLock()
Return the monitor used to synchronized access to the m_aAction.
Override:
Never.

setCaption

public void setCaption(String sCaption)
Set the caption of this MenuSheetItem. If the MenuSheetItem is already on display, also the peer's caption is set.
Override:
Never.
Parameters:
sCaption - the new caption.
Overrides:
setCaption in class MenuSheetObject

setEnabled

public void setEnabled(boolean fEnabled)
Set the enabled state of this MenuSheetItem. If the MenuSheetItem is already on display, also the peer's enabled state is set.
Override:
Never.
Parameters:
fEnabled - the new enabled state.

isEnabled

public boolean isEnabled()
Return the current enabled state of this MenuSheetItem.
Override:
Never.

setVisible

public void setVisible(boolean fVisible)
Mark the item visible or invisible.
Override:
Never.
Overrides:
setVisible in class MenuSheetObject

setAction

public Action setAction(Action aAction)
Set the action to perform when this item is selected.
Override:
Never.
Parameters:
aAction - the action to perform when this item is selected.
Returns:
the previously set action, if any.

setMnemonic

public void setMnemonic(char cMnemonic)
Set the mnemonic of this MenuSheetItem.

If there is a peer it will reflect the changes immediately.

Override:
Never.
Parameters:
sMnemonic - the new mnemonic.

setAccelerator

public void setAccelerator(KeyStroke ks)
Set the accelerator of this MenuSheetItem.

If there is a peer it will reflect the changes immediately.

Override:
Never.
Parameters:
ks - the new keystroke.

setToolTipText

public void setToolTipText(String s)
Set the ToolTip of this MenuSheetItem.

If there is a peer it will reflect the changes immediately.

Override:
Never.
Parameters:
s - the new ToolTip-Text.

setDefaultIcon

public void setDefaultIcon(ImageIcon iiImageIcon)
Set the default icon of this MenuSheetItem.

If there is a peer it will reflect the changes immediately.

Override:
Never.
Parameters:
iiImageIcon - the new icon.

setSelectedIcon

public void setSelectedIcon(ImageIcon iiImageIcon)
Set the selected icon of this MenuSheetItem.

If there is a peer it will reflect the changes immediately.

Override:
Never.
Parameters:
iiImageIcon - the new icon.

setDisabledIcon

public void setDisabledIcon(ImageIcon iiImageIcon)
Set the disabled icon of this MenuSheetItem.

If there is a peer it will reflect the changes immediately.

Override:
Never.
Parameters:
iiImageIcon - the new icon.

setDisabledSelectedIcon

public void setDisabledSelectedIcon(ImageIcon iiImageIcon)
Set the disabled selected icon of this MenuSheetItem.

If there is a peer it will reflect the changes immediately.

Override:
Never.
Parameters:
iiImageIcon - the new icon.

getPeer

public JMenuItem getPeer()
Get the JMenuItem peer of the MenuSheetItem. The JMenuItem peer is a JMenuItem with the same caption as this MenuSheetItem. Selecting this JMenuItem will invoke the action associated to this MenuSheetItem.
Override:
Never.
Overrides:
getPeer in class MenuSheetObject

getMenuPeer

public JMenu getMenuPeer()
Return the JMenu peer for this MenuSheetItem. The JMenu peer is a JMenu with the same caption as this MenuSheetItem, containing just one JMenuItem, which is equivalent to the JMenuItem peer of the MenuSheetItem.
Override:
Never.
Overrides:
getMenuPeer in class MenuSheetObject

actionPerformed

public void actionPerformed(ActionEvent e)
Hook method called whenever the user selects the MenuSheetItem. As a default invokes the action currently associated with the MenuSheetItem, handing it the currently attached SalesPoint and SaleProcess.
Override:
Never.
Specified by:
actionPerformed in interface ActionListener
See Also:
setAction(sale.Action), SalesPoint, SaleProcess

getMnemonic

public char getMnemonic()
Get the Mnemonic of this MenuSheetItem.
Override:
Never.
Returns:
the mnemonic of this MenuSheetItem.

getAccelerator

public KeyStroke getAccelerator()
Get the accelerator of this MenuSheetItem.
Override:
Never.
Returns:
the keystroke associated with the accelerator of this MenuSheetItem.

getToolTipText

public String getToolTipText()
Get the ToolTip of this MenuSheetItem.
Override:
Never.
Returns:
the ToolTip-String of this MenuSheetItem.

getDefaultIcon

public ImageIcon getDefaultIcon()
Get the default icon of this MenuSheetItem.
Override:
Never.
Returns:
the default icon of this MenuSheetItem.

getSelectedIcon

public ImageIcon getSelectedIcon()
Get the selected icon of this MenuSheetItem.
Override:
Never.
Returns:
the pressed icon of this MenuSheetItem.

getDisabledIcon

public ImageIcon getDisabledIcon()
Get the disabled item of this MenuSheetItem.
Override:
Never.
Returns:
the disabled icon of this MenuSheetItem.

getDisabledSelectedIcon

public ImageIcon getDisabledSelectedIcon()
Get the disabled selected item of this MenuSheetItem.
Override:
Never.
Returns:
the disabled selected icon of this MenuSheetItem.

SalesPoint Framework v3.0