SalesPoint Framework v3.1

data.stdforms.singletableformsheet
Class DefaultRemoveCatalogItemStrategy

java.lang.Object
  extended bysale.stdforms.FormSheetStrategy
      extended bydata.stdforms.singletableformsheet.EditButtonStrategy
          extended bydata.stdforms.singletableformsheet.DefaultRemoveCatalogItemStrategy
All Implemented Interfaces:
ProcessErrorCodes, Serializable

public class DefaultRemoveCatalogItemStrategy
extends EditButtonStrategy

Strategy that can be associated to the "Remove" button of a SingleTableFormSheet that displays the contents of a Catalog.

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

Nested Class Summary
 
Nested classes inherited from class sale.stdforms.FormSheetStrategy
FormSheetStrategy.ErrorHandler
 
Field Summary
protected  Catalog m_cCatalog
          The Catalog that is being edited.
 
Fields inherited from class sale.stdforms.FormSheetStrategy
DEFAULT_ERROR_HANDLER, m_ehErrHandler, MSG_POPUP_ERROR_HANDLER
 
Fields inherited from interface sale.ProcessErrorCodes
DATABASKET_CONFLICT_ERROR, DUPLICATE_KEY_EXCEPTION, ERR_INTERNAL, ERR_LOWERBOUND, ERR_NOERROR, ERR_UPPERBOUND, NOT_ENOUGH_ELEMENTS_ERROR, REMOVE_VETO_EXCEPTION
 
Constructor Summary
DefaultRemoveCatalogItemStrategy(Catalog c)
          Create a new DefaultRemoveCatalogItemStrategy.
 
Method Summary
protected  void doRemove(SaleProcess p, CatalogItem ci, DataBasket db)
          Perform the actual removal.
protected  Gate getCheckGate(SingleTableFormSheet stfs)
          Get the Gate that checks whether the removal is allowed.
protected  String getConfirmationCaption(SingleTableFormSheet stfs, CatalogItem ci)
          Get the caption for the default confirmation MsgForm.
protected  String getConfirmationText(SingleTableFormSheet stfs, CatalogItem ci)
          Get the text for the default confirmation MsgForm.
 Transition getEditProcess(SingleTableFormSheet stfs, SaleProcess p, SalesPoint sp)
          Get the first transition of the process that will perform the editing.
protected  Transition getRemoveTransition(SingleTableFormSheet stfs)
          Get the transition that performs the actual removal.
 
Methods inherited from class sale.stdforms.FormSheetStrategy
error, setErrorHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_cCatalog

protected Catalog m_cCatalog
The Catalog that is being edited.

Constructor Detail

DefaultRemoveCatalogItemStrategy

public DefaultRemoveCatalogItemStrategy(Catalog c)
Create a new DefaultRemoveCatalogItemStrategy.

Parameters:
c - the Catalog to be edited. Must be the same that is displayed by the SingleTableFormSheet.
Method Detail

getEditProcess

public Transition getEditProcess(SingleTableFormSheet stfs,
                                 SaleProcess p,
                                 SalesPoint sp)
Description copied from class: EditButtonStrategy
Get the first transition of the process that will perform the editing. The process can have any number of Gates and Transitions and display any number of Form- and MenuSheets. Normally, the sub-process should end at the gate at which the SingleTableFormSheet is being displayed, which can be obtained by SingleTableFormSheet.getGate().

Specified by:
getEditProcess in class EditButtonStrategy
Parameters:
stfs - the SingleTableFormSheet that triggers the sub-process.
p - the process into which the sub-process will be implanted.
sp - the SalesPoint at which the FormSheet is displayed, if any.
Override:
Never

getCheckGate

protected Gate getCheckGate(SingleTableFormSheet stfs)
Get the Gate that checks whether the removal is allowed. If this is the case, the Gate must be left through getRemoveTransition(data.stdforms.SingleTableFormSheet), otherwise, a transition to the SingleTableFormSheet's gate should be triggered.

Parameters:
stfs - the FormSheet that triggered the operation.
Override:
Sometimes The default implementation puts up a MsgForm asking for the user to confirm the removal. Caption and text of the message are obtained via getConfirmationCaption(data.stdforms.SingleTableFormSheet, data.CatalogItem) and getConfirmationText(data.stdforms.SingleTableFormSheet, data.CatalogItem), resp.

getConfirmationCaption

protected String getConfirmationCaption(SingleTableFormSheet stfs,
                                        CatalogItem ci)
Get the caption for the default confirmation MsgForm.

Parameters:
stfs - the FormSheet that triggered the operation.
ci - the CatalogItem that is going to be removed.
Override:
Sometimes The default implementation returns (stfs.getCaption() + " - Confirmation").

getConfirmationText

protected String getConfirmationText(SingleTableFormSheet stfs,
                                     CatalogItem ci)
Get the text for the default confirmation MsgForm.

Parameters:
stfs - the FormSheet that triggered the operation.
ci - the CatalogItem that is going to be removed.
Override:
Sometimes The default implementation returns ("Are you sure, you want to remove \"" + ci.getName() + "\"?").

getRemoveTransition

protected Transition getRemoveTransition(SingleTableFormSheet stfs)
Get the transition that performs the actual removal. This basically calls doRemove(sale.SaleProcess, data.CatalogItem, data.DataBasket).

Parameters:
stfs - the FormSheet that triggered the operation.
Override:
Never Instead, override doRemove(sale.SaleProcess, data.CatalogItem, data.DataBasket).

doRemove

protected void doRemove(SaleProcess p,
                        CatalogItem ci,
                        DataBasket db)
Perform the actual removal.

Any error condition should be passed on to FormSheetStrategy.error(sale.SaleProcess, int) in FormSheetStrategy.

Parameters:
p - the process in which this sub-process will be implanted.
ci - the CatalogItem to be removed. Can be null.
db - the DataBasket relative to which to perform the operation.
Override:
Sometimes

SalesPoint Framework v3.1