SalesPoint Framework v3.0

data.filters
Class AbstractStockFilter

java.lang.Object
  |
  +--data.filters.AbstractStockFilter
Direct Known Subclasses:
CountingStockFilter, StoringStockFilter

public abstract class AbstractStockFilter
extends Object
implements ListenableStock, StockChangeListener

Abstract superclass of all Stock filters. By using a Stock filter you can present partial views of a Stock to certain parts of your application, e.g., to the GUI elements. However, you cannot use this Stock as a replacement for a 'real' Stock, e.g., as an item in another Stock.

The concrete filter condition is implemented by subclassing either CountingStockFilter or StoringStockFilter and overriding some method. The concrete semantics is documented with the concrete subclass of AbstractStockFilter.

Since:
v2.0
Version:
2.0 19/08/1999
Author:
Steffen Zschaler
See Also:
Serialized Form

Field Summary
protected  ListenerHelper m_lhListeners
          The list of listeners of this Stock.
protected  Stock m_stSource
          The Stock that gets filtered.
 
Constructor Summary
protected AbstractStockFilter(Stock stSource)
          Create a new AbstractStockFilter.
 
Method Summary
 void add(StockItem si, DataBasket db)
          Add the given item to the source Stock.
 void addedStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 void addNameListener(PropertyChangeListener pcl)
          Register the listener with the source Stock.
 void addPropertyChangeListener(PropertyChangeListener pcl)
          Register the listener with the source Stock.
 void addStock(Stock st, DataBasket db, boolean fRemove)
          Add the given Stock to the source Stock.
 void addStockChangeListener(StockChangeListener scl)
          Register a listener that will receive events when the Stock's contents change.
 NameContext attach(NameContext nc)
          Attach the NameContext to the source Stock.
 void canEditStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 void canRemoveStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
abstract  Object clone()
           
 void commitAddStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 void commitEditStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 void commitRemoveStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 int compareTo(Object o)
          Compare the source Stock to the object.
 boolean contains(String sKey, DataBasket db)
          Returns (countItems (sKey, db) >= 0).
 NameContext detachNC()
          Detach the current NameContext from the source Stock.
 void editingStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 Value fillStockWithValue(DataBasket db, Value vTarget, StockFromValueCreator sfvc)
          Fill the source Stock.
protected  void fireCanEditStockItems(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireCanRemoveStockItems(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireEditingStockItems(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsAddCommit(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsAdded(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsAddRollback(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsEditCommit(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsEditRollback(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsNoEdit(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsNoRemove(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsRemoveCommit(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsRemoved(StockChangeEvent e)
          Fire an event to any listeners.
protected  void fireStockItemsRemoveRollback(StockChangeEvent e)
          Fire an event to any listeners.
 CatalogItem getAssociatedItem(DataBasket db)
          Get the source Stock's associated item.
 Catalog getCatalog(DataBasket db)
          Get the source Stock's Catalog.
 Stock getMainStock()
          Get the source stock.
 String getName()
          Get the source Stock's name.
 Stock getStock()
          Get the source Stock's Stock.
 Iterator iterator(DataBasket db, boolean fForEdit)
          Create an iterator that will return all items that match the condition.
 Set keySet(DataBasket db)
          Get a filtered key set.
 void noEditStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 void noRemoveStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 StockItem remove(StockItem si, DataBasket db)
          Remove the given item from the source Stock.
 StockItem remove(String sKey, DataBasket db)
          Remove the given item from the source Stock.
 void removedStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 void removeNameListener(PropertyChangeListener pcl)
          Un-Register the listener with the source Stock.
 void removePropertyChangeListener(PropertyChangeListener pcl)
          Un-Register the listener with the source Stock.
 void removeStockChangeListener(StockChangeListener scl)
          Un-Register a listener that received events when the Stock's contents changed.
 void rollbackAddStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 void rollbackEditStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 void rollbackRemoveStockItems(StockChangeEvent e)
          Receive the event from the source Stock, translate and propagate it to any listeners.
 void setName(String sName, DataBasket db)
          Set the source Stock's name.
 int size(DataBasket db)
          Calculate the size of the source Stock, considering only items that match the condition.
 Value sumStock(DataBasket db, CatalogItemValue civ, Value vInit)
          Calculate the total value of the Stock, evaluating only items that match the condition.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_stSource

protected Stock m_stSource
The Stock that gets filtered.

m_lhListeners

protected ListenerHelper m_lhListeners
The list of listeners of this Stock.
Constructor Detail

AbstractStockFilter

protected AbstractStockFilter(Stock stSource)
Create a new AbstractStockFilter. May only be called by subclasses.
Parameters:
stSource - the Stock to be filtered.
Method Detail

add

public void add(StockItem si,
                DataBasket db)
Add the given item to the source Stock.
Override:
Never.

addStock

public void addStock(Stock st,
                     DataBasket db,
                     boolean fRemove)
Add the given Stock to the source Stock.
Override:
Never.

contains

public boolean contains(String sKey,
                        DataBasket db)
Returns (countItems (sKey, db) >= 0).
Override:
Sometimes.

remove

public StockItem remove(String sKey,
                        DataBasket db)
                 throws VetoException
Remove the given item from the source Stock.
Override:
Never.

remove

public StockItem remove(StockItem si,
                        DataBasket db)
                 throws VetoException
Remove the given item from the source Stock.
Override:
Never.

iterator

public Iterator iterator(DataBasket db,
                         boolean fForEdit)
Create an iterator that will return all items that match the condition.
Override:
Never.

keySet

public Set keySet(DataBasket db)
Get a filtered key set.
Override:
Never.

sumStock

public Value sumStock(DataBasket db,
                      CatalogItemValue civ,
                      Value vInit)
Calculate the total value of the Stock, evaluating only items that match the condition.
Override:
Never.

fillStockWithValue

public Value fillStockWithValue(DataBasket db,
                                Value vTarget,
                                StockFromValueCreator sfvc)
Fill the source Stock.
Override:
Never.

size

public int size(DataBasket db)
Calculate the size of the source Stock, considering only items that match the condition.
Override:
Never.

getCatalog

public Catalog getCatalog(DataBasket db)
Get the source Stock's Catalog.
Override:
Never.

getStock

public Stock getStock()
Get the source Stock's Stock.
Override:
Never.

getMainStock

public Stock getMainStock()
Get the source stock. If the source stock is a StockFilter again, return this Stock's MainStock.
Override:
Never.

getAssociatedItem

public CatalogItem getAssociatedItem(DataBasket db)
Get the source Stock's associated item.
Override:
Never.

attach

public NameContext attach(NameContext nc)
Attach the NameContext to the source Stock.
Override:
Never.

detachNC

public NameContext detachNC()
Detach the current NameContext from the source Stock.
Override:
Never.

setName

public void setName(String sName,
                    DataBasket db)
             throws NameContextException
Set the source Stock's name.
Override:
Never.

getName

public String getName()
Get the source Stock's name.
Override:
Never.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener pcl)
Register the listener with the source Stock.
Override:
Never.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener pcl)
Un-Register the listener with the source Stock.
Override:
Never.

addNameListener

public void addNameListener(PropertyChangeListener pcl)
Register the listener with the source Stock.
Override:
Never.

removeNameListener

public void removeNameListener(PropertyChangeListener pcl)
Un-Register the listener with the source Stock.
Override:
Never.

compareTo

public int compareTo(Object o)
Compare the source Stock to the object.
Override:
Never.

clone

public abstract Object clone()
Override:
Always.
Overrides:
clone in class Object

addStockChangeListener

public void addStockChangeListener(StockChangeListener scl)
Register a listener that will receive events when the Stock's contents change.
Override:
Never.
Specified by:
addStockChangeListener in interface ListenableStock

removeStockChangeListener

public void removeStockChangeListener(StockChangeListener scl)
Un-Register a listener that received events when the Stock's contents changed.
Override:
Never.
Specified by:
removeStockChangeListener in interface ListenableStock

addedStockItems

public void addedStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
addedStockItems in interface StockChangeListener

commitAddStockItems

public void commitAddStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
commitAddStockItems in interface StockChangeListener

rollbackAddStockItems

public void rollbackAddStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
rollbackAddStockItems in interface StockChangeListener

canRemoveStockItems

public void canRemoveStockItems(StockChangeEvent e)
                         throws VetoException
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
canRemoveStockItems in interface StockChangeListener

noRemoveStockItems

public void noRemoveStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
noRemoveStockItems in interface StockChangeListener

removedStockItems

public void removedStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
removedStockItems in interface StockChangeListener

commitRemoveStockItems

public void commitRemoveStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
commitRemoveStockItems in interface StockChangeListener

rollbackRemoveStockItems

public void rollbackRemoveStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
rollbackRemoveStockItems in interface StockChangeListener

canEditStockItems

public void canEditStockItems(StockChangeEvent e)
                       throws VetoException
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
canEditStockItems in interface StockChangeListener

noEditStockItems

public void noEditStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
noEditStockItems in interface StockChangeListener

editingStockItems

public void editingStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
editingStockItems in interface StockChangeListener

commitEditStockItems

public void commitEditStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
commitEditStockItems in interface StockChangeListener

rollbackEditStockItems

public void rollbackEditStockItems(StockChangeEvent e)
Receive the event from the source Stock, translate and propagate it to any listeners.
Override:
Never.
Specified by:
rollbackEditStockItems in interface StockChangeListener

fireStockItemsAdded

protected void fireStockItemsAdded(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireStockItemsAddCommit

protected void fireStockItemsAddCommit(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireStockItemsAddRollback

protected void fireStockItemsAddRollback(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireStockItemsNoRemove

protected void fireStockItemsNoRemove(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireStockItemsRemoved

protected void fireStockItemsRemoved(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireStockItemsRemoveCommit

protected void fireStockItemsRemoveCommit(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireStockItemsRemoveRollback

protected void fireStockItemsRemoveRollback(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireCanRemoveStockItems

protected void fireCanRemoveStockItems(StockChangeEvent e)
                                throws VetoException
Fire an event to any listeners.
Override:
Never.

fireCanEditStockItems

protected void fireCanEditStockItems(StockChangeEvent e)
                              throws VetoException
Fire an event to any listeners.
Override:
Never.

fireStockItemsNoEdit

protected void fireStockItemsNoEdit(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireEditingStockItems

protected void fireEditingStockItems(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireStockItemsEditCommit

protected void fireStockItemsEditCommit(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

fireStockItemsEditRollback

protected void fireStockItemsEditRollback(StockChangeEvent e)
Fire an event to any listeners.
Override:
Never.

SalesPoint Framework v3.0