package data.events;

/**
  * A listener listening for CatalogChangeEvents.
  *
  * @author Steffen Zschaler
  * @version 2.0 19/08/1999
  * @since v2.0
  */
public interface CatalogChangeListener extends java.util.EventListener {

  /**
    * Called whenever a CatalogItem was added to the Catalog.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void addedCatalogItem (CatalogChangeEvent e);

  /**
    * Called whenever the adding of a CatalogItem was commited.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void commitedAddCatalogItem (CatalogChangeEvent e);

  /**
    * Called whenever the adding of a CatalogItem was rolled back.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void rolledbackAddCatalogItem (CatalogChangeEvent e);

  /**
    * Called to ask whether a CatalogItem may be removed. If one of the listeners vetos the removal, all
    * listeners that had already been asked will receive a {@link #noRemoveCatalogItem noRemoveCatalogItem}
    * event.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    *
    * @exception VetoException if the listener wants to veto the removal.
    */
  public void canRemoveCatalogItem (CatalogChangeEvent 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 noRemoveCatalogItem (CatalogChangeEvent e);

  /**
    * Called whenever a CatalogItem was removed from the Catalog.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void removedCatalogItem (CatalogChangeEvent e);

  /**
    * Called whenever the removal of a CatalogItem was commited.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void commitedRemoveCatalogItem (CatalogChangeEvent e);

  /**
    * Called whenever the removal of a CatalogItem was rolled back.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void rolledbackRemoveCatalogItem (CatalogChangeEvent e);

  /**
    * Called to ask whether a CatalogItem may be edited. If one of the listeners vetos the editing, all
    * steners that had already been asked will receive a {@link #noEditCatalogItem noEditCatalogItem} event.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    *
    * @exception VetoException if the listener wants to veto the editing.
    */
  public void canEditCatalogItem (CatalogChangeEvent 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 noEditCatalogItem (CatalogChangeEvent e);

  /**
    * Called whenever editing a CatalogItem was started. This event may be accompanied by a
    * <code>removedCatalogItem</code> and a <code>addedCatalogItem</code> event, but this is implementation
    * specific.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void editingCatalogItem (CatalogChangeEvent e);

  /**
    * Called whenever editing a CatalogItem was commited.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void commitEditCatalogItem (CatalogChangeEvent e);

  /**
    * Called whenever editing a CatalogItem was rolled back.
    *
    * @override Always
    *
    * @param e an event object describing the event.
    */
  public void rollbackEditCatalogItem (CatalogChangeEvent e);
}