svn-gvsig-desktop / trunk / extensions / extWFS2 / src-test / com / iver / cit / gvsig / gui / panels / AttributesTableTest.java @ 8220
History | View | Annotate | Download (3.62 KB)
1 |
package com.iver.cit.gvsig.gui.panels; |
---|---|
2 |
|
3 |
import java.awt.event.WindowEvent; |
4 |
import java.awt.event.WindowListener; |
5 |
import java.io.File; |
6 |
import java.util.Vector; |
7 |
|
8 |
import javax.swing.JFrame; |
9 |
|
10 |
import org.gvsig.gui.beans.swing.treeTable.TreeTable; |
11 |
import org.gvsig.remoteClient.gml.factories.XMLElementsFactory; |
12 |
import org.gvsig.remoteClient.gml.schemas.IXMLType; |
13 |
import org.gvsig.remoteClient.gml.schemas.XMLComplexType; |
14 |
import org.gvsig.remoteClient.gml.schemas.XMLElement; |
15 |
import org.gvsig.remoteClient.gml.schemas.XMLSchemaParser; |
16 |
|
17 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
18 |
*
|
19 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
20 |
*
|
21 |
* This program is free software; you can redistribute it and/or
|
22 |
* modify it under the terms of the GNU General Public License
|
23 |
* as published by the Free Software Foundation; either version 2
|
24 |
* of the License, or (at your option) any later version.
|
25 |
*
|
26 |
* This program is distributed in the hope that it will be useful,
|
27 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
* GNU General Public License for more details.
|
30 |
*
|
31 |
* You should have received a copy of the GNU General Public License
|
32 |
* along with this program; if not, write to the Free Software
|
33 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
34 |
*
|
35 |
* For more information, contact:
|
36 |
*
|
37 |
* Generalitat Valenciana
|
38 |
* Conselleria d'Infraestructures i Transport
|
39 |
* Av. Blasco Ib??ez, 50
|
40 |
* 46010 VALENCIA
|
41 |
* SPAIN
|
42 |
*
|
43 |
* +34 963862235
|
44 |
* gvsig@gva.es
|
45 |
* www.gvsig.gva.es
|
46 |
*
|
47 |
* or
|
48 |
*
|
49 |
* IVER T.I. S.A
|
50 |
* Salamanca 50
|
51 |
* 46005 Valencia
|
52 |
* Spain
|
53 |
*
|
54 |
* +34 963163400
|
55 |
* dac@iver.es
|
56 |
*/
|
57 |
/* CVS MESSAGES:
|
58 |
*
|
59 |
* $Id: AttributesTableTest.java 8220 2006-10-23 07:37:04Z jorpiell $
|
60 |
* $Log$
|
61 |
* Revision 1.1 2006-10-23 07:37:04 jorpiell
|
62 |
* Ya funciona el filterEncoding
|
63 |
*
|
64 |
*
|
65 |
*/
|
66 |
/**
|
67 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
68 |
*/
|
69 |
public class AttributesTableTest implements WindowListener{ |
70 |
private String gmlFile = "src-test/WFS-DescribeFeatureTypeAves.xml"; |
71 |
|
72 |
public static void main(String[] args) { |
73 |
AttributesTableTest att = new AttributesTableTest();
|
74 |
att.initialize(); |
75 |
} |
76 |
|
77 |
private void initialize(){ |
78 |
Vector att = describeFeatureType();
|
79 |
Object[] objs = new Object[att.size()]; |
80 |
for (int i=0 ; i<att.size() ; i++){ |
81 |
objs[i] = att.get(i); |
82 |
} |
83 |
TreeTable treetable = new TreeTable(new AttributesTableModel(objs)); |
84 |
createFrame(treetable); |
85 |
} |
86 |
|
87 |
private void createFrame(TreeTable tree){ |
88 |
JFrame f = new JFrame(); |
89 |
f.addWindowListener(this);
|
90 |
f.getContentPane().add(tree); |
91 |
f.setBounds(0,0,600,500); |
92 |
f.setVisible(true);
|
93 |
} |
94 |
|
95 |
|
96 |
private Vector describeFeatureType(){ |
97 |
XMLSchemaParser schemaParser = new XMLSchemaParser();
|
98 |
schemaParser.parse(new File(gmlFile),"ms"); |
99 |
XMLElement entity = XMLElementsFactory.getElement("Blyr");
|
100 |
if (entity != null){ |
101 |
IXMLType type = entity.getEntityType(); |
102 |
if ((type != null) && (type instanceof XMLComplexType)){ |
103 |
return (((XMLComplexType)type).getAttributes());
|
104 |
} |
105 |
} |
106 |
return null; |
107 |
} |
108 |
|
109 |
public void windowActivated(WindowEvent e) { |
110 |
// TODO Auto-generated method stub
|
111 |
|
112 |
} |
113 |
|
114 |
public void windowClosed(WindowEvent e) { |
115 |
// TODO Auto-generated method stub
|
116 |
System.exit(0); |
117 |
} |
118 |
|
119 |
public void windowClosing(WindowEvent e) { |
120 |
// TODO Auto-generated method stub
|
121 |
|
122 |
} |
123 |
|
124 |
public void windowDeactivated(WindowEvent e) { |
125 |
// TODO Auto-generated method stub
|
126 |
|
127 |
} |
128 |
|
129 |
public void windowDeiconified(WindowEvent e) { |
130 |
// TODO Auto-generated method stub
|
131 |
|
132 |
} |
133 |
|
134 |
public void windowIconified(WindowEvent e) { |
135 |
// TODO Auto-generated method stub
|
136 |
|
137 |
} |
138 |
|
139 |
public void windowOpened(WindowEvent e) { |
140 |
// TODO Auto-generated method stub
|
141 |
|
142 |
} |
143 |
} |