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