01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2005, Refractions Research Inc.
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.catalog.defaults;
18:
19: import org.geotools.catalog.Resolve;
20: import org.geotools.catalog.ResolveChangeEvent;
21: import org.geotools.catalog.ResolveDelta;
22:
23: /**
24: * Everything change change change ...
25: *
26: * @since 0.6.0
27: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/catalog/defaults/DefaultResolveChangeEvent.java $
28: */
29: public class DefaultResolveChangeEvent implements ResolveChangeEvent {
30: private Object source;
31: private Type type;
32: private ResolveDelta delta; // may be null for some events
33: private Resolve handle; // may be null for some events
34:
35: /**
36: * Construct <code>CatalogChangeEvent</code>.
37: *
38: * @param source Source of event, in case you care
39: * @param type Type constant from ICatalogChangeEvent
40: * @param delta Describes the change
41: */
42: public DefaultResolveChangeEvent(Object source, Type type,
43: ResolveDelta delta) {
44: this .source = source;
45: this .type = type;
46: this .delta = delta;
47:
48: if (source instanceof Resolve) {
49: handle = (Resolve) source;
50: }
51: }
52:
53: public String toString() {
54: StringBuffer buffer = new StringBuffer();
55: buffer.append("ResolveChangeEvent ("); //$NON-NLS-1$
56: buffer.append(type);
57:
58: if (delta != null) {
59: buffer.append(","); //$NON-NLS-1$
60: buffer.append(delta);
61: }
62:
63: if (handle != null) {
64: buffer.append(","); //$NON-NLS-1$
65: buffer.append(handle.getIdentifier());
66: }
67:
68: return buffer.toString();
69: }
70:
71: /**
72: * @see net.refractions.udig.catalog.ICatalogChangeEvent#getDelta()
73: */
74: public ResolveDelta getDelta() {
75: return delta;
76: }
77:
78: /**
79: * @see net.refractions.udig.catalog.ICatalogChangeEvent#getResource()
80: */
81: public Resolve getResolve() {
82: return handle;
83: }
84:
85: /**
86: * @see net.refractions.udig.catalog.ICatalogChangeEvent#getSource()
87: */
88: public Object getSource() {
89: return source;
90: }
91:
92: /**
93: * @see net.refractions.udig.catalog.ICatalogChangeEvent#getType()
94: */
95: public Type getType() {
96: return type;
97: }
98: }
|