root / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / gui / ProjectProperties.java @ 29598
History | View | Annotate | Download (15.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.gui; |
42 |
|
43 |
|
44 |
import java.awt.Color; |
45 |
import java.io.File; |
46 |
|
47 |
import javax.swing.JColorChooser; |
48 |
import javax.swing.JPanel; |
49 |
|
50 |
import org.gvsig.andami.PluginServices; |
51 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
52 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
53 |
import org.gvsig.app.extension.ProjectExtension; |
54 |
import org.gvsig.app.project.Project; |
55 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
56 |
|
57 |
|
58 |
|
59 |
/**
|
60 |
* Propiedades del proyecto
|
61 |
*
|
62 |
* @author Fernando Gonz?lez Cort?s
|
63 |
*/
|
64 |
public class ProjectProperties extends JPanel implements IWindow { |
65 |
private Project project = null; |
66 |
private javax.swing.JPanel pane = null; |
67 |
private javax.swing.JPanel jPanel = null; |
68 |
private javax.swing.JLabel jLabel = null; |
69 |
private javax.swing.JLabel jLabel1 = null; |
70 |
private javax.swing.JLabel jLabel2 = null; |
71 |
private javax.swing.JLabel jLabel3 = null; |
72 |
private javax.swing.JLabel jLabel4 = null; |
73 |
private javax.swing.JTextField txtName = null; |
74 |
private javax.swing.JTextField txtPath = null; |
75 |
private javax.swing.JTextField txtCreationDate = null; |
76 |
private javax.swing.JTextField txtModificationDate = null; |
77 |
private javax.swing.JTextField txtOwner = null; |
78 |
private javax.swing.JLabel jLabel5 = null; |
79 |
private javax.swing.JTextArea txtComments = null; |
80 |
private javax.swing.JButton btnOk = null; |
81 |
private javax.swing.JButton btnCancel = null; |
82 |
private javax.swing.JLabel jLabel6 = null; |
83 |
private javax.swing.JLabel lblColor = null; |
84 |
private javax.swing.JButton btnColor = null; |
85 |
private javax.swing.JScrollPane jScrollPane = null; |
86 |
private WindowInfo m_viewinfo = null; |
87 |
/**
|
88 |
* This is the default constructor
|
89 |
*
|
90 |
* @param owner Frame padre del di?logo
|
91 |
* @param p Proyecto cuyos datos se muestran en el di?logo
|
92 |
*/
|
93 |
public ProjectProperties(Project p) {
|
94 |
project = p; |
95 |
initialize(); |
96 |
} |
97 |
|
98 |
/**
|
99 |
* This method initializes this
|
100 |
*/
|
101 |
private void initialize() { |
102 |
setLayout(new java.awt.BorderLayout());
|
103 |
add(getJPanel(), java.awt.BorderLayout.CENTER); |
104 |
|
105 |
getTxtName().setText(project.getName()); |
106 |
|
107 |
String path = ProjectExtension.getPath();
|
108 |
|
109 |
if (path != null) { |
110 |
File f = new File(path); |
111 |
getTxtPath().setText(f.toString()); |
112 |
} else {
|
113 |
getTxtPath().setText("");
|
114 |
} |
115 |
|
116 |
getTxtOwner().setText(project.getOwner()); |
117 |
getTxtComments().setText(project.getComments()); |
118 |
getTxtCreationDate().setText(project.getCreationDate()); |
119 |
getTxtModificationDate().setText(project.getModificationDate()); |
120 |
|
121 |
getLblColor().setBackground(project.getSelectionColor()); |
122 |
} |
123 |
|
124 |
/**
|
125 |
* This method initializes jPanel
|
126 |
*
|
127 |
* @return javax.swing.JPanel
|
128 |
*/
|
129 |
private javax.swing.JPanel getJPanel() {
|
130 |
if (jPanel == null) { |
131 |
jPanel = new javax.swing.JPanel();
|
132 |
jPanel.add(getJLabel(), null);
|
133 |
jPanel.add(getTxtName(), null);
|
134 |
jPanel.add(getJLabel1(), null);
|
135 |
jPanel.add(getTxtPath(), null);
|
136 |
jPanel.add(getJLabel2(), null);
|
137 |
jPanel.add(getTxtCreationDate(), null);
|
138 |
jPanel.add(getJLabel3(), null);
|
139 |
jPanel.add(getTxtModificationDate(), null);
|
140 |
jPanel.add(getJLabel4(), null);
|
141 |
jPanel.add(getTxtOwner(), null);
|
142 |
jPanel.add(getJLabel5(), null);
|
143 |
jPanel.add(getJScrollPane(), null);
|
144 |
jPanel.add(getJLabel6(), null);
|
145 |
jPanel.add(getLblColor(), null);
|
146 |
jPanel.add(getBtnColor(), null);
|
147 |
java.awt.event.ActionListener okAction = new java.awt.event.ActionListener() {
|
148 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
149 |
project.setName(txtName.getText()); |
150 |
project.setOwner(txtOwner.getText()); |
151 |
project.setComments(txtComments.getText()); |
152 |
project.setSelectionColor(lblColor.getBackground()); |
153 |
PluginServices.getMDIManager().closeWindow(ProjectProperties.this); |
154 |
} |
155 |
}, cancelAction = new java.awt.event.ActionListener() {
|
156 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
157 |
PluginServices.getMDIManager().closeWindow(ProjectProperties.this); |
158 |
} |
159 |
}; |
160 |
jPanel.add(new AcceptCancelPanel(okAction, cancelAction));
|
161 |
jPanel.setPreferredSize(new java.awt.Dimension(250, 10)); |
162 |
} |
163 |
|
164 |
return jPanel;
|
165 |
} |
166 |
|
167 |
/**
|
168 |
* This method initializes jLabel
|
169 |
*
|
170 |
* @return javax.swing.JLabel
|
171 |
*/
|
172 |
private javax.swing.JLabel getJLabel() {
|
173 |
if (jLabel == null) { |
174 |
jLabel = new javax.swing.JLabel();
|
175 |
jLabel.setText(PluginServices.getText(this, "nombre_sesion") + ":"); |
176 |
jLabel.setPreferredSize(new java.awt.Dimension(199, 16)); |
177 |
} |
178 |
|
179 |
return jLabel;
|
180 |
} |
181 |
|
182 |
/**
|
183 |
* This method initializes jLabel1
|
184 |
*
|
185 |
* @return javax.swing.JLabel
|
186 |
*/
|
187 |
private javax.swing.JLabel getJLabel1() {
|
188 |
if (jLabel1 == null) { |
189 |
jLabel1 = new javax.swing.JLabel();
|
190 |
jLabel1.setText(PluginServices.getText(this, "path") + ":"); |
191 |
jLabel1.setPreferredSize(new java.awt.Dimension(199, 16)); |
192 |
} |
193 |
|
194 |
return jLabel1;
|
195 |
} |
196 |
|
197 |
/**
|
198 |
* This method initializes jLabel2
|
199 |
*
|
200 |
* @return javax.swing.JLabel
|
201 |
*/
|
202 |
private javax.swing.JLabel getJLabel2() {
|
203 |
if (jLabel2 == null) { |
204 |
jLabel2 = new javax.swing.JLabel();
|
205 |
jLabel2.setText(PluginServices.getText(this, "creation_date") + ":"); |
206 |
jLabel2.setPreferredSize(new java.awt.Dimension(199, 16)); |
207 |
} |
208 |
|
209 |
return jLabel2;
|
210 |
} |
211 |
|
212 |
/**
|
213 |
* This method initializes jLabel3
|
214 |
*
|
215 |
* @return javax.swing.JLabel
|
216 |
*/
|
217 |
private javax.swing.JLabel getJLabel3() {
|
218 |
if (jLabel3 == null) { |
219 |
jLabel3 = new javax.swing.JLabel();
|
220 |
jLabel3.setText(PluginServices.getText(this, "modification_date") + |
221 |
":");
|
222 |
jLabel3.setPreferredSize(new java.awt.Dimension(199, 16)); |
223 |
} |
224 |
|
225 |
return jLabel3;
|
226 |
} |
227 |
|
228 |
/**
|
229 |
* This method initializes jLabel4
|
230 |
*
|
231 |
* @return javax.swing.JLabel
|
232 |
*/
|
233 |
private javax.swing.JLabel getJLabel4() {
|
234 |
if (jLabel4 == null) { |
235 |
jLabel4 = new javax.swing.JLabel();
|
236 |
jLabel4.setText(PluginServices.getText(this, "owner") + ":"); |
237 |
jLabel4.setPreferredSize(new java.awt.Dimension(199, 16)); |
238 |
} |
239 |
|
240 |
return jLabel4;
|
241 |
} |
242 |
|
243 |
/**
|
244 |
* This method initializes txtName
|
245 |
*
|
246 |
* @return javax.swing.JTextField
|
247 |
*/
|
248 |
private javax.swing.JTextField getTxtName() {
|
249 |
if (txtName == null) { |
250 |
txtName = new javax.swing.JTextField();
|
251 |
txtName.setPreferredSize(new java.awt.Dimension(210, 20)); |
252 |
} |
253 |
|
254 |
return txtName;
|
255 |
} |
256 |
|
257 |
/**
|
258 |
* This method initializes txtPath
|
259 |
*
|
260 |
* @return javax.swing.JTextField
|
261 |
*/
|
262 |
private javax.swing.JTextField getTxtPath() {
|
263 |
if (txtPath == null) { |
264 |
txtPath = new javax.swing.JTextField();
|
265 |
txtPath.setPreferredSize(new java.awt.Dimension(210, 20)); |
266 |
txtPath.setEditable(false);
|
267 |
txtPath.setBackground(java.awt.Color.white); |
268 |
} |
269 |
|
270 |
return txtPath;
|
271 |
} |
272 |
|
273 |
/**
|
274 |
* This method initializes txtCreationDate
|
275 |
*
|
276 |
* @return javax.swing.JTextField
|
277 |
*/
|
278 |
private javax.swing.JTextField getTxtCreationDate() {
|
279 |
if (txtCreationDate == null) { |
280 |
txtCreationDate = new javax.swing.JTextField();
|
281 |
txtCreationDate.setPreferredSize(new java.awt.Dimension(210, 20)); |
282 |
txtCreationDate.setEditable(false);
|
283 |
txtCreationDate.setBackground(java.awt.Color.white); |
284 |
} |
285 |
|
286 |
return txtCreationDate;
|
287 |
} |
288 |
|
289 |
/**
|
290 |
* This method initializes txtModificationDate
|
291 |
*
|
292 |
* @return javax.swing.JTextField
|
293 |
*/
|
294 |
private javax.swing.JTextField getTxtModificationDate() {
|
295 |
if (txtModificationDate == null) { |
296 |
txtModificationDate = new javax.swing.JTextField();
|
297 |
txtModificationDate.setPreferredSize(new java.awt.Dimension(210, 20)); |
298 |
txtModificationDate.setEditable(false);
|
299 |
txtModificationDate.setBackground(java.awt.Color.white); |
300 |
} |
301 |
|
302 |
return txtModificationDate;
|
303 |
} |
304 |
|
305 |
/**
|
306 |
* This method initializes txtOwner
|
307 |
*
|
308 |
* @return javax.swing.JTextField
|
309 |
*/
|
310 |
private javax.swing.JTextField getTxtOwner() {
|
311 |
if (txtOwner == null) { |
312 |
txtOwner = new javax.swing.JTextField();
|
313 |
txtOwner.setPreferredSize(new java.awt.Dimension(210, 20)); |
314 |
} |
315 |
|
316 |
return txtOwner;
|
317 |
} |
318 |
|
319 |
/**
|
320 |
* This method initializes jLabel5
|
321 |
*
|
322 |
* @return javax.swing.JLabel
|
323 |
*/
|
324 |
private javax.swing.JLabel getJLabel5() {
|
325 |
if (jLabel5 == null) { |
326 |
jLabel5 = new javax.swing.JLabel();
|
327 |
jLabel5.setText(PluginServices.getText(this, "comentarios") + ":"); |
328 |
jLabel5.setPreferredSize(new java.awt.Dimension(119, 16)); |
329 |
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); |
330 |
} |
331 |
|
332 |
return jLabel5;
|
333 |
} |
334 |
|
335 |
/**
|
336 |
* This method initializes txtComments
|
337 |
*
|
338 |
* @return javax.swing.JTextArea
|
339 |
*/
|
340 |
private javax.swing.JTextArea getTxtComments() {
|
341 |
if (txtComments == null) { |
342 |
txtComments = new javax.swing.JTextArea();
|
343 |
txtComments.setRows(1);
|
344 |
txtComments.setColumns(20);
|
345 |
} |
346 |
|
347 |
return txtComments;
|
348 |
} |
349 |
|
350 |
// /**
|
351 |
// * This method initializes btnOk
|
352 |
// *
|
353 |
// * @return javax.swing.JButton
|
354 |
// */
|
355 |
// private javax.swing.JButton getBtnOk() {
|
356 |
// if (btnOk == null) {
|
357 |
// btnOk = new javax.swing.JButton();
|
358 |
// btnOk.setPreferredSize(new java.awt.Dimension(100, 30));
|
359 |
// btnOk.setText(PluginServices.getText(this, "ok") + ":");
|
360 |
//
|
361 |
// btnOk.addActionListener(new java.awt.event.ActionListener() {
|
362 |
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
363 |
// project.setName(txtName.getText());
|
364 |
// project.setOwner(txtOwner.getText());
|
365 |
// project.setComments(txtComments.getText());
|
366 |
// project.setSelectionColor(lblColor.getBackground());
|
367 |
// PluginServices.getMDIManager().closeView(ProjectProperties.this);
|
368 |
// }
|
369 |
// });
|
370 |
// }
|
371 |
//
|
372 |
// return btnOk;
|
373 |
// }
|
374 |
//
|
375 |
// /**
|
376 |
// * This method initializes btnCancel
|
377 |
// *
|
378 |
// * @return javax.swing.JButton
|
379 |
// */
|
380 |
// private javax.swing.JButton getBtnCancel() {
|
381 |
// if (btnCancel == null) {
|
382 |
// btnCancel = new javax.swing.JButton();
|
383 |
// btnCancel.setPreferredSize(new java.awt.Dimension(100, 30));
|
384 |
// btnCancel.setText(PluginServices.getText(this, "cancel") + ":");
|
385 |
//
|
386 |
// btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
387 |
// public void actionPerformed(java.awt.event.ActionEvent e) {
|
388 |
// PluginServices.getMDIManager().closeView(ProjectProperties.this);
|
389 |
// }
|
390 |
// });
|
391 |
// }
|
392 |
//
|
393 |
// return btnCancel;
|
394 |
// }
|
395 |
|
396 |
/**
|
397 |
* This method initializes jLabel6
|
398 |
*
|
399 |
* @return javax.swing.JLabel
|
400 |
*/
|
401 |
private javax.swing.JLabel getJLabel6() {
|
402 |
if (jLabel6 == null) { |
403 |
jLabel6 = new javax.swing.JLabel();
|
404 |
jLabel6.setText(PluginServices.getText(this, "selection_color") + |
405 |
":");
|
406 |
jLabel6.setPreferredSize(new java.awt.Dimension(190, 16)); |
407 |
} |
408 |
|
409 |
return jLabel6;
|
410 |
} |
411 |
|
412 |
/**
|
413 |
* This method initializes lblColor
|
414 |
*
|
415 |
* @return javax.swing.JLabel
|
416 |
*/
|
417 |
private javax.swing.JLabel getLblColor() {
|
418 |
if (lblColor == null) { |
419 |
lblColor = new javax.swing.JLabel();
|
420 |
|
421 |
// lblColor.setText("");
|
422 |
lblColor.setPreferredSize(new java.awt.Dimension(30, 16)); |
423 |
lblColor.setOpaque(true);
|
424 |
} |
425 |
|
426 |
return lblColor;
|
427 |
} |
428 |
|
429 |
/**
|
430 |
* This method initializes btnColor
|
431 |
*
|
432 |
* @return javax.swing.JButton
|
433 |
*/
|
434 |
private javax.swing.JButton getBtnColor() {
|
435 |
if (btnColor == null) { |
436 |
btnColor = new javax.swing.JButton();
|
437 |
btnColor.setPreferredSize(new java.awt.Dimension(34, 16)); |
438 |
btnColor.setText("...");
|
439 |
|
440 |
btnColor.addActionListener(new java.awt.event.ActionListener() {
|
441 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
442 |
Color ret = JColorChooser.showDialog(ProjectProperties.this, |
443 |
PluginServices.getText(this, "selection_color"), |
444 |
lblColor.getBackground()); |
445 |
|
446 |
if (ret != null) { |
447 |
lblColor.setBackground(ret); |
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(420, 70)); |
466 |
} |
467 |
|
468 |
return jScrollPane;
|
469 |
} |
470 |
|
471 |
/**
|
472 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
473 |
*/
|
474 |
public WindowInfo getWindowInfo() {
|
475 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
476 |
m_viewinfo.setWidth(450);
|
477 |
m_viewinfo.setHeight(250);
|
478 |
m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_sesion")); |
479 |
return m_viewinfo;
|
480 |
} |
481 |
|
482 |
/**
|
483 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
484 |
*/
|
485 |
public void viewActivated() { |
486 |
} |
487 |
|
488 |
public Object getWindowProfile() { |
489 |
return WindowInfo.DIALOG_PROFILE;
|
490 |
} |
491 |
|
492 |
} |
493 |
|
494 |
|
495 |
// @jve:visual-info decl-index=0 visual-constraint="10,10"
|