root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / project / ProjectWindow.java @ 2183
History | View | Annotate | Download (28.9 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.gui.project; |
42 |
|
43 |
import java.awt.Component; |
44 |
import java.beans.PropertyChangeEvent; |
45 |
import java.beans.PropertyChangeListener; |
46 |
import java.io.File; |
47 |
import java.text.DateFormat; |
48 |
|
49 |
import javax.swing.ButtonGroup; |
50 |
import javax.swing.JDialog; |
51 |
import javax.swing.JOptionPane; |
52 |
import javax.swing.JPanel; |
53 |
|
54 |
import com.hardcode.driverManager.DriverLoadException; |
55 |
import com.hardcode.gdbms.engine.data.DataSource; |
56 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
57 |
import com.hardcode.gdbms.engine.data.driver.DBDriver; |
58 |
import com.hardcode.gdbms.engine.data.driver.FileDriver; |
59 |
import com.iver.andami.PluginServices; |
60 |
import com.iver.andami.messages.NotificationManager; |
61 |
import com.iver.andami.ui.mdiManager.SingletonView; |
62 |
import com.iver.andami.ui.mdiManager.View; |
63 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
64 |
import com.iver.cit.gvsig.ProjectExtension; |
65 |
import com.iver.cit.gvsig.fmap.drivers.GeorreferencedRasterDriver; |
66 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
67 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
68 |
import com.iver.cit.gvsig.gui.DataBaseOpenDialog; |
69 |
import com.iver.cit.gvsig.gui.FOpenDialog; |
70 |
import com.iver.cit.gvsig.gui.FileOpenDialog; |
71 |
import com.iver.cit.gvsig.gui.Table; |
72 |
import com.iver.cit.gvsig.gui.layout.Layout; |
73 |
import com.iver.cit.gvsig.project.Project; |
74 |
import com.iver.cit.gvsig.project.ProjectElement; |
75 |
import com.iver.cit.gvsig.project.ProjectFactory; |
76 |
import com.iver.cit.gvsig.project.ProjectMap; |
77 |
import com.iver.cit.gvsig.project.ProjectTable; |
78 |
import com.iver.cit.gvsig.project.ProjectView; |
79 |
import com.iver.utiles.DefaultListModel; |
80 |
|
81 |
|
82 |
/**
|
83 |
* Clase principal del proyecto donde se puede operar para crear vistas,
|
84 |
* tablas, mapas, ...
|
85 |
*
|
86 |
* @author Fernando Gonz?lez Cort?s
|
87 |
*/
|
88 |
public class ProjectWindow extends JPanel implements PropertyChangeListener, |
89 |
View, SingletonView {
|
90 |
private javax.swing.JPanel jPanel = null; |
91 |
private javax.swing.JRadioButton btnVistas = null; |
92 |
private javax.swing.JRadioButton btnTablas = null; |
93 |
private javax.swing.JRadioButton btnMapas = null; |
94 |
private ButtonGroup grupo = new ButtonGroup(); |
95 |
private javax.swing.JPanel jPanel1 = null; |
96 |
private javax.swing.JList lstDocs = null; |
97 |
private javax.swing.JPanel jPanel2 = null; |
98 |
private javax.swing.JButton btnNuevo = null; |
99 |
private javax.swing.JButton btnPropiedades = null; |
100 |
private javax.swing.JButton btnAbrir = null; |
101 |
private javax.swing.JButton btnBorrar = null; |
102 |
private javax.swing.JButton btnRenombrar = null; |
103 |
private javax.swing.JPanel jPanel3 = null; |
104 |
private javax.swing.JLabel jLabel = null; |
105 |
private javax.swing.JLabel lblNombreSesion = null; |
106 |
private javax.swing.JLabel jLabel1 = null; |
107 |
private javax.swing.JLabel lblGuardado = null; |
108 |
private javax.swing.JLabel jLabel2 = null; |
109 |
private javax.swing.JLabel lblFecha = null; |
110 |
private javax.swing.JButton btnImportar = null; |
111 |
private javax.swing.JButton btnExportar = null; |
112 |
private javax.swing.JButton btnEditar = null; |
113 |
|
114 |
/** Proyecto representado en la vista */
|
115 |
private Project p;
|
116 |
|
117 |
/**
|
118 |
* Extension con la informaci?n, entre otras, sobre las extensiones para
|
119 |
* las tablas
|
120 |
*/
|
121 |
private ProjectExtension projectExtension;
|
122 |
private javax.swing.JScrollPane jScrollPane = null; |
123 |
private javax.swing.JPanel jPanel4 = null; |
124 |
|
125 |
/**
|
126 |
* This is the default constructor
|
127 |
*
|
128 |
* @param project Extension
|
129 |
*/
|
130 |
public ProjectWindow(ProjectExtension project) {
|
131 |
super();
|
132 |
|
133 |
initialize(); |
134 |
|
135 |
projectExtension = project; |
136 |
|
137 |
refreshControls(); |
138 |
} |
139 |
|
140 |
/**
|
141 |
* Asigna el proyecto a la ventana
|
142 |
*
|
143 |
* @param p Proyecto con el que se operar? a trav?s de este di?logo
|
144 |
*/
|
145 |
public void setProject(Project p) { |
146 |
this.p = p;
|
147 |
p.addPropertyChangeListener(this);
|
148 |
refreshControls(); |
149 |
} |
150 |
|
151 |
/**
|
152 |
* Activa los botones de la botonera del medio o los desactiva en funci?n
|
153 |
* de que est? seleccionado o no un elemento de proyecto en la lista del
|
154 |
* medio
|
155 |
*/
|
156 |
private void activarBotones() { |
157 |
if (lstDocs.getSelectedIndex() != -1) { |
158 |
btnAbrir.setEnabled(true);
|
159 |
btnBorrar.setEnabled(true);
|
160 |
btnRenombrar.setEnabled(true);
|
161 |
btnPropiedades.setEnabled(true);
|
162 |
} else {
|
163 |
btnAbrir.setEnabled(false);
|
164 |
btnBorrar.setEnabled(false);
|
165 |
btnRenombrar.setEnabled(false);
|
166 |
btnPropiedades.setEnabled(false);
|
167 |
} |
168 |
} |
169 |
|
170 |
/**
|
171 |
* Refresca la lista de elementos de proyecto con vistas, mapas o tablas,
|
172 |
* seg?n la opci?n activada
|
173 |
*/
|
174 |
private void refreshList() { |
175 |
if (p != null) { |
176 |
DefaultListModel model;
|
177 |
|
178 |
if (btnMapas.isSelected()) {
|
179 |
model = new DefaultListModel(p.getMaps()); |
180 |
|
181 |
// getBtnNuevo().setEnabled(true);
|
182 |
} else if (btnTablas.isSelected()) { |
183 |
model = new DefaultListModel(p.getTables()); |
184 |
|
185 |
// getBtnNuevo().setEnabled(false);
|
186 |
} else {
|
187 |
model = new DefaultListModel(p.getViews()); |
188 |
|
189 |
// getBtnNuevo().setEnabled(true);
|
190 |
} |
191 |
|
192 |
lstDocs.setModel(model); |
193 |
|
194 |
activarBotones(); |
195 |
} |
196 |
} |
197 |
|
198 |
/**
|
199 |
* Refresca las etiquetas con la informaci?n del proyecto
|
200 |
*/
|
201 |
private void refreshProperties() { |
202 |
if (p != null) { |
203 |
String aux;
|
204 |
|
205 |
lblNombreSesion.setText(p.getName()); |
206 |
|
207 |
String path = p.getPath();
|
208 |
|
209 |
if (path != null) { |
210 |
File f = new File(path); |
211 |
lblGuardado.setText(f.toString()); |
212 |
} else {
|
213 |
lblGuardado.setText("");
|
214 |
} |
215 |
|
216 |
lblFecha.setText(p.getCreationDate()); |
217 |
} |
218 |
} |
219 |
|
220 |
/**
|
221 |
* Refresca todo el di?logo
|
222 |
*/
|
223 |
public void refreshControls() { |
224 |
refreshList(); |
225 |
refreshProperties(); |
226 |
} |
227 |
|
228 |
/**
|
229 |
* This method initializes this
|
230 |
*/
|
231 |
private void initialize() { |
232 |
setLayout(new java.awt.FlowLayout());
|
233 |
add(getJPanel(), null);
|
234 |
add(getJPanel1(), null);
|
235 |
add(getJPanel3(), null);
|
236 |
|
237 |
this.setSize(400, 450); |
238 |
this.setPreferredSize(new java.awt.Dimension(400, 430)); |
239 |
grupo.add(btnVistas); |
240 |
grupo.add(btnTablas); |
241 |
grupo.add(btnMapas); |
242 |
|
243 |
btnVistas.setSelected(true);
|
244 |
} |
245 |
private String ask(String title, String content){ |
246 |
JOptionPane pane = new JOptionPane(); |
247 |
pane.setMessage(content); |
248 |
pane.setMessageType(JOptionPane.QUESTION_MESSAGE);
|
249 |
pane.setWantsInput(true);
|
250 |
pane.setInitialSelectionValue("");
|
251 |
|
252 |
JDialog dlg = pane.createDialog((Component) PluginServices.getMainFrame(), |
253 |
title); |
254 |
dlg.setModal(true);
|
255 |
dlg.show(); |
256 |
|
257 |
return pane.getInputValue().toString().trim();
|
258 |
} |
259 |
|
260 |
/**
|
261 |
* Crea un nuevo project element
|
262 |
*
|
263 |
* @throws Exception DOCUMENT ME!
|
264 |
*/
|
265 |
private void nuevo() throws Exception { |
266 |
DateFormat df = DateFormat.getDateInstance(); |
267 |
|
268 |
if (btnMapas.isSelected()) {
|
269 |
ProjectMap map = ProjectFactory.createMap(PluginServices.getText( |
270 |
this, "untitled")); |
271 |
map.setModel(new Layout());
|
272 |
map.getModel().setProjectMap(map); |
273 |
p.addMap(map); |
274 |
} else if (btnTablas.isSelected()) { |
275 |
try {
|
276 |
FOpenDialog fopen = new FOpenDialog();
|
277 |
FileOpenDialog fod = new FileOpenDialog(new Class[] { |
278 |
FileDriver.class, GeorreferencedRasterDriver.class |
279 |
}); |
280 |
DataBaseOpenDialog dbod = new DataBaseOpenDialog();
|
281 |
dbod.setClasses(new Class[] { DBDriver.class }); |
282 |
fopen.addTab("Fichero", fod);
|
283 |
fopen.addTab("Base de datos", dbod);
|
284 |
PluginServices.getMDIManager().addView(fopen); |
285 |
|
286 |
if (fopen.isAccepted()) {
|
287 |
JPanel panel = fopen.getSelectedTab();
|
288 |
ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
289 |
|
290 |
if (panel instanceof FileOpenDialog) { |
291 |
File[] files = fod.getFiles(); |
292 |
String[] driverNames = fod.getDriverNames(); |
293 |
|
294 |
for (int i = 0; i < files.length; i++) { |
295 |
String name = files[i].getName();
|
296 |
|
297 |
LayerFactory.getDataSourceFactory() |
298 |
.addFileDataSource(driverNames[i], |
299 |
name, files[i].getAbsolutePath(), |
300 |
files[i].getAbsolutePath(), null);
|
301 |
|
302 |
DataSource dataSource = LayerFactory.getDataSourceFactory()
|
303 |
.createRandomDataSource(name, DataSourceFactory.CLOSING_AUTOMATIC_MODE); |
304 |
SelectableDataSource sds = new SelectableDataSource(dataSource);
|
305 |
ProjectTable projectTable = ProjectFactory.createTable(name, |
306 |
sds); |
307 |
ext.getProject().addTable(projectTable); |
308 |
|
309 |
Table t = new Table();
|
310 |
t.setModel(projectTable); |
311 |
PluginServices.getMDIManager().addView(t); |
312 |
} |
313 |
} else if (panel instanceof DataBaseOpenDialog) { |
314 |
String driverName = dbod.getDriverName();
|
315 |
int port = -1; |
316 |
|
317 |
try {
|
318 |
port = Integer.parseInt(dbod.getPort());
|
319 |
} catch (NumberFormatException e) { |
320 |
} |
321 |
|
322 |
String name = dbod.getHost() + "/" + |
323 |
dbod.getDataBase(); |
324 |
|
325 |
if (port != -1) { |
326 |
name = dbod.getHost() + ":" + port + "/" + |
327 |
dbod.getDataBase(); |
328 |
} |
329 |
|
330 |
String user = dbod.getUser().trim();
|
331 |
String password = dbod.getPassword();
|
332 |
|
333 |
if (user.equals("")) { |
334 |
user = null;
|
335 |
password = null;
|
336 |
} |
337 |
|
338 |
LayerFactory.getDataSourceFactory().addDBDataSourceByTable(name, |
339 |
dbod.getHost(), port, user, password, |
340 |
dbod.getDataBase(), dbod.getTable(), driverName, null);
|
341 |
|
342 |
DataSource dataSource = LayerFactory.getDataSourceFactory()
|
343 |
.createRandomDataSource(name, DataSourceFactory.CLOSING_AUTOMATIC_MODE); |
344 |
SelectableDataSource sds = new SelectableDataSource(dataSource);
|
345 |
|
346 |
ProjectTable projectTable = ProjectFactory.createTable(name, |
347 |
sds); |
348 |
ext.getProject().addTable(projectTable); |
349 |
|
350 |
Table t = new Table();
|
351 |
t.setModel(projectTable); |
352 |
PluginServices.getMDIManager().addView(t); |
353 |
} |
354 |
} |
355 |
} catch (DriverLoadException e) {
|
356 |
NotificationManager.addError("Error al cargar los drivers", e);
|
357 |
} |
358 |
} else {
|
359 |
ProjectView vista = ProjectFactory.createView(PluginServices.getText( |
360 |
this, "untitled")); |
361 |
p.addView(vista); |
362 |
} |
363 |
} |
364 |
|
365 |
/**
|
366 |
* Abre la ventana de un nuevo project element
|
367 |
*/
|
368 |
private void abrir() { |
369 |
if (btnMapas.isSelected()) {
|
370 |
int index = lstDocs.getSelectedIndex();
|
371 |
|
372 |
if (index == -1) { |
373 |
return;
|
374 |
} |
375 |
|
376 |
Layout l = (Layout) ((ProjectMap) p.getMaps().get(index)).getModel(); |
377 |
l.fullRect(); |
378 |
PluginServices.getMDIManager().addView(l); |
379 |
} else if (btnTablas.isSelected()) { |
380 |
com.iver.cit.gvsig.gui.Table vista = new com.iver.cit.gvsig.gui.Table();
|
381 |
int index = lstDocs.getSelectedIndex();
|
382 |
|
383 |
if (index == -1) { |
384 |
return;
|
385 |
} |
386 |
|
387 |
vista.setModel((ProjectTable) p.getTables().get(index)); |
388 |
PluginServices.getMDIManager().addView(vista); |
389 |
} else {
|
390 |
com.iver.cit.gvsig.gui.View vista = new com.iver.cit.gvsig.gui.View();
|
391 |
int index = lstDocs.getSelectedIndex();
|
392 |
|
393 |
if (index == -1) { |
394 |
return;
|
395 |
} |
396 |
|
397 |
vista.setModel((ProjectView) p.getViews().get(index)); |
398 |
PluginServices.getMDIManager().addView(vista); |
399 |
} |
400 |
} |
401 |
|
402 |
/**
|
403 |
* Cambia el nombre de un project element
|
404 |
*/
|
405 |
private void renombrar() { |
406 |
ProjectElement elem = null;
|
407 |
int index = lstDocs.getSelectedIndex();
|
408 |
|
409 |
if (index == -1) { |
410 |
return;
|
411 |
} |
412 |
|
413 |
if (btnMapas.isSelected()) {
|
414 |
elem = (ProjectElement) p.getMaps().get(index); |
415 |
} else if (btnTablas.isSelected()) { |
416 |
elem = (ProjectElement) p.getTables().get(index); |
417 |
} else {
|
418 |
elem = (ProjectElement) p.getViews().get(index); |
419 |
} |
420 |
|
421 |
JOptionPane pane = new JOptionPane(); |
422 |
pane.setMessage(PluginServices.getText(this, "introduce_nombre")); |
423 |
pane.setMessageType(JOptionPane.QUESTION_MESSAGE);
|
424 |
pane.setWantsInput(true);
|
425 |
pane.setInitialSelectionValue(elem.getName()); |
426 |
|
427 |
JDialog dlg = pane.createDialog((Component) PluginServices.getMainFrame(), |
428 |
PluginServices.getText(this, "renombrar")); |
429 |
dlg.setModal(true);
|
430 |
dlg.show(); |
431 |
|
432 |
String nuevoNombre = pane.getInputValue().toString().trim();
|
433 |
|
434 |
if (nuevoNombre.length() == 0) { |
435 |
return;
|
436 |
} |
437 |
|
438 |
if (nuevoNombre == null) { |
439 |
return;
|
440 |
} |
441 |
|
442 |
elem.setName(nuevoNombre); |
443 |
|
444 |
refreshList(); |
445 |
} |
446 |
|
447 |
/**
|
448 |
* Borra un project element
|
449 |
*/
|
450 |
private void borrar() { |
451 |
int res = JOptionPane.showConfirmDialog((Component) PluginServices.getMainFrame(), |
452 |
PluginServices.getText(this, "confirmar_borrar"), |
453 |
PluginServices.getText(this, "borrar"), |
454 |
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); |
455 |
|
456 |
if (res == JOptionPane.YES_OPTION) { |
457 |
int index = lstDocs.getSelectedIndex();
|
458 |
|
459 |
if (btnMapas.isSelected()) {
|
460 |
PluginServices.getMDIManager().closeSingletonView(p.getMaps() |
461 |
.get(index)); |
462 |
p.delMap(index); |
463 |
} else if (btnTablas.isSelected()) { |
464 |
PluginServices.getMDIManager().closeSingletonView(p.getTables() |
465 |
.get(index)); |
466 |
p.delTable(index); |
467 |
} else {
|
468 |
PluginServices.getMDIManager().closeSingletonView(p.getViews() |
469 |
.get(index)); |
470 |
p.delView(index); |
471 |
} |
472 |
|
473 |
refreshList(); |
474 |
} |
475 |
} |
476 |
|
477 |
/**
|
478 |
* Muestra el di?logo de propiedades de un project element
|
479 |
*/
|
480 |
private void propiedades() { |
481 |
int index = lstDocs.getSelectedIndex();
|
482 |
|
483 |
if (index == -1) { |
484 |
return;
|
485 |
} |
486 |
|
487 |
View dlg;
|
488 |
|
489 |
if (btnMapas.isSelected()) {
|
490 |
dlg = new MapProperties((ProjectMap) p.getMaps().get(index));
|
491 |
} else if (btnTablas.isSelected()) { |
492 |
dlg = new TableProperties((ProjectTable) p.getTables().get(index));
|
493 |
} else {
|
494 |
dlg = new ViewProperties((ProjectView) p.getViews().get(index));
|
495 |
} |
496 |
|
497 |
PluginServices.getMDIManager().addView(dlg); |
498 |
|
499 |
refreshControls(); |
500 |
lstDocs.setSelectedIndex(index); |
501 |
} |
502 |
|
503 |
/**
|
504 |
* This method initializes jPanel
|
505 |
*
|
506 |
* @return javax.swing.JPanel
|
507 |
*/
|
508 |
private javax.swing.JPanel getJPanel() {
|
509 |
if (jPanel == null) { |
510 |
jPanel = new javax.swing.JPanel();
|
511 |
|
512 |
java.awt.FlowLayout layFlowLayout1 = new java.awt.FlowLayout();
|
513 |
layFlowLayout1.setHgap(15);
|
514 |
jPanel.setLayout(layFlowLayout1); |
515 |
jPanel.add(getBtnVistas(), null);
|
516 |
jPanel.add(getBtnTablas(), null);
|
517 |
jPanel.add(getBtnMapas(), null);
|
518 |
jPanel.setName("tipoDocPanel");
|
519 |
jPanel.setPreferredSize(new java.awt.Dimension(390, 125)); |
520 |
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
521 |
null, PluginServices.getText(this, "tipos_de_documentos"), |
522 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
523 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
524 |
} |
525 |
|
526 |
return jPanel;
|
527 |
} |
528 |
|
529 |
/**
|
530 |
* This method initializes btnVistas
|
531 |
*
|
532 |
* @return javax.swing.JRadioButton
|
533 |
*/
|
534 |
private javax.swing.JRadioButton getBtnVistas() {
|
535 |
if (btnVistas == null) { |
536 |
btnVistas = new javax.swing.JRadioButton();
|
537 |
btnVistas.setIcon(new javax.swing.ImageIcon(
|
538 |
this.getClass().getClassLoader().getResource("images/Vista.png"))); |
539 |
btnVistas.setSelectedIcon(new javax.swing.ImageIcon(
|
540 |
this.getClass().getClassLoader().getResource("images/Vista_sel.png"))); |
541 |
btnVistas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
542 |
btnVistas.setText(PluginServices.getText(this, "vistas")); |
543 |
btnVistas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
544 |
btnVistas.setName("vistasBtn");
|
545 |
btnVistas.addChangeListener(new javax.swing.event.ChangeListener() {
|
546 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
547 |
refreshList(); |
548 |
} |
549 |
}); |
550 |
} |
551 |
|
552 |
return btnVistas;
|
553 |
} |
554 |
|
555 |
/**
|
556 |
* This method initializes btnTablas
|
557 |
*
|
558 |
* @return javax.swing.JRadioButton
|
559 |
*/
|
560 |
private javax.swing.JRadioButton getBtnTablas() {
|
561 |
if (btnTablas == null) { |
562 |
btnTablas = new javax.swing.JRadioButton();
|
563 |
btnTablas.setIcon(new javax.swing.ImageIcon(
|
564 |
this.getClass().getClassLoader().getResource("images/tablas.png"))); |
565 |
btnTablas.setSelectedIcon(new javax.swing.ImageIcon(
|
566 |
this.getClass().getClassLoader().getResource("images/tablas_sel.png"))); |
567 |
btnTablas.setText(PluginServices.getText(this, "tablas")); |
568 |
btnTablas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
569 |
btnTablas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
570 |
btnTablas.setName("tablasBtn");
|
571 |
btnTablas.addChangeListener(new javax.swing.event.ChangeListener() {
|
572 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
573 |
refreshList(); |
574 |
} |
575 |
}); |
576 |
} |
577 |
|
578 |
return btnTablas;
|
579 |
} |
580 |
|
581 |
/**
|
582 |
* This method initializes btnMapas
|
583 |
*
|
584 |
* @return javax.swing.JRadioButton
|
585 |
*/
|
586 |
private javax.swing.JRadioButton getBtnMapas() {
|
587 |
if (btnMapas == null) { |
588 |
btnMapas = new javax.swing.JRadioButton();
|
589 |
btnMapas.setIcon(new javax.swing.ImageIcon(
|
590 |
this.getClass().getClassLoader().getResource("images/mapas.png"))); |
591 |
btnMapas.setSelectedIcon(new javax.swing.ImageIcon(
|
592 |
this.getClass().getClassLoader().getResource("images/mapas_sel.png"))); |
593 |
btnMapas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
594 |
btnMapas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
595 |
btnMapas.setText(PluginServices.getText(this, "mapas")); |
596 |
btnMapas.addChangeListener(new javax.swing.event.ChangeListener() {
|
597 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
598 |
refreshList(); |
599 |
} |
600 |
}); |
601 |
} |
602 |
|
603 |
return btnMapas;
|
604 |
} |
605 |
|
606 |
/**
|
607 |
* This method initializes jPanel1
|
608 |
*
|
609 |
* @return javax.swing.JPanel
|
610 |
*/
|
611 |
private javax.swing.JPanel getJPanel1() {
|
612 |
if (jPanel1 == null) { |
613 |
jPanel1 = new javax.swing.JPanel();
|
614 |
|
615 |
java.awt.BorderLayout layBorderLayout2 = new java.awt.BorderLayout();
|
616 |
layBorderLayout2.setVgap(30);
|
617 |
jPanel1.setLayout(layBorderLayout2); |
618 |
jPanel1.add(getJPanel2(), java.awt.BorderLayout.EAST); |
619 |
jPanel1.add(getJScrollPane(), java.awt.BorderLayout.CENTER); |
620 |
jPanel1.setPreferredSize(new java.awt.Dimension(390, 170)); |
621 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
622 |
null,
|
623 |
PluginServices.getText(this, "documentos_existentes"), |
624 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
625 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
626 |
} |
627 |
|
628 |
return jPanel1;
|
629 |
} |
630 |
|
631 |
/**
|
632 |
* This method initializes lstDocs
|
633 |
*
|
634 |
* @return javax.swing.JList
|
635 |
*/
|
636 |
private javax.swing.JList getLstDocs() {
|
637 |
if (lstDocs == null) { |
638 |
lstDocs = new javax.swing.JList();
|
639 |
lstDocs.addMouseListener(new java.awt.event.MouseAdapter() {
|
640 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
641 |
if (e.getClickCount() == 2) { |
642 |
abrir(); |
643 |
} |
644 |
} |
645 |
}); |
646 |
lstDocs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
647 |
public void valueChanged( |
648 |
javax.swing.event.ListSelectionEvent e) { |
649 |
activarBotones(); |
650 |
} |
651 |
}); |
652 |
} |
653 |
|
654 |
return lstDocs;
|
655 |
} |
656 |
|
657 |
/**
|
658 |
* This method initializes jPanel2
|
659 |
*
|
660 |
* @return javax.swing.JPanel
|
661 |
*/
|
662 |
private javax.swing.JPanel getJPanel2() {
|
663 |
if (jPanel2 == null) { |
664 |
jPanel2 = new javax.swing.JPanel();
|
665 |
|
666 |
java.awt.FlowLayout layFlowLayout11 = new java.awt.FlowLayout();
|
667 |
layFlowLayout11.setVgap(5);
|
668 |
jPanel2.setLayout(layFlowLayout11); |
669 |
jPanel2.add(getBtnNuevo(), null);
|
670 |
jPanel2.add(getBtnAbrir(), null);
|
671 |
jPanel2.add(getBtnRenombrar(), null);
|
672 |
jPanel2.add(getBtnBorrar(), null);
|
673 |
jPanel2.add(getBtnPropiedades(), null);
|
674 |
jPanel2.setPreferredSize(new java.awt.Dimension(100, 50)); |
675 |
} |
676 |
|
677 |
return jPanel2;
|
678 |
} |
679 |
|
680 |
/**
|
681 |
* This method initializes btnNuevo
|
682 |
*
|
683 |
* @return javax.swing.JButton
|
684 |
*/
|
685 |
private javax.swing.JButton getBtnNuevo() {
|
686 |
if (btnNuevo == null) { |
687 |
btnNuevo = new javax.swing.JButton();
|
688 |
btnNuevo.setPreferredSize(new java.awt.Dimension(80, 23)); |
689 |
btnNuevo.setName("btnNuevo");
|
690 |
btnNuevo.setText(PluginServices.getText(this, "nuevo")); |
691 |
btnNuevo.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
692 |
btnNuevo.addActionListener(new java.awt.event.ActionListener() {
|
693 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
694 |
try {
|
695 |
nuevo(); |
696 |
} catch (Exception e1) { |
697 |
NotificationManager.addError(e1.getLocalizedMessage(), |
698 |
e1); |
699 |
} |
700 |
} |
701 |
}); |
702 |
} |
703 |
|
704 |
return btnNuevo;
|
705 |
} |
706 |
|
707 |
/**
|
708 |
* This method initializes btnPropiedades
|
709 |
*
|
710 |
* @return javax.swing.JButton
|
711 |
*/
|
712 |
private javax.swing.JButton getBtnPropiedades() {
|
713 |
if (btnPropiedades == null) { |
714 |
btnPropiedades = new javax.swing.JButton();
|
715 |
btnPropiedades.setPreferredSize(new java.awt.Dimension(80, 23)); |
716 |
btnPropiedades.setText(PluginServices.getText(this, "propiedades")); |
717 |
btnPropiedades.setName("btnPropiedades");
|
718 |
btnPropiedades.setEnabled(false);
|
719 |
btnPropiedades.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
720 |
btnPropiedades.addActionListener(new java.awt.event.ActionListener() {
|
721 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
722 |
propiedades(); |
723 |
} |
724 |
}); |
725 |
} |
726 |
|
727 |
return btnPropiedades;
|
728 |
} |
729 |
|
730 |
/**
|
731 |
* This method initializes btnAbrir
|
732 |
*
|
733 |
* @return javax.swing.JButton
|
734 |
*/
|
735 |
private javax.swing.JButton getBtnAbrir() {
|
736 |
if (btnAbrir == null) { |
737 |
btnAbrir = new javax.swing.JButton();
|
738 |
btnAbrir.setPreferredSize(new java.awt.Dimension(80, 23)); |
739 |
btnAbrir.setName("btnAbrir");
|
740 |
btnAbrir.setText(PluginServices.getText(this, "abrir")); |
741 |
btnAbrir.setEnabled(false);
|
742 |
btnAbrir.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
743 |
btnAbrir.addActionListener(new java.awt.event.ActionListener() {
|
744 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
745 |
abrir(); |
746 |
} |
747 |
}); |
748 |
} |
749 |
|
750 |
return btnAbrir;
|
751 |
} |
752 |
|
753 |
/**
|
754 |
* This method initializes btnBorrar
|
755 |
*
|
756 |
* @return javax.swing.JButton
|
757 |
*/
|
758 |
private javax.swing.JButton getBtnBorrar() {
|
759 |
if (btnBorrar == null) { |
760 |
btnBorrar = new javax.swing.JButton();
|
761 |
btnBorrar.setPreferredSize(new java.awt.Dimension(80, 23)); |
762 |
btnBorrar.setText(PluginServices.getText(this, "borrar")); |
763 |
btnBorrar.setName("btnBorrar");
|
764 |
btnBorrar.setEnabled(false);
|
765 |
btnBorrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
766 |
btnBorrar.addActionListener(new java.awt.event.ActionListener() {
|
767 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
768 |
borrar(); |
769 |
} |
770 |
}); |
771 |
} |
772 |
|
773 |
return btnBorrar;
|
774 |
} |
775 |
|
776 |
/**
|
777 |
* This method initializes btnRenombrar
|
778 |
*
|
779 |
* @return javax.swing.JButton
|
780 |
*/
|
781 |
private javax.swing.JButton getBtnRenombrar() {
|
782 |
if (btnRenombrar == null) { |
783 |
btnRenombrar = new javax.swing.JButton();
|
784 |
btnRenombrar.setPreferredSize(new java.awt.Dimension(80, 23)); |
785 |
btnRenombrar.setName("btnRenombrar");
|
786 |
btnRenombrar.setText(PluginServices.getText(this, "renombrar")); |
787 |
btnRenombrar.setEnabled(false);
|
788 |
btnRenombrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
789 |
btnRenombrar.addActionListener(new java.awt.event.ActionListener() {
|
790 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
791 |
renombrar(); |
792 |
} |
793 |
}); |
794 |
} |
795 |
|
796 |
return btnRenombrar;
|
797 |
} |
798 |
|
799 |
/**
|
800 |
* This method initializes jPanel3
|
801 |
*
|
802 |
* @return javax.swing.JPanel
|
803 |
*/
|
804 |
private javax.swing.JPanel getJPanel3() {
|
805 |
if (jPanel3 == null) { |
806 |
jPanel3 = new javax.swing.JPanel();
|
807 |
|
808 |
java.awt.FlowLayout layFlowLayout3 = new java.awt.FlowLayout();
|
809 |
layFlowLayout3.setHgap(5);
|
810 |
layFlowLayout3.setAlignment(java.awt.FlowLayout.LEFT); |
811 |
jPanel3.setLayout(layFlowLayout3); |
812 |
jPanel3.add(getJLabel(), null);
|
813 |
jPanel3.add(getLblNombreSesion(), null);
|
814 |
jPanel3.add(getJLabel1(), null);
|
815 |
jPanel3.add(getLblGuardado(), null);
|
816 |
jPanel3.add(getJLabel2(), null);
|
817 |
jPanel3.add(getLblFecha(), null);
|
818 |
jPanel3.add(getJPanel4(), null);
|
819 |
jPanel3.setPreferredSize(new java.awt.Dimension(390, 125)); |
820 |
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder( |
821 |
null, PluginServices.getText(this, "propiedades_sesion"), |
822 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
823 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
824 |
} |
825 |
|
826 |
return jPanel3;
|
827 |
} |
828 |
|
829 |
/**
|
830 |
* This method initializes jLabel
|
831 |
*
|
832 |
* @return javax.swing.JLabel
|
833 |
*/
|
834 |
private javax.swing.JLabel getJLabel() {
|
835 |
if (jLabel == null) { |
836 |
jLabel = new javax.swing.JLabel();
|
837 |
jLabel.setText(PluginServices.getText(this, "nombre_sesion") + ":"); |
838 |
jLabel.setPreferredSize(new java.awt.Dimension(150, 16)); |
839 |
} |
840 |
|
841 |
return jLabel;
|
842 |
} |
843 |
|
844 |
/**
|
845 |
* This method initializes lblNombreSesion
|
846 |
*
|
847 |
* @return javax.swing.JLabel
|
848 |
*/
|
849 |
private javax.swing.JLabel getLblNombreSesion() {
|
850 |
if (lblNombreSesion == null) { |
851 |
lblNombreSesion = new javax.swing.JLabel();
|
852 |
lblNombreSesion.setText("");
|
853 |
lblNombreSesion.setName("lblNombreSesion");
|
854 |
lblNombreSesion.setPreferredSize(new java.awt.Dimension(200, 16)); |
855 |
lblNombreSesion.setAutoscrolls(true);
|
856 |
} |
857 |
|
858 |
return lblNombreSesion;
|
859 |
} |
860 |
|
861 |
/**
|
862 |
* This method initializes jLabel1
|
863 |
*
|
864 |
* @return javax.swing.JLabel
|
865 |
*/
|
866 |
private javax.swing.JLabel getJLabel1() {
|
867 |
if (jLabel1 == null) { |
868 |
jLabel1 = new javax.swing.JLabel();
|
869 |
jLabel1.setText(PluginServices.getText(this, "guardado") + ":"); |
870 |
jLabel1.setPreferredSize(new java.awt.Dimension(150, 16)); |
871 |
} |
872 |
|
873 |
return jLabel1;
|
874 |
} |
875 |
|
876 |
/**
|
877 |
* This method initializes lblGuardado
|
878 |
*
|
879 |
* @return javax.swing.JLabel
|
880 |
*/
|
881 |
private javax.swing.JLabel getLblGuardado() {
|
882 |
if (lblGuardado == null) { |
883 |
lblGuardado = new javax.swing.JLabel();
|
884 |
lblGuardado.setText("");
|
885 |
lblGuardado.setPreferredSize(new java.awt.Dimension(200, 16)); |
886 |
lblGuardado.setAutoscrolls(true);
|
887 |
} |
888 |
|
889 |
return lblGuardado;
|
890 |
} |
891 |
|
892 |
/**
|
893 |
* This method initializes jLabel2
|
894 |
*
|
895 |
* @return javax.swing.JLabel
|
896 |
*/
|
897 |
private javax.swing.JLabel getJLabel2() {
|
898 |
if (jLabel2 == null) { |
899 |
jLabel2 = new javax.swing.JLabel();
|
900 |
jLabel2.setText(PluginServices.getText(this, "creation_date") + |
901 |
":");
|
902 |
jLabel2.setPreferredSize(new java.awt.Dimension(150, 16)); |
903 |
} |
904 |
|
905 |
return jLabel2;
|
906 |
} |
907 |
|
908 |
/**
|
909 |
* This method initializes lblFecha
|
910 |
*
|
911 |
* @return javax.swing.JLabel
|
912 |
*/
|
913 |
private javax.swing.JLabel getLblFecha() {
|
914 |
if (lblFecha == null) { |
915 |
lblFecha = new javax.swing.JLabel();
|
916 |
lblFecha.setText("");
|
917 |
lblFecha.setPreferredSize(new java.awt.Dimension(200, 16)); |
918 |
lblFecha.setAutoscrolls(true);
|
919 |
} |
920 |
|
921 |
return lblFecha;
|
922 |
} |
923 |
|
924 |
/**
|
925 |
* This method initializes btnImportar
|
926 |
*
|
927 |
* @return javax.swing.JButton
|
928 |
*/
|
929 |
private javax.swing.JButton getBtnImportar() {
|
930 |
if (btnImportar == null) { |
931 |
btnImportar = new javax.swing.JButton();
|
932 |
btnImportar.setPreferredSize(new java.awt.Dimension(80, 23)); |
933 |
btnImportar.setText(PluginServices.getText(this, "importar")); |
934 |
btnImportar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
935 |
} |
936 |
|
937 |
return btnImportar;
|
938 |
} |
939 |
|
940 |
/**
|
941 |
* This method initializes btnExportar
|
942 |
*
|
943 |
* @return javax.swing.JButton
|
944 |
*/
|
945 |
private javax.swing.JButton getBtnExportar() {
|
946 |
if (btnExportar == null) { |
947 |
btnExportar = new javax.swing.JButton();
|
948 |
btnExportar.setPreferredSize(new java.awt.Dimension(80, 23)); |
949 |
btnExportar.setText(PluginServices.getText(this, "exportar")); |
950 |
btnExportar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
951 |
} |
952 |
|
953 |
return btnExportar;
|
954 |
} |
955 |
|
956 |
/**
|
957 |
* This method initializes btnEditar
|
958 |
*
|
959 |
* @return javax.swing.JButton
|
960 |
*/
|
961 |
private javax.swing.JButton getBtnEditar() {
|
962 |
if (btnEditar == null) { |
963 |
btnEditar = new javax.swing.JButton();
|
964 |
btnEditar.setPreferredSize(new java.awt.Dimension(80, 23)); |
965 |
btnEditar.setText(PluginServices.getText(this, "propiedades")); |
966 |
|
967 |
btnEditar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
968 |
|
969 |
final JPanel f = this; |
970 |
btnEditar.addActionListener(new java.awt.event.ActionListener() {
|
971 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
972 |
ProjectProperties dlg = new ProjectProperties(p);
|
973 |
PluginServices.getMDIManager().addView(dlg); |
974 |
refreshProperties(); |
975 |
} |
976 |
}); |
977 |
} |
978 |
|
979 |
return btnEditar;
|
980 |
} |
981 |
|
982 |
/**
|
983 |
* This method initializes jScrollPane
|
984 |
*
|
985 |
* @return javax.swing.JScrollPane
|
986 |
*/
|
987 |
private javax.swing.JScrollPane getJScrollPane() {
|
988 |
if (jScrollPane == null) { |
989 |
jScrollPane = new javax.swing.JScrollPane();
|
990 |
jScrollPane.setViewportView(getLstDocs()); |
991 |
jScrollPane.setPreferredSize(new java.awt.Dimension(200, 100)); |
992 |
jScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
993 |
} |
994 |
|
995 |
return jScrollPane;
|
996 |
} |
997 |
|
998 |
/**
|
999 |
* @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
|
1000 |
*/
|
1001 |
public Object getViewModel() { |
1002 |
return p;
|
1003 |
} |
1004 |
|
1005 |
/**
|
1006 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
1007 |
*/
|
1008 |
public ViewInfo getViewInfo() {
|
1009 |
ViewInfo m_viewinfo = new ViewInfo();
|
1010 |
m_viewinfo.setWidth(400);
|
1011 |
m_viewinfo.setHeight(430);
|
1012 |
m_viewinfo.setTitle(PluginServices.getText(this, "titulo")); |
1013 |
|
1014 |
return m_viewinfo;
|
1015 |
} |
1016 |
|
1017 |
/**
|
1018 |
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
|
1019 |
*/
|
1020 |
public void propertyChange(PropertyChangeEvent evt) { |
1021 |
refreshControls(); |
1022 |
} |
1023 |
|
1024 |
/**
|
1025 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
1026 |
*/
|
1027 |
public void viewActivated() { |
1028 |
} |
1029 |
|
1030 |
/**
|
1031 |
* This method initializes jPanel4
|
1032 |
*
|
1033 |
* @return javax.swing.JPanel
|
1034 |
*/
|
1035 |
private javax.swing.JPanel getJPanel4() {
|
1036 |
if (jPanel4 == null) { |
1037 |
jPanel4 = new javax.swing.JPanel();
|
1038 |
|
1039 |
java.awt.FlowLayout layFlowLayout2 = new java.awt.FlowLayout();
|
1040 |
layFlowLayout2.setHgap(30);
|
1041 |
jPanel4.setLayout(layFlowLayout2); |
1042 |
jPanel4.add(getBtnImportar(), null);
|
1043 |
jPanel4.add(getBtnExportar(), null);
|
1044 |
jPanel4.add(getBtnEditar(), null);
|
1045 |
jPanel4.setPreferredSize(new java.awt.Dimension(360, 30)); |
1046 |
} |
1047 |
|
1048 |
return jPanel4;
|
1049 |
} |
1050 |
} |