SalesPoint Framework v3.1

sale
Class FormSheet.FormButton

java.lang.Object
  extended bysale.FormSheet.FormButton
All Implemented Interfaces:
ActionListener, EventListener, Serializable
Enclosing class:
FormSheet

public static class FormSheet.FormButton
extends Object
implements ActionListener, Serializable

A button in the FormSheet's button bar.

Since:
v2.0
Author:
Steffen Zschaler
See Also:
FormSheet, Serialized Form

Field Summary
protected  Image[] m_aiImages
          The Images associated with the icons of this Button( [0]:DefaultImage, [1]:PressedImage, [2]:DisabledImage, [3]:PressedDiabledImage ).
protected  char m_cMnemonic
          The Mnemonic of this Button.
protected  JButton m_jbPeer
          The button's peer used to display the button.
protected  String m_sToolTip
          The ToolTip of this Button.
 
Constructor Summary
FormSheet.FormButton(String sCaption, int nID, Action aAction)
          Create a new, initially enabled FormButton.
 
Method Summary
 void actionPerformed(ActionEvent e)
          ActionListener interface method, invoked when the peer was clicked.
 void attach(FormSheet fs)
          Notify this button that it has been attached to, or detached from, a FormSheet.
 String getCaption()
          Get the caption of the button.
 ImageIcon getDefaultIcon()
          Get the default icon of this Button.
 ImageIcon getDisabledIcon()
          Get the disabled item of this Button.
 ImageIcon getDisabledSelectedIcon()
          Get the disabled selected item of this Button.
 FormSheet getFormSheet()
          Get the FormSheet this button is attached to.
 int getID()
          Get the unique ID of this button.
 char getMnemonic()
          Get the Mnemonic of this Button.
 JButton getPeer()
          Get the JButton peer of this button.
protected  Object getPeerLock()
          Return the monitor used to synchronized access to the peers.
 ImageIcon getSelectedIcon()
          Get the selected icon of this Button.
 String getToolTipText()
          Get the ToolTip of this Button.
 void hide()
          Hook method called when the FormSheet is hidden.
 boolean isEnabled()
          Return the enabled state of this button.
 boolean isVisible()
          Return the visible state of this button.
 Action setAction(Action aAction)
          Set the action that is performed when this button is clicked.
 void setCaption(String sCaption)
          Set the caption of the button.
 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 the button.
 void setMnemonic(char cMnemonic)
          Set the mnemonic of this Button.
 void setSelectedIcon(ImageIcon iiImageIcon)
          Set the selected icon of this MenuSheetItem.
 void setToolTipText(String s)
          Set the ToolTip of this Button.
 void setVisible(boolean fVisible)
          Set the visible state of the button.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_jbPeer

protected transient JButton m_jbPeer
The button's peer used to display the button. Will be lazyly created when it is first asked for.


m_aiImages

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


m_cMnemonic

protected char m_cMnemonic
The Mnemonic of this Button.


m_sToolTip

protected String m_sToolTip
The ToolTip of this Button.

Constructor Detail

FormSheet.FormButton

public FormSheet.FormButton(String sCaption,
                            int nID,
                            Action aAction)
Create a new, initially enabled FormButton.

Parameters:
sCaption - the caption of the button.
nID - a unique ID that can be used to identify the button in its FormSheet.
aAction - an action to perform when the button was clicked.
Method Detail

getPeerLock

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

Override:
Never

attach

public void attach(FormSheet fs)
Notify this button that it has been attached to, or detached from, a FormSheet.

Parameters:
fs - the FormSheet the button has been attached to. If null, the button has been detached from a FormSheet.
Override:
Never

getFormSheet

public FormSheet getFormSheet()
Get the FormSheet this button is attached to.

Override:
Never

hide

public void hide()
Hook method called when the FormSheet is hidden. Used to resolve circular references with the peer, in order to help the garbage collector.

Override:
Never

setCaption

public void setCaption(String sCaption)
Set the caption of the button. If there is a peer, its caption is also changed.

Parameters:
sCaption - the new caption.
Override:
Never

setMnemonic

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

Parameters:
cMnemonic - the new mnemonic.
Override:
Never

setToolTipText

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

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

getCaption

public String getCaption()
Get the caption of the button.

Override:
Never

setEnabled

public void setEnabled(boolean fEnabled)
Set the enabled state of the button.

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

isEnabled

public boolean isEnabled()
Return the enabled state of this button.

Override:
Never

setVisible

public void setVisible(boolean fVisible)
Set the visible state of the button.

Parameters:
fVisible - the new enabled state of the button.
Override:
Never

isVisible

public boolean isVisible()
Return the visible state of this button.

Override:
Never

getID

public int getID()
Get the unique ID of this button.

Override:
Never

getPeer

public JButton getPeer()
Get the JButton peer of this button. If there is not yet a peer, create one. Otherwise, just return the peer that already exists.

Override:
Sometimes Override this method if you want to change the appearance of the button's peer.

getMnemonic

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

Returns:
the mnemonic of this Button.
Override:
Never

getToolTipText

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

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

getDefaultIcon

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

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

getSelectedIcon

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

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

getDisabledIcon

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

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

getDisabledSelectedIcon

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

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

setAction

public Action setAction(Action aAction)
Set the action that is performed when this button is clicked.

Parameters:
aAction - the action to be performed, when this button is clicked.
Returns:
the previously attached action, if any.
Override:
Never

actionPerformed

public void actionPerformed(ActionEvent e)
ActionListener interface method, invoked when the peer was clicked. Performs the currently associated action.

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

SalesPoint Framework v3.1