Revision 36411 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/gui/ProjectProperties.java
ProjectProperties.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
|
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
|
2 | 2 |
* |
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
5 | 6 |
* This program is free software; you can redistribute it and/or |
6 | 7 |
* modify it under the terms of the GNU General Public License |
7 | 8 |
* as published by the Free Software Foundation; either version 2 |
8 | 9 |
* of the License, or (at your option) any later version. |
9 |
* |
|
10 |
*
|
|
10 | 11 |
* This program is distributed in the hope that it will be useful, |
11 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | 14 |
* GNU General Public License for more details. |
14 |
* |
|
15 |
*
|
|
15 | 16 |
* You should have received a copy of the GNU General Public License |
16 | 17 |
* 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 |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
40 | 21 |
*/ |
41 | 22 |
package org.gvsig.app.project.documents.gui; |
42 | 23 |
|
43 |
|
|
44 | 24 |
import java.awt.Color; |
45 | 25 |
import java.io.File; |
46 | 26 |
|
... | ... | |
52 | 32 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
53 | 33 |
import org.gvsig.app.extension.ProjectExtension; |
54 | 34 |
import org.gvsig.app.project.Project; |
55 |
import org.gvsig.app.project.Project; |
|
56 | 35 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
57 | 36 |
|
58 |
|
|
59 |
|
|
60 | 37 |
/** |
61 | 38 |
* Propiedades del proyecto |
62 |
* |
|
39 |
*
|
|
63 | 40 |
* @author Fernando Gonz?lez Cort?s |
64 | 41 |
*/ |
65 | 42 |
public class ProjectProperties extends JPanel implements IWindow { |
43 |
|
|
44 |
private static final long serialVersionUID = 8952351479171919349L; |
|
66 | 45 |
private Project project = null; |
67 | 46 |
private javax.swing.JPanel pane = null; |
68 | 47 |
private javax.swing.JPanel jPanel = null; |
... | ... | |
85 | 64 |
private javax.swing.JButton btnColor = null; |
86 | 65 |
private javax.swing.JScrollPane jScrollPane = null; |
87 | 66 |
private WindowInfo m_viewinfo = null; |
67 |
|
|
88 | 68 |
/** |
89 | 69 |
* This is the default constructor |
90 |
* |
|
91 |
* @param owner Frame padre del di?logo |
|
92 |
* @param p Proyecto cuyos datos se muestran en el di?logo |
|
70 |
* |
|
71 |
* @param owner |
|
72 |
* Frame padre del di?logo |
|
73 |
* @param p |
|
74 |
* Proyecto cuyos datos se muestran en el di?logo |
|
93 | 75 |
*/ |
94 | 76 |
public ProjectProperties(Project p) { |
95 | 77 |
project = p; |
... | ... | |
100 | 82 |
* This method initializes this |
101 | 83 |
*/ |
102 | 84 |
private void initialize() { |
103 |
setLayout(new java.awt.BorderLayout());
|
|
104 |
add(getJPanel(), java.awt.BorderLayout.CENTER);
|
|
85 |
setLayout(new java.awt.BorderLayout());
|
|
86 |
add(getJPanel(), java.awt.BorderLayout.CENTER);
|
|
105 | 87 |
|
106 | 88 |
getTxtName().setText(project.getName()); |
107 | 89 |
|
... | ... | |
124 | 106 |
|
125 | 107 |
/** |
126 | 108 |
* This method initializes jPanel |
127 |
* |
|
109 |
*
|
|
128 | 110 |
* @return javax.swing.JPanel |
129 | 111 |
*/ |
130 | 112 |
private javax.swing.JPanel getJPanel() { |
... | ... | |
145 | 127 |
jPanel.add(getJLabel6(), null); |
146 | 128 |
jPanel.add(getLblColor(), null); |
147 | 129 |
jPanel.add(getBtnColor(), null); |
148 |
java.awt.event.ActionListener okAction = new java.awt.event.ActionListener() { |
|
130 |
java.awt.event.ActionListener okAction = |
|
131 |
new java.awt.event.ActionListener() { |
|
132 |
|
|
133 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
134 |
project.setName(txtName.getText()); |
|
135 |
project.setOwner(txtOwner.getText()); |
|
136 |
project.setComments(txtComments.getText()); |
|
137 |
project.setSelectionColor(lblColor.getBackground()); |
|
138 |
PluginServices.getMDIManager().closeWindow( |
|
139 |
ProjectProperties.this); |
|
140 |
} |
|
141 |
}, cancelAction = new java.awt.event.ActionListener() { |
|
142 |
|
|
149 | 143 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
150 |
project.setName(txtName.getText()); |
|
151 |
project.setOwner(txtOwner.getText()); |
|
152 |
project.setComments(txtComments.getText()); |
|
153 |
project.setSelectionColor(lblColor.getBackground()); |
|
154 |
PluginServices.getMDIManager().closeWindow(ProjectProperties.this); |
|
144 |
PluginServices.getMDIManager().closeWindow( |
|
145 |
ProjectProperties.this); |
|
155 | 146 |
} |
156 |
}, cancelAction = new java.awt.event.ActionListener() { |
|
157 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
158 |
PluginServices.getMDIManager().closeWindow(ProjectProperties.this); |
|
159 |
} |
|
160 | 147 |
}; |
161 | 148 |
jPanel.add(new AcceptCancelPanel(okAction, cancelAction)); |
162 | 149 |
jPanel.setPreferredSize(new java.awt.Dimension(250, 10)); |
... | ... | |
167 | 154 |
|
168 | 155 |
/** |
169 | 156 |
* This method initializes jLabel |
170 |
* |
|
157 |
*
|
|
171 | 158 |
* @return javax.swing.JLabel |
172 | 159 |
*/ |
173 | 160 |
private javax.swing.JLabel getJLabel() { |
... | ... | |
182 | 169 |
|
183 | 170 |
/** |
184 | 171 |
* This method initializes jLabel1 |
185 |
* |
|
172 |
*
|
|
186 | 173 |
* @return javax.swing.JLabel |
187 | 174 |
*/ |
188 | 175 |
private javax.swing.JLabel getJLabel1() { |
... | ... | |
197 | 184 |
|
198 | 185 |
/** |
199 | 186 |
* This method initializes jLabel2 |
200 |
* |
|
187 |
*
|
|
201 | 188 |
* @return javax.swing.JLabel |
202 | 189 |
*/ |
203 | 190 |
private javax.swing.JLabel getJLabel2() { |
204 | 191 |
if (jLabel2 == null) { |
205 | 192 |
jLabel2 = new javax.swing.JLabel(); |
206 |
jLabel2.setText(PluginServices.getText(this, "creation_date") + ":"); |
|
193 |
jLabel2 |
|
194 |
.setText(PluginServices.getText(this, "creation_date") + ":"); |
|
207 | 195 |
jLabel2.setPreferredSize(new java.awt.Dimension(199, 16)); |
208 | 196 |
} |
209 | 197 |
|
... | ... | |
212 | 200 |
|
213 | 201 |
/** |
214 | 202 |
* This method initializes jLabel3 |
215 |
* |
|
203 |
*
|
|
216 | 204 |
* @return javax.swing.JLabel |
217 | 205 |
*/ |
218 | 206 |
private javax.swing.JLabel getJLabel3() { |
219 | 207 |
if (jLabel3 == null) { |
220 | 208 |
jLabel3 = new javax.swing.JLabel(); |
221 |
jLabel3.setText(PluginServices.getText(this, "modification_date") +
|
|
222 |
":"); |
|
209 |
jLabel3.setText(PluginServices.getText(this, "modification_date") |
|
210 |
+ ":");
|
|
223 | 211 |
jLabel3.setPreferredSize(new java.awt.Dimension(199, 16)); |
224 | 212 |
} |
225 | 213 |
|
... | ... | |
228 | 216 |
|
229 | 217 |
/** |
230 | 218 |
* This method initializes jLabel4 |
231 |
* |
|
219 |
*
|
|
232 | 220 |
* @return javax.swing.JLabel |
233 | 221 |
*/ |
234 | 222 |
private javax.swing.JLabel getJLabel4() { |
... | ... | |
243 | 231 |
|
244 | 232 |
/** |
245 | 233 |
* This method initializes txtName |
246 |
* |
|
234 |
*
|
|
247 | 235 |
* @return javax.swing.JTextField |
248 | 236 |
*/ |
249 | 237 |
private javax.swing.JTextField getTxtName() { |
... | ... | |
257 | 245 |
|
258 | 246 |
/** |
259 | 247 |
* This method initializes txtPath |
260 |
* |
|
248 |
*
|
|
261 | 249 |
* @return javax.swing.JTextField |
262 | 250 |
*/ |
263 | 251 |
private javax.swing.JTextField getTxtPath() { |
... | ... | |
273 | 261 |
|
274 | 262 |
/** |
275 | 263 |
* This method initializes txtCreationDate |
276 |
* |
|
264 |
*
|
|
277 | 265 |
* @return javax.swing.JTextField |
278 | 266 |
*/ |
279 | 267 |
private javax.swing.JTextField getTxtCreationDate() { |
... | ... | |
289 | 277 |
|
290 | 278 |
/** |
291 | 279 |
* This method initializes txtModificationDate |
292 |
* |
|
280 |
*
|
|
293 | 281 |
* @return javax.swing.JTextField |
294 | 282 |
*/ |
295 | 283 |
private javax.swing.JTextField getTxtModificationDate() { |
296 | 284 |
if (txtModificationDate == null) { |
297 | 285 |
txtModificationDate = new javax.swing.JTextField(); |
298 |
txtModificationDate.setPreferredSize(new java.awt.Dimension(210, 20)); |
|
286 |
txtModificationDate |
|
287 |
.setPreferredSize(new java.awt.Dimension(210, 20)); |
|
299 | 288 |
txtModificationDate.setEditable(false); |
300 | 289 |
txtModificationDate.setBackground(java.awt.Color.white); |
301 | 290 |
} |
... | ... | |
305 | 294 |
|
306 | 295 |
/** |
307 | 296 |
* This method initializes txtOwner |
308 |
* |
|
297 |
*
|
|
309 | 298 |
* @return javax.swing.JTextField |
310 | 299 |
*/ |
311 | 300 |
private javax.swing.JTextField getTxtOwner() { |
... | ... | |
319 | 308 |
|
320 | 309 |
/** |
321 | 310 |
* This method initializes jLabel5 |
322 |
* |
|
311 |
*
|
|
323 | 312 |
* @return javax.swing.JLabel |
324 | 313 |
*/ |
325 | 314 |
private javax.swing.JLabel getJLabel5() { |
... | ... | |
335 | 324 |
|
336 | 325 |
/** |
337 | 326 |
* This method initializes txtComments |
338 |
* |
|
327 |
*
|
|
339 | 328 |
* @return javax.swing.JTextArea |
340 | 329 |
*/ |
341 | 330 |
private javax.swing.JTextArea getTxtComments() { |
... | ... | |
348 | 337 |
return txtComments; |
349 | 338 |
} |
350 | 339 |
|
351 |
// /**
|
|
352 |
// * This method initializes btnOk
|
|
353 |
// *
|
|
354 |
// * @return javax.swing.JButton
|
|
355 |
// */
|
|
356 |
// private javax.swing.JButton getBtnOk() {
|
|
357 |
// if (btnOk == null) {
|
|
358 |
// btnOk = new javax.swing.JButton();
|
|
359 |
// btnOk.setPreferredSize(new java.awt.Dimension(100, 30));
|
|
360 |
// btnOk.setText(PluginServices.getText(this, "ok") + ":");
|
|
361 |
// |
|
362 |
// btnOk.addActionListener(new java.awt.event.ActionListener() {
|
|
363 |
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
364 |
// project.setName(txtName.getText());
|
|
365 |
// project.setOwner(txtOwner.getText());
|
|
366 |
// project.setComments(txtComments.getText());
|
|
367 |
// project.setSelectionColor(lblColor.getBackground());
|
|
368 |
// PluginServices.getMDIManager().closeView(ProjectProperties.this);
|
|
369 |
// }
|
|
370 |
// });
|
|
371 |
// }
|
|
372 |
// |
|
373 |
// return btnOk;
|
|
374 |
// }
|
|
375 |
// |
|
376 |
// /**
|
|
377 |
// * This method initializes btnCancel
|
|
378 |
// *
|
|
379 |
// * @return javax.swing.JButton
|
|
380 |
// */
|
|
381 |
// private javax.swing.JButton getBtnCancel() {
|
|
382 |
// if (btnCancel == null) {
|
|
383 |
// btnCancel = new javax.swing.JButton();
|
|
384 |
// btnCancel.setPreferredSize(new java.awt.Dimension(100, 30));
|
|
385 |
// btnCancel.setText(PluginServices.getText(this, "cancel") + ":");
|
|
386 |
// |
|
387 |
// btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
|
388 |
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
389 |
// PluginServices.getMDIManager().closeView(ProjectProperties.this);
|
|
390 |
// }
|
|
391 |
// });
|
|
392 |
// }
|
|
393 |
// |
|
394 |
// return btnCancel;
|
|
395 |
// }
|
|
340 |
// /**
|
|
341 |
// * This method initializes btnOk
|
|
342 |
// *
|
|
343 |
// * @return javax.swing.JButton
|
|
344 |
// */
|
|
345 |
// private javax.swing.JButton getBtnOk() {
|
|
346 |
// if (btnOk == null) {
|
|
347 |
// btnOk = new javax.swing.JButton();
|
|
348 |
// btnOk.setPreferredSize(new java.awt.Dimension(100, 30));
|
|
349 |
// btnOk.setText(PluginServices.getText(this, "ok") + ":");
|
|
350 |
//
|
|
351 |
// btnOk.addActionListener(new java.awt.event.ActionListener() {
|
|
352 |
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
353 |
// project.setName(txtName.getText());
|
|
354 |
// project.setOwner(txtOwner.getText());
|
|
355 |
// project.setComments(txtComments.getText());
|
|
356 |
// project.setSelectionColor(lblColor.getBackground());
|
|
357 |
// PluginServices.getMDIManager().closeView(ProjectProperties.this);
|
|
358 |
// }
|
|
359 |
// });
|
|
360 |
// }
|
|
361 |
//
|
|
362 |
// return btnOk;
|
|
363 |
// }
|
|
364 |
//
|
|
365 |
// /**
|
|
366 |
// * This method initializes btnCancel
|
|
367 |
// *
|
|
368 |
// * @return javax.swing.JButton
|
|
369 |
// */
|
|
370 |
// private javax.swing.JButton getBtnCancel() {
|
|
371 |
// if (btnCancel == null) {
|
|
372 |
// btnCancel = new javax.swing.JButton();
|
|
373 |
// btnCancel.setPreferredSize(new java.awt.Dimension(100, 30));
|
|
374 |
// btnCancel.setText(PluginServices.getText(this, "cancel") + ":");
|
|
375 |
//
|
|
376 |
// btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
|
377 |
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
|
378 |
// PluginServices.getMDIManager().closeView(ProjectProperties.this);
|
|
379 |
// }
|
|
380 |
// });
|
|
381 |
// }
|
|
382 |
//
|
|
383 |
// return btnCancel;
|
|
384 |
// }
|
|
396 | 385 |
|
397 | 386 |
/** |
398 | 387 |
* This method initializes jLabel6 |
399 |
* |
|
388 |
*
|
|
400 | 389 |
* @return javax.swing.JLabel |
401 | 390 |
*/ |
402 | 391 |
private javax.swing.JLabel getJLabel6() { |
403 | 392 |
if (jLabel6 == null) { |
404 | 393 |
jLabel6 = new javax.swing.JLabel(); |
405 |
jLabel6.setText(PluginServices.getText(this, "selection_color") +
|
|
406 |
":"); |
|
394 |
jLabel6.setText(PluginServices.getText(this, "selection_color") |
|
395 |
+ ":");
|
|
407 | 396 |
jLabel6.setPreferredSize(new java.awt.Dimension(190, 16)); |
408 | 397 |
} |
409 | 398 |
|
... | ... | |
412 | 401 |
|
413 | 402 |
/** |
414 | 403 |
* This method initializes lblColor |
415 |
* |
|
404 |
*
|
|
416 | 405 |
* @return javax.swing.JLabel |
417 | 406 |
*/ |
418 | 407 |
private javax.swing.JLabel getLblColor() { |
419 | 408 |
if (lblColor == null) { |
420 | 409 |
lblColor = new javax.swing.JLabel(); |
421 | 410 |
|
422 |
// lblColor.setText("");
|
|
411 |
// lblColor.setText("");
|
|
423 | 412 |
lblColor.setPreferredSize(new java.awt.Dimension(30, 16)); |
424 | 413 |
lblColor.setOpaque(true); |
425 | 414 |
} |
... | ... | |
429 | 418 |
|
430 | 419 |
/** |
431 | 420 |
* This method initializes btnColor |
432 |
* |
|
421 |
*
|
|
433 | 422 |
* @return javax.swing.JButton |
434 | 423 |
*/ |
435 | 424 |
private javax.swing.JButton getBtnColor() { |
... | ... | |
439 | 428 |
btnColor.setText("..."); |
440 | 429 |
|
441 | 430 |
btnColor.addActionListener(new java.awt.event.ActionListener() { |
442 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
443 |
Color ret = JColorChooser.showDialog(ProjectProperties.this, |
|
444 |
PluginServices.getText(this, "selection_color"), |
|
445 |
lblColor.getBackground()); |
|
446 | 431 |
|
447 |
if (ret != null) { |
|
448 |
lblColor.setBackground(ret); |
|
449 |
} |
|
432 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
433 |
Color ret = |
|
434 |
JColorChooser.showDialog(ProjectProperties.this, |
|
435 |
PluginServices.getText(this, "selection_color"), |
|
436 |
lblColor.getBackground()); |
|
437 |
|
|
438 |
if (ret != null) { |
|
439 |
lblColor.setBackground(ret); |
|
450 | 440 |
} |
451 |
}); |
|
441 |
} |
|
442 |
}); |
|
452 | 443 |
} |
453 | 444 |
|
454 | 445 |
return btnColor; |
... | ... | |
456 | 447 |
|
457 | 448 |
/** |
458 | 449 |
* This method initializes jScrollPane |
459 |
* |
|
450 |
*
|
|
460 | 451 |
* @return javax.swing.JScrollPane |
461 | 452 |
*/ |
462 | 453 |
private javax.swing.JScrollPane getJScrollPane() { |
... | ... | |
469 | 460 |
return jScrollPane; |
470 | 461 |
} |
471 | 462 |
|
472 |
/**
|
|
473 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
|
474 |
*/
|
|
475 |
public WindowInfo getWindowInfo() {
|
|
476 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
|
477 |
m_viewinfo.setWidth(450);
|
|
478 |
m_viewinfo.setHeight(250);
|
|
479 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_sesion"));
|
|
480 |
return m_viewinfo;
|
|
481 |
}
|
|
463 |
/**
|
|
464 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
|
465 |
*/
|
|
466 |
public WindowInfo getWindowInfo() {
|
|
467 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
|
468 |
m_viewinfo.setWidth(450);
|
|
469 |
m_viewinfo.setHeight(250);
|
|
470 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_sesion"));
|
|
471 |
return m_viewinfo;
|
|
472 |
}
|
|
482 | 473 |
|
483 |
/**
|
|
484 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
|
485 |
*/
|
|
486 |
public void viewActivated() {
|
|
487 |
}
|
|
474 |
/**
|
|
475 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
|
476 |
*/
|
|
477 |
public void viewActivated() {
|
|
478 |
}
|
|
488 | 479 |
|
489 |
public Object getWindowProfile() {
|
|
490 |
return WindowInfo.DIALOG_PROFILE;
|
|
491 |
}
|
|
480 |
public Object getWindowProfile() {
|
|
481 |
return WindowInfo.DIALOG_PROFILE;
|
|
482 |
}
|
|
492 | 483 |
|
493 | 484 |
} |
494 | 485 |
|
495 |
|
|
496 |
// @jve:visual-info decl-index=0 visual-constraint="10,10" |
|
486 |
// @jve:visual-info decl-index=0 visual-constraint="10,10" |
Also available in: Unified diff