org.salespointframework.core
Class FormSheet.FormButton

java.lang.Object
  extended by org.salespointframework.core.FormSheet.FormButton
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
Enclosing class:
FormSheet

public static class FormSheet.FormButton
extends java.lang.Object
implements java.awt.event.ActionListener

A button in the FormSheet's button bar.

Since:
v2.0
Version:
2.0 21/05/1999
Author:
Steffen Zschaler
See Also:
FormSheet

Field Summary
private static int DEFAULT_IMAGE
           
private static int DISABLED_IMAGE
           
private static int DISABLED_SELECTED_IMAGE
           
private  Action m_aAction
          The action associated with this button.
protected  java.awt.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.
private  boolean m_fEnabled
          Can this button be clicked?
private  FormSheet m_fsOwner
          The FormSheet owning this button.
private  boolean m_fVisible
          Is this button visible?
protected  javax.swing.JButton m_jbPeer
          The button's peer used to display the button.
(package private)  int m_nAddIndex
          The index of this button in the add sequence of its FormSheet.
private  int m_nID
          The unique ID used to identify the button in the FormSheet.
private  java.lang.Object m_oPeerLock
          The monitor synchronizing access to the peers.
private  java.lang.String m_sCaption
          The buttons caption.
protected  java.lang.String m_sName
          The Button name
protected  java.lang.String m_sToolTip
          The ToolTip of this Button.
private static int SELECTED_IMAGE
           
 
Constructor Summary
FormSheet.FormButton(java.lang.String sCaption, int nID, Action aAction)
          Create a new, initially enabled FormButton.
 
Method Summary
 void actionPerformed(java.awt.event.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.
 java.lang.String getCaption()
          Get the caption of the button.
 javax.swing.ImageIcon getDefaultIcon()
          Get the default icon of this Button.
 javax.swing.ImageIcon getDisabledIcon()
          Get the disabled item of this Button.
 javax.swing.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.
 java.lang.String getName()
          Get the name attribute of this button
 javax.swing.JButton getPeer()
          Get the JButton peer of this button.
protected  java.lang.Object getPeerLock()
          Return the monitor used to synchronized access to the peers.
 javax.swing.ImageIcon getSelectedIcon()
          Get the selected icon of this Button.
 java.lang.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(java.lang.String sCaption)
          Set the caption of the button.
 void setDefaultIcon(javax.swing.ImageIcon iiImageIcon)
          Set the default icon of this MenuSheetItem.
 void setDisabledIcon(javax.swing.ImageIcon iiImageIcon)
          Set the disabled icon of this MenuSheetItem.
 void setDisabledSelectedIcon(javax.swing.ImageIcon iiImageIcon)
          Set the disabled selected icon of this MenuSheetItem.
 void setEnabled(boolean fEnabled)
          Set the enabled state of the button.
private  void setIcon(javax.swing.ImageIcon iiImageIcon, int nIndex)
           
 void setMnemonic(char cMnemonic)
          Set the mnemonic of this Button.
 void setName(java.lang.String name)
          Set the awt name of thsi button
 void setSelectedIcon(javax.swing.ImageIcon iiImageIcon)
          Set the selected icon of this MenuSheetItem.
 void setToolTipText(java.lang.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_sCaption

private java.lang.String m_sCaption
The buttons caption.


m_nID

private int m_nID
The unique ID used to identify the button in the FormSheet.


m_jbPeer

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


m_fsOwner

private FormSheet m_fsOwner
The FormSheet owning this button.


m_aAction

private Action m_aAction
The action associated with this button.


m_fEnabled

private boolean m_fEnabled
Can this button be clicked?


m_fVisible

private boolean m_fVisible
Is this button visible?


m_nAddIndex

int m_nAddIndex
The index of this button in the add sequence of its FormSheet. Used to sort the buttons when filling the button panel.


m_aiImages

protected java.awt.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 java.lang.String m_sToolTip
The ToolTip of this Button.


m_sName

protected java.lang.String m_sName
The Button name


m_oPeerLock

private transient java.lang.Object m_oPeerLock
The monitor synchronizing access to the peers.


DEFAULT_IMAGE

private static final int DEFAULT_IMAGE
See Also:
Constant Field Values

SELECTED_IMAGE

private static final int SELECTED_IMAGE
See Also:
Constant Field Values

DISABLED_IMAGE

private static final int DISABLED_IMAGE
See Also:
Constant Field Values

DISABLED_SELECTED_IMAGE

private static final int DISABLED_SELECTED_IMAGE
See Also:
Constant Field Values
Constructor Detail

FormSheet.FormButton

public FormSheet.FormButton(java.lang.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 java.lang.Object getPeerLock()
Return the monitor used to synchronized access to the peers.


setIcon

private void setIcon(javax.swing.ImageIcon iiImageIcon,
                     int nIndex)

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.

getFormSheet

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


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.


setCaption

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

Parameters:
sCaption - the new caption.

getName

public java.lang.String getName()
Get the name attribute of this button

Returns:
nName

setName

public void setName(java.lang.String name)
Set the awt name of thsi button

Parameters:
the - new name

setMnemonic

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

Parameters:
cMnemonic - the new mnemonic.

setToolTipText

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

Parameters:
s - the new ToolTip-Text.

setDefaultIcon

public void setDefaultIcon(javax.swing.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.

setSelectedIcon

public void setSelectedIcon(javax.swing.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.

setDisabledIcon

public void setDisabledIcon(javax.swing.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.

setDisabledSelectedIcon

public void setDisabledSelectedIcon(javax.swing.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.

getCaption

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


setEnabled

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

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

isEnabled

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


setVisible

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

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

isVisible

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


getID

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


getPeer

public javax.swing.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.


getMnemonic

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

Returns:
the mnemonic of this Button.

getToolTipText

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

Returns:
the ToolTip-String of this Button.

getDefaultIcon

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

Returns:
the default icon of this Button.

getSelectedIcon

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

Returns:
the pressed icon of this Button.

getDisabledIcon

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

Returns:
the disabled icon of this Button.

getDisabledSelectedIcon

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

Returns:
the disabled selected icon of this Button.

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.

actionPerformed

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

Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
setAction(org.salespointframework.core.Action)