SalesPoint Framework v3.0

sale
Class FormSheet.FormButton

java.lang.Object
  |
  +--sale.FormSheet.FormButton

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

A button in the FormSheet's button bar.

Since:
v2.0
See Also:
FormSheet, Serialized Form
Source Code:
FormSheet.FormButton.java

Field Summary
protected  JButton m_jbPeer
          The button's peer used to display the 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.
 FormSheet getFormSheet()
          Get the FormSheet this button is attached to.
 int getID()
          Get the unique ID of this button.
 JButton getPeer()
          Get the JButton peer of this button.
 void hide()
          Hook method called when the FormSheet is hidden.
 boolean isEnabled()
          Return the enabled 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 setEnabled(boolean fEnabled)
          Set the enabled 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.
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

attach

public void attach(FormSheet fs)
Notify this button that it has been attached to, or detached from, a FormSheet.
Override:
Never.
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.
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.
Override:
Never.
Parameters:
sCaption - the new caption.

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.
Override:
Never.
Parameters:
fEnabled - the new enabled state of the button.

isEnabled

public boolean isEnabled()
Return the enabled 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.

setAction

public Action setAction(Action aAction)
Set the action that is performed when this button is clicked.
Override:
Never.
Parameters:
aAction - the action to be performed, when this button is clicked.
Returns:
the previously attached action, if any.

actionPerformed

public void actionPerformed(ActionEvent e)
ActionListener interface method, invoked when the peer was clicked. Performs the currently associated action.
Override:
Never.
Specified by:
actionPerformed in interface ActionListener
See Also:
setAction(sale.Action)

SalesPoint Framework v3.0