Source Code Cross Referenced for ResolveDelta.java in  » GIS » udig-1.1 » net » refractions » udig » catalog » internal » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » udig 1.1 » net.refractions.udig.catalog.internal 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    uDig - User Friendly Desktop Internet GIS client
003:         *    http://udig.refractions.net
004:         *    (C) 2004, Refractions Research Inc.
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:         */
017:        package net.refractions.udig.catalog.internal;
018:
019:        import java.io.IOException;
020:        import java.util.ArrayList;
021:        import java.util.Collections;
022:        import java.util.EnumSet;
023:        import java.util.List;
024:
025:        import net.refractions.udig.catalog.CatalogPlugin;
026:        import net.refractions.udig.catalog.IResolve;
027:        import net.refractions.udig.catalog.IResolveDelta;
028:        import net.refractions.udig.catalog.IResolveDeltaVisitor;
029:
030:        /**
031:         * Catalog delta.
032:         * 
033:         * @author jgarnett
034:         * @since 0.6.0
035:         */
036:        public class ResolveDelta implements  IResolveDelta {
037:            private List<IResolveDelta> children;
038:            private Kind kind = Kind.NO_CHANGE;
039:            private IResolve handle = null;
040:            private IResolve newHandle = null;
041:            private final Object newValue;
042:            private final Object oldValue;
043:
044:            /**
045:             * Delta saying something changed somewhere.
046:             * <p>
047:             * Handle is the root of the catalog. Indicates that all labels should refresh, handles are
048:             * still considered valid so layers can simply ask new info (they don't need to search for their
049:             * content again).
050:             * </p>
051:             */
052:            public ResolveDelta() {
053:                this .kind = Kind.CHANGED;
054:                this .children = NO_CHILDREN;
055:                handle = CatalogPlugin.getDefault().getLocalCatalog();
056:                newValue = oldValue = null;
057:                newHandle = null;
058:            }
059:
060:            /**
061:             * Delta for a changed handle, ie handle state refresh.
062:             * <p>
063:             * Used to communicate that new Info is available and labels should be refreshed.
064:             * </p>
065:             */
066:            public ResolveDelta(IResolve handle, List<IResolveDelta> changes) {
067:                this .kind = Kind.CHANGED;
068:                this .children = Collections.unmodifiableList(changes);
069:                this .handle = handle;
070:                if (kind == Kind.REPLACED) {
071:                    throw new IllegalArgumentException(
072:                            Messages.ResolveDelta_error_newHandleRequired);
073:                }
074:                newHandle = null;
075:                newValue = oldValue = null;
076:            }
077:
078:            /** 
079:             * Simple change used for Add and Remove with no children 
080:             */
081:            public ResolveDelta(IResolve handle, Kind kind) {
082:                this .kind = kind;
083:                this .children = NO_CHILDREN;
084:                this .handle = handle;
085:                if (kind == Kind.REPLACED) {
086:                    throw new IllegalArgumentException(
087:                            Messages.ResolveDelta_error_newHandleRequired);
088:                }
089:                newHandle = null;
090:                newValue = oldValue = null;
091:            }
092:
093:            /** Delta for a specific change */
094:            public ResolveDelta(IResolve handle, Kind kind,
095:                    List<IResolveDelta> changes) {
096:                this .kind = kind;
097:                List<? extends IResolveDelta> changes2 = changes;
098:                if (changes2 == null)
099:                    changes2 = new ArrayList<IResolveDelta>();
100:                this .children = Collections.unmodifiableList(changes2);
101:                this .handle = handle;
102:                if (kind == Kind.REPLACED) {
103:                    throw new IllegalArgumentException(
104:                            Messages.ResolveDelta_error_newHandleRequired);
105:                }
106:                newHandle = null;
107:                newValue = oldValue = null;
108:            }
109:
110:            /**
111:             * Delta for handle repalcement.
112:             * <p>
113:             * Used to indicate the actual connection used by the handle has been replaced. Layers should
114:             * foget everything they no and latch onto the newHandle.
115:             * </p>
116:             */
117:            public ResolveDelta(IResolve handle, IResolve newHandle,
118:                    List<IResolveDelta> changes) {
119:                this .kind = Kind.REPLACED;
120:                List<? extends IResolveDelta> changes2 = changes;
121:                if (changes2 == null)
122:                    changes2 = new ArrayList<IResolveDelta>();
123:
124:                this .children = Collections.unmodifiableList(changes2);
125:                this .handle = handle;
126:                this .newHandle = newHandle;
127:                newValue = oldValue = null;
128:            }
129:
130:            /**
131:             * Indicates a IResolve has changed.  (Kind==Kind.CHANGED).  
132:             * 
133:             * @param handle resolve that has changed
134:             * @param oldValue old value before change
135:             * @param newValue new value after change
136:             */
137:            public ResolveDelta(IResolve handle, Object oldValue,
138:                    Object newValue) {
139:                kind = Kind.CHANGED;
140:                this .children = NO_CHILDREN;
141:                this .handle = handle;
142:                newHandle = null;
143:                this .newValue = newValue;
144:                this .oldValue = oldValue;
145:            }
146:
147:            /*
148:             * @see net.refractions.udig.catalog.ICatalogDelta#accept(net.refractions.udig.catalog.IServiceVisitor)
149:             */
150:            public void accept(IResolveDeltaVisitor visitor) throws IOException {
151:                if (visitor.visit(this )) {
152:                    for (IResolveDelta delta : children) {
153:                        if (delta != null && visitor.visit(delta)) {
154:                            delta.accept(visitor);
155:                        }
156:                    }
157:                }
158:            }
159:
160:            /*
161:             * @see net.refractions.udig.catalog.ICatalogDelta#getAffected()
162:             */
163:            public List<IResolveDelta> getChildren() {
164:                return children;
165:            }
166:
167:            /*
168:             * @see net.refractions.udig.catalog.ICatalogDelta#getAffected(int, int)
169:             */
170:            public List<IResolveDelta> getChildren(EnumSet<Kind> kindMask) {
171:                List<IResolveDelta> list = new ArrayList<IResolveDelta>();
172:                for (IResolveDelta delta : children) {
173:                    if (delta != null && kindMask.contains(delta.getKind())) {
174:                        list.add(delta);
175:                    }
176:                }
177:                return list;
178:            }
179:
180:            /*
181:             * @see net.refractions.udig.catalog.IDelta#getKind()
182:             */
183:            public Kind getKind() {
184:                return kind;
185:            }
186:
187:            public IResolve getResolve() {
188:                return handle;
189:            }
190:
191:            public IResolve getNewResolve() {
192:                return newHandle;
193:            }
194:
195:            public String toString() {
196:                StringBuffer buffer = new StringBuffer();
197:
198:                /*
199:                 * private List<IResolveDelta> children; private Kind kind = Kind.NO_CHANGE; private
200:                 * IResolve handle = null; private IResolve newHandle = null;
201:                 */
202:                buffer.append(" ResolveDelta: ["); //$NON-NLS-1$
203:                buffer.append(kind);
204:
205:                if (handle != null) {
206:                    buffer.append(","); //$NON-NLS-1$
207:                    buffer.append(handle);
208:                }
209:
210:                if (newHandle != null) {
211:                    buffer.append(","); //$NON-NLS-1$
212:                    buffer.append(newHandle);
213:                }
214:
215:                if (children != null) {
216:                    buffer.append("children ["); //$NON-NLS-1$
217:                    for (int i = 0; i < children.size(); i++) {
218:                        buffer.append(children.get(i).getKind());
219:                    }
220:                    buffer.append("] "); //$NON-NLS-1$
221:                }
222:
223:                buffer.append("] "); //$NON-NLS-1$
224:                return buffer.toString();
225:            }
226:
227:            public Object getNewValue() {
228:                return newValue;
229:            }
230:
231:            public Object getOldValue() {
232:                return oldValue;
233:            }
234:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.