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