SalesPoint Framework v3.1

sale
Class ActionActionListener

java.lang.Object
  extended bysale.ActionActionListener
All Implemented Interfaces:
Action, ActionListener, EventListener, Serializable

public class ActionActionListener
extends Object
implements Action, ActionListener

A special ActionListener that allows to associate Actions with buttons that are not in a FormSheet's button bar or a MenuSheet.

You can use subclasses of this class as ActionListeners on any button in a FormSheet that is not in the button bar. You can then think of it as of an Action associated with that button. The doAction(sale.SaleProcess, sale.SalesPoint) method will be called with the same parameters as for an Action associated with a button in the FormSheet's button bar.

If you do not override doAction(sale.SaleProcess, sale.SalesPoint) in subclasses, it will defer event handling to the Action object handed in on creation. Thus, you can create chains of responsibility which allow for, e.g., a capability to be associated with any ActionEvent in the FormSheet.

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

Field Summary
protected  Action m_aAction
          The action to be performed, when the listener is triggered.
protected  FormSheet m_fsOwner
          The FormSheet that contains this Action's button.
 
Constructor Summary
ActionActionListener(FormSheet fsOwner)
          Create a new ActionActionListener.
ActionActionListener(FormSheet fsOwner, Action aAction)
          Create a new ActionActionListener.
 
Method Summary
 void actionPerformed(ActionEvent e)
          ActionListener interface method.
 void doAction(SaleProcess p, SalesPoint sp)
          Action interface method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_fsOwner

protected FormSheet m_fsOwner
The FormSheet that contains this Action's button.


m_aAction

protected Action m_aAction
The action to be performed, when the listener is triggered.

Constructor Detail

ActionActionListener

public ActionActionListener(FormSheet fsOwner)
Create a new ActionActionListener. You must override doAction(sale.SaleProcess, sale.SalesPoint) when using this constructor.

Parameters:
fsOwner - the FormSheet that contains this Action's button.

ActionActionListener

public ActionActionListener(FormSheet fsOwner,
                            Action aAction)
Create a new ActionActionListener. You should not override doAction(sale.SaleProcess, sale.SalesPoint) when using this constructor.

Parameters:
fsOwner - the FormSheet that contains this Action's button.
aAction - the Action to perform when the listener is triggered.
Method Detail

actionPerformed

public final void actionPerformed(ActionEvent e)
ActionListener interface method. Will redirect the event to the doAction(sale.SaleProcess, sale.SalesPoint) method.

Specified by:
actionPerformed in interface ActionListener
Override:
Never

doAction

public void doAction(SaleProcess p,
                     SalesPoint sp)
              throws Throwable
Action interface method. Unless you override it, it will redirect the event to the doAction() method of the Action that is associated with this listener.

Specified by:
doAction in interface Action
Parameters:
p - the SaleProcess context of the action.
sp - the SalesPoint context of the action.
Throws:
Throwable - on any error that shall be reported and lead to cancellation of the action.
See Also:
ActionActionListener(sale.FormSheet, sale.Action)
Override:
Sometimes Override this method when you used ActionActionListener(sale.FormSheet) as a constructor and want the listener to be the Action object at the same time.

SalesPoint Framework v3.1