root / branches / v10 / libraries / libJCRS / src / org / gvsig / crs / gui / panels / InfoCRSPanel.java @ 9061
History | View | Annotate | Download (12 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
|
34 |
* Campus Universitario s/n
|
35 |
* 02071 Alabacete
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 967 599 200
|
39 |
*/
|
40 |
|
41 |
package org.gvsig.crs.gui.panels; |
42 |
|
43 |
import java.awt.Dimension; |
44 |
import java.awt.FlowLayout; |
45 |
import java.awt.Font; |
46 |
import java.awt.GridLayout; |
47 |
import java.awt.event.ActionEvent; |
48 |
import java.awt.event.ActionListener; |
49 |
|
50 |
import javax.swing.JButton; |
51 |
import javax.swing.JLabel; |
52 |
import javax.swing.JPanel; |
53 |
import javax.swing.JScrollPane; |
54 |
import javax.swing.JTable; |
55 |
import javax.swing.ListSelectionModel; |
56 |
import javax.swing.table.DefaultTableModel; |
57 |
|
58 |
import org.cresques.ui.DefaultDialogPanel; |
59 |
import org.gvsig.crs.ICrs; |
60 |
|
61 |
import com.iver.andami.PluginServices; |
62 |
import com.iver.andami.ui.mdiManager.IWindow; |
63 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
64 |
|
65 |
/**
|
66 |
* Clase que genera el panel de informaci?n del CRS seleccionado
|
67 |
* en el caso del repositorio de la EPSG
|
68 |
* @author Miguel Garc?a Jim?nez (garciajimenez.miguel@gmail.com)
|
69 |
*
|
70 |
*/
|
71 |
public class InfoCRSPanel extends DefaultDialogPanel implements IWindow, ActionListener{ |
72 |
|
73 |
private static final long serialVersionUID = 1L; |
74 |
|
75 |
private JPanel panelLabels; |
76 |
|
77 |
private JTable jTable; |
78 |
public DefaultTableModel dtm = null; |
79 |
private JScrollPane jScrollPane1 = null; |
80 |
private JPanel jPanelbuttons; |
81 |
private JButton jButtonOk; |
82 |
|
83 |
private ICrs proj;
|
84 |
|
85 |
private JLabel jLabelProjcs; |
86 |
private JLabel jLabelGeogcs; |
87 |
private JLabel jLabelDatum; |
88 |
private JLabel jLabelSpheroid; |
89 |
private JLabel jLabelPrimem; |
90 |
private JLabel jLabelProjection; |
91 |
private JLabel jLabelUnits; |
92 |
private JLabel jLabelUnits_p; |
93 |
private JLabel jLabelProjcsdinamic; |
94 |
private JLabel jLabelGeogcsdinamic; |
95 |
private JLabel jLabelDatumdinamic; |
96 |
private JLabel jLabelSpheroiddinamic; |
97 |
private JLabel jLabelPrimemdinamic; |
98 |
private JLabel jLabelProjectiondinamic; |
99 |
private JLabel jLabelUnitsdinamic; |
100 |
private JLabel jLabelUnits_pdinamic; |
101 |
|
102 |
public InfoCRSPanel(ICrs p) {
|
103 |
super(false); |
104 |
proj = p; |
105 |
inicializate(); |
106 |
} |
107 |
|
108 |
private void inicializate() { |
109 |
this.add(getPanel(), null); |
110 |
this.add(getJPanelButtons(),null); |
111 |
} |
112 |
|
113 |
private JPanel getPanel() { |
114 |
if(panelLabels == null) { |
115 |
panelLabels = new JPanel(); |
116 |
panelLabels.setLayout(new GridLayout(6,4)); |
117 |
panelLabels.setLayout(new FlowLayout(FlowLayout.LEADING,5,10)); |
118 |
panelLabels.setPreferredSize(new Dimension(525, 300)); |
119 |
panelLabels.add(getJLabelProjcs(),null);
|
120 |
panelLabels.add(getJLabelProjcsDinamic(),null);
|
121 |
panelLabels.add(getJLabelGeogcs(),null);
|
122 |
panelLabels.add(getJLabelGeogcsDinamic(),null);
|
123 |
panelLabels.add(getJLabelDatum(),null);
|
124 |
panelLabels.add(getJLabelDatumDinamic(),null);
|
125 |
panelLabels.add(getJLabelSpheroid(),null);
|
126 |
panelLabels.add(getJLabelSpheroidDinamic(),null);
|
127 |
panelLabels.add(getJLabelPrimen(),null);
|
128 |
panelLabels.add(getJLabelPrimenDinamic(),null);
|
129 |
panelLabels.add(getJLabelUnits(),null);
|
130 |
panelLabels.add(getJLabelUnitsDinamic(),null);
|
131 |
panelLabels.add(getJLabelProjection(),null);
|
132 |
panelLabels.add(getJLabelProjectionDinamic(),null);
|
133 |
panelLabels.add(getJLabelUnits_p(),null);
|
134 |
panelLabels.add(getJLabelUnits_pDinamic(),null);
|
135 |
panelLabels.add(getJScrollPane1(), null);
|
136 |
} |
137 |
return panelLabels;
|
138 |
} |
139 |
|
140 |
private JPanel getJPanelButtons() { |
141 |
if(jPanelbuttons == null) { |
142 |
jPanelbuttons = new JPanel(); |
143 |
jPanelbuttons.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
144 |
jPanelbuttons.setPreferredSize(new Dimension(525,50)); |
145 |
jPanelbuttons.add(getJButtonOk(),null);
|
146 |
} |
147 |
return jPanelbuttons;
|
148 |
} |
149 |
|
150 |
private JButton getJButtonOk() { |
151 |
if(jButtonOk == null) { |
152 |
jButtonOk = new JButton(); |
153 |
jButtonOk.setText(PluginServices.getText(this,"ok")); |
154 |
jButtonOk.setPreferredSize(new Dimension(100,25)); |
155 |
jButtonOk.setMnemonic('O');
|
156 |
jButtonOk.setToolTipText("Accept");
|
157 |
jButtonOk.addActionListener(this);
|
158 |
} |
159 |
return jButtonOk;
|
160 |
} |
161 |
|
162 |
private JLabel getJLabelProjcs() { |
163 |
if(jLabelProjcs == null) { |
164 |
jLabelProjcs = new JLabel(); |
165 |
jLabelProjcs.setPreferredSize(new Dimension(75,20)); |
166 |
jLabelProjcs.setFont(new Font("Projcs:",Font.BOLD,10)); |
167 |
jLabelProjcs.setText(PluginServices.getText(this,"projcs")+":"); |
168 |
} |
169 |
return jLabelProjcs;
|
170 |
} |
171 |
|
172 |
private JLabel getJLabelProjcsDinamic() { |
173 |
if(jLabelProjcsdinamic == null) { |
174 |
jLabelProjcsdinamic = new JLabel(); |
175 |
jLabelProjcsdinamic.setPreferredSize(new Dimension(150,20)); |
176 |
jLabelProjcsdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
177 |
jLabelProjcsdinamic.setText(proj.getCrsWkt().getProjcs()); |
178 |
} |
179 |
return jLabelProjcsdinamic;
|
180 |
} |
181 |
|
182 |
private JLabel getJLabelGeogcs() { |
183 |
if(jLabelGeogcs == null) { |
184 |
jLabelGeogcs = new JLabel(); |
185 |
jLabelGeogcs.setPreferredSize(new Dimension(75,20)); |
186 |
jLabelGeogcs.setFont(new Font("Geogcs:",Font.BOLD,10)); |
187 |
jLabelGeogcs.setText(PluginServices.getText(this,"geogcs")+ ":"); |
188 |
} |
189 |
return jLabelGeogcs;
|
190 |
} |
191 |
|
192 |
private JLabel getJLabelGeogcsDinamic() { |
193 |
if(jLabelGeogcsdinamic == null) { |
194 |
jLabelGeogcsdinamic = new JLabel(); |
195 |
jLabelGeogcsdinamic.setPreferredSize(new Dimension(150,20)); |
196 |
jLabelGeogcsdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
197 |
jLabelGeogcsdinamic.setText(proj.getCrsWkt().getGeogcs()); |
198 |
} |
199 |
return jLabelGeogcsdinamic;
|
200 |
} |
201 |
|
202 |
private JLabel getJLabelDatum() { |
203 |
if(jLabelDatum == null) { |
204 |
jLabelDatum = new JLabel(); |
205 |
jLabelDatum.setPreferredSize(new Dimension(75,20)); |
206 |
jLabelDatum.setFont(new Font("Datum:",Font.BOLD,10)); |
207 |
jLabelDatum.setText(PluginServices.getText(this,"datum")+":"); |
208 |
} |
209 |
return jLabelDatum;
|
210 |
} |
211 |
|
212 |
private JLabel getJLabelDatumDinamic() { |
213 |
if(jLabelDatumdinamic == null) { |
214 |
jLabelDatumdinamic = new JLabel(); |
215 |
jLabelDatumdinamic.setPreferredSize(new Dimension(150,20)); |
216 |
jLabelDatumdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
217 |
jLabelDatumdinamic.setText(proj.getCrsWkt().getDatumName()); |
218 |
} |
219 |
return jLabelDatumdinamic;
|
220 |
} |
221 |
|
222 |
private JLabel getJLabelSpheroid() { |
223 |
if(jLabelSpheroid == null) { |
224 |
jLabelSpheroid = new JLabel(); |
225 |
jLabelSpheroid.setPreferredSize(new Dimension(75,20)); |
226 |
jLabelSpheroid.setFont(new Font("Spheroid",Font.BOLD,10)); |
227 |
jLabelSpheroid.setText(PluginServices.getText(this,"spheriod")+":"); |
228 |
} |
229 |
return jLabelSpheroid;
|
230 |
} |
231 |
|
232 |
private JLabel getJLabelSpheroidDinamic() { |
233 |
if(jLabelSpheroiddinamic == null) { |
234 |
String[] sphe = proj.getCrsWkt().getSpheroid(); |
235 |
jLabelSpheroiddinamic = new JLabel(); |
236 |
jLabelSpheroiddinamic.setPreferredSize(new Dimension(200,20)); |
237 |
jLabelSpheroiddinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
238 |
jLabelSpheroiddinamic.setText(sphe[0]+" , "+sphe[1]+" , "+sphe[2]); |
239 |
} |
240 |
return jLabelSpheroiddinamic;
|
241 |
} |
242 |
|
243 |
private JLabel getJLabelPrimen() { |
244 |
if(jLabelPrimem == null) { |
245 |
jLabelPrimem = new JLabel(); |
246 |
jLabelPrimem.setPreferredSize(new Dimension(75,20)); |
247 |
jLabelPrimem.setFont(new Font("Primen:",Font.BOLD,10)); |
248 |
jLabelPrimem.setText(PluginServices.getText(this,"primem")+":"); |
249 |
} |
250 |
return jLabelPrimem;
|
251 |
} |
252 |
|
253 |
private JLabel getJLabelPrimenDinamic() { |
254 |
if(jLabelPrimemdinamic == null) { |
255 |
String pri[] = proj.getCrsWkt().getPrimen(); |
256 |
jLabelPrimemdinamic = new JLabel(); |
257 |
jLabelPrimemdinamic.setPreferredSize(new Dimension(150,20)); |
258 |
jLabelPrimemdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
259 |
jLabelPrimemdinamic.setText(pri[0]+" , "+pri[1]); |
260 |
} |
261 |
return jLabelPrimemdinamic;
|
262 |
} |
263 |
|
264 |
private JLabel getJLabelProjection() { |
265 |
if(jLabelProjection == null) { |
266 |
jLabelProjection = new JLabel(); |
267 |
jLabelProjection.setPreferredSize(new Dimension(75,20)); |
268 |
jLabelProjection.setFont(new Font("Projection",Font.BOLD,10)); |
269 |
jLabelProjection.setText(PluginServices.getText(this,"projection")+":"); |
270 |
} |
271 |
return jLabelProjection;
|
272 |
} |
273 |
|
274 |
private JLabel getJLabelProjectionDinamic() { |
275 |
if(jLabelProjectiondinamic == null) { |
276 |
jLabelProjectiondinamic = new JLabel(); |
277 |
jLabelProjectiondinamic.setPreferredSize(new Dimension(150,20)); |
278 |
jLabelProjectiondinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
279 |
jLabelProjectiondinamic.setText(proj.getCrsWkt().getProjection()); |
280 |
} |
281 |
return jLabelProjectiondinamic;
|
282 |
} |
283 |
|
284 |
private JLabel getJLabelUnits() { |
285 |
if(jLabelUnits == null) { |
286 |
jLabelUnits = new JLabel(); |
287 |
jLabelUnits.setPreferredSize(new Dimension(75,20)); |
288 |
jLabelUnits.setFont(new Font("Units",Font.BOLD,10)); |
289 |
jLabelUnits.setText(PluginServices.getText(this,"units")+":"); |
290 |
} |
291 |
return jLabelUnits;
|
292 |
} |
293 |
|
294 |
private JLabel getJLabelUnitsDinamic() { |
295 |
if(jLabelUnitsdinamic == null) { |
296 |
String[] units = proj.getCrsWkt().getUnit(); |
297 |
jLabelUnitsdinamic = new JLabel(); |
298 |
jLabelUnitsdinamic.setPreferredSize(new Dimension(200,20)); |
299 |
jLabelUnitsdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
300 |
jLabelUnitsdinamic.setText(units[0]+" , "+units[1]); |
301 |
} |
302 |
return jLabelUnitsdinamic;
|
303 |
} |
304 |
|
305 |
private JLabel getJLabelUnits_p() { |
306 |
if(jLabelUnits_p == null) { |
307 |
jLabelUnits_p = new JLabel(); |
308 |
jLabelUnits_p.setPreferredSize(new Dimension(75,20)); |
309 |
jLabelUnits_p.setFont(new Font("",Font.BOLD,10)); |
310 |
jLabelUnits_p.setText(PluginServices.getText(this,"units_p")+":"); |
311 |
} |
312 |
return jLabelUnits_p;
|
313 |
} |
314 |
|
315 |
private JLabel getJLabelUnits_pDinamic() { |
316 |
if(jLabelUnits_pdinamic == null) { |
317 |
String[] uni_p = proj.getCrsWkt().getUnit_p(); |
318 |
jLabelUnits_pdinamic = new JLabel(); |
319 |
jLabelUnits_pdinamic.setPreferredSize(new Dimension(150,20)); |
320 |
jLabelUnits_pdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
321 |
jLabelUnits_pdinamic.setText(uni_p[0]+" , "+uni_p[1]); |
322 |
|
323 |
} |
324 |
return jLabelUnits_pdinamic;
|
325 |
} |
326 |
|
327 |
private JScrollPane getJScrollPane1() { |
328 |
if(jScrollPane1 == null) { |
329 |
jScrollPane1 = new JScrollPane(); |
330 |
jScrollPane1.setPreferredSize(new Dimension(400,150)); |
331 |
/* jScrollPane1.setBorder(
|
332 |
BorderFactory.createCompoundBorder(
|
333 |
BorderFactory.createCompoundBorder(
|
334 |
BorderFactory.createTitledBorder("Transformations"),
|
335 |
BorderFactory.createEmptyBorder(5,5,5,5)),
|
336 |
jScrollPane1.getBorder()));*/
|
337 |
jScrollPane1.setViewportView(getJTable()); |
338 |
} |
339 |
return jScrollPane1;
|
340 |
} |
341 |
|
342 |
private JTable getJTable() { |
343 |
if(jTable == null) { |
344 |
String[] columnNames = {PluginServices.getText(this,"nombre") |
345 |
,PluginServices.getText(this,"valor")}; |
346 |
String[] param_n = proj.getCrsWkt().getParam_name(); |
347 |
String[] param_v = proj.getCrsWkt().getParam_value(); |
348 |
Object[][]data; |
349 |
if(param_v != null) { |
350 |
data = new Object[param_v.length][2]; |
351 |
for(int i = 0 ; i < 2 ; i++ ) |
352 |
for(int j = 0 ; j < param_n.length ; j++) { |
353 |
if(i == 0) |
354 |
data[j][i] = param_n[j]; |
355 |
else
|
356 |
data[j][i] = param_v[j]; |
357 |
} |
358 |
} else
|
359 |
data = new Object[1][1]; |
360 |
dtm = new DefaultTableModel(data, columnNames); |
361 |
jTable = new JTable(dtm); |
362 |
jTable.setCellSelectionEnabled(false);
|
363 |
jTable.setRowSelectionAllowed(true);
|
364 |
jTable.setColumnSelectionAllowed(false);
|
365 |
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
366 |
|
367 |
} |
368 |
return jTable;
|
369 |
} |
370 |
|
371 |
public WindowInfo getWindowInfo() {
|
372 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
373 |
m_viewinfo.setTitle(PluginServices.getText(this,proj.getCrsWkt().getName()));
|
374 |
return m_viewinfo;
|
375 |
} |
376 |
|
377 |
public void actionPerformed(ActionEvent e) { |
378 |
if (e.getSource() == getJButtonOk()){
|
379 |
PluginServices.getMDIManager().closeWindow(this);
|
380 |
} |
381 |
} |
382 |
} |