|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object data.filters.AbstractStockFilter<T,CT>
public abstract class AbstractStockFilter<T extends StockItem,CT extends CatalogItem>
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.
Field Summary | |
---|---|
protected ListenerHelper |
m_lhListeners
The list of listeners of this Stock. |
protected Stock<T,CT> |
m_stSource
The Stock that gets filtered. |
Fields inherited from interface data.Nameable |
---|
NAME_PROPERTY |
Constructor Summary | |
---|---|
protected |
AbstractStockFilter(Stock<T,CT> stSource)
Create a new AbstractStockFilter. |
Method Summary | |
---|---|
void |
add(T si,
DataBasket db)
Add the given item to the source Stock. |
void |
addedStockItems(StockChangeEvent<T,CT> 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<T,CT> 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<T,CT> e)
Receive the event from the source Stock, translate and propagate it to any listeners. |
void |
canRemoveStockItems(StockChangeEvent<T,CT> e)
Receive the event from the source Stock, translate and propagate it to any listeners. |
abstract Object |
clone()
Clone the StockItem. |
void |
commitAddStockItems(StockChangeEvent<T,CT> e)
Receive the event from the source Stock, translate and propagate it to any listeners. |
void |
commitEditStockItems(StockChangeEvent<T,CT> e)
Receive the event from the source Stock, translate and propagate it to any listeners. |
void |
commitRemoveStockItems(StockChangeEvent<T,CT> 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<T,CT> 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<T,CT> e)
Fire an event to any listeners. |
protected void |
fireCanRemoveStockItems(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireEditingStockItems(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsAddCommit(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsAdded(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsAddRollback(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsEditCommit(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsEditRollback(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsNoEdit(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsNoRemove(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsRemoveCommit(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsRemoved(StockChangeEvent<T,CT> e)
Fire an event to any listeners. |
protected void |
fireStockItemsRemoveRollback(StockChangeEvent<T,CT> 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<T> |
iterator(DataBasket db,
boolean fForEdit)
Create an iterator that will return all items that match the condition. |
Set<String> |
keySet(DataBasket db)
Get a filtered key set. |
void |
noEditStockItems(StockChangeEvent<T,CT> e)
Receive the event from the source Stock, translate and propagate it to any listeners. |
void |
noRemoveStockItems(StockChangeEvent<T,CT> e)
Receive the event from the source Stock, translate and propagate it to any listeners. |
StockItem |
remove(String sKey,
DataBasket db)
Remove the given item from the source Stock. |
StockItem |
remove(T si,
DataBasket db)
Remove the given item from the source Stock. |
void |
removedStockItems(StockChangeEvent<T,CT> 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<T,CT> e)
Receive the event from the source Stock, translate and propagate it to any listeners. |
void |
rollbackEditStockItems(StockChangeEvent<T,CT> e)
Receive the event from the source Stock, translate and propagate it to any listeners. |
void |
rollbackRemoveStockItems(StockChangeEvent<T,CT> 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 |
Methods inherited from interface data.Stock |
---|
contains, containsStock, countItems, get |
Field Detail |
---|
protected Stock<T extends StockItem,CT extends CatalogItem> m_stSource
protected ListenerHelper m_lhListeners
Constructor Detail |
---|
protected AbstractStockFilter(Stock<T,CT> stSource)
stSource
- the Stock to be filtered.Method Detail |
---|
public void add(T si, DataBasket db)
add
in interface Stock<T extends StockItem,CT extends CatalogItem>
si
- the item to be added.db
- the DataBasket relative to which the item will be added.public void addStock(Stock<T,CT> st, DataBasket db, boolean fRemove)
addStock
in interface Stock<T extends StockItem,CT extends CatalogItem>
st
- the Stock whose contents is to be added to this Stock.db
- the DataBasket relative to which to perform the actions. addStock
will add all
items from the source Stock that are visible using this DataBasket.fRemove
- if true, the items will be removed from the source Stock prior to adding them to this
Stock. Otherwise, they will be cloned prior to adding them to the Stock.public boolean contains(String sKey, DataBasket db)
(countItems (sKey, db) >= 0)
.
contains
in interface Stock<T extends StockItem,CT extends CatalogItem>
sKey
- the key for which to check containment.db
- the DataBasket used to check visibility.public StockItem remove(String sKey, DataBasket db) throws VetoException
remove
in interface Stock<T extends StockItem,CT extends CatalogItem>
sKey
- the key for which to remove an item.db
- the DataBasket relative to which to remove the item.
VetoException
- if a listener vetoed the removal.public StockItem remove(T si, DataBasket db) throws VetoException
remove
in interface Stock<T extends StockItem,CT extends CatalogItem>
si
- the StockItem to be removed.db
- the DataBasket relative to which to remove the item.
VetoException
- if a listener vetoed the removal.public Iterator<T> iterator(DataBasket db, boolean fForEdit)
iterator
in interface Stock<T extends StockItem,CT extends CatalogItem>
db
- the DataBasket relative to which to retrieve the StockItems.fForEdit
- if true, the StockItems will be retrieved for editing.public Set<String> keySet(DataBasket db)
keySet
in interface Stock<T extends StockItem,CT extends CatalogItem>
db
- the DataBasket used for determining visibility.public Value sumStock(DataBasket db, CatalogItemValue civ, Value vInit)
sumStock
in interface Stock<T extends StockItem,CT extends CatalogItem>
db
- the DataBasket that is used to determine visibility.civ
- the CatalogItemValue used for determining the value of a CatalogItem.vInit
- the initial value. The sum of the Stock will be added to this value.
vInit
, only with a changed value.public Value fillStockWithValue(DataBasket db, Value vTarget, StockFromValueCreator sfvc)
fillStockWithValue
in interface Stock<T extends StockItem,CT extends CatalogItem>
db
- the DataBasket relative to which to perform the operation.vTarget
- the value by which to increase the Stock's total value.sfvc
- the strategy used to fill the Stock.
public int size(DataBasket db)
size
in interface Stock<T extends StockItem,CT extends CatalogItem>
db
- the DataBasket used to determine visibility.public Catalog getCatalog(DataBasket db)
getCatalog
in interface Stock<T extends StockItem,CT extends CatalogItem>
db
- a DataBasket determinig visibility of the stock's catalog.public Stock getStock()
getStock
in interface StockItem
public Stock getMainStock()
public CatalogItem getAssociatedItem(DataBasket db)
getAssociatedItem
in interface StockItem
db
- the DataBasket that is used for checking visibility.public NameContext attach(NameContext nc)
attach
in interface Nameable
nc
- the new NameContext of this Nameable object.
public NameContext detachNC()
detachNC
in interface Nameable
public void setName(String sName, DataBasket db) throws NameContextException
setName
in interface Nameable
sName
- the new name of the objectdb
- the DataBasket relative to which the operation is to be performed.
NameContextException
- if the name change was not approved of by the NameContext.NameContext
public String getName()
getName
in interface Nameable
public void addPropertyChangeListener(PropertyChangeListener pcl)
addPropertyChangeListener
in interface Nameable
public void removePropertyChangeListener(PropertyChangeListener pcl)
removePropertyChangeListener
in interface Nameable
public void addNameListener(PropertyChangeListener pcl)
addNameListener
in interface Nameable
public void removeNameListener(PropertyChangeListener pcl)
removeNameListener
in interface Nameable
public int compareTo(Object o)
compareTo
in interface Comparable<Object>
public abstract Object clone()
StockItem
clone
in interface StockItem
clone
in class Object
public void addStockChangeListener(StockChangeListener scl)
addStockChangeListener
in interface ListenableStock<T extends StockItem,CT extends CatalogItem>
scl
- the listenerpublic void removeStockChangeListener(StockChangeListener scl)
removeStockChangeListener
in interface ListenableStock<T extends StockItem,CT extends CatalogItem>
scl
- the listenerpublic void addedStockItems(StockChangeEvent<T,CT> e)
addedStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void commitAddStockItems(StockChangeEvent<T,CT> e)
commitAddStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void rollbackAddStockItems(StockChangeEvent<T,CT> e)
rollbackAddStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void canRemoveStockItems(StockChangeEvent<T,CT> e) throws VetoException
canRemoveStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.
VetoException
- if the listener wants to veto the removal.public void noRemoveStockItems(StockChangeEvent<T,CT> e)
noRemoveStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void removedStockItems(StockChangeEvent<T,CT> e)
removedStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void commitRemoveStockItems(StockChangeEvent<T,CT> e)
commitRemoveStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void rollbackRemoveStockItems(StockChangeEvent<T,CT> e)
rollbackRemoveStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void canEditStockItems(StockChangeEvent<T,CT> e) throws VetoException
canEditStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.
VetoException
- if the listener wants to veto the editing.public void noEditStockItems(StockChangeEvent<T,CT> e)
noEditStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void editingStockItems(StockChangeEvent<T,CT> e)
editingStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void commitEditStockItems(StockChangeEvent<T,CT> e)
commitEditStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.public void rollbackEditStockItems(StockChangeEvent<T,CT> e)
rollbackEditStockItems
in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
e
- an event object describing the event.protected void fireStockItemsAdded(StockChangeEvent<T,CT> e)
protected void fireStockItemsAddCommit(StockChangeEvent<T,CT> e)
protected void fireStockItemsAddRollback(StockChangeEvent<T,CT> e)
protected void fireStockItemsNoRemove(StockChangeEvent<T,CT> e)
protected void fireStockItemsRemoved(StockChangeEvent<T,CT> e)
protected void fireStockItemsRemoveCommit(StockChangeEvent<T,CT> e)
protected void fireStockItemsRemoveRollback(StockChangeEvent<T,CT> e)
protected void fireCanRemoveStockItems(StockChangeEvent<T,CT> e) throws VetoException
VetoException
protected void fireCanEditStockItems(StockChangeEvent<T,CT> e) throws VetoException
VetoException
protected void fireStockItemsNoEdit(StockChangeEvent<T,CT> e)
protected void fireEditingStockItems(StockChangeEvent<T,CT> e)
protected void fireStockItemsEditCommit(StockChangeEvent<T,CT> e)
protected void fireStockItemsEditRollback(StockChangeEvent<T,CT> e)
|
SalesPoint v3.3 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |