01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.event;
17:
18: /**
19: * Small stratagy object passed in by our parent so we can call home. Used to
20: * pass change information "up" to our parent, to root parent will broadcast the
21: * events out to listeners.
22: *
23: * @author Jody
24: */
25: public interface GTNote {
26: /** Used to denote an parentless compeneted */
27: public static GTNote EMPTY = new GTNote() {
28: public GTComponent getParent() {
29: throw new IllegalStateException("Invalid root");
30: }
31:
32: public void setParent(GTComponent newParent) {
33: throw new IllegalStateException(
34: "Invalid GTNote (you need to create a new instance)");
35: }
36:
37: public void setNotificationName(String name) {
38: throw new IllegalStateException(
39: "Invalid GTNote (you need to create a new instance)");
40: }
41:
42: public String getNotificationName() {
43: return "";
44: }
45:
46: public void setNotificationPosition(int index) {
47: throw new IllegalStateException(
48: "Invalid GTNote (you need to create a new instance)");
49: }
50:
51: public int getNotificationPosition() {
52: return GTDelta.NO_INDEX;
53: }
54:
55: public String toString() {
56: return "NO_PARENT";
57: }
58: };
59:
60: /**
61: * Used to locate our parent.
62: * <p>
63: * This method will return a "NULLObject", called GTRoot.NO_PARENT when no
64: * parent is present, client code should never have to be concerned this
65: * method return <code>null</code>.
66: *
67: * @return Parent GTComponent or GTRoot.NO_PARENT if none
68: */
69: GTComponent getParent();
70:
71: /**
72: * Used to set the parent, and associated placement information.
73: *
74: * @param newParent
75: * GTComponent or NULLGTRoot if none
76: */
77: void setParent(GTComponent newParent);
78:
79: /** Indicate name used during notification */
80: public void setNotificationName(String name);
81:
82: /** Indicate name used during notification */
83: public String getNotificationName();
84:
85: /** Indicate name position used during notification */
86: public void setNotificationPosition(int index);
87:
88: /** Indicate position used during notification */
89: public int getNotificationPosition();
90: }
|