root / trunk / extensions / extWFS2 / src-test / com / iver / cit / gvsig / gui / panels / FieldsTableTest.java @ 27077
History | View | Annotate | Download (4.79 KB)
1 |
package com.iver.cit.gvsig.gui.panels; |
---|---|
2 |
|
3 |
import java.awt.Component; |
4 |
import java.io.File; |
5 |
import java.io.IOException; |
6 |
import java.util.Vector; |
7 |
|
8 |
import javax.swing.JFrame; |
9 |
import javax.swing.JScrollPane; |
10 |
import javax.swing.JTree; |
11 |
|
12 |
import org.gvsig.remoteClient.gml.factories.XMLElementsFactory; |
13 |
import org.gvsig.remoteClient.gml.schemas.XMLElement; |
14 |
import org.gvsig.remoteClient.gml.schemas.XMLSchemaParser; |
15 |
import org.xmlpull.v1.XmlPullParserException; |
16 |
|
17 |
import com.iver.cit.gvsig.gui.panels.fieldstree.FieldsTreeTable; |
18 |
import com.iver.cit.gvsig.gui.panels.fieldstree.TreeTableModelWithCheckBoxes; |
19 |
|
20 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
21 |
*
|
22 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
23 |
*
|
24 |
* This program is free software; you can redistribute it and/or
|
25 |
* modify it under the terms of the GNU General Public License
|
26 |
* as published by the Free Software Foundation; either version 2
|
27 |
* of the License, or (at your option) any later version.
|
28 |
*
|
29 |
* This program is distributed in the hope that it will be useful,
|
30 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
31 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
32 |
* GNU General Public License for more details.
|
33 |
*
|
34 |
* You should have received a copy of the GNU General Public License
|
35 |
* along with this program; if not, write to the Free Software
|
36 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
37 |
*
|
38 |
* For more information, contact:
|
39 |
*
|
40 |
* Generalitat Valenciana
|
41 |
* Conselleria d'Infraestructures i Transport
|
42 |
* Av. Blasco Ib??ez, 50
|
43 |
* 46010 VALENCIA
|
44 |
* SPAIN
|
45 |
*
|
46 |
* +34 963862235
|
47 |
* gvsig@gva.es
|
48 |
* www.gvsig.gva.es
|
49 |
*
|
50 |
* or
|
51 |
*
|
52 |
* IVER T.I. S.A
|
53 |
* Salamanca 50
|
54 |
* 46005 Valencia
|
55 |
* Spain
|
56 |
*
|
57 |
* +34 963163400
|
58 |
* dac@iver.es
|
59 |
*/
|
60 |
/* CVS MESSAGES:
|
61 |
*
|
62 |
* $Id$
|
63 |
* $Log$
|
64 |
* Revision 1.2 2007-01-16 08:47:49 csanchez
|
65 |
* Sistema de Warnings y Excepciones adaptado a BasicException
|
66 |
*
|
67 |
* Revision 1.1 2006/12/26 09:10:37 ppiqueras
|
68 |
* Cambiado "atttibutes" en todas las aparaciones en atributos, m?todos, clases o comentarios por "fields". (S?lo a aquellas que afectan a clases dentro del proyecto extWFS2).
|
69 |
*
|
70 |
* Revision 1.7 2006/11/01 17:29:08 jorpiell
|
71 |
* Se ha elimiado el nodo virtual de la raiz. Adem?s ya se cargan los valores de un campo complejo en la pesta?a del filtro
|
72 |
*
|
73 |
* Revision 1.6 2006/10/31 09:37:18 jorpiell
|
74 |
* Se devuelve el tipo de la entidad completo, y no sus hijos
|
75 |
*
|
76 |
* Revision 1.5 2006/10/27 12:25:57 jorpiell
|
77 |
* Modificado el test
|
78 |
*
|
79 |
* Revision 1.3 2006/10/24 07:58:14 jorpiell
|
80 |
* Eliminado el parametro booleano que hac?a que apareciesen mas de una columna en el tree table
|
81 |
*
|
82 |
* Revision 1.2 2006/10/24 07:27:56 jorpiell
|
83 |
* Algunos cambios en el modelo que usa la tabla
|
84 |
*
|
85 |
* Revision 1.1 2006/10/23 07:37:04 jorpiell
|
86 |
* Ya funciona el filterEncoding
|
87 |
*
|
88 |
*
|
89 |
*/
|
90 |
/**
|
91 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
92 |
*/
|
93 |
public class FieldsTableTest{ |
94 |
private String gmlFile = "src-test/WFS-DescribeFeatureTypeAves.xml"; |
95 |
|
96 |
public static void main(String[] args) { |
97 |
FieldsTableTest att = new FieldsTableTest();
|
98 |
att.initializeTable(); |
99 |
//att.initializeTree();
|
100 |
} |
101 |
|
102 |
private void initializeTree(){ |
103 |
Vector att = describeFeatureType();
|
104 |
|
105 |
TreeTableModelWithCheckBoxes model = new TreeTableModelWithCheckBoxes(att.get(0)); |
106 |
JTree tree = new JTree(model); |
107 |
|
108 |
createFrame(tree); |
109 |
} |
110 |
private void initializeTable(){ |
111 |
Vector att = describeFeatureType();
|
112 |
|
113 |
TreeTableModelWithCheckBoxes model = new TreeTableModelWithCheckBoxes();
|
114 |
FieldsTreeTable treetable = new FieldsTreeTable(model);
|
115 |
|
116 |
JScrollPane scrollPane = new JScrollPane(); |
117 |
scrollPane.setViewportView(treetable); |
118 |
|
119 |
createFrame(scrollPane); |
120 |
|
121 |
//Sets the model
|
122 |
treetable.setModel(new TreeTableModelWithCheckBoxes(att.get(0))); |
123 |
} |
124 |
|
125 |
private void createFrame(Component component){ |
126 |
JFrame f = new JFrame(); |
127 |
f.addWindowListener(new java.awt.event.WindowAdapter() {
|
128 |
public void windowClosing(java.awt.event.WindowEvent evt) { |
129 |
System.exit(0); |
130 |
} |
131 |
}); |
132 |
f.getContentPane().add(component); |
133 |
f.setBounds(0,0,600,500); |
134 |
f.setVisible(true);
|
135 |
} |
136 |
|
137 |
|
138 |
private Vector describeFeatureType(){ |
139 |
XMLSchemaParser schemaParser = new XMLSchemaParser();
|
140 |
try {
|
141 |
schemaParser.parse(new File(gmlFile),"ms"); |
142 |
} catch (XmlPullParserException e) {
|
143 |
// TODO Auto-generated catch block
|
144 |
e.printStackTrace(); |
145 |
} catch (IOException e) { |
146 |
// TODO Auto-generated catch block
|
147 |
e.printStackTrace(); |
148 |
} |
149 |
XMLElement entity = XMLElementsFactory.getElement("Blyr");
|
150 |
if (entity != null){ |
151 |
Vector vector = new Vector(); |
152 |
vector.add(entity); |
153 |
return vector;
|
154 |
} |
155 |
|
156 |
return null; |
157 |
} |
158 |
|
159 |
} |