001 package data.events;
002
003 import java.util.EventListener;
004
005 import data.CatalogItem;
006 import data.StockItem;
007
008 /**
009 * Listener listening for StockChangeEvents.
010 *
011 * @author Steffen Zschaler
012 * @version 2.0 19/08/1999
013 * @since v2.0
014 */
015 public interface StockChangeListener<T extends StockItem, CT extends CatalogItem> extends EventListener {
016
017 /**
018 * Called whenever StockItems were added to the Stock.
019 *
020 * @override Always
021 *
022 * @param e an event object describing the event.
023 */
024 public void addedStockItems(StockChangeEvent<T, CT> e);
025
026 /**
027 * Called whenever the adding of StockItems was commited.
028 *
029 * @override Always
030 *
031 * @param e an event object describing the event.
032 */
033 public void commitAddStockItems(StockChangeEvent<T, CT> e);
034
035 /**
036 * Called whenever the adding of StockItems was rolled back.
037 *
038 * @override Always
039 *
040 * @param e an event object describing the event.
041 */
042 public void rollbackAddStockItems(StockChangeEvent<T, CT> e);
043
044 /**
045 * Called to ask whether certain StockItems may be removed. If one of the listeners vetos the removal, all
046 * listeners that had already been asked will receive a {@link #noRemoveStockItems noRemoveStockItems}
047 * event.
048 *
049 * @override Always
050 *
051 * @param e an event object describing the event.
052 *
053 * @exception VetoException if the listener wants to veto the removal.
054 */
055 public void canRemoveStockItems(StockChangeEvent<T, CT> e) throws VetoException;
056
057 /**
058 * Called for each listener that already agreed with a removal that was then rejected by another listener.
059 *
060 * @override Always
061 *
062 * @param e an event object describing the event.
063 */
064 public void noRemoveStockItems(StockChangeEvent<T, CT> e);
065
066 /**
067 * Called whenever StockItems were removed from the Stock.
068 *
069 * @override Always
070 *
071 * @param e an event object describing the event.
072 */
073 public void removedStockItems(StockChangeEvent<T, CT> e);
074
075 /**
076 * Called whenever the removal of StockItems was commited.
077 *
078 * @override Always
079 *
080 * @param e an event object describing the event.
081 */
082 public void commitRemoveStockItems(StockChangeEvent<T, CT> e);
083
084 /**
085 * Called whenever the removal of StockItems was rolled back.
086 *
087 * @override Always
088 *
089 * @param e an event object describing the event.
090 */
091 public void rollbackRemoveStockItems(StockChangeEvent<T, CT> e);
092
093 /**
094 * Called to ask whether certain StockItems may be edited. If one of the listeners vetos the editing, all
095 * listeners that had already been asked will receive a {@link #noEditStockItems noEditStockItems}
096 * event.
097 *
098 * @override Always
099 *
100 * @param e an event object describing the event.
101 *
102 * @exception VetoException if the listener wants to veto the editing.
103 */
104 public void canEditStockItems(StockChangeEvent<T, CT> e) throws VetoException;
105
106 /**
107 * Called for each listener that already agreed with an editing that was then rejected by another listener.
108 *
109 * @override Always
110 *
111 * @param e an event object describing the event.
112 */
113 public void noEditStockItems(StockChangeEvent<T, CT> e);
114
115 /**
116 * Called whenever the Stock began editing StockItems. This event may be accompanied by a
117 * <code>removedStockItems</code> and a <code>addedStockItems</code> event, but this is implementation
118 * specific.
119 *
120 * @override Always
121 *
122 * @param e an event object describing the event.
123 */
124 public void editingStockItems(StockChangeEvent<T, CT> e);
125
126 /**
127 * Called whenever the editing of StockItems was commited.
128 *
129 * @override Always
130 *
131 * @param e an event object describing the event.
132 */
133 public void commitEditStockItems(StockChangeEvent<T, CT> e);
134
135 /**
136 * Called whenever the editing of StockItems was rolled back.
137 *
138 * @override Always
139 *
140 * @param e an event object describing the event.
141 */
142 public void rollbackEditStockItems(StockChangeEvent<T, CT> e);
143 }