01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
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: */
17: package net.refractions.udig.catalog.internal;
18:
19: import net.refractions.udig.catalog.IResolve;
20: import net.refractions.udig.catalog.IResolveChangeEvent;
21: import net.refractions.udig.catalog.IResolveDelta;
22:
23: /**
24: * Everything change change change ...
25: *
26: * @author jgarnett
27: * @since 0.6.0
28: */
29: public class ResolveChangeEvent implements IResolveChangeEvent {
30: private Object source;
31: private Type type;
32: private IResolveDelta delta; // may be null for some events
33: private IResolve 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 ResolveChangeEvent(Object source, Type type,
43: IResolveDelta delta) {
44: this .source = source;
45: this .type = type;
46: this .delta = delta;
47: if (source instanceof IResolve) {
48: handle = (IResolve) source;
49: }
50: }
51:
52: public String toString() {
53: StringBuffer buffer = new StringBuffer();
54: buffer.append("ResolveChangeEvent ("); //$NON-NLS-1$
55: buffer.append(type);
56:
57: if (delta != null) {
58: buffer.append(","); //$NON-NLS-1$
59: buffer.append(delta);
60:
61: }
62: if (handle != null) {
63: buffer.append(","); //$NON-NLS-1$
64: buffer.append(handle.getIdentifier());
65: }
66:
67: return buffer.toString();
68: }
69:
70: /**
71: * @see net.refractions.udig.catalog.ICatalogChangeEvent#getDelta()
72: */
73: public IResolveDelta getDelta() {
74: return delta;
75: }
76:
77: /**
78: * @see net.refractions.udig.catalog.ICatalogChangeEvent#getResource()
79: */
80: public IResolve getResolve() {
81: return handle;
82: }
83:
84: /**
85: * @see net.refractions.udig.catalog.ICatalogChangeEvent#getSource()
86: */
87: public Object getSource() {
88: return source;
89: }
90:
91: /**
92: * @see net.refractions.udig.catalog.ICatalogChangeEvent#getType()
93: */
94: public Type getType() {
95: return type;
96: }
97: }
|