Source Code Cross Referenced for ShowFullPathPlugIn.java in  » GIS » openjump » org » openjump » core » ui » plugin » view » 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 » openjump » org.openjump.core.ui.plugin.view 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI 
003:         * for visualizing and manipulating spatial features with geometry and attributes.
004:         *
005:         * JUMP is Copyright (C) 2003 Vivid Solutions
006:         *
007:         * This program implements extensions to JUMP and is
008:         * Copyright (C) 2004 Integrated Systems Analysts, Inc.
009:         * 
010:         * This program is free software; you can redistribute it and/or
011:         * modify it under the terms of the GNU General Public License
012:         * as published by the Free Software Foundation; either version 2
013:         * of the License, or (at your option) any later version.
014:         * 
015:         * This program is distributed in the hope that it will be useful,
016:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
017:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
018:         * GNU General Public License for more details.
019:         * 
020:         * You should have received a copy of the GNU General Public License
021:         * along with this program; if not, write to the Free Software
022:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
023:         * 
024:         * For more information, contact:
025:         *
026:         * Integrated Systems Analysts, Inc.
027:         * 630C Anchors St., Suite 101
028:         * Fort Walton Beach, Florida
029:         * USA
030:         *
031:         * (850)862-7321
032:         * www.ashs.isa.com
033:         */
034:
035:        package org.openjump.core.ui.plugin.view;
036:
037:        import java.awt.Component;
038:        import java.awt.Graphics;
039:        import java.awt.event.ContainerEvent;
040:        import java.awt.event.ContainerListener;
041:        import java.util.Collection;
042:        import java.util.Iterator;
043:
044:        import com.vividsolutions.jts.geom.Envelope;
045:        import com.vividsolutions.jts.geom.Geometry;
046:        import com.vividsolutions.jump.I18N;
047:        import com.vividsolutions.jump.io.datasource.DataSourceQuery;
048:        import com.vividsolutions.jump.workbench.model.Layer;
049:        import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
050:        import com.vividsolutions.jump.workbench.plugin.PlugInContext;
051:        import com.vividsolutions.jump.workbench.ui.LayerNamePanelListener;
052:        import com.vividsolutions.jump.workbench.ui.LayerViewPanel;
053:        import com.vividsolutions.jump.workbench.ui.LayerViewPanelListener;
054:        import com.vividsolutions.jump.workbench.ui.TaskFrame;
055:
056:        public class ShowFullPathPlugIn extends AbstractPlugIn {
057:            PlugInContext gContext;
058:            final static String sErrorSeeOutputWindow = I18N
059:                    .get("org.openjump.core.ui.plugin.view.ShowFullPathPlugIn.Error-See-Output-Window");
060:            final static String sNumberSelected = I18N
061:                    .get("org.openjump.core.ui.plugin.view.ShowFullPathPlugIn.NumberSelected");
062:
063:            //-- added by sstein for test reasons
064:            //	private LayerListener myLayerListener = new LayerListener() {
065:            //        public void categoryChanged(CategoryEvent e) {}
066:            //        public void featuresChanged(FeatureEvent e)  {}        
067:            //		public void layerChanged(LayerEvent e) {
068:            //        if (e.getType() == LayerEventType.ADDED || e.getType() == LayerEventType.REMOVED) {
069:            //            Collection layerCollection = (Collection) gContext.getWorkbenchContext().getLayerNamePanel().getLayerManager().getLayers();
070:            //            for (Iterator i = layerCollection.iterator(); i.hasNext();)
071:            //            {
072:            //                Layer layer = (Layer) i.next();
073:            //                if (layer.hasReadableDataSource())
074:            //                {
075:            //                    DataSourceQuery dsq = layer.getDataSourceQuery();
076:            //                    try{
077:            //                    	String fname = dsq.getDataSource().getProperties().get("File").toString();                   	
078:            //                    	layer.setDescription(fname);
079:            //                    }
080:            //                    catch(Exception e){
081:            //                    	System.out.println("seems to be a database dataset" + e);
082:            //                    }                }
083:            //            	}   
084:            //        	}
085:            //		}
086:            //	};
087:
088:            private LayerNamePanelListener layerNamePanelListener = new LayerNamePanelListener() {
089:                public void layerSelectionChanged() {
090:                    Collection layerCollection = (Collection) gContext
091:                            .getWorkbenchContext().getLayerNamePanel()
092:                            .getLayerManager().getLayers();
093:                    for (Iterator i = layerCollection.iterator(); i.hasNext();) {
094:                        Layer layer = (Layer) i.next();
095:                        if (layer.hasReadableDataSource()) {
096:                            DataSourceQuery dsq = layer.getDataSourceQuery();
097:                            String fname = "";
098:                            Object fnameObj = dsq.getDataSource()
099:                                    .getProperties().get("File");
100:                            if (fnameObj != null)
101:                                fname = fnameObj.toString();
102:                            //layer.setDescription(fname);
103:
104:                            Object archiveObj = layer.getBlackboard().get(
105:                                    "ArchiveFileName");
106:                            //if (archiveObj != null) layer.setDescription(archiveObj.toString());
107:                        }
108:                    }
109:                }
110:            };
111:
112:            private LayerViewPanelListener layerViewPanelListener = new LayerViewPanelListener() {
113:                public void selectionChanged() {
114:                    LayerViewPanel panel = gContext.getWorkbenchContext()
115:                            .getLayerViewPanel();
116:                    if (panel == null) {
117:                        return;
118:                    } //[Jon Aquino 2005-08-04]
119:                    Collection selectedFeatures = panel.getSelectionManager()
120:                            .getSelectedItems();
121:                    int numSel = selectedFeatures.size();
122:                    int numPts = 0;
123:                    for (Iterator i = selectedFeatures.iterator(); i.hasNext();)
124:                        numPts += ((Geometry) i.next()).getNumPoints();
125:
126:                    //LDB added the following to simulate 4D Draw Coordinates Panel
127:                    Envelope env = envelope(panel.getSelectionManager()
128:                            .getSelectedItems());
129:                    String sx = panel.format(env.getWidth());
130:                    String sy = panel.format(env.getHeight());
131:                    //gContext.getWorkbenchFrame().setTimeMessage(sNumberSelected + " " + numSel);
132:                    gContext.getWorkbenchFrame().setTimeMessage(
133:                            sNumberSelected + " " + numSel + " [" + sx + ", "
134:                                    + sy + "] " + numPts + " pts");
135:                }
136:
137:                public void cursorPositionChanged(String x, String y) {
138:
139:                }
140:
141:                public void painted(Graphics graphics) {
142:
143:                }
144:            };
145:
146:            public void initialize(PlugInContext context) throws Exception {
147:                gContext = context;
148:                //    	/***	added by sstein ***********************/
149:                //	    //
150:                //        // Whenever anything happens on an internal frame we want to do this.
151:                //        //
152:                //	    GUIUtil.addInternalFrameListener(
153:                //	            context.getWorkbenchFrame().getDesktopPane(),
154:                //	            GUIUtil.toInternalFrameListener(new ActionListener() {
155:                //	        public void actionPerformed(ActionEvent e) {
156:                //	            installListenersOnCurrentPanel();
157:                //	        }
158:                //	    }));
159:                /**** original *********************************/
160:                context.getWorkbenchFrame().getDesktopPane()
161:                        .addContainerListener(new ContainerListener() {
162:                            public void componentAdded(ContainerEvent e) {
163:                                Component child = e.getChild();
164:                                if (child
165:                                        .getClass()
166:                                        .getName()
167:                                        .equals(
168:                                                "com.vividsolutions.jump.workbench.ui.TaskFrame")) {
169:                                    ((TaskFrame) child)
170:                                            .getLayerNamePanel()
171:                                            .addListener(layerNamePanelListener);
172:                                    ((TaskFrame) child)
173:                                            .getLayerViewPanel()
174:                                            .addListener(layerViewPanelListener);
175:                                }
176:                            }
177:
178:                            public void componentRemoved(ContainerEvent e) {
179:                                Component child = e.getChild();
180:                                if (child
181:                                        .getClass()
182:                                        .getName()
183:                                        .equals(
184:                                                "com.vividsolutions.jump.workbench.ui.TaskFrame")) {
185:                                    ((TaskFrame) child).getLayerNamePanel()
186:                                            .removeListener(
187:                                                    layerNamePanelListener);
188:                                    ((TaskFrame) child).getLayerViewPanel()
189:                                            .removeListener(
190:                                                    layerViewPanelListener);
191:                                }
192:                            }
193:                        });
194:            }
195:
196:            //    //-- method by sstein adapted from Zoombar
197:            //    private void installListenersOnCurrentPanel(){
198:            //    	 System.out.println("try to install listener");
199:            //        String LAYER_PATH_LISTENERS_INSTALLED_KEY =
200:            //            Integer.toHexString(hashCode()) + " - LAYER PATH LISTENERS INSTALLED";
201:            //        if (viewBlackboard().get(LAYER_PATH_LISTENERS_INSTALLED_KEY) != null) {
202:            //            return;
203:            //        }
204:            //
205:            //    	if(gContext.getLayerViewPanel() == null){
206:            //    		return;
207:            //    	}
208:            //        //[sstein]        
209:            //        LayerManager lm = gContext.getLayerManager();
210:            //        lm.addLayerListener(this.myLayerListener);
211:            //        System.out.println("listener installed");
212:            //        viewBlackboard().put(LAYER_PATH_LISTENERS_INSTALLED_KEY, new Object());
213:            //    }
214:            //    
215:            //    //-- method by sstein adapted from Zoombar    
216:            //    private Blackboard viewBlackboard() {
217:            //        return gContext.getLayerViewPanel() != null ? gContext.getLayerViewPanel().getBlackboard() : new Blackboard();
218:            //    }
219:            //    
220:            public boolean execute(PlugInContext context) throws Exception {
221:                try {
222:                    return true;
223:                } catch (Exception e) {
224:                    context
225:                            .getWorkbenchFrame()
226:                            .warnUser(
227:                                    I18N
228:                                            .get("org.openjump.core.ui.plugin.layer.AddSIDLayerPlugIn.Error-See-Output-Window"));
229:                    context.getWorkbenchFrame().getOutputFrame()
230:                            .createNewDocument();
231:                    context.getWorkbenchFrame().getOutputFrame().addText(
232:                            "ShowFullPathPlugIn Exception:" + e.toString());
233:                    return false;
234:                }
235:            }
236:
237:            private Envelope envelope(Collection geometries) {
238:                Envelope envelope = new Envelope();
239:
240:                for (Iterator i = geometries.iterator(); i.hasNext();) {
241:                    Geometry geometry = (Geometry) i.next();
242:                    envelope.expandToInclude(geometry.getEnvelopeInternal());
243:                }
244:
245:                return envelope;
246:            }
247:
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.