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