SalesPoint Framework v3.0

data.stdforms.singletableformsheet
Class AbstractAddCatalogItemStrategy

java.lang.Object
  |
  +--sale.stdforms.FormSheetStrategy
        |
        +--data.stdforms.singletableformsheet.EditButtonStrategy
              |
              +--data.stdforms.singletableformsheet.AbstractAddCatalogItemStrategy

public abstract class AbstractAddCatalogItemStrategy
extends EditButtonStrategy

A strategy that can be attached to the "Add" button of a SingleTableFormSheet that displays a Catalog's contents.

This strategy is abstract since the creation of the CatalogItem is application specific. It must be defined by overriding createCatalogItem(java.lang.String).

Hooks:
Adding Items To Container - Button
Since:
v2.0
Version:
2.0 20/08/1999
Author:
Steffen Zschaler
See Also:
Serialized Form

Inner classes inherited from class sale.stdforms.FormSheetStrategy
FormSheetStrategy.ErrorHandler
 
Field Summary
static String KEY_LABEL
          The resource bundle key of the label to be shown in the "Define Key" FormSheet.
protected  Catalog m_cCatalog
          The Catalog to be edited.
 
Fields inherited from class sale.stdforms.FormSheetStrategy
DEFAULT_ERROR_HANDLER, m_ehErrHandler, MSG_POPUP_ERROR_HANDLER
 
Constructor Summary
AbstractAddCatalogItemStrategy(Catalog c)
          Create a new AbstractAddCatalogItemStrategy.
 
Method Summary
protected  void addToCatalog(SaleProcess p, CatalogItem ci)
          Add the specified CatalogItem to the Catalog.
protected abstract  CatalogItem createCatalogItem(String sKey)
          Create a new CatalogItem of the given key.
protected  Gate getCreateCIGate(SingleTableFormSheet stfs)
          Get the first Gate in the sub-process.
protected  Gate getEditCIGate(CatalogItem ci, SingleTableFormSheet stfs, Transition tOk)
          Get a Gate at which a newly created CatalogItem can be edited by the user.
 Transition getEditProcess(SingleTableFormSheet stfs, SaleProcess p, SalesPoint sp)
           
protected  String getNewKey(SingleTableFormSheet stfs, SaleProcess p)
          Get the key of the new item.
protected  String getResourceString(String sKey)
          Get the resource String for the specified key.
 
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

KEY_LABEL

public static final String KEY_LABEL
The resource bundle key of the label to be shown in the "Define Key" FormSheet.

m_cCatalog

protected Catalog m_cCatalog
The Catalog to be edited.
Constructor Detail

AbstractAddCatalogItemStrategy

public AbstractAddCatalogItemStrategy(Catalog c)
Create a new AbstractAddCatalogItemStrategy.
Parameters:
c - the Catalog to be edited. Must be the same that is displayed in the SingleTableFormSheet.
Method Detail

getEditProcess

public Transition getEditProcess(SingleTableFormSheet stfs,
                                 SaleProcess p,
                                 SalesPoint sp)
Override:
Never.
Overrides:
getEditProcess in class EditButtonStrategy

getCreateCIGate

protected Gate getCreateCIGate(SingleTableFormSheet stfs)
Get the first Gate in the sub-process. This Gate asks the user for the key of the new item, creates it in a new Transition and after editing the new item adds it to the Catalog.
Override:
Never.
Instead, override getNewKey(data.stdforms.SingleTableFormSheet, sale.SaleProcess), createCatalogItem(java.lang.String), getEditCIGate(data.CatalogItem, data.stdforms.SingleTableFormSheet, sale.Transition) and/or addToCatalog(sale.SaleProcess, data.CatalogItem).
Parameters:
stfs - the FormSheet that triggered the sub-process.

getNewKey

protected String getNewKey(SingleTableFormSheet stfs,
                           SaleProcess p)
                    throws InterruptedException
Get the key of the new item. Can assume that at a Gate.
Override:
Sometimes.
The default implementation pops up a FormSheet where the user can enter a new key.
Parameters:
stfs - the FormSheet that triggered the sub-process.
p - the process into which the sub-process was embedded.

createCatalogItem

protected abstract CatalogItem createCatalogItem(String sKey)
Create a new CatalogItem of the given key.
Override:
Always.
The contents of this method is application specific.
Parameters:
sKey - the key for which to create a new CatalogItem.
Returns:
the new CatalogItem.
Hooks:
Adding Items To Container - Button

getEditCIGate

protected Gate getEditCIGate(CatalogItem ci,
                             SingleTableFormSheet stfs,
                             Transition tOk)
Get a Gate at which a newly created CatalogItem can be edited by the user.
Override:
Sometimes.
The default implementation simply continues with tOk.
Parameters:
ci - the CatalogItem to be edited.
stfs - the FormSheet that triggered the sub-process. A transition to this FormSheet's gate must be leaving the Gate if the user cancels the operation.
tOk - the Transition that must be leaving the Gate if the user finished editing and did not cancel the operation or enter invalid data.

addToCatalog

protected void addToCatalog(SaleProcess p,
                            CatalogItem ci)
Add the specified CatalogItem to the Catalog.

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

Override:
Never.
Parameters:
p - the process into which the sub-process was embedded.
ci - the CatalogItem to be added to the Catalog.

getResourceString

protected String getResourceString(String sKey)
Get the resource String for the specified key.
Override:
Sometimes.
The default implementation returns ""Please specify the CatalogItem's key:"" if asked for KEY_LABEL.

SalesPoint Framework v3.0