package data.events;

import util.*;

/**
  * An <i>abstract</i> adapter class for receiving catalog change events. The methods in this class are empty.
  * This class exists as convenience for creating listener objects.
  *
  * <p>Extend this class to create a CatalogChangeEvent listener and override the methods for the events of
  * interest. (If you implement the CatalogChangeListener 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.)</p>
  *
  * <p>Create a listener object using the extended class and then register it with a ListenableCatalog using
  * the Catalog's {@link data.ListenableCatalog#addCatalogChangeListener} method. When the Catalog's contents
  * change, the relevant method in the listener object is invoked, and a {@link CatalogChangeEvent} is passed
  * to it.</p>
  *
  * @author Steffen Zschaler
  * @version 2.0 19/08/1999
  * @since v2.0
  */
public abstract class CatalogChangeAdapter extends Object implements CatalogChangeListener, SerializableListener {

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

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

  /**
    * Called whenever the adding of a CatalogItem was rolled back.
    *
    * @override Sometimes
    *
    * @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 Sometimes
    *
    * @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 Sometimes
    *
    * @param e an event object describing the event.
    */
  public void noRemoveCatalogItem (CatalogChangeEvent e) {}

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

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

  /**
    * Called whenever the removal of a CatalogItem was rolled back.
    *
    * @override Sometimes
    *
    * @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 Sometimes
    *
    * @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 Sometimes
    *
    * @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 Sometimes
    *
    * @param e an event object describing the event.
    */
  public void editingCatalogItem (CatalogChangeEvent e) {}

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

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