/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ package org.geotools.gui.swing.contexttree; import java.util.EventObject; import org.geotools.map.MapContext; /** * Event generated by ContextTreeModel * * @author Johann Sorel * * @source $URL$ */ public class TreeContextEvent extends EventObject{ private final MapContext mapcontext; private final int begin; private final int end; /** * constructor * @param treetable the treetable generating the event * @param mapcontext the mapcontext concerne * @param position the position of the mapcontext */ TreeContextEvent(JContextTree treetable, MapContext mapcontext, int position) { this(treetable,mapcontext,position,position); } /** * constructor * @param treetable treetable the treetable generating the event * @param mapcontext the mapcontext concerne * @param begin start position of the mapcontext * @param end end position of the mapcontext */ TreeContextEvent(JContextTree treetable, MapContext mapcontext, int begin, int end) { super(treetable); this.mapcontext = mapcontext; this.begin = begin; this.end = end; } /** * return the Mapcontext affected by the event * @return concern Mapcontext */ public MapContext getContext() { return this.mapcontext; } /** * return the start index for contextmoved event * or the index for other events * @return start index for contextmoved event * or the index for other events */ public int getFromIndex() { return begin; } /** * return the target index for contextmoved event * or the index for other events * @return index for contextmoved event * or the index for other events */ public int getToIndex() { return end; } }