root / tags / v10_RC2c / applications / appgvSIG / src / com / iver / cit / gvsig / gui / project / ProjectWindow.java @ 8745
History | View | Annotate | Download (36.4 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.awt.FlowLayout; |
45 |
import java.awt.GridBagConstraints; |
46 |
import java.awt.GridBagLayout; |
47 |
import java.awt.GridLayout; |
48 |
import java.awt.Insets; |
49 |
import java.beans.PropertyChangeEvent; |
50 |
import java.beans.PropertyChangeListener; |
51 |
import java.io.File; |
52 |
import java.text.DateFormat; |
53 |
import java.util.ArrayList; |
54 |
|
55 |
import javax.swing.ButtonGroup; |
56 |
import javax.swing.ImageIcon; |
57 |
import javax.swing.JDialog; |
58 |
import javax.swing.JLabel; |
59 |
import javax.swing.JList; |
60 |
import javax.swing.JOptionPane; |
61 |
import javax.swing.JPanel; |
62 |
import javax.swing.JRadioButton; |
63 |
import javax.swing.JScrollPane; |
64 |
import javax.swing.border.TitledBorder; |
65 |
|
66 |
import org.gvsig.gui.beans.swing.JButton; |
67 |
|
68 |
import com.hardcode.driverManager.Driver; |
69 |
import com.hardcode.driverManager.DriverLoadException; |
70 |
import com.hardcode.gdbms.engine.data.DataSource; |
71 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
72 |
import com.hardcode.gdbms.engine.data.driver.DBDriver; |
73 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
74 |
import com.hardcode.gdbms.engine.data.driver.FileDriver; |
75 |
import com.iver.andami.PluginServices; |
76 |
import com.iver.andami.messages.NotificationManager; |
77 |
import com.iver.andami.ui.mdiManager.SingletonWindow; |
78 |
import com.iver.andami.ui.mdiManager.IWindow; |
79 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
80 |
import com.iver.cit.gvsig.ProjectExtension; |
81 |
import com.iver.cit.gvsig.fmap.edition.EditableAdapter; |
82 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
83 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
84 |
import com.iver.cit.gvsig.gui.DataBaseOpenDialog; |
85 |
import com.iver.cit.gvsig.gui.FOpenDialog; |
86 |
import com.iver.cit.gvsig.gui.FileOpenDialog; |
87 |
import com.iver.cit.gvsig.gui.Table; |
88 |
import com.iver.cit.gvsig.gui.layout.Layout; |
89 |
import com.iver.cit.gvsig.project.Project; |
90 |
import com.iver.cit.gvsig.project.ProjectElement; |
91 |
import com.iver.cit.gvsig.project.ProjectFactory; |
92 |
import com.iver.cit.gvsig.project.ProjectMap; |
93 |
import com.iver.cit.gvsig.project.ProjectTable; |
94 |
import com.iver.cit.gvsig.project.ProjectView; |
95 |
import com.iver.utiles.DefaultListModel; |
96 |
|
97 |
|
98 |
/**
|
99 |
* Clase principal del proyecto donde se puede operar para crear vistas,
|
100 |
* tablas, mapas, ...
|
101 |
*
|
102 |
* @author Fernando Gonz?lez Cort?s
|
103 |
*/
|
104 |
public class ProjectWindow extends JPanel implements PropertyChangeListener, |
105 |
IWindow, SingletonWindow { |
106 |
private JPanel jPanel = null; |
107 |
private JRadioButton btnVistas = null; |
108 |
private JRadioButton btnTablas = null; |
109 |
private JRadioButton btnMapas = null; |
110 |
private ButtonGroup grupo = new ButtonGroup(); |
111 |
private JPanel jPanel1 = null; |
112 |
private JList lstDocs = null; |
113 |
private JPanel jPanel2 = null; |
114 |
private JButton btnNuevo = null; |
115 |
private JButton btnPropiedades = null; |
116 |
private JButton btnAbrir = null; |
117 |
private JButton btnBorrar = null; |
118 |
private JButton btnRenombrar = null; |
119 |
private JPanel jPanel3 = null; |
120 |
private JLabel jLabel = null; |
121 |
private JLabel lblNombreSesion = null; |
122 |
private JLabel jLabel1 = null; |
123 |
private JLabel lblGuardado = null; |
124 |
private JLabel jLabel2 = null; |
125 |
private JLabel lblFecha = null; |
126 |
private JButton btnImportar = null; |
127 |
private JButton btnExportar = null; |
128 |
private JButton btnEditar = null; |
129 |
// The properties of the Project Manager window (size, position, etc):
|
130 |
private WindowInfo m_viewInfo=null; |
131 |
|
132 |
/** Proyecto representado en la vista */
|
133 |
private Project p;
|
134 |
|
135 |
/**
|
136 |
* Extension con la informaci?n, entre otras, sobre las extensiones para
|
137 |
* las tablas
|
138 |
*/
|
139 |
private ProjectExtension projectExtension;
|
140 |
private JScrollPane jScrollPane = null; |
141 |
private JPanel jPanel4 = null; |
142 |
|
143 |
/**
|
144 |
* This is the default constructor
|
145 |
*
|
146 |
* @param project Extension
|
147 |
*/
|
148 |
public ProjectWindow(ProjectExtension project) {
|
149 |
super();
|
150 |
|
151 |
initialize(); |
152 |
|
153 |
projectExtension = project; |
154 |
|
155 |
refreshControls(); |
156 |
} |
157 |
|
158 |
/**
|
159 |
* This is the default constructor
|
160 |
*
|
161 |
* @param project Extension
|
162 |
*/
|
163 |
public ProjectWindow() {
|
164 |
super();
|
165 |
|
166 |
initialize(); |
167 |
refreshControls(); |
168 |
} |
169 |
|
170 |
public void setProjectExtension(ProjectExtension p) { |
171 |
projectExtension = p; |
172 |
} |
173 |
|
174 |
|
175 |
/**
|
176 |
* Asigna el proyecto a la ventana
|
177 |
*
|
178 |
* @param p Proyecto con el que se operar? a trav?s de este di?logo
|
179 |
*/
|
180 |
public void setProject(Project p) { |
181 |
this.p = p;
|
182 |
p.addPropertyChangeListener(this);
|
183 |
refreshControls(); |
184 |
} |
185 |
|
186 |
/**
|
187 |
* Activa los botones de la botonera del medio o los desactiva en funci?n
|
188 |
* de que est? seleccionado o no un elemento de proyecto en la lista del
|
189 |
* medio
|
190 |
*/
|
191 |
private void activarBotones() { |
192 |
if (lstDocs.getSelectedIndex() != -1) { |
193 |
btnAbrir.setEnabled(true);
|
194 |
btnBorrar.setEnabled(true);
|
195 |
if (lstDocs.getSelectedIndices().length==1) { |
196 |
btnRenombrar.setEnabled(true);
|
197 |
btnPropiedades.setEnabled(true);
|
198 |
}else {
|
199 |
btnRenombrar.setEnabled(false);
|
200 |
btnPropiedades.setEnabled(false);
|
201 |
} |
202 |
} else {
|
203 |
btnAbrir.setEnabled(false);
|
204 |
btnBorrar.setEnabled(false);
|
205 |
btnRenombrar.setEnabled(false);
|
206 |
btnPropiedades.setEnabled(false);
|
207 |
} |
208 |
} |
209 |
|
210 |
/**
|
211 |
* Refresca la lista de elementos de proyecto con vistas, mapas o tablas,
|
212 |
* seg?n la opci?n activada
|
213 |
*/
|
214 |
private void refreshList() { |
215 |
if (p != null) { |
216 |
DefaultListModel model;
|
217 |
String tituloMarco = PluginServices.getText(this, "documentos_existentes"); |
218 |
|
219 |
if (btnMapas.isSelected()) {
|
220 |
model = new DefaultListModel(p.getMaps()); |
221 |
tituloMarco = PluginServices.getText(this, "mapas"); |
222 |
|
223 |
// getBtnNuevo().setEnabled(true);
|
224 |
} else if (btnTablas.isSelected()) { |
225 |
model = new DefaultListModel(p.getTables()); |
226 |
tituloMarco = PluginServices.getText(this, "tablas"); |
227 |
|
228 |
// getBtnNuevo().setEnabled(false);
|
229 |
} else {
|
230 |
model = new DefaultListModel(p.getViews()); |
231 |
tituloMarco = PluginServices.getText(this, "vistas"); |
232 |
|
233 |
// getBtnNuevo().setEnabled(true);
|
234 |
} |
235 |
|
236 |
lstDocs.setModel(model); |
237 |
((TitledBorder)getJPanel1().getBorder()).setTitle(tituloMarco);
|
238 |
getJPanel1().repaint(1);
|
239 |
|
240 |
activarBotones(); |
241 |
} |
242 |
} |
243 |
|
244 |
/**
|
245 |
* Refresca las etiquetas con la informaci?n del proyecto
|
246 |
*/
|
247 |
private void refreshProperties() { |
248 |
if (p != null) { |
249 |
String aux;
|
250 |
|
251 |
lblNombreSesion.setText(p.getName()); |
252 |
|
253 |
String path = ProjectExtension.getPath();
|
254 |
|
255 |
if (path != null) { |
256 |
File f = new File(path); |
257 |
lblGuardado.setText(f.toString()); |
258 |
} else {
|
259 |
lblGuardado.setText("");
|
260 |
} |
261 |
|
262 |
lblFecha.setText(p.getCreationDate()); |
263 |
} |
264 |
} |
265 |
|
266 |
/**
|
267 |
* Refresca todo el di?logo
|
268 |
*/
|
269 |
public void refreshControls() { |
270 |
refreshList(); |
271 |
refreshProperties(); |
272 |
} |
273 |
|
274 |
/**
|
275 |
* This method initializes this
|
276 |
*/
|
277 |
private void initialize() { |
278 |
GridBagLayout layout = new GridBagLayout(); |
279 |
setLayout(layout); |
280 |
GridBagConstraints c = new GridBagConstraints(); |
281 |
c.fill = GridBagConstraints.HORIZONTAL;
|
282 |
c.gridy=0;
|
283 |
c.insets = new Insets(2, 5, 2, 5); |
284 |
|
285 |
layout.setConstraints(getJPanel(),c); |
286 |
add(getJPanel(), null);
|
287 |
|
288 |
c.fill = GridBagConstraints.BOTH;
|
289 |
c.gridy=1;
|
290 |
c.weightx = 1.0;
|
291 |
c.weighty = 1.0;
|
292 |
layout.setConstraints(getJPanel1(),c); |
293 |
add(getJPanel1(), null);
|
294 |
c.fill = GridBagConstraints.HORIZONTAL;
|
295 |
c.weightx = 0;
|
296 |
c.weighty = 0;
|
297 |
c.gridy=2;
|
298 |
layout.setConstraints(getJPanel3(),c); |
299 |
add(getJPanel3(), null);
|
300 |
|
301 |
this.setSize(430, 435); |
302 |
this.setPreferredSize(new java.awt.Dimension(430, 430)); |
303 |
this.setMinimumSize(new java.awt.Dimension(430, 430)); |
304 |
grupo.add(btnVistas); |
305 |
grupo.add(btnTablas); |
306 |
grupo.add(btnMapas); |
307 |
|
308 |
btnVistas.setSelected(true);
|
309 |
} |
310 |
private String ask(String title, String content){ |
311 |
JOptionPane pane = new JOptionPane(); |
312 |
pane.setMessage(content); |
313 |
pane.setMessageType(JOptionPane.QUESTION_MESSAGE);
|
314 |
pane.setWantsInput(true);
|
315 |
pane.setInitialSelectionValue("");
|
316 |
|
317 |
JDialog dlg = pane.createDialog((Component) PluginServices.getMainFrame(), |
318 |
title); |
319 |
dlg.setModal(true);
|
320 |
dlg.show(); |
321 |
|
322 |
return pane.getInputValue().toString().trim();
|
323 |
} |
324 |
|
325 |
/**
|
326 |
* Crea un nuevo project element
|
327 |
*
|
328 |
* @throws Exception DOCUMENT ME!
|
329 |
*/
|
330 |
private void newProjectElement() throws Exception { |
331 |
|
332 |
if (btnMapas.isSelected()) {
|
333 |
ProjectMap map = ProjectFactory.createMap(PluginServices.getText( |
334 |
this, "untitled")); |
335 |
map.setModel(new Layout());
|
336 |
map.getModel().setProjectMap(map); |
337 |
p.addMap(map); |
338 |
} else if (btnTablas.isSelected()) { |
339 |
try {
|
340 |
FOpenDialog fopen = new FOpenDialog(PluginServices.getText(this,"Nueva_tabla")); |
341 |
FileOpenDialog fod = new FileOpenDialog(new Class[] { |
342 |
FileDriver.class}, false, PluginServices.getText(this,"Tablas")); |
343 |
DataBaseOpenDialog dbod = new DataBaseOpenDialog();
|
344 |
dbod.setClasses(new Class[] { DBDriver.class }); |
345 |
fopen.addTab(PluginServices.getText(this,"Fichero"), fod); |
346 |
fopen.addTab(PluginServices.getText(this,"base_datos"), dbod); |
347 |
PluginServices.getMDIManager().addWindow(fopen); |
348 |
|
349 |
if (fopen.isAccepted()) {
|
350 |
JPanel panel = fopen.getSelectedTab();
|
351 |
ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
352 |
|
353 |
if (panel instanceof FileOpenDialog) { |
354 |
File[] files = fod.getFiles(); |
355 |
String[] driverNames = fod.getDriverNames(); |
356 |
|
357 |
for (int i = 0; i < files.length; i++) { |
358 |
String name = files[i].getName();
|
359 |
|
360 |
LayerFactory.getDataSourceFactory() |
361 |
.addFileDataSource(driverNames[i], |
362 |
name, files[i].getAbsolutePath()); |
363 |
|
364 |
DataSource dataSource = LayerFactory.getDataSourceFactory()
|
365 |
.createRandomDataSource(name, DataSourceFactory.AUTOMATIC_OPENING); |
366 |
SelectableDataSource sds = new SelectableDataSource(dataSource);
|
367 |
EditableAdapter auxea=new EditableAdapter();
|
368 |
auxea.setOriginalDataSource(sds); |
369 |
// TODO: fjp: ESTO HAY QUE REVISARLO.
|
370 |
// Por ahora, para obtener un driver que sirva para esta
|
371 |
// fuente de datos, compruebo que implementa IWriteable.
|
372 |
// IWriter writer = (IWriter) LayerFactory.getWM().getWriter(driverNames[i]);
|
373 |
Driver drv = LayerFactory.getDM().getDriver(driverNames[i]);
|
374 |
// if (drv instanceof IWriter)
|
375 |
// {
|
376 |
// auxea.setWriter((IWriter) drv);
|
377 |
// }
|
378 |
ProjectTable projectTable = ProjectFactory.createTable(name, |
379 |
auxea); |
380 |
ext.getProject().addTable(projectTable); |
381 |
Project.openTable(projectTable); |
382 |
} |
383 |
} else if (panel instanceof DataBaseOpenDialog) { |
384 |
String driverName = dbod.getDriverName();
|
385 |
int port = -1; |
386 |
|
387 |
try {
|
388 |
port = Integer.parseInt(dbod.getPort());
|
389 |
} catch (NumberFormatException e) { |
390 |
} |
391 |
|
392 |
String name = dbod.getHost() + "/" + |
393 |
dbod.getDataBase(); |
394 |
|
395 |
if (port != -1) { |
396 |
name = dbod.getHost() + ":" + port + "/" + |
397 |
dbod.getDataBase(); |
398 |
} |
399 |
|
400 |
String user = dbod.getUser().trim();
|
401 |
String password = dbod.getPassword();
|
402 |
|
403 |
if (user.equals("")) { |
404 |
user = null;
|
405 |
password = null;
|
406 |
} |
407 |
|
408 |
LayerFactory.getDataSourceFactory().addDBDataSourceByTable(name, |
409 |
dbod.getHost(), port, user, password, |
410 |
dbod.getDataBase(), dbod.getTable(), driverName); |
411 |
|
412 |
DataSource dataSource = LayerFactory.getDataSourceFactory()
|
413 |
.createRandomDataSource(name, DataSourceFactory.AUTOMATIC_OPENING); |
414 |
SelectableDataSource sds = new SelectableDataSource(dataSource);
|
415 |
EditableAdapter auxea=new EditableAdapter();
|
416 |
// TODO: fjp: ESTO HAY QUE REVISARLO.
|
417 |
// Por ahora, para obtener un driver que sirva para esta
|
418 |
// fuente de datos, compruebo que implementa IWriteable.
|
419 |
// IWriter writer = (IWriter) LayerFactory.getWM().getWriter(driverNames[i]);
|
420 |
Driver drv = LayerFactory.getDM().getDriver(driverName);
|
421 |
// if (drv instanceof IWriter)
|
422 |
// {
|
423 |
// auxea.setWriter((IWriter) drv);
|
424 |
// }
|
425 |
|
426 |
auxea.setOriginalDataSource(sds); |
427 |
ProjectTable projectTable = ProjectFactory.createTable(name, |
428 |
auxea); |
429 |
ext.getProject().addTable(projectTable); |
430 |
|
431 |
Table t = new Table();
|
432 |
t.setModel(projectTable); |
433 |
projectTable.setAndamiWindow(t); |
434 |
PluginServices.getMDIManager().addWindow(t); |
435 |
} |
436 |
} |
437 |
} catch (DriverLoadException e) {
|
438 |
NotificationManager.addError("Error al cargar los drivers", e);
|
439 |
} |
440 |
} else {
|
441 |
String viewName = ""; |
442 |
String aux = PluginServices.getText(this, "untitled"); |
443 |
viewName = aux + " - " + ProjectView.numViews++;
|
444 |
// Buscamos si alguna vista ya ten?a este nombre:
|
445 |
while (existViewName(viewName))
|
446 |
{ |
447 |
viewName = aux + " - " + ProjectView.numViews++;
|
448 |
} |
449 |
ProjectView vista = ProjectFactory.createView(viewName); |
450 |
p.addView(vista); |
451 |
} |
452 |
} |
453 |
|
454 |
private boolean existViewName(String viewName) { |
455 |
ArrayList viewList = p.getViews();
|
456 |
for (int i=0; i < viewList.size(); i++) |
457 |
{ |
458 |
ProjectView pv = (ProjectView) viewList.get(i); |
459 |
String title = pv.getName();
|
460 |
if (title.compareTo(viewName) == 0) |
461 |
{ |
462 |
return true; |
463 |
} |
464 |
} |
465 |
|
466 |
return false; |
467 |
} |
468 |
|
469 |
/**
|
470 |
* Abre la ventana de un nuevo project element
|
471 |
*/
|
472 |
private void abrir() { |
473 |
int[] indexes = lstDocs.getSelectedIndices(); |
474 |
for (int i=indexes.length-1;i>=0;i--) { |
475 |
int index=indexes[i];
|
476 |
if (btnMapas.isSelected()) {
|
477 |
if (index == -1) { |
478 |
return;
|
479 |
} |
480 |
ProjectMap projectMap = (ProjectMap) p.getMaps().get(index); |
481 |
Layout l = projectMap.getModel(); |
482 |
// System.out.println("l.getName " + l.getName() + " projectMap.getName " + projectMap.getName());
|
483 |
projectMap.setName(l.getName()); |
484 |
l.setProjectMap(projectMap); |
485 |
l.fullRect(); |
486 |
l.getWindowInfo().setTitle(PluginServices.getText(this,
|
487 |
"Mapa") + " : " +l.getName()); |
488 |
PluginServices.getMDIManager().addWindow(l); |
489 |
} else if (btnTablas.isSelected()) { |
490 |
if (index == -1) { |
491 |
return;
|
492 |
} |
493 |
ProjectTable pt=(ProjectTable) p.getTables().get(index); |
494 |
Project.openTable(pt); |
495 |
} else {
|
496 |
com.iver.cit.gvsig.gui.View vista = new com.iver.cit.gvsig.gui.View();
|
497 |
if (index == -1) { |
498 |
return;
|
499 |
} |
500 |
|
501 |
vista.setModel((ProjectView) p.getViews().get(index)); |
502 |
PluginServices.getMDIManager().addWindow(vista); |
503 |
} |
504 |
} |
505 |
} |
506 |
|
507 |
/**
|
508 |
* Cambia el nombre de un project element
|
509 |
*/
|
510 |
private void renombrar() { |
511 |
ProjectElement elem = null;
|
512 |
int index = lstDocs.getSelectedIndex();
|
513 |
|
514 |
if (index == -1) { |
515 |
return;
|
516 |
} |
517 |
|
518 |
if (btnMapas.isSelected()) {
|
519 |
elem = (ProjectElement) p.getMaps().get(index); |
520 |
} else if (btnTablas.isSelected()) { |
521 |
elem = (ProjectElement) p.getTables().get(index); |
522 |
} else {
|
523 |
elem = (ProjectElement) p.getViews().get(index); |
524 |
} |
525 |
|
526 |
if (elem.isLocked()) {
|
527 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_renamed")); |
528 |
return;
|
529 |
} |
530 |
|
531 |
JOptionPane pane = new JOptionPane(); |
532 |
pane.setMessage(PluginServices.getText(this, "introduce_nombre")); |
533 |
pane.setMessageType(JOptionPane.QUESTION_MESSAGE);
|
534 |
pane.setWantsInput(true);
|
535 |
pane.setInitialSelectionValue(elem.getName()); |
536 |
pane.setInputValue(elem.getName()); |
537 |
JDialog dlg = pane.createDialog((Component) PluginServices.getMainFrame(), |
538 |
PluginServices.getText(this, "renombrar")); |
539 |
dlg.setModal(true);
|
540 |
dlg.show(); |
541 |
|
542 |
String nuevoNombre = pane.getInputValue().toString().trim();
|
543 |
|
544 |
if (nuevoNombre.length() == 0) { |
545 |
return;
|
546 |
} |
547 |
|
548 |
if (nuevoNombre == null) { |
549 |
return;
|
550 |
} |
551 |
|
552 |
for (int i=0; i<lstDocs.getModel().getSize(); i++){ |
553 |
if (i==index) continue; |
554 |
if (((ProjectElement)lstDocs.getModel().getElementAt(i)).getName().equals(nuevoNombre)){
|
555 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "elemento_ya_existe")); |
556 |
return;
|
557 |
} |
558 |
|
559 |
} |
560 |
elem.setName(nuevoNombre); |
561 |
|
562 |
refreshList(); |
563 |
} |
564 |
|
565 |
/**
|
566 |
* Borra un project element
|
567 |
*/
|
568 |
private void borrar() { |
569 |
int res = JOptionPane.showConfirmDialog((Component) PluginServices.getMainFrame(), |
570 |
PluginServices.getText(this, "confirmar_borrar"), |
571 |
PluginServices.getText(this, "borrar"), |
572 |
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); |
573 |
|
574 |
if (res == JOptionPane.YES_OPTION) { |
575 |
int[] indexes = lstDocs.getSelectedIndices(); |
576 |
for (int i=indexes.length-1;i>=0;i--) { |
577 |
int index=indexes[i];
|
578 |
if (btnMapas.isSelected()) {
|
579 |
if (((ProjectElement) p.getMaps().get(index)).isLocked()) {
|
580 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_deleted")); |
581 |
return;
|
582 |
} |
583 |
PluginServices.getMDIManager().closeSingletonWindow(p.getMaps() |
584 |
.get(index)); |
585 |
p.delMap(index); |
586 |
} else if (btnTablas.isSelected()) { |
587 |
if (((ProjectElement) p.getTables().get(index)).isLocked()) {
|
588 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_deleted")); |
589 |
return;
|
590 |
} |
591 |
PluginServices.getMDIManager().closeSingletonWindow(p.getTables() |
592 |
.get(index)); |
593 |
p.delTable(index); |
594 |
} else {
|
595 |
if (((ProjectElement) p.getViews().get(index)).isLocked()) {
|
596 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_deleted")); |
597 |
return;
|
598 |
} |
599 |
PluginServices.getMDIManager().closeSingletonWindow(p.getViews() |
600 |
.get(index)); |
601 |
p.delView(index); |
602 |
} |
603 |
} |
604 |
refreshList(); |
605 |
} |
606 |
} |
607 |
|
608 |
/**
|
609 |
* Muestra el di?logo de propiedades de un project element
|
610 |
*/
|
611 |
private void propiedades() { |
612 |
int index = lstDocs.getSelectedIndex();
|
613 |
|
614 |
if (index == -1) { |
615 |
return;
|
616 |
} |
617 |
|
618 |
IWindow dlg = null;
|
619 |
|
620 |
if (btnMapas.isSelected()) {
|
621 |
if (((ProjectElement) p.getMaps().get(index)).isLocked()) {
|
622 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element")); |
623 |
return;
|
624 |
} |
625 |
dlg = new MapProperties((ProjectMap) p.getMaps().get(index));
|
626 |
} else if (btnTablas.isSelected()) { |
627 |
if (((ProjectElement) p.getTables().get(index)).isLocked()) {
|
628 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element")); |
629 |
return;
|
630 |
} |
631 |
try {
|
632 |
dlg = new TableProperties((ProjectTable) p.getTables().get(index));
|
633 |
} catch (DriverException e) {
|
634 |
NotificationManager.addError(e.getMessage(), e); |
635 |
} |
636 |
} else {
|
637 |
if (((ProjectElement) p.getViews().get(index)).isLocked()) {
|
638 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element")); |
639 |
return;
|
640 |
} |
641 |
|
642 |
dlg = new ViewProperties((ProjectView) p.getViews().get(index));
|
643 |
} |
644 |
|
645 |
PluginServices.getMDIManager().addWindow(dlg); |
646 |
|
647 |
refreshControls(); |
648 |
lstDocs.setSelectedIndex(index); |
649 |
} |
650 |
|
651 |
/**
|
652 |
* This method initializes jPanel
|
653 |
*
|
654 |
* @return JPanel
|
655 |
*/
|
656 |
private JPanel getJPanel() { |
657 |
if (jPanel == null) { |
658 |
jPanel = new JPanel(); |
659 |
|
660 |
java.awt.FlowLayout layFlowLayout1 = new java.awt.FlowLayout();
|
661 |
layFlowLayout1.setHgap(15);
|
662 |
jPanel.setLayout(layFlowLayout1); |
663 |
jPanel.add(getBtnVistas(), null);
|
664 |
jPanel.add(getBtnTablas(), null);
|
665 |
jPanel.add(getBtnMapas(), null);
|
666 |
jPanel.setName("tipoDocPanel");
|
667 |
jPanel.setPreferredSize(new java.awt.Dimension(430, 125)); |
668 |
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
669 |
null, PluginServices.getText(this, "tipos_de_documentos"), |
670 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
671 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
672 |
} |
673 |
|
674 |
return jPanel;
|
675 |
} |
676 |
|
677 |
/**
|
678 |
* This method initializes btnVistas
|
679 |
*
|
680 |
* @return JRadioButton
|
681 |
*/
|
682 |
private JRadioButton getBtnVistas() { |
683 |
if (btnVistas == null) { |
684 |
btnVistas = new JRadioButton(); |
685 |
btnVistas.setIcon(new ImageIcon( |
686 |
this.getClass().getClassLoader().getResource("images/Vista.png"))); |
687 |
btnVistas.setSelectedIcon(new ImageIcon( |
688 |
this.getClass().getClassLoader().getResource("images/Vista_sel.png"))); |
689 |
btnVistas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
690 |
btnVistas.setText(PluginServices.getText(this, "vistas")); |
691 |
btnVistas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
692 |
btnVistas.setName("vistasBtn");
|
693 |
btnVistas.addChangeListener(new javax.swing.event.ChangeListener() {
|
694 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
695 |
refreshList(); |
696 |
} |
697 |
}); |
698 |
} |
699 |
|
700 |
return btnVistas;
|
701 |
} |
702 |
|
703 |
/**
|
704 |
* This method initializes btnTablas
|
705 |
*
|
706 |
* @return JRadioButton
|
707 |
*/
|
708 |
private JRadioButton getBtnTablas() { |
709 |
if (btnTablas == null) { |
710 |
btnTablas = new JRadioButton(); |
711 |
btnTablas.setIcon(new ImageIcon( |
712 |
this.getClass().getClassLoader().getResource("images/tablas.png"))); |
713 |
btnTablas.setSelectedIcon(new ImageIcon( |
714 |
this.getClass().getClassLoader().getResource("images/tablas_sel.png"))); |
715 |
btnTablas.setText(PluginServices.getText(this, "tablas")); |
716 |
btnTablas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
717 |
btnTablas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
718 |
btnTablas.setName("tablasBtn");
|
719 |
btnTablas.addChangeListener(new javax.swing.event.ChangeListener() {
|
720 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
721 |
refreshList(); |
722 |
} |
723 |
}); |
724 |
} |
725 |
|
726 |
return btnTablas;
|
727 |
} |
728 |
|
729 |
/**
|
730 |
* This method initializes btnMapas
|
731 |
*
|
732 |
* @return JRadioButton
|
733 |
*/
|
734 |
private JRadioButton getBtnMapas() { |
735 |
if (btnMapas == null) { |
736 |
btnMapas = new JRadioButton(); |
737 |
btnMapas.setIcon(new ImageIcon( |
738 |
this.getClass().getClassLoader().getResource("images/mapas.png"))); |
739 |
btnMapas.setSelectedIcon(new ImageIcon( |
740 |
this.getClass().getClassLoader().getResource("images/mapas_sel.png"))); |
741 |
btnMapas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
742 |
btnMapas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
743 |
btnMapas.setText(PluginServices.getText(this, "mapas")); |
744 |
btnMapas.addChangeListener(new javax.swing.event.ChangeListener() {
|
745 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
746 |
refreshList(); |
747 |
} |
748 |
}); |
749 |
} |
750 |
|
751 |
return btnMapas;
|
752 |
} |
753 |
|
754 |
/**
|
755 |
* This method initializes jPanel1
|
756 |
*
|
757 |
* @return JPanel
|
758 |
*/
|
759 |
private JPanel getJPanel1() { |
760 |
if (jPanel1 == null) { |
761 |
jPanel1 = new JPanel(); |
762 |
|
763 |
GridBagLayout layout2 = new GridBagLayout(); |
764 |
GridBagConstraints c = new GridBagConstraints(); |
765 |
|
766 |
jPanel1.setLayout(layout2); |
767 |
c.insets = new Insets(2, 5, 2, 5); |
768 |
c.anchor = GridBagConstraints.WEST;
|
769 |
c.fill = GridBagConstraints.BOTH;
|
770 |
c.weightx= 1.0;
|
771 |
c.weighty = 1.0;
|
772 |
layout2.setConstraints(getJScrollPane(),c); |
773 |
jPanel1.add(getJScrollPane()); |
774 |
|
775 |
c.anchor = GridBagConstraints.EAST;
|
776 |
|
777 |
|
778 |
c.fill = GridBagConstraints.NONE;
|
779 |
c.weightx= 0;
|
780 |
c.weighty = 0;
|
781 |
layout2.setConstraints(getJPanel2(),c); |
782 |
jPanel1.add(getJPanel2()); |
783 |
|
784 |
//jPanel1.setPreferredSize(new java.awt.Dimension(430,170));
|
785 |
jPanel1.setMinimumSize(new java.awt.Dimension(430,170)); |
786 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
787 |
null,
|
788 |
PluginServices.getText(this, "documentos_existentes"), |
789 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
790 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
791 |
} |
792 |
|
793 |
return jPanel1;
|
794 |
} |
795 |
|
796 |
/**
|
797 |
* This method initializes lstDocs
|
798 |
*
|
799 |
* @return JList
|
800 |
*/
|
801 |
private JList getLstDocs() { |
802 |
if (lstDocs == null) { |
803 |
lstDocs = new JList(); |
804 |
lstDocs.addMouseListener(new java.awt.event.MouseAdapter() {
|
805 |
public ProjectElement[] getSelecteds() { |
806 |
if (lstDocs.getSelectedIndex() < 0) { |
807 |
return new ProjectElement[0]; |
808 |
} |
809 |
Object[] seleteds = lstDocs.getSelectedValues(); |
810 |
ProjectElement[] returnValue = new ProjectElement[seleteds.length]; |
811 |
System.arraycopy(seleteds,0,returnValue,0,seleteds.length); |
812 |
return returnValue;
|
813 |
} |
814 |
|
815 |
public ProjectElement getItem(java.awt.event.MouseEvent e) {
|
816 |
if (lstDocs.getSelectedIndex() < 0) { |
817 |
return null; |
818 |
} |
819 |
Component c = lstDocs.getComponentAt(e.getPoint());
|
820 |
|
821 |
return null; |
822 |
} |
823 |
|
824 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
825 |
if (e.getButton() == e.BUTTON3) {
|
826 |
String docType;
|
827 |
ProjectElement[] selecteds = this.getSelecteds(); |
828 |
|
829 |
if (selecteds == null) return; |
830 |
if (btnMapas.isSelected()) {
|
831 |
docType = "Map";
|
832 |
} else if (btnTablas.isSelected()) { |
833 |
docType = "Table";
|
834 |
} else {
|
835 |
docType = "View";
|
836 |
} |
837 |
DocumentPopupMenu menu = new DocumentPopupMenu(docType,this.getItem(e),(ProjectElement[])selecteds); |
838 |
if (menu.getActionsVisibles() < 1) return; |
839 |
lstDocs.add(menu); |
840 |
menu.show(e.getComponent(), e.getX(), e.getY()); |
841 |
return;
|
842 |
} |
843 |
if (e.getClickCount() == 2) { |
844 |
abrir(); |
845 |
} |
846 |
} |
847 |
}); |
848 |
lstDocs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
849 |
public void valueChanged( |
850 |
javax.swing.event.ListSelectionEvent e) { |
851 |
activarBotones(); |
852 |
} |
853 |
}); |
854 |
} |
855 |
|
856 |
return lstDocs;
|
857 |
} |
858 |
|
859 |
/**
|
860 |
* This method initializes jPanel2
|
861 |
*
|
862 |
* @return JPanel
|
863 |
*/
|
864 |
private JPanel getJPanel2() { |
865 |
if (jPanel2 == null) { |
866 |
jPanel2 = new JPanel(); |
867 |
|
868 |
//FlowLayout layout = new FlowLayout();
|
869 |
GridLayout layout = new GridLayout(5,1); |
870 |
layout.setVgap(7);
|
871 |
|
872 |
jPanel2.setLayout(layout); |
873 |
jPanel2.add(getBtnNuevo(), null);
|
874 |
jPanel2.add(getBtnAbrir(), null);
|
875 |
jPanel2.add(getBtnRenombrar(), null);
|
876 |
jPanel2.add(getBtnBorrar(), null);
|
877 |
jPanel2.add(getBtnPropiedades(), null);
|
878 |
jPanel2.setPreferredSize(new java.awt.Dimension(100, 150)); |
879 |
jPanel2.setMinimumSize(new java.awt.Dimension(100, 150)); |
880 |
jPanel2.setMaximumSize(new java.awt.Dimension(100, 150)); |
881 |
} |
882 |
|
883 |
return jPanel2;
|
884 |
} |
885 |
|
886 |
/**
|
887 |
* This method initializes btnNuevo
|
888 |
*
|
889 |
* @return JButton
|
890 |
*/
|
891 |
private JButton getBtnNuevo() { |
892 |
if (btnNuevo == null) { |
893 |
btnNuevo = new JButton(); |
894 |
btnNuevo.setName("btnNuevo");
|
895 |
btnNuevo.setText(PluginServices.getText(this, "nuevo")); |
896 |
btnNuevo.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
897 |
btnNuevo.addActionListener(new java.awt.event.ActionListener() {
|
898 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
899 |
try {
|
900 |
newProjectElement(); |
901 |
} catch (Exception e1) { |
902 |
NotificationManager.addError(e1.getLocalizedMessage(), |
903 |
e1); |
904 |
} |
905 |
} |
906 |
}); |
907 |
} |
908 |
|
909 |
return btnNuevo;
|
910 |
} |
911 |
|
912 |
/**
|
913 |
* This method initializes btnPropiedades
|
914 |
*
|
915 |
* @return JButton
|
916 |
*/
|
917 |
private JButton getBtnPropiedades() { |
918 |
if (btnPropiedades == null) { |
919 |
btnPropiedades = new JButton(); |
920 |
btnPropiedades.setText(PluginServices.getText(this, "propiedades")); |
921 |
btnPropiedades.setName("btnPropiedades");
|
922 |
btnPropiedades.setEnabled(false);
|
923 |
btnPropiedades.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
924 |
btnPropiedades.addActionListener(new java.awt.event.ActionListener() {
|
925 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
926 |
propiedades(); |
927 |
} |
928 |
}); |
929 |
} |
930 |
|
931 |
return btnPropiedades;
|
932 |
} |
933 |
|
934 |
/**
|
935 |
* This method initializes btnAbrir
|
936 |
*
|
937 |
* @return JButton
|
938 |
*/
|
939 |
private JButton getBtnAbrir() { |
940 |
if (btnAbrir == null) { |
941 |
btnAbrir = new JButton(); |
942 |
btnAbrir.setName("btnAbrir");
|
943 |
btnAbrir.setText(PluginServices.getText(this, "abrir")); |
944 |
btnAbrir.setEnabled(false);
|
945 |
btnAbrir.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
946 |
btnAbrir.addActionListener(new java.awt.event.ActionListener() {
|
947 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
948 |
abrir(); |
949 |
} |
950 |
}); |
951 |
} |
952 |
|
953 |
return btnAbrir;
|
954 |
} |
955 |
|
956 |
/**
|
957 |
* This method initializes btnBorrar
|
958 |
*
|
959 |
* @return JButton
|
960 |
*/
|
961 |
private JButton getBtnBorrar() { |
962 |
if (btnBorrar == null) { |
963 |
btnBorrar = new JButton(); |
964 |
btnBorrar.setText(PluginServices.getText(this, "borrar")); |
965 |
btnBorrar.setName("btnBorrar");
|
966 |
btnBorrar.setEnabled(false);
|
967 |
btnBorrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
968 |
btnBorrar.addActionListener(new java.awt.event.ActionListener() {
|
969 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
970 |
borrar(); |
971 |
} |
972 |
}); |
973 |
} |
974 |
|
975 |
return btnBorrar;
|
976 |
} |
977 |
|
978 |
/**
|
979 |
* This method initializes btnRenombrar
|
980 |
*
|
981 |
* @return JButton
|
982 |
*/
|
983 |
private JButton getBtnRenombrar() { |
984 |
if (btnRenombrar == null) { |
985 |
btnRenombrar = new JButton(); |
986 |
btnRenombrar.setName("btnRenombrar");
|
987 |
btnRenombrar.setText(PluginServices.getText(this, "renombrar")); |
988 |
btnRenombrar.setEnabled(false);
|
989 |
btnRenombrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
990 |
btnRenombrar.addActionListener(new java.awt.event.ActionListener() {
|
991 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
992 |
renombrar(); |
993 |
} |
994 |
}); |
995 |
} |
996 |
|
997 |
return btnRenombrar;
|
998 |
} |
999 |
|
1000 |
/**
|
1001 |
* This method initializes jPanel3
|
1002 |
*
|
1003 |
* @return JPanel
|
1004 |
*/
|
1005 |
private JPanel getJPanel3() { |
1006 |
if (jPanel3 == null) { |
1007 |
jPanel3 = new JPanel(); |
1008 |
|
1009 |
GridBagLayout layout3 = new GridBagLayout(); |
1010 |
GridBagConstraints c = new GridBagConstraints(); |
1011 |
jPanel3.setLayout(layout3); |
1012 |
c.insets = new Insets(2, 5, 0, 5); |
1013 |
c.anchor = GridBagConstraints.WEST;
|
1014 |
c.gridx =0;
|
1015 |
c.gridy =0;
|
1016 |
layout3.setConstraints(getJLabel(),c); |
1017 |
jPanel3.add(getJLabel(), null);
|
1018 |
c.fill = GridBagConstraints.HORIZONTAL;
|
1019 |
c.weightx=1.0;
|
1020 |
c.gridx =1;
|
1021 |
layout3.setConstraints(getLblNombreSesion(),c); |
1022 |
jPanel3.add(getLblNombreSesion(), null);
|
1023 |
|
1024 |
c.gridx =0;
|
1025 |
c.gridy =1;
|
1026 |
c.fill = GridBagConstraints.NONE;
|
1027 |
c.weightx=0.0;
|
1028 |
layout3.setConstraints(getJLabel1(),c); |
1029 |
jPanel3.add(getJLabel1(), null);
|
1030 |
c.fill = GridBagConstraints.HORIZONTAL;
|
1031 |
c.weightx=1.0;
|
1032 |
c.gridx =1;
|
1033 |
layout3.setConstraints(getLblGuardado(),c); |
1034 |
jPanel3.add(getLblGuardado(), null);
|
1035 |
|
1036 |
c.gridx =0;
|
1037 |
c.gridy =2;
|
1038 |
c.fill = GridBagConstraints.NONE;
|
1039 |
c.weightx=0.0;
|
1040 |
layout3.setConstraints(getJLabel2(),c); |
1041 |
jPanel3.add(getJLabel2(), null);
|
1042 |
|
1043 |
c.fill = GridBagConstraints.HORIZONTAL;
|
1044 |
c.weightx=1.0;
|
1045 |
c.gridx =1;
|
1046 |
layout3.setConstraints(getLblFecha(),c); |
1047 |
jPanel3.add(getLblFecha(), null);
|
1048 |
jPanel3.setPreferredSize(new java.awt.Dimension(430, 125)); |
1049 |
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder( |
1050 |
null, PluginServices.getText(this, "propiedades_sesion"), |
1051 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
1052 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
1053 |
c.gridx =1;
|
1054 |
c.gridy =4;
|
1055 |
c.anchor = GridBagConstraints.EAST;
|
1056 |
layout3.setConstraints(getJPanel4(),c); |
1057 |
jPanel3.add(getJPanel4(), null);
|
1058 |
} |
1059 |
|
1060 |
return jPanel3;
|
1061 |
} |
1062 |
|
1063 |
/**
|
1064 |
* This method initializes jLabel
|
1065 |
*
|
1066 |
* @return JLabel
|
1067 |
*/
|
1068 |
private JLabel getJLabel() { |
1069 |
if (jLabel == null) { |
1070 |
jLabel = new JLabel(); |
1071 |
jLabel.setText(PluginServices.getText(this, "nombre_sesion") + ":"); |
1072 |
jLabel.setPreferredSize(new java.awt.Dimension(150, 16)); |
1073 |
} |
1074 |
|
1075 |
return jLabel;
|
1076 |
} |
1077 |
|
1078 |
/**
|
1079 |
* This method initializes lblNombreSesion
|
1080 |
*
|
1081 |
* @return JLabel
|
1082 |
*/
|
1083 |
private JLabel getLblNombreSesion() { |
1084 |
if (lblNombreSesion == null) { |
1085 |
lblNombreSesion = new JLabel(); |
1086 |
lblNombreSesion.setText("");
|
1087 |
lblNombreSesion.setName("lblNombreSesion");
|
1088 |
lblNombreSesion.setPreferredSize(new java.awt.Dimension(200, 16)); |
1089 |
lblNombreSesion.setAutoscrolls(true);
|
1090 |
} |
1091 |
|
1092 |
return lblNombreSesion;
|
1093 |
} |
1094 |
|
1095 |
/**
|
1096 |
* This method initializes jLabel1
|
1097 |
*
|
1098 |
* @return JLabel
|
1099 |
*/
|
1100 |
private JLabel getJLabel1() { |
1101 |
if (jLabel1 == null) { |
1102 |
jLabel1 = new JLabel(); |
1103 |
jLabel1.setText(PluginServices.getText(this, "guardado") + ":"); |
1104 |
jLabel1.setPreferredSize(new java.awt.Dimension(150, 16)); |
1105 |
} |
1106 |
|
1107 |
return jLabel1;
|
1108 |
} |
1109 |
|
1110 |
/**
|
1111 |
* This method initializes lblGuardado
|
1112 |
*
|
1113 |
* @return JLabel
|
1114 |
*/
|
1115 |
private JLabel getLblGuardado() { |
1116 |
if (lblGuardado == null) { |
1117 |
lblGuardado = new JLabel(); |
1118 |
lblGuardado.setText("");
|
1119 |
lblGuardado.setPreferredSize(new java.awt.Dimension(200, 16)); |
1120 |
lblGuardado.setAutoscrolls(true);
|
1121 |
} |
1122 |
|
1123 |
return lblGuardado;
|
1124 |
} |
1125 |
|
1126 |
/**
|
1127 |
* This method initializes jLabel2
|
1128 |
*
|
1129 |
* @return JLabel
|
1130 |
*/
|
1131 |
private JLabel getJLabel2() { |
1132 |
if (jLabel2 == null) { |
1133 |
jLabel2 = new JLabel(); |
1134 |
jLabel2.setText(PluginServices.getText(this, "creation_date") + |
1135 |
":");
|
1136 |
jLabel2.setPreferredSize(new java.awt.Dimension(150, 16)); |
1137 |
} |
1138 |
|
1139 |
return jLabel2;
|
1140 |
} |
1141 |
|
1142 |
/**
|
1143 |
* This method initializes lblFecha
|
1144 |
*
|
1145 |
* @return JLabel
|
1146 |
*/
|
1147 |
private JLabel getLblFecha() { |
1148 |
if (lblFecha == null) { |
1149 |
lblFecha = new JLabel(); |
1150 |
lblFecha.setText("");
|
1151 |
lblFecha.setPreferredSize(new java.awt.Dimension(200, 16)); |
1152 |
lblFecha.setAutoscrolls(true);
|
1153 |
} |
1154 |
|
1155 |
return lblFecha;
|
1156 |
} |
1157 |
|
1158 |
/**
|
1159 |
* This method initializes btnImportar
|
1160 |
*
|
1161 |
* @return JButton
|
1162 |
*/
|
1163 |
private JButton getBtnImportar() { |
1164 |
if (btnImportar == null) { |
1165 |
btnImportar = new JButton(); |
1166 |
btnImportar.setPreferredSize(new java.awt.Dimension(80, 23)); |
1167 |
btnImportar.setText(PluginServices.getText(this, "importar")); |
1168 |
btnImportar.setName("btnImportar");
|
1169 |
btnImportar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
1170 |
// TODO implement import
|
1171 |
btnImportar.setVisible(false);
|
1172 |
} |
1173 |
|
1174 |
return btnImportar;
|
1175 |
} |
1176 |
|
1177 |
/**
|
1178 |
* This method initializes btnExportar
|
1179 |
*
|
1180 |
* @return JButton
|
1181 |
*/
|
1182 |
private JButton getBtnExportar() { |
1183 |
if (btnExportar == null) { |
1184 |
btnExportar = new JButton(); |
1185 |
btnExportar.setPreferredSize(new java.awt.Dimension(80, 23)); |
1186 |
btnExportar.setText(PluginServices.getText(this, "exportar")); |
1187 |
btnExportar.setName("btnExportar");
|
1188 |
btnExportar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
1189 |
// TODO implement export
|
1190 |
btnExportar.setVisible(false);
|
1191 |
} |
1192 |
|
1193 |
return btnExportar;
|
1194 |
} |
1195 |
|
1196 |
/**
|
1197 |
* This method initializes btnEditar
|
1198 |
*
|
1199 |
* @return JButton
|
1200 |
*/
|
1201 |
private JButton getBtnEditar() { |
1202 |
if (btnEditar == null) { |
1203 |
btnEditar = new JButton(); |
1204 |
btnEditar.setPreferredSize(new java.awt.Dimension(80, 23)); |
1205 |
btnEditar.setText(PluginServices.getText(this, "propiedades")); |
1206 |
|
1207 |
btnEditar.setName("btnEditar");
|
1208 |
btnEditar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
1209 |
|
1210 |
btnEditar.addActionListener(new java.awt.event.ActionListener() {
|
1211 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
1212 |
ProjectProperties dlg = new ProjectProperties(p);
|
1213 |
PluginServices.getMDIManager().addWindow(dlg); |
1214 |
refreshProperties(); |
1215 |
} |
1216 |
}); |
1217 |
} |
1218 |
|
1219 |
return btnEditar;
|
1220 |
} |
1221 |
|
1222 |
/**
|
1223 |
* This method initializes jScrollPane
|
1224 |
*
|
1225 |
* @return JScrollPane
|
1226 |
*/
|
1227 |
private JScrollPane getJScrollPane() { |
1228 |
if (jScrollPane == null) { |
1229 |
jScrollPane = new JScrollPane(); |
1230 |
jScrollPane.setViewportView(getLstDocs()); |
1231 |
jScrollPane.setPreferredSize(new java.awt.Dimension(200, 100)); |
1232 |
jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
1233 |
} |
1234 |
|
1235 |
return jScrollPane;
|
1236 |
} |
1237 |
|
1238 |
/**
|
1239 |
* @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel()
|
1240 |
*/
|
1241 |
public Object getWindowModel() { |
1242 |
return p;
|
1243 |
} |
1244 |
|
1245 |
/**
|
1246 |
* This method is used to get <strong>an initial</strong> ViewInfo object
|
1247 |
* for this Project Manager window. It is not intended to retrieve the
|
1248 |
* ViewInfo object in a later time.
|
1249 |
* <strong>Use PluginServices.getMDIManager().getViewInfo(view)
|
1250 |
* to retrieve the ViewInfo object at any time after the creation of the
|
1251 |
* object.
|
1252 |
*
|
1253 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
|
1254 |
*/
|
1255 |
public WindowInfo getWindowInfo() {
|
1256 |
//if (m_viewInfo==null) {
|
1257 |
m_viewInfo = new WindowInfo(WindowInfo.MAXIMIZABLE);
|
1258 |
//m_viewInfo = new ViewInfo(ViewInfo.MAXIMIZABLE+ViewInfo.RESIZABLE);
|
1259 |
m_viewInfo.setWidth(this.getWidth());
|
1260 |
m_viewInfo.setHeight(this.getHeight());
|
1261 |
m_viewInfo.setNormalWidth(this.getPreferredSize().width);
|
1262 |
m_viewInfo.setNormalHeight(this.getPreferredSize().height);
|
1263 |
|
1264 |
m_viewInfo.setTitle(PluginServices.getText(this, "titulo")); |
1265 |
//}
|
1266 |
return m_viewInfo;
|
1267 |
} |
1268 |
|
1269 |
/**
|
1270 |
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
|
1271 |
*/
|
1272 |
public void propertyChange(PropertyChangeEvent evt) { |
1273 |
refreshControls(); |
1274 |
} |
1275 |
|
1276 |
/**
|
1277 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
1278 |
*/
|
1279 |
public void viewActivated() { |
1280 |
} |
1281 |
|
1282 |
/**
|
1283 |
* This method initializes jPanel4
|
1284 |
*
|
1285 |
* @return JPanel
|
1286 |
*/
|
1287 |
private JPanel getJPanel4() { |
1288 |
if (jPanel4 == null) { |
1289 |
jPanel4 = new JPanel(); |
1290 |
|
1291 |
jPanel4.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
1292 |
jPanel4.setPreferredSize(new java.awt.Dimension(414, 30)); |
1293 |
jPanel4.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); |
1294 |
jPanel4.add(getBtnImportar(), null);
|
1295 |
jPanel4.add(getBtnExportar(), null);
|
1296 |
jPanel4.add(getBtnEditar(), null);
|
1297 |
} |
1298 |
|
1299 |
return jPanel4;
|
1300 |
} |
1301 |
} // @jve:decl-index=0:visual-constraint="10,10"
|