Statistics
| Revision:

svn-gvsig-desktop / branches / v10 / extensions / extWFS2 / src-test / com / iver / cit / gvsig / gui / panels / AttributesTableTest.java @ 9916

History | View | Annotate | Download (4.59 KB)

1 8220 jorpiell
package com.iver.cit.gvsig.gui.panels;
2
3 8278 jorpiell
import java.awt.Component;
4 8220 jorpiell
import java.io.File;
5 9916 jorpiell
import java.io.IOException;
6 8220 jorpiell
import java.util.Vector;
7
8
import javax.swing.JFrame;
9 8273 jorpiell
import javax.swing.JScrollPane;
10
import javax.swing.JTree;
11 8220 jorpiell
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 9916 jorpiell
import org.xmlpull.v1.XmlPullParserException;
16 8220 jorpiell
17 8399 jorpiell
import com.iver.cit.gvsig.gui.panels.attributesTree.AttributesTreeTable;
18
import com.iver.cit.gvsig.gui.panels.attributesTree.TreeTableModelWithCheckBoxes;
19 8393 ppiqueras
20 8220 jorpiell
/* 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 9916 jorpiell
 * Revision 1.7.2.3  2007-01-25 16:11:15  jorpiell
65
 * Se han cambiado los imports que hac?an referencia a remoteServices. Esto es as?, porque se han renombrado las clases del driver de GML
66
 *
67
 * Revision 1.7.2.2  2006/11/17 11:28:45  ppiqueras
68 8847 ppiqueras
 * Corregidos bugs y a?adida nueva funcionalidad.
69 8767 jjdelcerro
 *
70
 * Revision 1.7  2006/11/01 17:29:08  jorpiell
71 8469 jorpiell
 * 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 8444 jorpiell
 * 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 8399 jorpiell
 * Modificado el test
78 8393 ppiqueras
 *
79
 * Revision 1.3  2006/10/24 07:58:14  jorpiell
80 8278 jorpiell
 * 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 8273 jorpiell
 * Algunos cambios en el modelo que usa la tabla
84
 *
85
 * Revision 1.1  2006/10/23 07:37:04  jorpiell
86 8220 jorpiell
 * Ya funciona el filterEncoding
87
 *
88
 *
89
 */
90
/**
91
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
92
 */
93 8399 jorpiell
public class AttributesTableTest{
94 8220 jorpiell
        private String gmlFile = "src-test/WFS-DescribeFeatureTypeAves.xml";
95
96 9916 jorpiell
        public static void main(String[] args) throws XmlPullParserException, IOException {
97 8220 jorpiell
                AttributesTableTest att = new AttributesTableTest();
98 8399 jorpiell
                att.initializeTable();
99
                //att.initializeTree();
100 8220 jorpiell
        }
101 8399 jorpiell
102 9916 jorpiell
        private void initializeTree() throws XmlPullParserException, IOException{
103 8278 jorpiell
                Vector att = describeFeatureType();
104 8469 jorpiell
105
                TreeTableModelWithCheckBoxes model = new TreeTableModelWithCheckBoxes(att.get(0));
106 8399 jorpiell
                JTree tree = new JTree(model);
107
108 8278 jorpiell
                createFrame(tree);
109
        }
110 9916 jorpiell
        private void initializeTable() throws XmlPullParserException, IOException{
111 8220 jorpiell
                Vector att = describeFeatureType();
112 8469 jorpiell
113 8399 jorpiell
                TreeTableModelWithCheckBoxes model = new TreeTableModelWithCheckBoxes();
114
                AttributesTreeTable treetable = new AttributesTreeTable(model);
115
116 8273 jorpiell
                JScrollPane scrollPane = new JScrollPane();
117 8399 jorpiell
                scrollPane.setViewportView(treetable);
118 8273 jorpiell
119
                createFrame(scrollPane);
120 8399 jorpiell
121
                //Sets the model
122 8469 jorpiell
                treetable.setModel(new TreeTableModelWithCheckBoxes(att.get(0)));
123 8220 jorpiell
        }
124
125 8278 jorpiell
        private void createFrame(Component component){
126 8220 jorpiell
                JFrame f = new JFrame();
127 8399 jorpiell
                f.addWindowListener(new java.awt.event.WindowAdapter() {
128
            public void windowClosing(java.awt.event.WindowEvent evt) {
129
                    System.exit(0);
130
            }
131
        });
132 8278 jorpiell
                f.getContentPane().add(component);
133 8220 jorpiell
                f.setBounds(0,0,600,500);
134
                f.setVisible(true);
135
        }
136
137
138 9916 jorpiell
        private Vector describeFeatureType() throws XmlPullParserException, IOException{
139 8220 jorpiell
                XMLSchemaParser schemaParser = new XMLSchemaParser();
140
                schemaParser.parse(new File(gmlFile),"ms");
141
                XMLElement entity = XMLElementsFactory.getElement("Blyr");
142
                if (entity != null){
143 8444 jorpiell
                                Vector vector = new Vector();
144
                                vector.add(entity);
145
                                return vector;
146 8220 jorpiell
                }
147 8444 jorpiell
148 8220 jorpiell
                return null;
149
        }
150 8399 jorpiell
151 8220 jorpiell
}