001    /*
002      Copyright (C) 2002 Julien van Malderen
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,
010      but WITHOUT ANY WARRANTY; without even the implied warranty of
011      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012      GNU Lesser General Public License for more details.
013    
014      You should have received a copy of the GNU Lesser General Public License
015      along with this program; if not, write to the Free Software
016      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
017    
018    package org.objectweb.jac.aspects.gui;
019    
020    import org.objectweb.jac.core.rtti.CollectionItem;
021    
022    /**
023     * A class that represents a position in a given collection. */
024    
025    public class CollectionPosition
026    {
027       CollectionItem collection;
028       CollectionView collectionView;
029       int index;
030       Object substance;
031    
032       /**
033        * Constructs a new position.
034        *
035        * @param collectionView the collection view that corresponds to
036        * the substance
037        * @param collection the substance collection
038        * @param index the row index of this position 
039        * @param substance the object that holds the collection */
040       public CollectionPosition(CollectionView collectionView,
041                                 CollectionItem collection, int index,
042                                 Object substance) {
043          this.collectionView = collectionView;
044          this.collection = collection;
045          this.index = index;
046          this.substance = substance;
047       }
048    
049       /**
050        * Returns the collection view. */
051       public CollectionView getCollectionView() {
052          return collectionView;
053       }
054       
055       /**
056        * Returns the collection. */
057       public CollectionItem getCollection() {
058          return collection;
059       }
060       
061       /**
062        * The index of this position in the collection. */
063       public int getIndex() {
064          return index;
065       }
066       
067       /**
068        * Returns the substance that holds the collection. */ 
069       public Object getSubstance() {
070          return substance;
071       }
072    }