svn-gvsig-desktop / tags / v1_1_Build_1009 / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / panels / WFSFormatPanel.java @ 12649
History | View | Annotate | Download (4.66 KB)
1 |
package com.iver.cit.gvsig.gui.panels; |
---|---|
2 |
|
3 |
import java.util.ArrayList; |
4 |
import java.util.Collection; |
5 |
import java.util.TreeSet; |
6 |
import java.util.Vector; |
7 |
|
8 |
import javax.swing.AbstractListModel; |
9 |
import javax.swing.JList; |
10 |
import javax.swing.JPanel; |
11 |
import javax.swing.JScrollPane; |
12 |
|
13 |
import com.iver.andami.PluginServices; |
14 |
import com.iver.cit.gvsig.fmap.layers.WFSLayerNode; |
15 |
|
16 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
17 |
*
|
18 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
19 |
*
|
20 |
* This program is free software; you can redistribute it and/or
|
21 |
* modify it under the terms of the GNU General Public License
|
22 |
* as published by the Free Software Foundation; either version 2
|
23 |
* of the License, or (at your option) any later version.
|
24 |
*
|
25 |
* This program is distributed in the hope that it will be useful,
|
26 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
27 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
28 |
* GNU General Public License for more details.
|
29 |
*
|
30 |
* You should have received a copy of the GNU General Public License
|
31 |
* along with this program; if not, write to the Free Software
|
32 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
33 |
*
|
34 |
* For more information, contact:
|
35 |
*
|
36 |
* Generalitat Valenciana
|
37 |
* Conselleria d'Infraestructures i Transport
|
38 |
* Av. Blasco Ib??ez, 50
|
39 |
* 46010 VALENCIA
|
40 |
* SPAIN
|
41 |
*
|
42 |
* +34 963862235
|
43 |
* gvsig@gva.es
|
44 |
* www.gvsig.gva.es
|
45 |
*
|
46 |
* or
|
47 |
*
|
48 |
* IVER T.I. S.A
|
49 |
* Salamanca 50
|
50 |
* 46005 Valencia
|
51 |
* Spain
|
52 |
*
|
53 |
* +34 963163400
|
54 |
* dac@iver.es
|
55 |
*/
|
56 |
/* CVS MESSAGES:
|
57 |
*
|
58 |
* $Id: WFSFormatPanel.java 12649 2007-07-17 12:20:01Z $
|
59 |
* $Log$
|
60 |
* Revision 1.1 2006-06-15 07:50:58 jorpiell
|
61 |
* A?adida la funcionalidad de reproyectar y hechos algunos cambios en la interfaz
|
62 |
*
|
63 |
*
|
64 |
*/
|
65 |
/**
|
66 |
* @author Jorge Piera Llodr? (piera_jor@gva.es)
|
67 |
*/
|
68 |
public class WFSFormatPanel extends JPanel { |
69 |
private JPanel srsPanel = null; |
70 |
private JScrollPane jScrollPane2 = null; |
71 |
private JList lstSRSs = null; |
72 |
|
73 |
/**
|
74 |
* This method initializes
|
75 |
*
|
76 |
*/
|
77 |
public WFSFormatPanel() {
|
78 |
super();
|
79 |
initialize(); |
80 |
} |
81 |
|
82 |
/**
|
83 |
* This method initializes this
|
84 |
*
|
85 |
*/
|
86 |
private void initialize() { |
87 |
this.setLayout(null); |
88 |
this.setBounds(10, 5, 481, 427); |
89 |
this.add(getSrsPanel(), null); |
90 |
|
91 |
} |
92 |
|
93 |
/**
|
94 |
* This method initializes srsPanel
|
95 |
*
|
96 |
* @return javax.swing.JPanel
|
97 |
*/
|
98 |
private JPanel getSrsPanel() { |
99 |
if (srsPanel == null) { |
100 |
srsPanel = new JPanel(); |
101 |
srsPanel.setLayout(null);
|
102 |
srsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
103 |
null, PluginServices.getText(this, "seleccionar_srs"), |
104 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
105 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
106 |
srsPanel.setBounds(7, 10, 453, 168); |
107 |
srsPanel.add(getJScrollPane2(), null);
|
108 |
} |
109 |
return srsPanel;
|
110 |
} |
111 |
|
112 |
/**
|
113 |
* This method initializes jScrollPane2
|
114 |
*
|
115 |
* @return javax.swing.JScrollPane
|
116 |
*/
|
117 |
private javax.swing.JScrollPane getJScrollPane2() {
|
118 |
if (jScrollPane2 == null) { |
119 |
jScrollPane2 = new javax.swing.JScrollPane();
|
120 |
jScrollPane2.setBounds(5, 23, 442, 141); |
121 |
jScrollPane2.setViewportView(getLstSRSs()); |
122 |
jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 200)); |
123 |
} |
124 |
|
125 |
return jScrollPane2;
|
126 |
} |
127 |
|
128 |
/**
|
129 |
* This method initializes lstSRSs
|
130 |
*
|
131 |
* @return javax.swing.JList
|
132 |
*/
|
133 |
public javax.swing.JList getLstSRSs() {
|
134 |
if (lstSRSs == null) { |
135 |
lstSRSs = new javax.swing.JList();
|
136 |
lstSRSs.setModel(new SRSListModel());
|
137 |
lstSRSs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
138 |
lstSRSs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
139 |
public void valueChanged( |
140 |
javax.swing.event.ListSelectionEvent e) { |
141 |
int i = lstSRSs.getSelectedIndex();
|
142 |
} |
143 |
}); |
144 |
} |
145 |
|
146 |
return lstSRSs;
|
147 |
} |
148 |
|
149 |
/**
|
150 |
* Refresh the panel
|
151 |
* @param feature
|
152 |
*/
|
153 |
public void refresh(WFSLayerNode feature) { |
154 |
setFormats(feature); |
155 |
} |
156 |
|
157 |
/**
|
158 |
* Sets a SRS list
|
159 |
* @param feature
|
160 |
*/
|
161 |
private void setFormats(WFSLayerNode feature){ |
162 |
getLstSRSs().setListData(new Object[0]); |
163 |
Vector srs = feature.getSrs();
|
164 |
getLstSRSs().setListData(srs.toArray()); |
165 |
} |
166 |
|
167 |
public class SRSListModel extends AbstractListModel { |
168 |
private static final long serialVersionUID = -6134561791965083588L; |
169 |
ArrayList srs = new ArrayList(); |
170 |
|
171 |
public int getSize() { |
172 |
return srs.size();
|
173 |
} |
174 |
|
175 |
public Object getElementAt(int index) { |
176 |
return srs.get(index);
|
177 |
} |
178 |
|
179 |
public void setAll(Collection c) { |
180 |
|
181 |
srs.clear(); |
182 |
srs.addAll(c); |
183 |
} |
184 |
|
185 |
public Collection intersect(Collection c) { |
186 |
TreeSet resul = new TreeSet(); |
187 |
for (int i = 0; i < srs.size(); i++) { |
188 |
if (c.contains(srs.get(i)))
|
189 |
resul.add(srs.get(i)); |
190 |
} |
191 |
return resul;
|
192 |
} |
193 |
} |
194 |
} |