SalesPoint Framework v3.1

sale
Class MenuSheetItem

java.lang.Object
  extended bysale.MenuSheetObject
      extended bysale.MenuSheetItem
All Implemented Interfaces:
ActionListener, EventListener, Serializable

public class MenuSheetItem
extends MenuSheetObject
implements ActionListener

A MenuSheetItem that has a label and an associated action.

Since:
v1.0
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)
          Creates a new MenuSheetItem with caption and action.
MenuSheetItem(String sCaption, String sTag, Action aAction)
          Creates a new MenuSheetItem with caption, tag and action; initially enabled.
MenuSheetItem(String sCaption, String sTag, Action aAction, char cMnemonic)
          Creates 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)
Creates 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)
Creates 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)
Creates 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.

Overrides:
setCaption in class MenuSheetObject
Parameters:
sCaption - the new caption.
Override:
Never

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.

Parameters:
fEnabled - the new enabled state.
Override:
Never

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.

Overrides:
setVisible in class MenuSheetObject
Parameters:
fVisible - the visibility state of the MenuSheetObject.
Override:
Never

setAction

public Action setAction(Action aAction)
Set the action to perform when this item is selected.

Parameters:
aAction - the action to perform when this item is selected.
Returns:
the previously set action, if any.
Override:
Never

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

setAccelerator

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

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

Parameters:
ks - the new keystroke.
Override:
Never

setToolTipText

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

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

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

setDefaultIcon

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

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

Parameters:
iiImageIcon - the new icon.
Override:
Never

setSelectedIcon

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

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

Parameters:
iiImageIcon - the new icon.
Override:
Never

setDisabledIcon

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

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

Parameters:
iiImageIcon - the new icon.
Override:
Never

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.

Parameters:
iiImageIcon - the new icon.
Override:
Never

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.

Specified by:
getPeer in class MenuSheetObject
Override:
Never

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.

Specified by:
getMenuPeer in class MenuSheetObject
Override:
Never

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.

Specified by:
actionPerformed in interface ActionListener
See Also:
setAction(sale.Action), SalesPoint, SaleProcess
Override:
Never

getMnemonic

public char getMnemonic()
Get the Mnemonic of this MenuSheetItem.

Returns:
the mnemonic of this MenuSheetItem.
Override:
Never

getAccelerator

public KeyStroke getAccelerator()
Get the accelerator of this MenuSheetItem.

Returns:
the keystroke associated with the accelerator of this MenuSheetItem.
Override:
Never

getToolTipText

public String getToolTipText()
Get the ToolTip of this MenuSheetItem.

Returns:
the ToolTip-String of this MenuSheetItem.
Override:
Never

getDefaultIcon

public ImageIcon getDefaultIcon()
Get the default icon of this MenuSheetItem.

Returns:
the default icon of this MenuSheetItem.
Override:
Never

getSelectedIcon

public ImageIcon getSelectedIcon()
Get the selected icon of this MenuSheetItem.

Returns:
the pressed icon of this MenuSheetItem.
Override:
Never

getDisabledIcon

public ImageIcon getDisabledIcon()
Get the disabled item of this MenuSheetItem.

Returns:
the disabled icon of this MenuSheetItem.
Override:
Never

getDisabledSelectedIcon

public ImageIcon getDisabledSelectedIcon()
Get the disabled selected item of this MenuSheetItem.

Returns:
the disabled selected icon of this MenuSheetItem.
Override:
Never

SalesPoint Framework v3.1