root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / project / ProjectWindow.java @ 1774
History | View | Annotate | Download (34.2 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.DBDriver; |
56 |
import com.hardcode.gdbms.engine.data.DataSource; |
57 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
58 |
import com.hardcode.gdbms.engine.data.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 |
|
246 |
/**
|
247 |
* Crea un nuevo project element
|
248 |
*
|
249 |
* @throws Exception DOCUMENT ME!
|
250 |
*/
|
251 |
private void nuevo() throws Exception { |
252 |
DateFormat df = DateFormat.getDateInstance(); |
253 |
|
254 |
if (btnMapas.isSelected()) {
|
255 |
ProjectMap map = ProjectFactory.createMap(PluginServices.getText( |
256 |
this, "untitled")); |
257 |
map.setModel(new Layout());
|
258 |
map.getModel().setProjectMap(map); |
259 |
p.addMap(map); |
260 |
} else if (btnTablas.isSelected()) { |
261 |
try {
|
262 |
FOpenDialog fopen = new FOpenDialog();
|
263 |
FileOpenDialog fod = new FileOpenDialog(new Class[]{FileDriver.class, GeorreferencedRasterDriver.class}); |
264 |
DataBaseOpenDialog dbod = new DataBaseOpenDialog();
|
265 |
dbod.setClasses(new Class[] { DBDriver.class }); |
266 |
fopen.addTab("Fichero", fod);
|
267 |
fopen.addTab("Base de datos", dbod);
|
268 |
PluginServices.getMDIManager().addView(fopen); |
269 |
|
270 |
if (fopen.isAccepted()) {
|
271 |
JPanel panel = fopen.getSelectedTab();
|
272 |
|
273 |
if (panel instanceof FileOpenDialog) { |
274 |
File[] files = fod.getFiles(); |
275 |
String[] driverNames = fod.getDriverNames(); |
276 |
for (int i = 0; i < files.length; i++) { |
277 |
String name = files[i].getName();
|
278 |
LayerFactory.getDataSourceFactory().addFileDataSource(driverNames[i], name, files[i].getAbsolutePath(), files[i].getAbsolutePath()); |
279 |
|
280 |
DataSource dataSource = LayerFactory.getDataSourceFactory().createRandomDataSource(name);
|
281 |
SelectableDataSource sds = new SelectableDataSource(dataSource);
|
282 |
ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
283 |
ProjectTable projectTable = ProjectFactory.createTable(null, sds);
|
284 |
ext.getProject().addTable(projectTable); |
285 |
|
286 |
Table t = new Table();
|
287 |
t.setModel(projectTable); |
288 |
PluginServices.getMDIManager().addView(t); |
289 |
} |
290 |
} else if (panel instanceof DataBaseOpenDialog) { |
291 |
String driverName = dbod.getDriverName();
|
292 |
int port = -1; |
293 |
|
294 |
try {
|
295 |
port = Integer.parseInt(dbod.getPort());
|
296 |
} catch (NumberFormatException e) { |
297 |
} |
298 |
|
299 |
String name = dbod.getHost() + "/" + |
300 |
dbod.getDataBase(); |
301 |
|
302 |
if (port != -1) { |
303 |
name = dbod.getHost() + ":" + port + "/" + |
304 |
dbod.getDataBase(); |
305 |
} |
306 |
|
307 |
String user = dbod.getUser().trim();
|
308 |
String password = dbod.getPassword();
|
309 |
|
310 |
if (user.equals("")) { |
311 |
user = null;
|
312 |
password = null;
|
313 |
} |
314 |
|
315 |
LayerFactory.getDataSourceFactory().addDBDataSource(name, dbod.getHost(), |
316 |
port, user, password, dbod.getDataBase(), |
317 |
dbod.getTable(), null, driverName);
|
318 |
|
319 |
DataSource dataSource = LayerFactory.getDataSourceFactory().createRandomDataSource(name);
|
320 |
SelectableDataSource sds = new SelectableDataSource(dataSource);
|
321 |
|
322 |
ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
323 |
ProjectTable projectTable = ProjectFactory.createTable(null, sds);
|
324 |
ext.getProject().addTable(projectTable); |
325 |
|
326 |
Table t = new Table();
|
327 |
t.setModel(projectTable); |
328 |
PluginServices.getMDIManager().addView(t); |
329 |
} |
330 |
} |
331 |
} catch (DriverLoadException e) {
|
332 |
NotificationManager.addError("Error al cargar los drivers", e);
|
333 |
} |
334 |
} else {
|
335 |
ProjectView vista = ProjectFactory.createView(PluginServices.getText( |
336 |
this, "untitled")); |
337 |
p.addView(vista); |
338 |
} |
339 |
} |
340 |
|
341 |
/**
|
342 |
* Abre la ventana de un nuevo project element
|
343 |
*/
|
344 |
private void abrir() { |
345 |
if (btnMapas.isSelected()) {
|
346 |
int index = lstDocs.getSelectedIndex();
|
347 |
|
348 |
if (index == -1) { |
349 |
return;
|
350 |
} |
351 |
|
352 |
Layout l = (Layout)((ProjectMap) p.getMaps().get(index)).getModel(); |
353 |
l.fullRect(); |
354 |
PluginServices.getMDIManager().addView(l); |
355 |
} else if (btnTablas.isSelected()) { |
356 |
com.iver.cit.gvsig.gui.Table vista = new com.iver.cit.gvsig.gui.Table();
|
357 |
int index = lstDocs.getSelectedIndex();
|
358 |
|
359 |
if (index == -1) { |
360 |
return;
|
361 |
} |
362 |
|
363 |
vista.setModel((ProjectTable) p.getTables().get(index)); |
364 |
PluginServices.getMDIManager().addView(vista); |
365 |
} else {
|
366 |
com.iver.cit.gvsig.gui.View vista = new com.iver.cit.gvsig.gui.View();
|
367 |
int index = lstDocs.getSelectedIndex();
|
368 |
|
369 |
if (index == -1) { |
370 |
return;
|
371 |
} |
372 |
|
373 |
vista.setModel((ProjectView) p.getViews().get(index)); |
374 |
PluginServices.getMDIManager().addView(vista); |
375 |
|
376 |
} |
377 |
} |
378 |
|
379 |
/**
|
380 |
* Cambia el nombre de un project element
|
381 |
*/
|
382 |
private void renombrar() { |
383 |
ProjectElement elem = null;
|
384 |
int index = lstDocs.getSelectedIndex();
|
385 |
|
386 |
if (index == -1) { |
387 |
return;
|
388 |
} |
389 |
|
390 |
if (btnMapas.isSelected()) {
|
391 |
elem = (ProjectElement) p.getMaps().get(index); |
392 |
} else if (btnTablas.isSelected()) { |
393 |
elem = (ProjectElement) p.getTables().get(index); |
394 |
} else {
|
395 |
elem = (ProjectElement) p.getViews().get(index); |
396 |
} |
397 |
|
398 |
JOptionPane pane = new JOptionPane(); |
399 |
pane.setMessage(PluginServices.getText(this, "introduce_nombre")); |
400 |
pane.setMessageType(JOptionPane.QUESTION_MESSAGE);
|
401 |
pane.setWantsInput(true);
|
402 |
pane.setInitialSelectionValue(elem.getName()); |
403 |
|
404 |
JDialog dlg = pane.createDialog((Component) PluginServices.getMainFrame(), |
405 |
PluginServices.getText(this, "renombrar")); |
406 |
dlg.setModal(true);
|
407 |
dlg.show(); |
408 |
|
409 |
String nuevoNombre = pane.getInputValue().toString().trim();
|
410 |
|
411 |
if (nuevoNombre.length() == 0) { |
412 |
return;
|
413 |
} |
414 |
|
415 |
if (nuevoNombre == null) { |
416 |
return;
|
417 |
} |
418 |
|
419 |
elem.setName(nuevoNombre); |
420 |
|
421 |
refreshList(); |
422 |
} |
423 |
|
424 |
/**
|
425 |
* Borra un project element
|
426 |
*/
|
427 |
private void borrar() { |
428 |
int res = JOptionPane.showConfirmDialog((Component) PluginServices.getMainFrame(), |
429 |
PluginServices.getText(this, "confirmar_borrar"), |
430 |
PluginServices.getText(this, "borrar"), |
431 |
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); |
432 |
|
433 |
if (res == JOptionPane.YES_OPTION) { |
434 |
int index = lstDocs.getSelectedIndex();
|
435 |
|
436 |
if (btnMapas.isSelected()) {
|
437 |
PluginServices.getMDIManager().closeSingletonView(p.getMaps().get(index)); |
438 |
p.delMap(index); |
439 |
} else if (btnTablas.isSelected()) { |
440 |
PluginServices.getMDIManager().closeSingletonView(p.getTables().get(index)); |
441 |
p.delTable(index); |
442 |
} else {
|
443 |
PluginServices.getMDIManager().closeSingletonView(p.getViews().get(index)); |
444 |
p.delView(index); |
445 |
} |
446 |
|
447 |
refreshList(); |
448 |
} |
449 |
} |
450 |
|
451 |
/**
|
452 |
* Muestra el di?logo de propiedades de un project element
|
453 |
*/
|
454 |
private void propiedades() { |
455 |
int index = lstDocs.getSelectedIndex();
|
456 |
|
457 |
if (index == -1) { |
458 |
return;
|
459 |
} |
460 |
|
461 |
View dlg;
|
462 |
|
463 |
if (btnMapas.isSelected()) {
|
464 |
dlg = new MapProperties((ProjectMap) p.getMaps().get(index));
|
465 |
} else if (btnTablas.isSelected()) { |
466 |
dlg = new TableProperties((ProjectTable) p.getTables().get(index));
|
467 |
} else {
|
468 |
dlg = new ViewProperties((ProjectView) p.getViews().get(index));
|
469 |
} |
470 |
|
471 |
PluginServices.getMDIManager().addView(dlg); |
472 |
|
473 |
refreshControls(); |
474 |
lstDocs.setSelectedIndex(index); |
475 |
} |
476 |
|
477 |
/**
|
478 |
* This method initializes jPanel
|
479 |
*
|
480 |
* @return javax.swing.JPanel
|
481 |
*/
|
482 |
private javax.swing.JPanel getJPanel() {
|
483 |
if (jPanel == null) { |
484 |
jPanel = new javax.swing.JPanel();
|
485 |
|
486 |
java.awt.FlowLayout layFlowLayout1 = new java.awt.FlowLayout();
|
487 |
layFlowLayout1.setHgap(15);
|
488 |
jPanel.setLayout(layFlowLayout1); |
489 |
jPanel.add(getBtnVistas(), null);
|
490 |
jPanel.add(getBtnTablas(), null);
|
491 |
jPanel.add(getBtnMapas(), null);
|
492 |
jPanel.setName("tipoDocPanel");
|
493 |
jPanel.setPreferredSize(new java.awt.Dimension(390, 125)); |
494 |
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
495 |
null, PluginServices.getText(this, "tipos_de_documentos"), |
496 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
497 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
498 |
} |
499 |
|
500 |
return jPanel;
|
501 |
} |
502 |
|
503 |
/**
|
504 |
* This method initializes btnVistas
|
505 |
*
|
506 |
* @return javax.swing.JRadioButton
|
507 |
*/
|
508 |
private javax.swing.JRadioButton getBtnVistas() {
|
509 |
if (btnVistas == null) { |
510 |
btnVistas = new javax.swing.JRadioButton();
|
511 |
btnVistas.setIcon(new javax.swing.ImageIcon(
|
512 |
this.getClass().getClassLoader().getResource("images/Vista.png"))); |
513 |
btnVistas.setSelectedIcon(new javax.swing.ImageIcon(
|
514 |
this.getClass().getClassLoader().getResource("images/Vista_sel.png"))); |
515 |
btnVistas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
516 |
btnVistas.setText(PluginServices.getText(this, "vistas")); |
517 |
btnVistas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
518 |
btnVistas.setName("vistasBtn");
|
519 |
btnVistas.addChangeListener(new javax.swing.event.ChangeListener() {
|
520 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
521 |
refreshList(); |
522 |
} |
523 |
}); |
524 |
} |
525 |
|
526 |
return btnVistas;
|
527 |
} |
528 |
|
529 |
/**
|
530 |
* This method initializes btnTablas
|
531 |
*
|
532 |
* @return javax.swing.JRadioButton
|
533 |
*/
|
534 |
private javax.swing.JRadioButton getBtnTablas() {
|
535 |
if (btnTablas == null) { |
536 |
btnTablas = new javax.swing.JRadioButton();
|
537 |
btnTablas.setIcon(new javax.swing.ImageIcon(
|
538 |
this.getClass().getClassLoader().getResource("images/tablas.png"))); |
539 |
btnTablas.setSelectedIcon(new javax.swing.ImageIcon(
|
540 |
this.getClass().getClassLoader().getResource("images/tablas_sel.png"))); |
541 |
btnTablas.setText(PluginServices.getText(this, "tablas")); |
542 |
btnTablas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
543 |
btnTablas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
544 |
btnTablas.setName("tablasBtn");
|
545 |
btnTablas.addChangeListener(new javax.swing.event.ChangeListener() {
|
546 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
547 |
refreshList(); |
548 |
} |
549 |
}); |
550 |
} |
551 |
|
552 |
return btnTablas;
|
553 |
} |
554 |
|
555 |
/**
|
556 |
* This method initializes btnMapas
|
557 |
*
|
558 |
* @return javax.swing.JRadioButton
|
559 |
*/
|
560 |
private javax.swing.JRadioButton getBtnMapas() {
|
561 |
if (btnMapas == null) { |
562 |
btnMapas = new javax.swing.JRadioButton();
|
563 |
btnMapas.setIcon(new javax.swing.ImageIcon(
|
564 |
this.getClass().getClassLoader().getResource("images/mapas.png"))); |
565 |
btnMapas.setSelectedIcon(new javax.swing.ImageIcon(
|
566 |
this.getClass().getClassLoader().getResource("images/mapas_sel.png"))); |
567 |
btnMapas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
568 |
btnMapas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
569 |
btnMapas.setText(PluginServices.getText(this, "mapas")); |
570 |
btnMapas.addChangeListener(new javax.swing.event.ChangeListener() {
|
571 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
572 |
refreshList(); |
573 |
} |
574 |
}); |
575 |
} |
576 |
|
577 |
return btnMapas;
|
578 |
} |
579 |
|
580 |
/**
|
581 |
* This method initializes jPanel1
|
582 |
*
|
583 |
* @return javax.swing.JPanel
|
584 |
*/
|
585 |
private javax.swing.JPanel getJPanel1() {
|
586 |
if (jPanel1 == null) { |
587 |
jPanel1 = new javax.swing.JPanel();
|
588 |
|
589 |
java.awt.BorderLayout layBorderLayout2 = new java.awt.BorderLayout();
|
590 |
layBorderLayout2.setVgap(30);
|
591 |
jPanel1.setLayout(layBorderLayout2); |
592 |
jPanel1.add(getJPanel2(), java.awt.BorderLayout.EAST); |
593 |
jPanel1.add(getJScrollPane(), java.awt.BorderLayout.CENTER); |
594 |
jPanel1.setPreferredSize(new java.awt.Dimension(390, 170)); |
595 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
596 |
null, PluginServices.getText(this, "documentos_existentes"), |
597 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
598 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
599 |
} |
600 |
|
601 |
return jPanel1;
|
602 |
} |
603 |
|
604 |
/**
|
605 |
* This method initializes lstDocs
|
606 |
*
|
607 |
* @return javax.swing.JList
|
608 |
*/
|
609 |
private javax.swing.JList getLstDocs() {
|
610 |
if (lstDocs == null) { |
611 |
lstDocs = new javax.swing.JList();
|
612 |
lstDocs.addMouseListener(new java.awt.event.MouseAdapter() {
|
613 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
614 |
if (e.getClickCount() == 2) { |
615 |
abrir(); |
616 |
} |
617 |
} |
618 |
}); |
619 |
lstDocs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
620 |
public void valueChanged( |
621 |
javax.swing.event.ListSelectionEvent e) { |
622 |
activarBotones(); |
623 |
} |
624 |
}); |
625 |
} |
626 |
|
627 |
return lstDocs;
|
628 |
} |
629 |
|
630 |
/**
|
631 |
* This method initializes jPanel2
|
632 |
*
|
633 |
* @return javax.swing.JPanel
|
634 |
*/
|
635 |
private javax.swing.JPanel getJPanel2() {
|
636 |
if (jPanel2 == null) { |
637 |
jPanel2 = new javax.swing.JPanel();
|
638 |
|
639 |
java.awt.FlowLayout layFlowLayout11 = new java.awt.FlowLayout();
|
640 |
layFlowLayout11.setVgap(5);
|
641 |
jPanel2.setLayout(layFlowLayout11); |
642 |
jPanel2.add(getBtnNuevo(), null);
|
643 |
jPanel2.add(getBtnAbrir(), null);
|
644 |
jPanel2.add(getBtnRenombrar(), null);
|
645 |
jPanel2.add(getBtnBorrar(), null);
|
646 |
jPanel2.add(getBtnPropiedades(), null);
|
647 |
jPanel2.setPreferredSize(new java.awt.Dimension(100, 50)); |
648 |
} |
649 |
|
650 |
return jPanel2;
|
651 |
} |
652 |
|
653 |
/**
|
654 |
* This method initializes btnNuevo
|
655 |
*
|
656 |
* @return javax.swing.JButton
|
657 |
*/
|
658 |
private javax.swing.JButton getBtnNuevo() {
|
659 |
if (btnNuevo == null) { |
660 |
btnNuevo = new javax.swing.JButton();
|
661 |
btnNuevo.setPreferredSize(new java.awt.Dimension(80, 23)); |
662 |
btnNuevo.setName("btnNuevo");
|
663 |
btnNuevo.setText(PluginServices.getText(this, "nuevo")); |
664 |
btnNuevo.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
665 |
btnNuevo.addActionListener(new java.awt.event.ActionListener() {
|
666 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
667 |
try {
|
668 |
nuevo(); |
669 |
} catch (Exception e1) { |
670 |
NotificationManager.addError(e1.getLocalizedMessage(), |
671 |
e1); |
672 |
} |
673 |
} |
674 |
}); |
675 |
} |
676 |
|
677 |
return btnNuevo;
|
678 |
} |
679 |
|
680 |
/**
|
681 |
* This method initializes btnPropiedades
|
682 |
*
|
683 |
* @return javax.swing.JButton
|
684 |
*/
|
685 |
private javax.swing.JButton getBtnPropiedades() {
|
686 |
if (btnPropiedades == null) { |
687 |
btnPropiedades = new javax.swing.JButton();
|
688 |
btnPropiedades.setPreferredSize(new java.awt.Dimension(80, 23)); |
689 |
btnPropiedades.setText(PluginServices.getText(this, "propiedades")); |
690 |
btnPropiedades.setName("btnPropiedades");
|
691 |
btnPropiedades.setEnabled(false);
|
692 |
btnPropiedades.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
693 |
btnPropiedades.addActionListener(new java.awt.event.ActionListener() {
|
694 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
695 |
propiedades(); |
696 |
} |
697 |
}); |
698 |
} |
699 |
|
700 |
return btnPropiedades;
|
701 |
} |
702 |
|
703 |
/**
|
704 |
* This method initializes btnAbrir
|
705 |
*
|
706 |
* @return javax.swing.JButton
|
707 |
*/
|
708 |
private javax.swing.JButton getBtnAbrir() {
|
709 |
if (btnAbrir == null) { |
710 |
btnAbrir = new javax.swing.JButton();
|
711 |
btnAbrir.setPreferredSize(new java.awt.Dimension(80, 23)); |
712 |
btnAbrir.setName("btnAbrir");
|
713 |
btnAbrir.setText(PluginServices.getText(this, "abrir")); |
714 |
btnAbrir.setEnabled(false);
|
715 |
btnAbrir.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
716 |
btnAbrir.addActionListener(new java.awt.event.ActionListener() {
|
717 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
718 |
abrir(); |
719 |
} |
720 |
}); |
721 |
} |
722 |
|
723 |
return btnAbrir;
|
724 |
} |
725 |
|
726 |
/**
|
727 |
* This method initializes btnBorrar
|
728 |
*
|
729 |
* @return javax.swing.JButton
|
730 |
*/
|
731 |
private javax.swing.JButton getBtnBorrar() {
|
732 |
if (btnBorrar == null) { |
733 |
btnBorrar = new javax.swing.JButton();
|
734 |
btnBorrar.setPreferredSize(new java.awt.Dimension(80, 23)); |
735 |
btnBorrar.setText(PluginServices.getText(this, "borrar")); |
736 |
btnBorrar.setName("btnBorrar");
|
737 |
btnBorrar.setEnabled(false);
|
738 |
btnBorrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
739 |
btnBorrar.addActionListener(new java.awt.event.ActionListener() {
|
740 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
741 |
borrar(); |
742 |
} |
743 |
}); |
744 |
} |
745 |
|
746 |
return btnBorrar;
|
747 |
} |
748 |
|
749 |
/**
|
750 |
* This method initializes btnRenombrar
|
751 |
*
|
752 |
* @return javax.swing.JButton
|
753 |
*/
|
754 |
private javax.swing.JButton getBtnRenombrar() {
|
755 |
if (btnRenombrar == null) { |
756 |
btnRenombrar = new javax.swing.JButton();
|
757 |
btnRenombrar.setPreferredSize(new java.awt.Dimension(80, 23)); |
758 |
btnRenombrar.setName("btnRenombrar");
|
759 |
btnRenombrar.setText(PluginServices.getText(this, "renombrar")); |
760 |
btnRenombrar.setEnabled(false);
|
761 |
btnRenombrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
762 |
btnRenombrar.addActionListener(new java.awt.event.ActionListener() {
|
763 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
764 |
renombrar(); |
765 |
} |
766 |
}); |
767 |
} |
768 |
|
769 |
return btnRenombrar;
|
770 |
} |
771 |
|
772 |
/**
|
773 |
* This method initializes jPanel3
|
774 |
*
|
775 |
* @return javax.swing.JPanel
|
776 |
*/
|
777 |
private javax.swing.JPanel getJPanel3() {
|
778 |
if (jPanel3 == null) { |
779 |
jPanel3 = new javax.swing.JPanel();
|
780 |
|
781 |
java.awt.FlowLayout layFlowLayout3 = new java.awt.FlowLayout();
|
782 |
layFlowLayout3.setHgap(5);
|
783 |
layFlowLayout3.setAlignment(java.awt.FlowLayout.LEFT); |
784 |
jPanel3.setLayout(layFlowLayout3); |
785 |
jPanel3.add(getJLabel(), null);
|
786 |
jPanel3.add(getLblNombreSesion(), null);
|
787 |
jPanel3.add(getJLabel1(), null);
|
788 |
jPanel3.add(getLblGuardado(), null);
|
789 |
jPanel3.add(getJLabel2(), null);
|
790 |
jPanel3.add(getLblFecha(), null);
|
791 |
jPanel3.add(getJPanel4(), null);
|
792 |
jPanel3.setPreferredSize(new java.awt.Dimension(390, 125)); |
793 |
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder( |
794 |
null, PluginServices.getText(this, "propiedades_sesion"), |
795 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
796 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
797 |
} |
798 |
|
799 |
return jPanel3;
|
800 |
} |
801 |
|
802 |
/**
|
803 |
* This method initializes jLabel
|
804 |
*
|
805 |
* @return javax.swing.JLabel
|
806 |
*/
|
807 |
private javax.swing.JLabel getJLabel() {
|
808 |
if (jLabel == null) { |
809 |
jLabel = new javax.swing.JLabel();
|
810 |
jLabel.setText(PluginServices.getText(this, "nombre_sesion") + ":"); |
811 |
jLabel.setPreferredSize(new java.awt.Dimension(150, 16)); |
812 |
} |
813 |
|
814 |
return jLabel;
|
815 |
} |
816 |
|
817 |
/**
|
818 |
* This method initializes lblNombreSesion
|
819 |
*
|
820 |
* @return javax.swing.JLabel
|
821 |
*/
|
822 |
private javax.swing.JLabel getLblNombreSesion() {
|
823 |
if (lblNombreSesion == null) { |
824 |
lblNombreSesion = new javax.swing.JLabel();
|
825 |
lblNombreSesion.setText("");
|
826 |
lblNombreSesion.setName("lblNombreSesion");
|
827 |
lblNombreSesion.setPreferredSize(new java.awt.Dimension(200, 16)); |
828 |
lblNombreSesion.setAutoscrolls(true);
|
829 |
} |
830 |
|
831 |
return lblNombreSesion;
|
832 |
} |
833 |
|
834 |
/**
|
835 |
* This method initializes jLabel1
|
836 |
*
|
837 |
* @return javax.swing.JLabel
|
838 |
*/
|
839 |
private javax.swing.JLabel getJLabel1() {
|
840 |
if (jLabel1 == null) { |
841 |
jLabel1 = new javax.swing.JLabel();
|
842 |
jLabel1.setText(PluginServices.getText(this, "guardado") + ":"); |
843 |
jLabel1.setPreferredSize(new java.awt.Dimension(150, 16)); |
844 |
} |
845 |
|
846 |
return jLabel1;
|
847 |
} |
848 |
|
849 |
/**
|
850 |
* This method initializes lblGuardado
|
851 |
*
|
852 |
* @return javax.swing.JLabel
|
853 |
*/
|
854 |
private javax.swing.JLabel getLblGuardado() {
|
855 |
if (lblGuardado == null) { |
856 |
lblGuardado = new javax.swing.JLabel();
|
857 |
lblGuardado.setText("");
|
858 |
lblGuardado.setPreferredSize(new java.awt.Dimension(200, 16)); |
859 |
lblGuardado.setAutoscrolls(true);
|
860 |
} |
861 |
|
862 |
return lblGuardado;
|
863 |
} |
864 |
|
865 |
/**
|
866 |
* This method initializes jLabel2
|
867 |
*
|
868 |
* @return javax.swing.JLabel
|
869 |
*/
|
870 |
private javax.swing.JLabel getJLabel2() {
|
871 |
if (jLabel2 == null) { |
872 |
jLabel2 = new javax.swing.JLabel();
|
873 |
jLabel2.setText(PluginServices.getText(this, "creation_date") + ":"); |
874 |
jLabel2.setPreferredSize(new java.awt.Dimension(150, 16)); |
875 |
} |
876 |
|
877 |
return jLabel2;
|
878 |
} |
879 |
|
880 |
/**
|
881 |
* This method initializes lblFecha
|
882 |
*
|
883 |
* @return javax.swing.JLabel
|
884 |
*/
|
885 |
private javax.swing.JLabel getLblFecha() {
|
886 |
if (lblFecha == null) { |
887 |
lblFecha = new javax.swing.JLabel();
|
888 |
lblFecha.setText("");
|
889 |
lblFecha.setPreferredSize(new java.awt.Dimension(200, 16)); |
890 |
lblFecha.setAutoscrolls(true);
|
891 |
} |
892 |
|
893 |
return lblFecha;
|
894 |
} |
895 |
|
896 |
/**
|
897 |
* This method initializes btnImportar
|
898 |
*
|
899 |
* @return javax.swing.JButton
|
900 |
*/
|
901 |
private javax.swing.JButton getBtnImportar() {
|
902 |
if (btnImportar == null) { |
903 |
btnImportar = new javax.swing.JButton();
|
904 |
btnImportar.setPreferredSize(new java.awt.Dimension(80, 23)); |
905 |
btnImportar.setText(PluginServices.getText(this, "importar")); |
906 |
btnImportar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
907 |
} |
908 |
|
909 |
return btnImportar;
|
910 |
} |
911 |
|
912 |
/**
|
913 |
* This method initializes btnExportar
|
914 |
*
|
915 |
* @return javax.swing.JButton
|
916 |
*/
|
917 |
private javax.swing.JButton getBtnExportar() {
|
918 |
if (btnExportar == null) { |
919 |
btnExportar = new javax.swing.JButton();
|
920 |
btnExportar.setPreferredSize(new java.awt.Dimension(80, 23)); |
921 |
btnExportar.setText(PluginServices.getText(this, "exportar")); |
922 |
btnExportar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
923 |
} |
924 |
|
925 |
return btnExportar;
|
926 |
} |
927 |
|
928 |
/**
|
929 |
* This method initializes btnEditar
|
930 |
*
|
931 |
* @return javax.swing.JButton
|
932 |
*/
|
933 |
private javax.swing.JButton getBtnEditar() {
|
934 |
if (btnEditar == null) { |
935 |
btnEditar = new javax.swing.JButton();
|
936 |
btnEditar.setPreferredSize(new java.awt.Dimension(80, 23)); |
937 |
btnEditar.setText(PluginServices.getText(this, "propiedades")); |
938 |
|
939 |
btnEditar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
940 |
|
941 |
final JPanel f = this; |
942 |
btnEditar.addActionListener(new java.awt.event.ActionListener() {
|
943 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
944 |
ProjectProperties dlg = new ProjectProperties(p);
|
945 |
PluginServices.getMDIManager().addView(dlg); |
946 |
refreshProperties(); |
947 |
} |
948 |
}); |
949 |
} |
950 |
|
951 |
return btnEditar;
|
952 |
} |
953 |
|
954 |
/**
|
955 |
* This method initializes jScrollPane
|
956 |
*
|
957 |
* @return javax.swing.JScrollPane
|
958 |
*/
|
959 |
private javax.swing.JScrollPane getJScrollPane() {
|
960 |
if (jScrollPane == null) { |
961 |
jScrollPane = new javax.swing.JScrollPane();
|
962 |
jScrollPane.setViewportView(getLstDocs()); |
963 |
jScrollPane.setPreferredSize(new java.awt.Dimension(200, 100)); |
964 |
jScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); |
965 |
} |
966 |
|
967 |
return jScrollPane;
|
968 |
} |
969 |
|
970 |
/**
|
971 |
* @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
|
972 |
*/
|
973 |
public Object getViewModel() { |
974 |
return p;
|
975 |
} |
976 |
|
977 |
/**
|
978 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
979 |
*/
|
980 |
public ViewInfo getViewInfo() {
|
981 |
ViewInfo m_viewinfo = new ViewInfo();
|
982 |
m_viewinfo.setWidth(400);
|
983 |
m_viewinfo.setHeight(430);
|
984 |
m_viewinfo.setTitle(PluginServices.getText(this, "titulo")); |
985 |
|
986 |
return m_viewinfo;
|
987 |
} |
988 |
|
989 |
/**
|
990 |
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
|
991 |
*/
|
992 |
public void propertyChange(PropertyChangeEvent evt) { |
993 |
refreshControls(); |
994 |
} |
995 |
|
996 |
/**
|
997 |
* @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
|
998 |
*/
|
999 |
public void viewActivated() { |
1000 |
} |
1001 |
|
1002 |
/**
|
1003 |
* This method initializes jPanel4
|
1004 |
*
|
1005 |
* @return javax.swing.JPanel
|
1006 |
*/
|
1007 |
private javax.swing.JPanel getJPanel4() {
|
1008 |
if (jPanel4 == null) { |
1009 |
jPanel4 = new javax.swing.JPanel();
|
1010 |
|
1011 |
java.awt.FlowLayout layFlowLayout2 = new java.awt.FlowLayout();
|
1012 |
layFlowLayout2.setHgap(30);
|
1013 |
jPanel4.setLayout(layFlowLayout2); |
1014 |
jPanel4.add(getBtnImportar(), null);
|
1015 |
jPanel4.add(getBtnExportar(), null);
|
1016 |
jPanel4.add(getBtnEditar(), null);
|
1017 |
jPanel4.setPreferredSize(new java.awt.Dimension(360, 30)); |
1018 |
} |
1019 |
|
1020 |
return jPanel4;
|
1021 |
} |
1022 |
} |