001    package data.events;
002    
003    import util.SerializableListener;
004    
005    /**
006     * An <i>abstract</i> adapter class for receiving catalog change events. The methods in this class are empty.
007     * This class exists as convenience for creating listener objects.
008     *
009     * <p>Extend this class to create a CatalogChangeEvent listener and override the methods for the events of
010     * interest. (If you implement the CatalogChangeListener interface, you have to define all of the methods in
011     * it. This abstract class defines empty method bodies for them all, so you can concentrate on defining
012     * methods only for events you care about.)</p>
013     *
014     * <p>Create a listener object using the extended class and then register it with a ListenableCatalog using
015     * the Catalog's {@link data.ListenableCatalog#addCatalogChangeListener} method. When the Catalog's contents
016     * change, the relevant method in the listener object is invoked, and a {@link CatalogChangeEvent} is passed
017     * to it.</p>
018     *
019     * @author Steffen Zschaler
020     * @version 2.0 19/08/1999
021     * @since v2.0
022     */
023    public abstract class CatalogChangeAdapter extends Object implements CatalogChangeListener,
024            SerializableListener {
025    
026        /**
027         * Called whenever a CatalogItem was added to the Catalog.
028         *
029         * @override Sometimes
030         *
031         * @param e an event object describing the event.
032         */
033        public void addedCatalogItem(CatalogChangeEvent e) {}
034    
035        /**
036         * Called whenever the adding of a CatalogItem was commited.
037         *
038         * @override Sometimes
039         *
040         * @param e an event object describing the event.
041         */
042        public void commitedAddCatalogItem(CatalogChangeEvent e) {}
043    
044        /**
045         * Called whenever the adding of a CatalogItem was rolled back.
046         *
047         * @override Sometimes
048         *
049         * @param e an event object describing the event.
050         */
051        public void rolledbackAddCatalogItem(CatalogChangeEvent e) {}
052    
053        /**
054         * Called to ask whether a CatalogItem may be removed. If one of the listeners vetos the removal, all
055         * listeners that had already been asked will receive a {@link #noRemoveCatalogItem noRemoveCatalogItem}
056         * event.
057         *
058         * @override Sometimes
059         *
060         * @param e an event object describing the event.
061         *
062         * @exception VetoException if the listener wants to veto the removal.
063         */
064        public void canRemoveCatalogItem(CatalogChangeEvent e) throws VetoException {}
065    
066        /**
067         * Called for each listener that already agreed with a removal that was then rejected by another listener.
068         *
069         * @override Sometimes
070         *
071         * @param e an event object describing the event.
072         */
073        public void noRemoveCatalogItem(CatalogChangeEvent e) {}
074    
075        /**
076         * Called whenever a CatalogItem was removed from the Catalog.
077         *
078         * @override Sometimes
079         *
080         * @param e an event object describing the event.
081         */
082        public void removedCatalogItem(CatalogChangeEvent e) {}
083    
084        /**
085         * Called whenever the removal of a CatalogItem was commited.
086         *
087         * @override Sometimes
088         *
089         * @param e an event object describing the event.
090         */
091        public void commitedRemoveCatalogItem(CatalogChangeEvent e) {}
092    
093        /**
094         * Called whenever the removal of a CatalogItem was rolled back.
095         *
096         * @override Sometimes
097         *
098         * @param e an event object describing the event.
099         */
100        public void rolledbackRemoveCatalogItem(CatalogChangeEvent e) {}
101    
102        /**
103         * Called to ask whether a CatalogItem may be edited. If one of the listeners vetos the editing, all
104         * steners that had already been asked will receive a {@link #noEditCatalogItem noEditCatalogItem} event.
105         *
106         * @override Sometimes
107         *
108         * @param e an event object describing the event.
109         *
110         * @exception VetoException if the listener wants to veto the editing.
111         */
112        public void canEditCatalogItem(CatalogChangeEvent e) throws VetoException {}
113    
114        /**
115         * Called for each listener that already agreed with an editing that was then rejected by another listener.
116         *
117         * @override Sometimes
118         *
119         * @param e an event object describing the event.
120         */
121        public void noEditCatalogItem(CatalogChangeEvent e) {}
122    
123        /**
124         * Called whenever editing a CatalogItem was started. This event may be accompanied by a
125         * <code>removedCatalogItem</code> and a <code>addedCatalogItem</code> event, but this is implementation
126         * specific.
127         *
128         * @override Sometimes
129         *
130         * @param e an event object describing the event.
131         */
132        public void editingCatalogItem(CatalogChangeEvent e) {}
133    
134        /**
135         * Called whenever editing a CatalogItem was commited.
136         *
137         * @override Sometimes
138         *
139         * @param e an event object describing the event.
140         */
141        public void commitEditCatalogItem(CatalogChangeEvent e) {}
142    
143        /**
144         * Called whenever editing a CatalogItem was rolled back.
145         *
146         * @override Sometimes
147         *
148         * @param e an event object describing the event.
149         */
150        public void rollbackEditCatalogItem(CatalogChangeEvent e) {}
151    }