package data.events;

import java.util.*;

/**
  * Listener listening for StockChangeEvents.
  *
  * @author Steffen Zschaler
  * @version 2.0 19/08/1999
  * @since v2.0
  */
public interface StockChangeListener extends EventListener {

  /**
    * Called whenever StockItems were added to the Stock.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void addedStockItems (StockChangeEvent e);

  /**
    * Called whenever the adding of StockItems was commited.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void commitAddStockItems (StockChangeEvent e);

  /**
    * Called whenever the adding of StockItems was rolled back.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void rollbackAddStockItems (StockChangeEvent e);

  /**
    * 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 {@link #noRemoveStockItems noRemoveStockItems}
    * event.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    *
    * @exception VetoException if the listener wants to veto the removal.
    */
  public void canRemoveStockItems (StockChangeEvent e) throws VetoException;

  /**
    * Called for each listener that already agreed with a removal that was then rejected by another listener.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void noRemoveStockItems (StockChangeEvent e);

  /**
    * Called whenever StockItems were removed from the Stock.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void removedStockItems (StockChangeEvent e);

  /**
    * Called whenever the removal of StockItems was commited.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void commitRemoveStockItems (StockChangeEvent e);

  /**
    * Called whenever the removal of StockItems was rolled back.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void rollbackRemoveStockItems (StockChangeEvent e);

  /**
    * 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 {@link #noEditStockItems noEditStockItems}
    * event.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    *
    * @exception VetoException if the listener wants to veto the editing.
    */
  public void canEditStockItems (StockChangeEvent e) throws VetoException;

  /**
    * Called for each listener that already agreed with an editing that was then rejected by another listener.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void noEditStockItems (StockChangeEvent e);

  /**
    * Called whenever the Stock began editing StockItems. This event may be accompanied by a
    * <code>removedStockItems</code> and a <code>addedStockItems</code> event, but this is implementation
    * specific.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void editingStockItems (StockChangeEvent e);

  /**
    * Called whenever the editing of StockItems was commited.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void commitEditStockItems (StockChangeEvent e);

  /**
    * Called whenever the editing of StockItems was rolled back.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void rollbackEditStockItems (StockChangeEvent e);
}