package sale; import java.io.Serializable; /** * An action that can be associated with a {@link MenuSheetItem MenuSheetItem} or * {@link FormSheet.FormButton FormSheet button}. * * <p>Actions are triggered when there associated control is clicked. They can run in * the context of a {@link Shop}, possibly a {@link SalesPoint}, and also maybe a {@link SaleProcess}.</p> * * @author Steffen Zschaler * @version 2.0 21/05/1999 * @since v2.0 */ public interface Action extends Serializable { /** * Perform the actual action. * * <p>The parameters define the context in which the action is performed:</p> * * <ol> * <li>It will always be performed in the context of the Shop. The Shop can be * retrieved via {@link sale.Shop#getTheShop Shop.getTheShop()}.</li> * <li>If <code>sp != null</code>, <code>sp</code> will define the SalesPoint * that is the context of this action.</li> * <li>If <code>p != null</code>, <code>p</code> will define the SaleProcess * that is the context of this action.</li> * </ol> * * <p>Note, that virtually any combination of the parameters makes sense.</p> * * @override Always * * @param p the SaleProcess context of the action. * @param sp the SalesPoint context of the action. * * @exception Throwable on any error that shall be reported and lead to cancellation of * the action. */ public void doAction (SaleProcess p, SalesPoint sp) throws Throwable; }