Source Code Cross Referenced for FeatureValidationOp.java in  » GIS » udig-1.1 » net » refractions » udig » validation » 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.validation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * 
003:         */package net.refractions.udig.validation;
004:
005:        import java.util.Iterator;
006:
007:        import net.refractions.udig.project.ILayer;
008:        import net.refractions.udig.ui.PlatformGIS;
009:        import net.refractions.udig.ui.operations.IOp;
010:
011:        import org.eclipse.core.runtime.IProgressMonitor;
012:        import org.eclipse.jface.dialogs.Dialog;
013:        import org.eclipse.swt.widgets.Display;
014:        import org.eclipse.swt.widgets.Shell;
015:        import org.geotools.data.FeatureSource;
016:        import org.geotools.feature.Feature;
017:        import org.geotools.feature.FeatureCollection;
018:        import org.geotools.feature.FeatureType;
019:        import org.geotools.validation.FeatureValidation;
020:
021:        /**
022:         * An abstract class for feature validation which uses org.geotools.validation
023:         *
024:         * @author chorner
025:         * @since 1.0.1
026:         */
027:        abstract class FeatureValidationOp implements  IOp {
028:            public GenericValidationResults results; //for testing
029:
030:            /**
031:             * 
032:             *
033:             * @return the appropriate Validating Feature Method Class
034:             */
035:            abstract FeatureValidation getValidator();
036:
037:            /** 
038:             * 
039:             * @see net.refractions.udig.ui.operations.IOp#op(org.eclipse.swt.widgets.Display, java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
040:             */
041:            public void op(final Display display, Object target,
042:                    IProgressMonitor monitor) throws Exception {
043:                final ILayer layer = (ILayer) target;
044:                FeatureSource source = layer.getResource(FeatureSource.class,
045:                        monitor);
046:                FeatureCollection collection;
047:                collection = source.getFeatures();
048:                results = new GenericValidationResults();
049:
050:                PlatformGIS.syncInDisplayThread(new Runnable() {
051:
052:                    public void run() {
053:                        Dialog dialog = getDialog(display.getActiveShell(),
054:                                layer.getSchema());
055:                        if (dialog != null) {
056:                            dialog.open();
057:                        }
058:                    }
059:
060:                });
061:
062:                final FeatureValidation featureValidation = getValidator();
063:                if (featureValidation == null)
064:                    return;
065:                //IsValidGeometryValidation geometryValidation = new IsValidGeometryValidation();
066:                FeatureType type;
067:
068:                // iterate through the collection and validate each feature
069:                Iterator iterator;
070:                for (iterator = collection.iterator(); iterator.hasNext();) {
071:                    Feature feature = (Feature) iterator.next();
072:                    type = feature.getFeatureType();
073:                    if (canValidate(type)) {
074:                        featureValidation.validate(feature, type, results);
075:                    }
076:                }
077:                collection.close(iterator);
078:
079:                OpUtils.setSelection(layer, results);
080:                //OpUtils.notifyUser(display, results);
081:
082:                monitor.internalWorked(1);
083:                monitor.done();
084:            }
085:
086:            /**
087:             * This method may be overridden for classes which need a dialog for user input
088:             * 
089:             * @param shell
090:             * @param featureType
091:             * @return null
092:             */
093:            protected Dialog getDialog(Shell shell, FeatureType featureType) {
094:                return null;
095:            }
096:
097:            /**
098:             * This method may be overridden for classes which only validate certain featureTypes
099:             *
100:             * @param featureType
101:             * @return boolean
102:             */
103:            protected boolean canValidate(FeatureType featureType) {
104:                return true;
105:            }
106:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.