root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / view / gui / ViewProperties.java @ 29596
History | View | Annotate | Download (21.1 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. 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 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package org.gvsig.app.project.documents.view.gui; |
42 |
|
43 |
|
44 |
import java.awt.Color; |
45 |
import java.awt.Dimension; |
46 |
import java.awt.GridLayout; |
47 |
import java.awt.event.ActionListener; |
48 |
|
49 |
import javax.swing.JColorChooser; |
50 |
import javax.swing.JComboBox; |
51 |
import javax.swing.JLabel; |
52 |
import javax.swing.JPanel; |
53 |
|
54 |
import org.cresques.cts.IProjection; |
55 |
import org.gvsig.andami.PluginServices; |
56 |
import org.gvsig.andami.ui.mdiManager.SingletonWindow; |
57 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
58 |
import org.gvsig.app.gui.JComboBoxUnits; |
59 |
import org.gvsig.app.gui.panels.CRSSelectPanel; |
60 |
import org.gvsig.app.project.documents.layout.Attributes; |
61 |
import org.gvsig.app.project.documents.view.ProjectView; |
62 |
import org.gvsig.fmap.mapcontext.MapContext; |
63 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
64 |
import org.gvsig.gui.beans.swing.JButton; |
65 |
|
66 |
/**
|
67 |
* Dialogo donde se muestran las propiedades de una vista
|
68 |
*
|
69 |
* @author Fernando Gonz?lez Cort?s
|
70 |
*/
|
71 |
public class ViewProperties extends JPanel implements SingletonWindow{ |
72 |
/*private String[] units = new String[] {
|
73 |
PluginServices.getText(this, "metros"),
|
74 |
PluginServices.getText(this, "kilometros"),
|
75 |
};
|
76 |
*/
|
77 |
private static String[] unitsNames = null; |
78 |
private javax.swing.JLabel jLabel = null; |
79 |
private javax.swing.JTextField txtName = null; |
80 |
private javax.swing.JLabel jLabel1 = null; |
81 |
private javax.swing.JTextField txtDate = null; |
82 |
private javax.swing.JLabel jLabel2 = null; |
83 |
private javax.swing.JTextField txtOwner = null; |
84 |
private javax.swing.JLabel jLabel4 = null; |
85 |
private javax.swing.JComboBox cmbMapUnits = null; |
86 |
private javax.swing.JLabel jLabel5 = null; |
87 |
private javax.swing.JComboBox cmbDistanceUnits = null; |
88 |
private javax.swing.JLabel jLabel6 = null; |
89 |
private javax.swing.JTextArea txtComments = null; |
90 |
private javax.swing.JLabel jLabel7 = null; |
91 |
private javax.swing.JLabel lblColor = null; |
92 |
|
93 |
private Color backColor = null; |
94 |
|
95 |
private JButton btnColor = null; |
96 |
private ProjectView view=null; |
97 |
private javax.swing.JScrollPane jScrollPane = null; |
98 |
private javax.swing.JPanel jPanel = null; |
99 |
private javax.swing.JPanel jPanel1 = null; |
100 |
private javax.swing.JPanel jPanel2 = null; |
101 |
private javax.swing.JPanel jPanel3 = null; |
102 |
|
103 |
private javax.swing.JLabel jLabel3 = null; |
104 |
private javax.swing.JLabel jLabelSep1 = null; |
105 |
private WindowInfo m_viewinfo = null; |
106 |
//private JLabel jLblProj = null;
|
107 |
//private JLabel jLblProjName = null;
|
108 |
//private JButton jBtnChangeProj = null;
|
109 |
protected CRSSelectPanel jPanelProj = null; |
110 |
private AcceptCancelPanel okCancelPanel = null; |
111 |
private boolean isAcceppted=false; |
112 |
private JLabel jLabel8 = null; |
113 |
private JComboBox cmbDistanceArea = null; |
114 |
/**
|
115 |
* This is the default constructor
|
116 |
*
|
117 |
* @param f Frame padre del dialogo
|
118 |
* @param v Vista que se representa
|
119 |
*/
|
120 |
public ViewProperties(ProjectView v) {
|
121 |
view = v; |
122 |
initialize(); |
123 |
} |
124 |
|
125 |
/**
|
126 |
* This method initializes this
|
127 |
*/
|
128 |
private void initialize() { |
129 |
this.setSize(386, 436); |
130 |
java.awt.FlowLayout layFlowLayout3 = new java.awt.FlowLayout();
|
131 |
layFlowLayout3.setHgap(0);
|
132 |
setLayout(layFlowLayout3); |
133 |
/* jLblProjName = new JLabel();
|
134 |
jLblProj = new JLabel();
|
135 |
jLblProj.setText(view.getProjection().getAbrev());
|
136 |
jLblProj.setPreferredSize(new java.awt.Dimension(180,20));
|
137 |
jLblProjName.setText("Proyecci?n actual:");
|
138 |
jLblProjName.setPreferredSize(new java.awt.Dimension(95,15));*/
|
139 |
this.setPreferredSize(new java.awt.Dimension(365,463)); |
140 |
add(getJPanel(), null);
|
141 |
add(getJPanel1(), null);
|
142 |
add(getJPanel2(), null);
|
143 |
add(getJPanel3(), null);
|
144 |
add(getJLabelSep1(), null);
|
145 |
this.add(getJPanelProj(), null); |
146 |
this.add(getJLabel6(), null); |
147 |
add(getJScrollPane(), null);
|
148 |
|
149 |
|
150 |
this.add(getJLabel7(), null); |
151 |
this.add(getLblColor(), null); |
152 |
this.add(getBtnColor(), null); |
153 |
|
154 |
|
155 |
add(getJLabel3(), null);
|
156 |
this.add(getOkCancelPanel(), null); |
157 |
txtName.setText(view.getName()); |
158 |
txtDate.setText(view.getCreationDate()); |
159 |
txtOwner.setText(view.getOwner()); |
160 |
|
161 |
cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits()); |
162 |
cmbDistanceUnits.setSelectedIndex(view.getMapContext().getViewPort().getDistanceUnits()); |
163 |
cmbDistanceArea.setSelectedIndex(view.getMapContext().getViewPort().getDistanceArea()); |
164 |
txtComments.setText(view.getComment()); |
165 |
|
166 |
lblColor.setBackground(view.getMapContext().getViewPort().getBackColor()); |
167 |
} |
168 |
|
169 |
/**
|
170 |
* This method initializes jLabel
|
171 |
*
|
172 |
* @return javax.swing.JLabel
|
173 |
*/
|
174 |
private javax.swing.JLabel getJLabel() {
|
175 |
if (jLabel == null) { |
176 |
jLabel = new javax.swing.JLabel();
|
177 |
jLabel.setText(PluginServices.getText(this, "nombre") + ":"); |
178 |
} |
179 |
|
180 |
return jLabel;
|
181 |
} |
182 |
|
183 |
private javax.swing.JLabel getJLabelSep1() {
|
184 |
if (jLabelSep1 == null) { |
185 |
jLabelSep1 = new javax.swing.JLabel();
|
186 |
jLabelSep1.setPreferredSize(new java.awt.Dimension(200, 10)); |
187 |
} |
188 |
return jLabelSep1;
|
189 |
} |
190 |
|
191 |
/**
|
192 |
* This method initializes txtName
|
193 |
*
|
194 |
* @return javax.swing.JTextField
|
195 |
*/
|
196 |
private javax.swing.JTextField getTxtName() {
|
197 |
if (txtName == null) { |
198 |
txtName = new javax.swing.JTextField();
|
199 |
txtName.setPreferredSize(new java.awt.Dimension(200, 20)); |
200 |
} |
201 |
|
202 |
return txtName;
|
203 |
} |
204 |
|
205 |
/**
|
206 |
* This method initializes jLabel1
|
207 |
*
|
208 |
* @return javax.swing.JLabel
|
209 |
*/
|
210 |
private javax.swing.JLabel getJLabel1() {
|
211 |
if (jLabel1 == null) { |
212 |
jLabel1 = new javax.swing.JLabel();
|
213 |
jLabel1.setText(PluginServices.getText(this, "creation_date") + ":"); |
214 |
} |
215 |
|
216 |
return jLabel1;
|
217 |
} |
218 |
|
219 |
/**
|
220 |
* This method initializes txtDate
|
221 |
*
|
222 |
* @return javax.swing.JTextField
|
223 |
*/
|
224 |
private javax.swing.JTextField getTxtDate() {
|
225 |
if (txtDate == null) { |
226 |
txtDate = new javax.swing.JTextField();
|
227 |
txtDate.setPreferredSize(new java.awt.Dimension(200, 20)); |
228 |
txtDate.setEditable(false);
|
229 |
txtDate.setBackground(java.awt.Color.white); |
230 |
} |
231 |
|
232 |
return txtDate;
|
233 |
} |
234 |
|
235 |
/**
|
236 |
* This method initializes jLabel2
|
237 |
*
|
238 |
* @return javax.swing.JLabel
|
239 |
*/
|
240 |
private javax.swing.JLabel getJLabel2() {
|
241 |
if (jLabel2 == null) { |
242 |
jLabel2 = new javax.swing.JLabel();
|
243 |
jLabel2.setText(PluginServices.getText(this, "owner") + ":"); |
244 |
} |
245 |
|
246 |
return jLabel2;
|
247 |
} |
248 |
|
249 |
/**
|
250 |
* This method initializes txtOwner
|
251 |
*
|
252 |
* @return javax.swing.JTextField
|
253 |
*/
|
254 |
private javax.swing.JTextField getTxtOwner() {
|
255 |
if (txtOwner == null) { |
256 |
txtOwner = new javax.swing.JTextField();
|
257 |
txtOwner.setPreferredSize(new java.awt.Dimension(200, 20)); |
258 |
} |
259 |
|
260 |
return txtOwner;
|
261 |
} |
262 |
|
263 |
/**
|
264 |
* This method initializes jLabel4
|
265 |
*
|
266 |
* @return javax.swing.JLabel
|
267 |
*/
|
268 |
private javax.swing.JLabel getJLabel4() {
|
269 |
if (jLabel4 == null) { |
270 |
jLabel4 = new javax.swing.JLabel();
|
271 |
jLabel4.setText(PluginServices.getText(this, "map_units") + ":"); |
272 |
jLabel4.setName("jLabel4");
|
273 |
} |
274 |
|
275 |
return jLabel4;
|
276 |
} |
277 |
|
278 |
/**
|
279 |
* This method initializes cmbMapUnits
|
280 |
*
|
281 |
* @return javax.swing.JComboBox
|
282 |
*/
|
283 |
private javax.swing.JComboBox getCmbMapUnits() {
|
284 |
if (cmbMapUnits == null|| MapContext.getDistanceNames().length>cmbMapUnits.getItemCount()) { |
285 |
boolean includePixels;
|
286 |
cmbMapUnits = new JComboBoxUnits(includePixels = false); |
287 |
|
288 |
// cmbMapUnits = new javax.swing.JComboBox(getUnitsNames());
|
289 |
cmbMapUnits.setPreferredSize(new java.awt.Dimension(200, 20)); |
290 |
IProjection proj=view.getProjection(); |
291 |
if (!proj.isProjected()) {
|
292 |
// if (cmbMapUnits.getItemCount()==MapContext.NAMES.length) {
|
293 |
// cmbMapUnits.addItem(PluginServices.getText(this, Attributes.DEGREES));
|
294 |
// }
|
295 |
cmbMapUnits.setSelectedItem(PluginServices.getText(this,"Grados")); // deegree |
296 |
cmbMapUnits.setEnabled(false);
|
297 |
}else {
|
298 |
if (!(cmbMapUnits.getItemCount()==MapContext.getDistanceNames().length)) {
|
299 |
cmbMapUnits.removeItem(PluginServices.getText(this,"Grados")); // deegree |
300 |
view.getMapContext().getViewPort().setMapUnits(1);
|
301 |
} |
302 |
cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits()); |
303 |
cmbMapUnits.setEnabled(true);
|
304 |
} |
305 |
cmbMapUnits.setSelectedIndex(view.getMapContext().getViewPort().getMapUnits()); |
306 |
|
307 |
//
|
308 |
// cmbMapUnits.addActionListener(new java.awt.event.ActionListener() {
|
309 |
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
310 |
// //view.getMapContext().getViewPort().setMapUnits(cmbMapUnits.getSelectedIndex());
|
311 |
// }
|
312 |
// });
|
313 |
} |
314 |
|
315 |
return cmbMapUnits;
|
316 |
} |
317 |
|
318 |
/**
|
319 |
* This method initializes jLabel5
|
320 |
*
|
321 |
* @return javax.swing.JLabel
|
322 |
*/
|
323 |
private javax.swing.JLabel getJLabel5() {
|
324 |
if (jLabel5 == null) { |
325 |
jLabel5 = new javax.swing.JLabel();
|
326 |
jLabel5.setText(PluginServices.getText(this, "distance_units") + ":"); |
327 |
jLabel5.setName("jLabel5");
|
328 |
} |
329 |
|
330 |
return jLabel5;
|
331 |
} |
332 |
|
333 |
/**
|
334 |
* This method initializes cmbDistanceUnits
|
335 |
*
|
336 |
* @return javax.swing.JComboBox
|
337 |
*/
|
338 |
private javax.swing.JComboBox getCmbDistanceUnits() {
|
339 |
if (cmbDistanceUnits == null|| MapContext.getDistanceNames().length>cmbDistanceUnits.getItemCount()){ |
340 |
boolean includePixels;
|
341 |
cmbDistanceUnits = new JComboBoxUnits(includePixels = false); |
342 |
// cmbDistanceUnits = new javax.swing.JComboBox(getUnitsNames());
|
343 |
cmbDistanceUnits.setPreferredSize(new java.awt.Dimension(200, 20)); |
344 |
// cmbDistanceUnits.setEditable(false);
|
345 |
// cmbDistanceUnits.setSelectedIndex(view.getMapContext().getViewPort().getDistanceUnits());
|
346 |
// cmbDistanceUnits.addActionListener(new java.awt.event.ActionListener() {
|
347 |
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
348 |
// //view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
|
349 |
// }
|
350 |
// });
|
351 |
} |
352 |
|
353 |
return cmbDistanceUnits;
|
354 |
} |
355 |
|
356 |
/**
|
357 |
* This method initializes jLabel6
|
358 |
*
|
359 |
* @return javax.swing.JLabel
|
360 |
*/
|
361 |
private javax.swing.JLabel getJLabel6() {
|
362 |
if (jLabel6 == null) { |
363 |
jLabel6 = new javax.swing.JLabel();
|
364 |
jLabel6.setText(PluginServices.getText(this, "comentarios") + ":"); |
365 |
jLabel6.setPreferredSize(new java.awt.Dimension(340,35)); |
366 |
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); |
367 |
jLabel6.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); |
368 |
} |
369 |
|
370 |
return jLabel6;
|
371 |
} |
372 |
|
373 |
/**
|
374 |
* This method initializes txtComments
|
375 |
*
|
376 |
* @return javax.swing.JTextArea
|
377 |
*/
|
378 |
private javax.swing.JTextArea getTxtComments() {
|
379 |
if (txtComments == null) { |
380 |
txtComments = new javax.swing.JTextArea();
|
381 |
txtComments.setRows(1);
|
382 |
txtComments.setColumns(28);
|
383 |
} |
384 |
|
385 |
return txtComments;
|
386 |
} |
387 |
|
388 |
/**
|
389 |
* This method initializes jLabel7
|
390 |
*
|
391 |
* @return javax.swing.JLabel
|
392 |
*/
|
393 |
private javax.swing.JLabel getJLabel7() {
|
394 |
if (jLabel7 == null) { |
395 |
jLabel7 = new javax.swing.JLabel();
|
396 |
jLabel7.setText(PluginServices.getText(this, "background_color") + |
397 |
":");
|
398 |
jLabel7.setPreferredSize(new java.awt.Dimension(190,16)); |
399 |
} |
400 |
|
401 |
return jLabel7;
|
402 |
} |
403 |
|
404 |
/**
|
405 |
* This method initializes lblColor
|
406 |
*
|
407 |
* @return javax.swing.JLabel
|
408 |
*/
|
409 |
private javax.swing.JLabel getLblColor() {
|
410 |
if (lblColor == null) { |
411 |
lblColor = new javax.swing.JLabel();
|
412 |
lblColor.setText("");
|
413 |
lblColor.setPreferredSize(new java.awt.Dimension(30, 16)); |
414 |
Color theColor = view.getMapContext().getViewPort().getBackColor();
|
415 |
backColor=theColor; |
416 |
if (theColor == null) { |
417 |
theColor = Color.WHITE;
|
418 |
} |
419 |
lblColor.setBackground(theColor); |
420 |
lblColor.setOpaque(true);
|
421 |
} |
422 |
|
423 |
return lblColor;
|
424 |
} |
425 |
|
426 |
/**
|
427 |
* This method initializes btnColor
|
428 |
*
|
429 |
* @return javax.swing.JButton
|
430 |
*/
|
431 |
private JButton getBtnColor() { |
432 |
if (btnColor == null) { |
433 |
btnColor = new JButton(); |
434 |
|
435 |
btnColor.setText("...");
|
436 |
|
437 |
btnColor.addActionListener(new java.awt.event.ActionListener() {
|
438 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
439 |
Color ret = JColorChooser.showDialog(ViewProperties.this, |
440 |
PluginServices.getText(this, "background_color"), |
441 |
lblColor.getBackground()); |
442 |
|
443 |
if (ret != null) { |
444 |
lblColor.setBackground(ret); |
445 |
backColor = ret; |
446 |
} else {
|
447 |
lblColor.setBackground(Color.WHITE);
|
448 |
} |
449 |
} |
450 |
}); |
451 |
} |
452 |
|
453 |
return btnColor;
|
454 |
} |
455 |
|
456 |
/**
|
457 |
* This method initializes jScrollPane
|
458 |
*
|
459 |
* @return javax.swing.JScrollPane
|
460 |
*/
|
461 |
private javax.swing.JScrollPane getJScrollPane() {
|
462 |
if (jScrollPane == null) { |
463 |
jScrollPane = new javax.swing.JScrollPane();
|
464 |
jScrollPane.setViewportView(getTxtComments()); |
465 |
jScrollPane.setPreferredSize(new java.awt.Dimension(340, 70)); |
466 |
} |
467 |
|
468 |
return jScrollPane;
|
469 |
} |
470 |
|
471 |
/**
|
472 |
* This method initializes jPanel
|
473 |
*
|
474 |
* @return javax.swing.JPanel
|
475 |
*/
|
476 |
private javax.swing.JPanel getJPanel() {
|
477 |
if (jPanel == null) { |
478 |
jPanel = new javax.swing.JPanel();
|
479 |
|
480 |
/*
|
481 |
java.awt.FlowLayout layFlowLayout4 = new java.awt.FlowLayout();
|
482 |
layFlowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
|
483 |
layFlowLayout4.setVgap(9);
|
484 |
jPanel.setLayout(layFlowLayout4);
|
485 |
*/
|
486 |
|
487 |
GridLayout layout = new GridLayout(3,1); |
488 |
layout.setVgap(5);
|
489 |
jPanel.setLayout(layout); |
490 |
|
491 |
|
492 |
jPanel.add(getJLabel(), null);
|
493 |
jPanel.add(getJLabel1(), null);
|
494 |
jPanel.add(getJLabel2(), null);
|
495 |
jPanel.setPreferredSize(new java.awt.Dimension(140, 80)); |
496 |
} |
497 |
|
498 |
return jPanel;
|
499 |
} |
500 |
|
501 |
/**
|
502 |
* This method initializes jPanel1
|
503 |
*
|
504 |
* @return javax.swing.JPanel
|
505 |
*/
|
506 |
private javax.swing.JPanel getJPanel1() {
|
507 |
if (jPanel1 == null) { |
508 |
jPanel1 = new javax.swing.JPanel();
|
509 |
|
510 |
java.awt.FlowLayout layFlowLayout2 = new java.awt.FlowLayout();
|
511 |
layFlowLayout2.setHgap(5);
|
512 |
layFlowLayout2.setAlignment(java.awt.FlowLayout.LEFT); |
513 |
jPanel1.setLayout(layFlowLayout2); |
514 |
jPanel1.add(getTxtName(), null);
|
515 |
jPanel1.add(getTxtDate(), null);
|
516 |
jPanel1.add(getTxtOwner(), null);
|
517 |
jPanel1.setPreferredSize(new java.awt.Dimension(210, 80)); |
518 |
} |
519 |
|
520 |
return jPanel1;
|
521 |
} |
522 |
|
523 |
/**
|
524 |
* This method initializes jPanel2
|
525 |
*
|
526 |
* @return javax.swing.JPanel
|
527 |
*/
|
528 |
private javax.swing.JPanel getJPanel2() {
|
529 |
if (jPanel2 == null) { |
530 |
jLabel8 = new JLabel(); |
531 |
jLabel8.setText("unidades_area");
|
532 |
GridLayout gridLayout = new GridLayout(); |
533 |
gridLayout.setRows(3);
|
534 |
jPanel2 = new javax.swing.JPanel();
|
535 |
|
536 |
jPanel2.setLayout(gridLayout); |
537 |
jPanel2.setPreferredSize(new java.awt.Dimension(140,80)); |
538 |
jPanel2.add(getJLabel4(), null);
|
539 |
jPanel2.add(getJLabel5(), null);
|
540 |
jPanel2.add(jLabel8, null);
|
541 |
} |
542 |
|
543 |
return jPanel2;
|
544 |
} |
545 |
|
546 |
/**
|
547 |
* This method initializes jPanel3
|
548 |
*
|
549 |
* @return javax.swing.JPanel
|
550 |
*/
|
551 |
private javax.swing.JPanel getJPanel3() {
|
552 |
if (jPanel3 == null) { |
553 |
jPanel3 = new javax.swing.JPanel();
|
554 |
|
555 |
java.awt.FlowLayout layFlowLayout6 = new java.awt.FlowLayout();
|
556 |
layFlowLayout6.setAlignment(java.awt.FlowLayout.LEFT); |
557 |
jPanel3.setLayout(layFlowLayout6); |
558 |
jPanel3.add(getCmbMapUnits(), null);
|
559 |
jPanel3.add(getCmbDistanceUnits(), null);
|
560 |
jPanel3.setPreferredSize(new java.awt.Dimension(210,80)); |
561 |
jPanel3.add(getCmbDistanceArea(), null);
|
562 |
} |
563 |
|
564 |
return jPanel3;
|
565 |
} |
566 |
|
567 |
|
568 |
/**
|
569 |
* This method initializes jLabel3
|
570 |
*
|
571 |
* @return javax.swing.JLabel
|
572 |
*/
|
573 |
private javax.swing.JLabel getJLabel3() {
|
574 |
if (jLabel3 == null) { |
575 |
jLabel3 = new javax.swing.JLabel();
|
576 |
jLabel3.setText("");
|
577 |
jLabel3.setPreferredSize(new java.awt.Dimension(30, 0)); |
578 |
} |
579 |
|
580 |
return jLabel3;
|
581 |
} |
582 |
|
583 |
/**
|
584 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
585 |
*/
|
586 |
public WindowInfo getWindowInfo() {
|
587 |
WindowInfo m_viewinfo=new WindowInfo();
|
588 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_vista")); |
589 |
m_viewinfo.setHeight(410);
|
590 |
return m_viewinfo;
|
591 |
} |
592 |
|
593 |
/**
|
594 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
595 |
*/
|
596 |
public void viewActivated() { |
597 |
} |
598 |
/**
|
599 |
* This method initializes jButton
|
600 |
*
|
601 |
* @return javax.swing.JButton
|
602 |
* /
|
603 |
private JButton getJBtnChangeProj() {
|
604 |
if (jBtnChangeProj == null) {
|
605 |
jBtnChangeProj = new JButton();
|
606 |
jBtnChangeProj.setText("...");
|
607 |
jBtnChangeProj.setPreferredSize(new java.awt.Dimension(34,16));
|
608 |
jBtnChangeProj.addActionListener(new java.awt.event.ActionListener() {
|
609 |
public void actionPerformed(java.awt.event.ActionEvent e) {
|
610 |
CSSelectionDialog csSelect = new CSSelectionDialog();
|
611 |
csSelect.setProjection(view.getProjection());
|
612 |
|
613 |
PluginServices.getMDIManager().addView(csSelect);
|
614 |
|
615 |
if (csSelect.isOkPressed()) {
|
616 |
view.getMapContext().setProjection(csSelect.getProjection());
|
617 |
jLblProj.setText(view.getProjection().getAbrev());
|
618 |
}
|
619 |
}
|
620 |
});
|
621 |
}
|
622 |
return jBtnChangeProj;
|
623 |
} */
|
624 |
/**
|
625 |
* This method initializes jPanel4
|
626 |
*
|
627 |
* @return javax.swing.JPanel
|
628 |
*/
|
629 |
private CRSSelectPanel getJPanelProj() {
|
630 |
if (jPanelProj == null) { |
631 |
IProjection proj=view.getProjection(); |
632 |
jPanelProj = CRSSelectPanel.getPanel(proj); |
633 |
jPanelProj.setPreferredSize(new java.awt.Dimension(330,35)); |
634 |
jPanelProj.addActionListener(new java.awt.event.ActionListener() {
|
635 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
636 |
if (jPanelProj.isOkPressed()) {
|
637 |
if (!jPanelProj.getCurProj().isProjected()) {
|
638 |
// if (getCmbMapUnits().getItemCount()==MapContext.NAMES.length) {
|
639 |
// getCmbMapUnits().addItem(PluginServices.getText(this, Attributes.DEGREES));
|
640 |
// }
|
641 |
getCmbMapUnits().setSelectedItem(PluginServices.getText(this, Attributes.DEGREES)); |
642 |
getCmbMapUnits().setEnabled(false);
|
643 |
}else {
|
644 |
if (getCmbMapUnits().getSelectedItem().equals(PluginServices.getText(this, Attributes.DEGREES))) { |
645 |
getCmbMapUnits().setSelectedIndex(1);
|
646 |
} |
647 |
getCmbMapUnits().setEnabled(true);
|
648 |
// if (!(getCmbMapUnits().getItemCount()==MapContext.NAMES.length)) {
|
649 |
// getCmbMapUnits().removeItem(PluginServices.getText(this, Attributes.DEGREES));
|
650 |
// }
|
651 |
} |
652 |
view.setProjection(jPanelProj.getCurProj()); |
653 |
} |
654 |
} |
655 |
}); |
656 |
|
657 |
// jPanelProj.add(jLblProjName, null);
|
658 |
// jPanelProj.add(jLblProj, null);
|
659 |
// jPanelProj.add(getJBtnChangeProj(), null);
|
660 |
} |
661 |
return jPanelProj;
|
662 |
} |
663 |
|
664 |
/**
|
665 |
* @see org.gvsig.andami.ui.mdiManager.SingletonWindow#getWindowModel()
|
666 |
*/
|
667 |
public Object getWindowModel() { |
668 |
return view;
|
669 |
} |
670 |
|
671 |
/**
|
672 |
* This method initializes okCancelPanel
|
673 |
*
|
674 |
* @return javax.swing.JPanel
|
675 |
*/
|
676 |
private AcceptCancelPanel getOkCancelPanel() {
|
677 |
if (okCancelPanel == null) { |
678 |
ActionListener okAction, cancelAction;
|
679 |
okAction = new java.awt.event.ActionListener() {
|
680 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
681 |
view.setName(txtName.getText()); |
682 |
view.setCreationDate(txtDate.getText()); |
683 |
view.setOwner(txtOwner.getText()); |
684 |
view.setComment(txtComments.getText()); |
685 |
view.getMapContext().getViewPort().setMapUnits(cmbMapUnits.getSelectedIndex()); |
686 |
view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex()); |
687 |
view.getMapContext().getViewPort().setDistanceArea(cmbDistanceArea.getSelectedIndex()); |
688 |
view.setBackColor(backColor); |
689 |
isAcceppted=true;
|
690 |
PluginServices.getMDIManager().closeWindow(ViewProperties.this); |
691 |
} |
692 |
}; |
693 |
cancelAction = new java.awt.event.ActionListener() {
|
694 |
|
695 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
696 |
isAcceppted=false;
|
697 |
PluginServices.getMDIManager().closeWindow(ViewProperties.this); |
698 |
} |
699 |
}; |
700 |
okCancelPanel = new AcceptCancelPanel(okAction, cancelAction);
|
701 |
Dimension sz = this.getSize(); |
702 |
sz.setSize((int)sz.getWidth()-20, (int) sz.getHeight()); |
703 |
okCancelPanel.setPreferredSize(sz); |
704 |
} |
705 |
return okCancelPanel;
|
706 |
} |
707 |
|
708 |
// private String[] getUnitsNames() {
|
709 |
// if (unitsNames == null) {
|
710 |
// unitsNames = new String[MapContext.NAMES.length];
|
711 |
// int i=0;
|
712 |
// for (i=0;i<MapContext.NAMES.length;i++) {
|
713 |
// unitsNames[i]=PluginServices.getText(this, MapContext.NAMES[i]);
|
714 |
// }
|
715 |
// //unitsNames[i]=PluginServices.getText(this, Attributes.DEGREES);
|
716 |
// }
|
717 |
// return unitsNames;
|
718 |
// }
|
719 |
|
720 |
public boolean isAcceppted() { |
721 |
return isAcceppted;
|
722 |
} |
723 |
/**
|
724 |
* This method initializes jComboBox
|
725 |
*
|
726 |
* @return javax.swing.JComboBox
|
727 |
*/
|
728 |
private JComboBox getCmbDistanceArea() { |
729 |
String[] names= MapContext.getAreaNames(); |
730 |
if (cmbDistanceArea == null || names.length>cmbDistanceArea.getItemCount()) { |
731 |
for (int i = 0; i < names.length; i++) { |
732 |
names[i]=PluginServices.getText(this,names[i])+ MapContext.getOfLinear(i);
|
733 |
} |
734 |
cmbDistanceArea = new javax.swing.JComboBox(names);
|
735 |
cmbDistanceArea.setPreferredSize(new java.awt.Dimension(200, 20)); |
736 |
cmbDistanceArea.setEditable(false);
|
737 |
cmbDistanceArea.setSelectedIndex(view.getMapContext().getViewPort().getDistanceArea()); |
738 |
cmbDistanceArea.addActionListener(new java.awt.event.ActionListener() {
|
739 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
740 |
//view.getMapContext().getViewPort().setDistanceUnits(cmbDistanceUnits.getSelectedIndex());
|
741 |
} |
742 |
}); |
743 |
} |
744 |
|
745 |
return cmbDistanceArea;
|
746 |
|
747 |
} |
748 |
public Object getWindowProfile() { |
749 |
// TODO Auto-generated method stub
|
750 |
return WindowInfo.PROPERTIES_PROFILE;
|
751 |
} |
752 |
|
753 |
} // @jve:decl-index=0:visual-constraint="10,10"
|