001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.event;
017:
018: /**
019: * Indicates the "root" of a Geotools data structure with event notification.
020: *
021: * <p>
022: * Several of the GeoTools objects are produced in reference to specifications,
023: * in particular XML based specifications. Often we try and match the same
024: * abstractions present in a specification like SLD or Filter. But rather then
025: * make use of pure Java Beans, and make user interface code responsible for
026: * managing a host of listeners we are providing a single set of listeners
027: * located at the object matching the document base.
028: * </p>
029: *
030: * <p></p>
031: *
032: * @author Jody Garnett, Refractions Research
033: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/api/src/main/java/org/geotools/event/GTRoot.java $
034: */
035: public interface GTRoot extends GTComponent {
036: public static GTRoot NO_PARENT = new GTRoot() {
037: public GTComponent getParent() {
038: throw new IllegalStateException("Invalid root");
039: }
040:
041: public void changed(GTDelta delta) {
042: }
043:
044: public void removed(GTDelta delta) {
045: }
046:
047: public void addListener(GTListener listener) {
048: }
049:
050: public void removeListener(GTListener listener) {
051: }
052:
053: public GTNote getNote() {
054: return GTNote.EMPTY;
055: }
056:
057: public void setNote(GTNote container) {
058: }
059:
060: public String toString() {
061: return "NO_PARENT";
062: }
063: };
064:
065: /**
066: * Should not be called, will return a "NullObject" - NO_PARENT.
067: *
068: * @return NO_PARENT
069: */
070: public GTComponent getParent();
071:
072: /**
073: * Since this is the "root" of the tree, please fire event off to the
074: * listeners.
075: *
076: * @param delta Delta describing change
077: */
078: public void changed(GTDelta delta);
079:
080: /**
081: * Since this is the "root" of the tree, please fire event off to the
082: * listeners.
083: *
084: * @param delta Delta describing change
085: */
086: public void removed(GTDelta delta);
087:
088: /**
089: * Adds a listener for GTEvents
090: *
091: * @param listener Listener to change events
092: */
093: public void addListener(GTListener listener);
094:
095: /**
096: * Removes a previously installed GTListener
097: *
098: * @param listener Listener to change events
099: */
100: public void removeListener(GTListener listener);
101: }
|