SalesPoint v3.3 API

data.events
Class StockChangeAdapter<T extends StockItem,CT extends CatalogItem>

java.lang.Object
  extended by data.events.StockChangeAdapter<T,CT>
All Implemented Interfaces:
StockChangeListener<T,CT>, Serializable, EventListener, SerializableListener

public class StockChangeAdapter<T extends StockItem,CT extends CatalogItem>
extends Object
implements StockChangeListener<T,CT>, SerializableListener

An abstract adapter class for receiving stock change events. The methods in this class are empty. This class exists as convenience for creating listener objects.

Extend this class to create a StockChangeEvent listener and override the methods for the events of interest. (If you implement the StockChangeListener interface, you have to define all of the methods in it. This abstract class defines empty method bodies for them all, so you can concentrate on defining methods only for events you care about.)

Create a listener object using the extended class and then register it with a ListenableStock using the Stock's ListenableStock.addStockChangeListener(data.events.StockChangeListener) method. When the Stock's contents change, the relevant method in the listener object is invoked, and a StockChangeEvent is passed to it.

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

Constructor Summary
StockChangeAdapter()
           
 
Method Summary
 void addedStockItems(StockChangeEvent<T,CT> e)
          Called whenever StockItems were added to the Stock.
 void canEditStockItems(StockChangeEvent<T,CT> e)
          Called to ask whether certain StockItems may be edited.
 void canRemoveStockItems(StockChangeEvent<T,CT> e)
          Called to ask whether certain StockItems may be removed.
 void commitAddStockItems(StockChangeEvent<T,CT> e)
          Called whenever the adding of StockItems was commited.
 void commitEditStockItems(StockChangeEvent<T,CT> e)
          Called whenever the editing of StockItems was commited.
 void commitRemoveStockItems(StockChangeEvent<T,CT> e)
          Called whenever the removal of StockItems was commited.
 void editingStockItems(StockChangeEvent<T,CT> e)
          Called whenever the Stock began editing StockItems.
 void noEditStockItems(StockChangeEvent<T,CT> e)
          Called for each listener that already agreed with an editing that was then rejected by another listener.
 void noRemoveStockItems(StockChangeEvent<T,CT> e)
          Called for each listener that already agreed with a removal that was then rejected by another listener.
 void removedStockItems(StockChangeEvent<T,CT> e)
          Called whenever StockItems were removed from the Stock.
 void rollbackAddStockItems(StockChangeEvent<T,CT> e)
          Called whenever the adding of StockItems was rolled back.
 void rollbackEditStockItems(StockChangeEvent<T,CT> e)
          Called whenever the editing of StockItems was rolled back.
 void rollbackRemoveStockItems(StockChangeEvent<T,CT> e)
          Called whenever the removal of StockItems was rolled back.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StockChangeAdapter

public StockChangeAdapter()
Method Detail

addedStockItems

public void addedStockItems(StockChangeEvent<T,CT> e)
Called whenever StockItems were added to the Stock.

Specified by:
addedStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

commitAddStockItems

public void commitAddStockItems(StockChangeEvent<T,CT> e)
Called whenever the adding of StockItems was commited.

Specified by:
commitAddStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

rollbackAddStockItems

public void rollbackAddStockItems(StockChangeEvent<T,CT> e)
Called whenever the adding of StockItems was rolled back.

Specified by:
rollbackAddStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

canRemoveStockItems

public void canRemoveStockItems(StockChangeEvent<T,CT> e)
                         throws VetoException
Called to ask whether certain StockItems may be removed. If one of the listeners vetos the removal, all listeners that had already been asked will receive a noRemoveStockItems event.

Specified by:
canRemoveStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Throws:
VetoException - if the listener wants to veto the removal.
Override:
Sometimes

noRemoveStockItems

public void noRemoveStockItems(StockChangeEvent<T,CT> e)
Called for each listener that already agreed with a removal that was then rejected by another listener.

Specified by:
noRemoveStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

removedStockItems

public void removedStockItems(StockChangeEvent<T,CT> e)
Called whenever StockItems were removed from the Stock.

Specified by:
removedStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

commitRemoveStockItems

public void commitRemoveStockItems(StockChangeEvent<T,CT> e)
Called whenever the removal of StockItems was commited.

Specified by:
commitRemoveStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

rollbackRemoveStockItems

public void rollbackRemoveStockItems(StockChangeEvent<T,CT> e)
Called whenever the removal of StockItems was rolled back.

Specified by:
rollbackRemoveStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

canEditStockItems

public void canEditStockItems(StockChangeEvent<T,CT> e)
                       throws VetoException
Called to ask whether certain StockItems may be edited. If one of the listeners vetos the editing, all listeners that had already been asked will receive a noEditStockItems event.

Specified by:
canEditStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Throws:
VetoException - if the listener wants to veto the editing.
Override:
Sometimes

noEditStockItems

public void noEditStockItems(StockChangeEvent<T,CT> e)
Called for each listener that already agreed with an editing that was then rejected by another listener.

Specified by:
noEditStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

editingStockItems

public void editingStockItems(StockChangeEvent<T,CT> e)
Called whenever the Stock began editing StockItems. This event may be accompanied by a removedStockItems and a addedStockItems event, but this is implementation specific.

Specified by:
editingStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

commitEditStockItems

public void commitEditStockItems(StockChangeEvent<T,CT> e)
Called whenever the editing of StockItems was commited.

Specified by:
commitEditStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

rollbackEditStockItems

public void rollbackEditStockItems(StockChangeEvent<T,CT> e)
Called whenever the editing of StockItems was rolled back.

Specified by:
rollbackEditStockItems in interface StockChangeListener<T extends StockItem,CT extends CatalogItem>
Parameters:
e - an event object describing the event.
Override:
Sometimes

SalesPoint v3.3 API