001    /*
002      Copyright (C) 2002 Laurent Martelli <laurent@aopsys.com>
003      
004      This program is free software; you can redistribute it and/or modify
005      it under the terms of the GNU Lesser General Public License as
006      published by the Free Software Foundation; either version 2 of the
007      License, or (at your option) any later version.
008    
009      This program is distributed in the hope that it will be useful, but
010      WITHOUT ANY WARRANTY; without even the implied warranty of
011      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012      Lesser General Public License for more details.
013    
014      You should have received a copy of the GNU Lesser General Public
015      License along with this program; if not, write to the Free Software
016      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
017      USA */
018    
019    package org.objectweb.jac.aspects.gui;
020    
021    import org.objectweb.jac.core.rtti.CollectionItem;
022    
023    /**
024     * This interface defines callback methods used to notify that a
025     * collection was updated (that is, an object was added to it or
026     * removed from it).
027     */
028    public interface CollectionUpdate {
029    
030       /**
031        * Upcalled when the collection is changed (with a set or other
032        * methods such as clear, removeAll, addAll, ...).
033        * 
034        * @param substance the object of which a field was updated
035        * @param collection the updated collection
036        * @param value the new collection
037        * @param param extra data
038        *
039        * @see ViewControlWrapper#registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object) 
040        */
041       void onChange(Object substance, CollectionItem collection, Object value,
042                     Object param);
043    
044       /**
045        * Upcalled when an item is added in a collection.
046        * 
047        * @param substance the object of which a collection was updated
048        * @param collection the updated collection
049        * @param value the collection's value
050        * @param added the value added to the collection
051        * @param param extra data (e.g. index)
052        *
053        * @see ViewControlWrapper#registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object) 
054        */
055       void onAdd(Object substance, CollectionItem collection, Object value,
056                  Object added, Object param);
057    
058       /**
059        * Upcalled when an item is removed from a collection.
060        * 
061        * @param substance the object of which a collection was updated
062        * @param collection the updated collection
063        * @param value the collection's value
064        * @param removed the removed item
065        * @param param extra data (e.g. index)
066        *
067        * @see ViewControlWrapper#registerCollection(Wrappee,CollectionItem,CollectionUpdate,Object) 
068        */
069       void onRemove(Object substance, CollectionItem collection, Object value,
070                     Object removed, Object param);
071    }