Source Code Cross Referenced for ObjectViewerAttributesTableFrame.java in  » GIS » GeOxygene-1.3 » fr » ign » cogit » geoxygene » util » viewer » 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 » GeOxygene 1.3 » fr.ign.cogit.geoxygene.util.viewer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of the GeOxygene project source files. 
003:         * 
004:         * GeOxygene aims at providing an open framework which implements OGC/ISO specifications for 
005:         * the development and deployment of geographic (GIS) applications. It is a open source 
006:         * contribution of the COGIT laboratory at the Institut Géographique National (the French 
007:         * National Mapping Agency).
008:         * 
009:         * See: http://oxygene-project.sourceforge.net 
010:         *  
011:         * Copyright (C) 2005 Institut Géographique National
012:         *
013:         * This library is free software; you can redistribute it and/or modify it under the terms
014:         * of the GNU Lesser General Public License as published by the Free Software Foundation; 
015:         * either version 2.1 of the License, or any later version.
016:         *
017:         * This library is distributed in the hope that it will be useful, but WITHOUT ANY 
018:         * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
019:         * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
020:         *
021:         * You should have received a copy of the GNU Lesser General Public License along with 
022:         * this library (see file LICENSE if present); if not, write to the Free Software 
023:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:         *  
025:         */
026:
027:        package fr.ign.cogit.geoxygene.util.viewer;
028:
029:        import java.awt.BorderLayout;
030:        import java.util.Vector;
031:
032:        import javax.swing.JFrame;
033:        import javax.swing.JScrollPane;
034:        import javax.swing.JTable;
035:
036:        import uk.ac.leeds.ccg.dbffile.Dbf;
037:        import uk.ac.leeds.ccg.geotools.DataSource;
038:        import uk.ac.leeds.ccg.geotools.ShapefileReader;
039:        import uk.ac.leeds.ccg.geotools.Theme;
040:
041:        /**
042:         *
043:         * @author Thierry Badard & Arnaud Braun
044:         * @version 1.0
045:         * 
046:         */
047:
048:        class ObjectViewerAttributesTableFrame extends JFrame {
049:
050:            private static final String FRAME_TITLE = "GeOxygene Theme Values - ";
051:
052:            private Theme theme;
053:            private int nbFields;
054:            private int nbRecords;
055:            private Vector columnNames;
056:            private Vector rowData;
057:            private String title;
058:            private DataSource dataSource;
059:
060:            public ObjectViewerAttributesTableFrame(Theme t,
061:                    String dataSourceType, DataSource source) {
062:                super ();
063:
064:                theme = t;
065:                dataSource = source;
066:
067:                if (dataSourceType.equals(Utils.SHAPEFILE)) {
068:                    shapefile();
069:                }
070:
071:                else if (dataSourceType.equals(Utils.GEOXYGENE)) {
072:                    geoxygene();
073:                }
074:
075:                else {
076:                    System.out
077:                            .println(" ## SHOW ATTRIBUTES : NOT DEFINED FOR THIS KIND OF DATASOURCE ");
078:                }
079:
080:                // Title
081:                this .setTitle(FRAME_TITLE + title);
082:
083:                // Layout
084:                this .getContentPane().setLayout(new BorderLayout());
085:
086:                // Create/setup table
087:                JTable table = new JTable(rowData, columnNames);
088:
089:                // Place table in JScrollPane
090:                JScrollPane scrollPane = new JScrollPane(table);
091:
092:                // Add to Screen
093:                this .getContentPane().add(scrollPane, BorderLayout.CENTER);
094:
095:            }
096:
097:            /** Fill vectors of attributes for a shapefile by reading directly dbf file (we do not load it into memory) */
098:            public void shapefile() {
099:
100:                String themeName = theme.getName();
101:                title = themeName.substring(themeName.lastIndexOf("/") + 1);
102:
103:                try {
104:                    // Transformer URL en File pour eviter le chargement en memoire du fichier Dbf
105:                    final Dbf themeDbf = ((ShapefileReader) dataSource).dbf;
106:
107:                    nbFields = themeDbf.getNumFields();
108:                    nbRecords = themeDbf.getLastRec();
109:                    StringBuffer fieldName;
110:                    Vector row;
111:                    columnNames = new Vector();
112:                    rowData = new Vector();
113:
114:                    for (int i = 0; i < nbFields; i++) {
115:                        fieldName = themeDbf.getFieldName(i);
116:                        columnNames.add(fieldName);
117:                    }
118:
119:                    for (int j = 0; j < nbRecords; j++) {
120:                        row = new Vector();
121:                        for (int i = 0; i < nbFields; i++) {
122:                            if (themeDbf.getFieldType(i) == 'N') {
123:                                row.add((themeDbf.getFloatCol(i, j, j + 1))[0]
124:                                        .toString());
125:                            } else {
126:                                row.add((themeDbf.getStringCol(i, j, j + 1))[0]
127:                                        .toString());
128:                            }
129:                        }
130:                        rowData.add(row);
131:                    }
132:
133:                } catch (Exception e) {
134:                    System.err.println("Can not open the file: " + e);
135:                }
136:
137:            }
138:
139:            /** Fill vectors of attributes for GeOxygene data */
140:            public void geoxygene() {
141:                title = theme.getName();
142:                GeOxygeneReader geOxyRd = (GeOxygeneReader) dataSource;
143:                Object[] result = geOxyRd.readData();
144:                columnNames = (Vector) result[0];
145:                rowData = (Vector) result[1];
146:
147:            }
148:
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.