root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / project / ProjectWindow.java @ 6877
History | View | Annotate | Download (36.6 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.SingletonView; |
78 |
import com.iver.andami.ui.mdiManager.IWindow; |
79 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
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, SingletonView { |
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 ViewInfo 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 |
DateFormat df = DateFormat.getDateInstance(); |
332 |
|
333 |
if (btnMapas.isSelected()) {
|
334 |
ProjectMap map = ProjectFactory.createMap(PluginServices.getText( |
335 |
this, "untitled")); |
336 |
map.setModel(new Layout());
|
337 |
map.getModel().setProjectMap(map); |
338 |
p.addMap(map); |
339 |
} else if (btnTablas.isSelected()) { |
340 |
try {
|
341 |
FOpenDialog fopen = new FOpenDialog(PluginServices.getText(this,"Nueva_tabla")); |
342 |
FileOpenDialog fod = new FileOpenDialog(new Class[] { |
343 |
FileDriver.class}, false, PluginServices.getText(this,"Tablas")); |
344 |
DataBaseOpenDialog dbod = new DataBaseOpenDialog();
|
345 |
dbod.setClasses(new Class[] { DBDriver.class }); |
346 |
fopen.addTab("Fichero", fod);
|
347 |
fopen.addTab("Base de datos", dbod);
|
348 |
PluginServices.getMDIManager().addView(fopen); |
349 |
|
350 |
if (fopen.isAccepted()) {
|
351 |
JPanel panel = fopen.getSelectedTab();
|
352 |
ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
353 |
|
354 |
if (panel instanceof FileOpenDialog) { |
355 |
File[] files = fod.getFiles(); |
356 |
String[] driverNames = fod.getDriverNames(); |
357 |
|
358 |
for (int i = 0; i < files.length; i++) { |
359 |
String name = files[i].getName();
|
360 |
|
361 |
LayerFactory.getDataSourceFactory() |
362 |
.addFileDataSource(driverNames[i], |
363 |
name, files[i].getAbsolutePath()); |
364 |
|
365 |
DataSource dataSource = LayerFactory.getDataSourceFactory()
|
366 |
.createRandomDataSource(name, DataSourceFactory.AUTOMATIC_OPENING); |
367 |
SelectableDataSource sds = new SelectableDataSource(dataSource);
|
368 |
EditableAdapter auxea=new EditableAdapter();
|
369 |
auxea.setOriginalDataSource(sds); |
370 |
// TODO: fjp: ESTO HAY QUE REVISARLO.
|
371 |
// Por ahora, para obtener un driver que sirva para esta
|
372 |
// fuente de datos, compruebo que implementa IWriteable.
|
373 |
// IWriter writer = (IWriter) LayerFactory.getWM().getWriter(driverNames[i]);
|
374 |
Driver drv = LayerFactory.getDM().getDriver(driverNames[i]);
|
375 |
// if (drv instanceof IWriter)
|
376 |
// {
|
377 |
// auxea.setWriter((IWriter) drv);
|
378 |
// }
|
379 |
ProjectTable projectTable = ProjectFactory.createTable(name, |
380 |
auxea); |
381 |
ext.getProject().addTable(projectTable); |
382 |
|
383 |
Table t = new Table();
|
384 |
t.setModel(projectTable); |
385 |
projectTable.setAndamiView(t); |
386 |
PluginServices.getMDIManager().addView(t); |
387 |
} |
388 |
} else if (panel instanceof DataBaseOpenDialog) { |
389 |
String driverName = dbod.getDriverName();
|
390 |
int port = -1; |
391 |
|
392 |
try {
|
393 |
port = Integer.parseInt(dbod.getPort());
|
394 |
} catch (NumberFormatException e) { |
395 |
} |
396 |
|
397 |
String name = dbod.getHost() + "/" + |
398 |
dbod.getDataBase(); |
399 |
|
400 |
if (port != -1) { |
401 |
name = dbod.getHost() + ":" + port + "/" + |
402 |
dbod.getDataBase(); |
403 |
} |
404 |
|
405 |
String user = dbod.getUser().trim();
|
406 |
String password = dbod.getPassword();
|
407 |
|
408 |
if (user.equals("")) { |
409 |
user = null;
|
410 |
password = null;
|
411 |
} |
412 |
|
413 |
LayerFactory.getDataSourceFactory().addDBDataSourceByTable(name, |
414 |
dbod.getHost(), port, user, password, |
415 |
dbod.getDataBase(), dbod.getTable(), driverName); |
416 |
|
417 |
DataSource dataSource = LayerFactory.getDataSourceFactory()
|
418 |
.createRandomDataSource(name, DataSourceFactory.AUTOMATIC_OPENING); |
419 |
SelectableDataSource sds = new SelectableDataSource(dataSource);
|
420 |
EditableAdapter auxea=new EditableAdapter();
|
421 |
// TODO: fjp: ESTO HAY QUE REVISARLO.
|
422 |
// Por ahora, para obtener un driver que sirva para esta
|
423 |
// fuente de datos, compruebo que implementa IWriteable.
|
424 |
// IWriter writer = (IWriter) LayerFactory.getWM().getWriter(driverNames[i]);
|
425 |
Driver drv = LayerFactory.getDM().getDriver(driverName);
|
426 |
// if (drv instanceof IWriter)
|
427 |
// {
|
428 |
// auxea.setWriter((IWriter) drv);
|
429 |
// }
|
430 |
|
431 |
auxea.setOriginalDataSource(sds); |
432 |
ProjectTable projectTable = ProjectFactory.createTable(name, |
433 |
auxea); |
434 |
ext.getProject().addTable(projectTable); |
435 |
|
436 |
Table t = new Table();
|
437 |
t.setModel(projectTable); |
438 |
projectTable.setAndamiView(t); |
439 |
PluginServices.getMDIManager().addView(t); |
440 |
} |
441 |
} |
442 |
} catch (DriverLoadException e) {
|
443 |
NotificationManager.addError("Error al cargar los drivers", e);
|
444 |
} |
445 |
} else {
|
446 |
String viewName = ""; |
447 |
String aux = PluginServices.getText(this, "untitled"); |
448 |
viewName = aux + " - " + ProjectView.numViews++;
|
449 |
// Buscamos si alguna vista ya ten?a este nombre:
|
450 |
while (existViewName(viewName))
|
451 |
{ |
452 |
viewName = aux + " - " + ProjectView.numViews++;
|
453 |
} |
454 |
ProjectView vista = ProjectFactory.createView(viewName); |
455 |
p.addView(vista); |
456 |
} |
457 |
} |
458 |
|
459 |
private boolean existViewName(String viewName) { |
460 |
ArrayList viewList = p.getViews();
|
461 |
for (int i=0; i < viewList.size(); i++) |
462 |
{ |
463 |
ProjectView pv = (ProjectView) viewList.get(i); |
464 |
String title = pv.getName();
|
465 |
if (title.compareTo(viewName) == 0) |
466 |
{ |
467 |
return true; |
468 |
} |
469 |
} |
470 |
|
471 |
return false; |
472 |
} |
473 |
|
474 |
/**
|
475 |
* Abre la ventana de un nuevo project element
|
476 |
*/
|
477 |
private void abrir() { |
478 |
int[] indexes = lstDocs.getSelectedIndices(); |
479 |
for (int i=indexes.length-1;i>=0;i--) { |
480 |
int index=indexes[i];
|
481 |
if (btnMapas.isSelected()) {
|
482 |
if (index == -1) { |
483 |
return;
|
484 |
} |
485 |
ProjectMap projectMap = (ProjectMap) p.getMaps().get(index); |
486 |
Layout l = projectMap.getModel(); |
487 |
// System.out.println("l.getName " + l.getName() + " projectMap.getName " + projectMap.getName());
|
488 |
projectMap.setName(l.getName()); |
489 |
l.setProjectMap(projectMap); |
490 |
l.fullRect(); |
491 |
l.getViewInfo().setTitle(PluginServices.getText(this,
|
492 |
"Mapa") + " : " +l.getName()); |
493 |
PluginServices.getMDIManager().addView(l); |
494 |
} else if (btnTablas.isSelected()) { |
495 |
com.iver.cit.gvsig.gui.Table vista = new com.iver.cit.gvsig.gui.Table();
|
496 |
if (index == -1) { |
497 |
return;
|
498 |
} |
499 |
ProjectTable pt=(ProjectTable) p.getTables().get(index); |
500 |
vista.setModel(pt); |
501 |
PluginServices.getMDIManager().addView(vista); |
502 |
} else {
|
503 |
com.iver.cit.gvsig.gui.View vista = new com.iver.cit.gvsig.gui.View();
|
504 |
if (index == -1) { |
505 |
return;
|
506 |
} |
507 |
|
508 |
vista.setModel((ProjectView) p.getViews().get(index)); |
509 |
PluginServices.getMDIManager().addView(vista); |
510 |
} |
511 |
} |
512 |
} |
513 |
|
514 |
/**
|
515 |
* Cambia el nombre de un project element
|
516 |
*/
|
517 |
private void renombrar() { |
518 |
ProjectElement elem = null;
|
519 |
int index = lstDocs.getSelectedIndex();
|
520 |
|
521 |
if (index == -1) { |
522 |
return;
|
523 |
} |
524 |
|
525 |
if (btnMapas.isSelected()) {
|
526 |
elem = (ProjectElement) p.getMaps().get(index); |
527 |
} else if (btnTablas.isSelected()) { |
528 |
elem = (ProjectElement) p.getTables().get(index); |
529 |
} else {
|
530 |
elem = (ProjectElement) p.getViews().get(index); |
531 |
} |
532 |
|
533 |
if (elem.isLocked()) {
|
534 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_renamed")); |
535 |
return;
|
536 |
} |
537 |
|
538 |
JOptionPane pane = new JOptionPane(); |
539 |
pane.setMessage(PluginServices.getText(this, "introduce_nombre")); |
540 |
pane.setMessageType(JOptionPane.QUESTION_MESSAGE);
|
541 |
pane.setWantsInput(true);
|
542 |
pane.setInitialSelectionValue(elem.getName()); |
543 |
pane.setInputValue(elem.getName()); |
544 |
JDialog dlg = pane.createDialog((Component) PluginServices.getMainFrame(), |
545 |
PluginServices.getText(this, "renombrar")); |
546 |
dlg.setModal(true);
|
547 |
dlg.show(); |
548 |
|
549 |
String nuevoNombre = pane.getInputValue().toString().trim();
|
550 |
|
551 |
if (nuevoNombre.length() == 0) { |
552 |
return;
|
553 |
} |
554 |
|
555 |
if (nuevoNombre == null) { |
556 |
return;
|
557 |
} |
558 |
|
559 |
for (int i=0; i<lstDocs.getModel().getSize(); i++){ |
560 |
if (i==index) continue; |
561 |
if (((ProjectElement)lstDocs.getModel().getElementAt(i)).getName().equals(nuevoNombre)){
|
562 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "elemento_ya_existe")); |
563 |
return;
|
564 |
} |
565 |
|
566 |
} |
567 |
elem.setName(nuevoNombre); |
568 |
|
569 |
refreshList(); |
570 |
} |
571 |
|
572 |
/**
|
573 |
* Borra un project element
|
574 |
*/
|
575 |
private void borrar() { |
576 |
int res = JOptionPane.showConfirmDialog((Component) PluginServices.getMainFrame(), |
577 |
PluginServices.getText(this, "confirmar_borrar"), |
578 |
PluginServices.getText(this, "borrar"), |
579 |
JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); |
580 |
|
581 |
if (res == JOptionPane.YES_OPTION) { |
582 |
int[] indexes = lstDocs.getSelectedIndices(); |
583 |
for (int i=indexes.length-1;i>=0;i--) { |
584 |
int index=indexes[i];
|
585 |
if (btnMapas.isSelected()) {
|
586 |
if (((ProjectElement) p.getMaps().get(index)).isLocked()) {
|
587 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_deleted")); |
588 |
return;
|
589 |
} |
590 |
PluginServices.getMDIManager().closeSingletonView(p.getMaps() |
591 |
.get(index)); |
592 |
p.delMap(index); |
593 |
} else if (btnTablas.isSelected()) { |
594 |
if (((ProjectElement) p.getTables().get(index)).isLocked()) {
|
595 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_deleted")); |
596 |
return;
|
597 |
} |
598 |
PluginServices.getMDIManager().closeSingletonView(p.getTables() |
599 |
.get(index)); |
600 |
p.delTable(index); |
601 |
} else {
|
602 |
if (((ProjectElement) p.getViews().get(index)).isLocked()) {
|
603 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element_it_cannot_be_deleted")); |
604 |
return;
|
605 |
} |
606 |
PluginServices.getMDIManager().closeSingletonView(p.getViews() |
607 |
.get(index)); |
608 |
p.delView(index); |
609 |
} |
610 |
} |
611 |
refreshList(); |
612 |
} |
613 |
} |
614 |
|
615 |
/**
|
616 |
* Muestra el di?logo de propiedades de un project element
|
617 |
*/
|
618 |
private void propiedades() { |
619 |
int index = lstDocs.getSelectedIndex();
|
620 |
|
621 |
if (index == -1) { |
622 |
return;
|
623 |
} |
624 |
|
625 |
IWindow dlg = null;
|
626 |
|
627 |
if (btnMapas.isSelected()) {
|
628 |
if (((ProjectElement) p.getMaps().get(index)).isLocked()) {
|
629 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element")); |
630 |
return;
|
631 |
} |
632 |
dlg = new MapProperties((ProjectMap) p.getMaps().get(index));
|
633 |
} else if (btnTablas.isSelected()) { |
634 |
if (((ProjectElement) p.getTables().get(index)).isLocked()) {
|
635 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element")); |
636 |
return;
|
637 |
} |
638 |
try {
|
639 |
dlg = new TableProperties((ProjectTable) p.getTables().get(index));
|
640 |
} catch (DriverException e) {
|
641 |
NotificationManager.addError(e.getMessage(), e); |
642 |
} |
643 |
} else {
|
644 |
if (((ProjectElement) p.getViews().get(index)).isLocked()) {
|
645 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "locked_element")); |
646 |
return;
|
647 |
} |
648 |
|
649 |
dlg = new ViewProperties((ProjectView) p.getViews().get(index));
|
650 |
} |
651 |
|
652 |
PluginServices.getMDIManager().addView(dlg); |
653 |
|
654 |
refreshControls(); |
655 |
lstDocs.setSelectedIndex(index); |
656 |
} |
657 |
|
658 |
/**
|
659 |
* This method initializes jPanel
|
660 |
*
|
661 |
* @return JPanel
|
662 |
*/
|
663 |
private JPanel getJPanel() { |
664 |
if (jPanel == null) { |
665 |
jPanel = new JPanel(); |
666 |
|
667 |
java.awt.FlowLayout layFlowLayout1 = new java.awt.FlowLayout();
|
668 |
layFlowLayout1.setHgap(15);
|
669 |
jPanel.setLayout(layFlowLayout1); |
670 |
jPanel.add(getBtnVistas(), null);
|
671 |
jPanel.add(getBtnTablas(), null);
|
672 |
jPanel.add(getBtnMapas(), null);
|
673 |
jPanel.setName("tipoDocPanel");
|
674 |
jPanel.setPreferredSize(new java.awt.Dimension(430, 125)); |
675 |
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
676 |
null, PluginServices.getText(this, "tipos_de_documentos"), |
677 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
678 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
679 |
} |
680 |
|
681 |
return jPanel;
|
682 |
} |
683 |
|
684 |
/**
|
685 |
* This method initializes btnVistas
|
686 |
*
|
687 |
* @return JRadioButton
|
688 |
*/
|
689 |
private JRadioButton getBtnVistas() { |
690 |
if (btnVistas == null) { |
691 |
btnVistas = new JRadioButton(); |
692 |
btnVistas.setIcon(new ImageIcon( |
693 |
this.getClass().getClassLoader().getResource("images/Vista.png"))); |
694 |
btnVistas.setSelectedIcon(new ImageIcon( |
695 |
this.getClass().getClassLoader().getResource("images/Vista_sel.png"))); |
696 |
btnVistas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
697 |
btnVistas.setText(PluginServices.getText(this, "vistas")); |
698 |
btnVistas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
699 |
btnVistas.setName("vistasBtn");
|
700 |
btnVistas.addChangeListener(new javax.swing.event.ChangeListener() {
|
701 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
702 |
refreshList(); |
703 |
} |
704 |
}); |
705 |
} |
706 |
|
707 |
return btnVistas;
|
708 |
} |
709 |
|
710 |
/**
|
711 |
* This method initializes btnTablas
|
712 |
*
|
713 |
* @return JRadioButton
|
714 |
*/
|
715 |
private JRadioButton getBtnTablas() { |
716 |
if (btnTablas == null) { |
717 |
btnTablas = new JRadioButton(); |
718 |
btnTablas.setIcon(new ImageIcon( |
719 |
this.getClass().getClassLoader().getResource("images/tablas.png"))); |
720 |
btnTablas.setSelectedIcon(new ImageIcon( |
721 |
this.getClass().getClassLoader().getResource("images/tablas_sel.png"))); |
722 |
btnTablas.setText(PluginServices.getText(this, "tablas")); |
723 |
btnTablas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
724 |
btnTablas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
725 |
btnTablas.setName("tablasBtn");
|
726 |
btnTablas.addChangeListener(new javax.swing.event.ChangeListener() {
|
727 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
728 |
refreshList(); |
729 |
} |
730 |
}); |
731 |
} |
732 |
|
733 |
return btnTablas;
|
734 |
} |
735 |
|
736 |
/**
|
737 |
* This method initializes btnMapas
|
738 |
*
|
739 |
* @return JRadioButton
|
740 |
*/
|
741 |
private JRadioButton getBtnMapas() { |
742 |
if (btnMapas == null) { |
743 |
btnMapas = new JRadioButton(); |
744 |
btnMapas.setIcon(new ImageIcon( |
745 |
this.getClass().getClassLoader().getResource("images/mapas.png"))); |
746 |
btnMapas.setSelectedIcon(new ImageIcon( |
747 |
this.getClass().getClassLoader().getResource("images/mapas_sel.png"))); |
748 |
btnMapas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
749 |
btnMapas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
750 |
btnMapas.setText(PluginServices.getText(this, "mapas")); |
751 |
btnMapas.addChangeListener(new javax.swing.event.ChangeListener() {
|
752 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
753 |
refreshList(); |
754 |
} |
755 |
}); |
756 |
} |
757 |
|
758 |
return btnMapas;
|
759 |
} |
760 |
|
761 |
/**
|
762 |
* This method initializes jPanel1
|
763 |
*
|
764 |
* @return JPanel
|
765 |
*/
|
766 |
private JPanel getJPanel1() { |
767 |
if (jPanel1 == null) { |
768 |
jPanel1 = new JPanel(); |
769 |
|
770 |
GridBagLayout layout2 = new GridBagLayout(); |
771 |
GridBagConstraints c = new GridBagConstraints(); |
772 |
|
773 |
jPanel1.setLayout(layout2); |
774 |
c.insets = new Insets(2, 5, 2, 5); |
775 |
c.anchor = GridBagConstraints.WEST;
|
776 |
c.fill = GridBagConstraints.BOTH;
|
777 |
c.weightx= 1.0;
|
778 |
c.weighty = 1.0;
|
779 |
layout2.setConstraints(getJScrollPane(),c); |
780 |
jPanel1.add(getJScrollPane()); |
781 |
|
782 |
c.anchor = GridBagConstraints.EAST;
|
783 |
|
784 |
|
785 |
c.fill = GridBagConstraints.NONE;
|
786 |
c.weightx= 0;
|
787 |
c.weighty = 0;
|
788 |
layout2.setConstraints(getJPanel2(),c); |
789 |
jPanel1.add(getJPanel2()); |
790 |
|
791 |
//jPanel1.setPreferredSize(new java.awt.Dimension(430,170));
|
792 |
jPanel1.setMinimumSize(new java.awt.Dimension(430,170)); |
793 |
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder( |
794 |
null,
|
795 |
PluginServices.getText(this, "documentos_existentes"), |
796 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
797 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
798 |
} |
799 |
|
800 |
return jPanel1;
|
801 |
} |
802 |
|
803 |
/**
|
804 |
* This method initializes lstDocs
|
805 |
*
|
806 |
* @return JList
|
807 |
*/
|
808 |
private JList getLstDocs() { |
809 |
if (lstDocs == null) { |
810 |
lstDocs = new JList(); |
811 |
lstDocs.addMouseListener(new java.awt.event.MouseAdapter() {
|
812 |
public ProjectElement[] getSelecteds() { |
813 |
if (lstDocs.getSelectedIndex() < 0) { |
814 |
return new ProjectElement[0]; |
815 |
} |
816 |
Object[] seleteds = lstDocs.getSelectedValues(); |
817 |
ProjectElement[] returnValue = new ProjectElement[seleteds.length]; |
818 |
System.arraycopy(seleteds,0,returnValue,0,seleteds.length); |
819 |
return returnValue;
|
820 |
} |
821 |
|
822 |
public ProjectElement getItem(java.awt.event.MouseEvent e) {
|
823 |
if (lstDocs.getSelectedIndex() < 0) { |
824 |
return null; |
825 |
} |
826 |
Component c = lstDocs.getComponentAt(e.getPoint());
|
827 |
|
828 |
return null; |
829 |
} |
830 |
|
831 |
public void mouseClicked(java.awt.event.MouseEvent e) { |
832 |
if (e.getButton() == e.BUTTON3) {
|
833 |
String docType;
|
834 |
ProjectElement[] selecteds = this.getSelecteds(); |
835 |
|
836 |
if (selecteds == null) return; |
837 |
if (btnMapas.isSelected()) {
|
838 |
docType = "Map";
|
839 |
} else if (btnTablas.isSelected()) { |
840 |
docType = "Table";
|
841 |
} else {
|
842 |
docType = "View";
|
843 |
} |
844 |
DocumentPopupMenu menu = new DocumentPopupMenu(docType,this.getItem(e),(ProjectElement[])selecteds); |
845 |
if (menu.getActionsVisibles() < 1) return; |
846 |
lstDocs.add(menu); |
847 |
menu.show(e.getComponent(), e.getX(), e.getY()); |
848 |
return;
|
849 |
} |
850 |
if (e.getClickCount() == 2) { |
851 |
abrir(); |
852 |
} |
853 |
} |
854 |
}); |
855 |
lstDocs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
856 |
public void valueChanged( |
857 |
javax.swing.event.ListSelectionEvent e) { |
858 |
activarBotones(); |
859 |
} |
860 |
}); |
861 |
} |
862 |
|
863 |
return lstDocs;
|
864 |
} |
865 |
|
866 |
/**
|
867 |
* This method initializes jPanel2
|
868 |
*
|
869 |
* @return JPanel
|
870 |
*/
|
871 |
private JPanel getJPanel2() { |
872 |
if (jPanel2 == null) { |
873 |
jPanel2 = new JPanel(); |
874 |
|
875 |
//FlowLayout layout = new FlowLayout();
|
876 |
GridLayout layout = new GridLayout(5,1); |
877 |
layout.setVgap(7);
|
878 |
|
879 |
jPanel2.setLayout(layout); |
880 |
jPanel2.add(getBtnNuevo(), null);
|
881 |
jPanel2.add(getBtnAbrir(), null);
|
882 |
jPanel2.add(getBtnRenombrar(), null);
|
883 |
jPanel2.add(getBtnBorrar(), null);
|
884 |
jPanel2.add(getBtnPropiedades(), null);
|
885 |
jPanel2.setPreferredSize(new java.awt.Dimension(100, 150)); |
886 |
jPanel2.setMinimumSize(new java.awt.Dimension(100, 150)); |
887 |
jPanel2.setMaximumSize(new java.awt.Dimension(100, 150)); |
888 |
} |
889 |
|
890 |
return jPanel2;
|
891 |
} |
892 |
|
893 |
/**
|
894 |
* This method initializes btnNuevo
|
895 |
*
|
896 |
* @return JButton
|
897 |
*/
|
898 |
private JButton getBtnNuevo() { |
899 |
if (btnNuevo == null) { |
900 |
btnNuevo = new JButton(); |
901 |
btnNuevo.setName("btnNuevo");
|
902 |
btnNuevo.setText(PluginServices.getText(this, "nuevo")); |
903 |
btnNuevo.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
904 |
btnNuevo.addActionListener(new java.awt.event.ActionListener() {
|
905 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
906 |
try {
|
907 |
newProjectElement(); |
908 |
} catch (Exception e1) { |
909 |
NotificationManager.addError(e1.getLocalizedMessage(), |
910 |
e1); |
911 |
} |
912 |
} |
913 |
}); |
914 |
} |
915 |
|
916 |
return btnNuevo;
|
917 |
} |
918 |
|
919 |
/**
|
920 |
* This method initializes btnPropiedades
|
921 |
*
|
922 |
* @return JButton
|
923 |
*/
|
924 |
private JButton getBtnPropiedades() { |
925 |
if (btnPropiedades == null) { |
926 |
btnPropiedades = new JButton(); |
927 |
btnPropiedades.setText(PluginServices.getText(this, "propiedades")); |
928 |
btnPropiedades.setName("btnPropiedades");
|
929 |
btnPropiedades.setEnabled(false);
|
930 |
btnPropiedades.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
931 |
btnPropiedades.addActionListener(new java.awt.event.ActionListener() {
|
932 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
933 |
propiedades(); |
934 |
} |
935 |
}); |
936 |
} |
937 |
|
938 |
return btnPropiedades;
|
939 |
} |
940 |
|
941 |
/**
|
942 |
* This method initializes btnAbrir
|
943 |
*
|
944 |
* @return JButton
|
945 |
*/
|
946 |
private JButton getBtnAbrir() { |
947 |
if (btnAbrir == null) { |
948 |
btnAbrir = new JButton(); |
949 |
btnAbrir.setName("btnAbrir");
|
950 |
btnAbrir.setText(PluginServices.getText(this, "abrir")); |
951 |
btnAbrir.setEnabled(false);
|
952 |
btnAbrir.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
953 |
btnAbrir.addActionListener(new java.awt.event.ActionListener() {
|
954 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
955 |
abrir(); |
956 |
} |
957 |
}); |
958 |
} |
959 |
|
960 |
return btnAbrir;
|
961 |
} |
962 |
|
963 |
/**
|
964 |
* This method initializes btnBorrar
|
965 |
*
|
966 |
* @return JButton
|
967 |
*/
|
968 |
private JButton getBtnBorrar() { |
969 |
if (btnBorrar == null) { |
970 |
btnBorrar = new JButton(); |
971 |
btnBorrar.setText(PluginServices.getText(this, "borrar")); |
972 |
btnBorrar.setName("btnBorrar");
|
973 |
btnBorrar.setEnabled(false);
|
974 |
btnBorrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
975 |
btnBorrar.addActionListener(new java.awt.event.ActionListener() {
|
976 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
977 |
borrar(); |
978 |
} |
979 |
}); |
980 |
} |
981 |
|
982 |
return btnBorrar;
|
983 |
} |
984 |
|
985 |
/**
|
986 |
* This method initializes btnRenombrar
|
987 |
*
|
988 |
* @return JButton
|
989 |
*/
|
990 |
private JButton getBtnRenombrar() { |
991 |
if (btnRenombrar == null) { |
992 |
btnRenombrar = new JButton(); |
993 |
btnRenombrar.setName("btnRenombrar");
|
994 |
btnRenombrar.setText(PluginServices.getText(this, "renombrar")); |
995 |
btnRenombrar.setEnabled(false);
|
996 |
btnRenombrar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
997 |
btnRenombrar.addActionListener(new java.awt.event.ActionListener() {
|
998 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
999 |
renombrar(); |
1000 |
} |
1001 |
}); |
1002 |
} |
1003 |
|
1004 |
return btnRenombrar;
|
1005 |
} |
1006 |
|
1007 |
/**
|
1008 |
* This method initializes jPanel3
|
1009 |
*
|
1010 |
* @return JPanel
|
1011 |
*/
|
1012 |
private JPanel getJPanel3() { |
1013 |
if (jPanel3 == null) { |
1014 |
jPanel3 = new JPanel(); |
1015 |
|
1016 |
GridBagLayout layout3 = new GridBagLayout(); |
1017 |
GridBagConstraints c = new GridBagConstraints(); |
1018 |
jPanel3.setLayout(layout3); |
1019 |
c.insets = new Insets(2, 5, 0, 5); |
1020 |
c.anchor = GridBagConstraints.WEST;
|
1021 |
c.gridx =0;
|
1022 |
c.gridy =0;
|
1023 |
layout3.setConstraints(getJLabel(),c); |
1024 |
jPanel3.add(getJLabel(), null);
|
1025 |
c.fill = GridBagConstraints.HORIZONTAL;
|
1026 |
c.weightx=1.0;
|
1027 |
c.gridx =1;
|
1028 |
layout3.setConstraints(getLblNombreSesion(),c); |
1029 |
jPanel3.add(getLblNombreSesion(), null);
|
1030 |
|
1031 |
c.gridx =0;
|
1032 |
c.gridy =1;
|
1033 |
c.fill = GridBagConstraints.NONE;
|
1034 |
c.weightx=0.0;
|
1035 |
layout3.setConstraints(getJLabel1(),c); |
1036 |
jPanel3.add(getJLabel1(), null);
|
1037 |
c.fill = GridBagConstraints.HORIZONTAL;
|
1038 |
c.weightx=1.0;
|
1039 |
c.gridx =1;
|
1040 |
layout3.setConstraints(getLblGuardado(),c); |
1041 |
jPanel3.add(getLblGuardado(), null);
|
1042 |
|
1043 |
c.gridx =0;
|
1044 |
c.gridy =2;
|
1045 |
c.fill = GridBagConstraints.NONE;
|
1046 |
c.weightx=0.0;
|
1047 |
layout3.setConstraints(getJLabel2(),c); |
1048 |
jPanel3.add(getJLabel2(), null);
|
1049 |
|
1050 |
c.fill = GridBagConstraints.HORIZONTAL;
|
1051 |
c.weightx=1.0;
|
1052 |
c.gridx =1;
|
1053 |
layout3.setConstraints(getLblFecha(),c); |
1054 |
jPanel3.add(getLblFecha(), null);
|
1055 |
jPanel3.setPreferredSize(new java.awt.Dimension(430, 125)); |
1056 |
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder( |
1057 |
null, PluginServices.getText(this, "propiedades_sesion"), |
1058 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
1059 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
1060 |
c.gridx =1;
|
1061 |
c.gridy =4;
|
1062 |
c.anchor = GridBagConstraints.EAST;
|
1063 |
layout3.setConstraints(getJPanel4(),c); |
1064 |
jPanel3.add(getJPanel4(), null);
|
1065 |
} |
1066 |
|
1067 |
return jPanel3;
|
1068 |
} |
1069 |
|
1070 |
/**
|
1071 |
* This method initializes jLabel
|
1072 |
*
|
1073 |
* @return JLabel
|
1074 |
*/
|
1075 |
private JLabel getJLabel() { |
1076 |
if (jLabel == null) { |
1077 |
jLabel = new JLabel(); |
1078 |
jLabel.setText(PluginServices.getText(this, "nombre_sesion") + ":"); |
1079 |
jLabel.setPreferredSize(new java.awt.Dimension(150, 16)); |
1080 |
} |
1081 |
|
1082 |
return jLabel;
|
1083 |
} |
1084 |
|
1085 |
/**
|
1086 |
* This method initializes lblNombreSesion
|
1087 |
*
|
1088 |
* @return JLabel
|
1089 |
*/
|
1090 |
private JLabel getLblNombreSesion() { |
1091 |
if (lblNombreSesion == null) { |
1092 |
lblNombreSesion = new JLabel(); |
1093 |
lblNombreSesion.setText("");
|
1094 |
lblNombreSesion.setName("lblNombreSesion");
|
1095 |
lblNombreSesion.setPreferredSize(new java.awt.Dimension(200, 16)); |
1096 |
lblNombreSesion.setAutoscrolls(true);
|
1097 |
} |
1098 |
|
1099 |
return lblNombreSesion;
|
1100 |
} |
1101 |
|
1102 |
/**
|
1103 |
* This method initializes jLabel1
|
1104 |
*
|
1105 |
* @return JLabel
|
1106 |
*/
|
1107 |
private JLabel getJLabel1() { |
1108 |
if (jLabel1 == null) { |
1109 |
jLabel1 = new JLabel(); |
1110 |
jLabel1.setText(PluginServices.getText(this, "guardado") + ":"); |
1111 |
jLabel1.setPreferredSize(new java.awt.Dimension(150, 16)); |
1112 |
} |
1113 |
|
1114 |
return jLabel1;
|
1115 |
} |
1116 |
|
1117 |
/**
|
1118 |
* This method initializes lblGuardado
|
1119 |
*
|
1120 |
* @return JLabel
|
1121 |
*/
|
1122 |
private JLabel getLblGuardado() { |
1123 |
if (lblGuardado == null) { |
1124 |
lblGuardado = new JLabel(); |
1125 |
lblGuardado.setText("");
|
1126 |
lblGuardado.setPreferredSize(new java.awt.Dimension(200, 16)); |
1127 |
lblGuardado.setAutoscrolls(true);
|
1128 |
} |
1129 |
|
1130 |
return lblGuardado;
|
1131 |
} |
1132 |
|
1133 |
/**
|
1134 |
* This method initializes jLabel2
|
1135 |
*
|
1136 |
* @return JLabel
|
1137 |
*/
|
1138 |
private JLabel getJLabel2() { |
1139 |
if (jLabel2 == null) { |
1140 |
jLabel2 = new JLabel(); |
1141 |
jLabel2.setText(PluginServices.getText(this, "creation_date") + |
1142 |
":");
|
1143 |
jLabel2.setPreferredSize(new java.awt.Dimension(150, 16)); |
1144 |
} |
1145 |
|
1146 |
return jLabel2;
|
1147 |
} |
1148 |
|
1149 |
/**
|
1150 |
* This method initializes lblFecha
|
1151 |
*
|
1152 |
* @return JLabel
|
1153 |
*/
|
1154 |
private JLabel getLblFecha() { |
1155 |
if (lblFecha == null) { |
1156 |
lblFecha = new JLabel(); |
1157 |
lblFecha.setText("");
|
1158 |
lblFecha.setPreferredSize(new java.awt.Dimension(200, 16)); |
1159 |
lblFecha.setAutoscrolls(true);
|
1160 |
} |
1161 |
|
1162 |
return lblFecha;
|
1163 |
} |
1164 |
|
1165 |
/**
|
1166 |
* This method initializes btnImportar
|
1167 |
*
|
1168 |
* @return JButton
|
1169 |
*/
|
1170 |
private JButton getBtnImportar() { |
1171 |
if (btnImportar == null) { |
1172 |
btnImportar = new JButton(); |
1173 |
btnImportar.setPreferredSize(new java.awt.Dimension(80, 23)); |
1174 |
btnImportar.setText(PluginServices.getText(this, "importar")); |
1175 |
btnImportar.setName("btnImportar");
|
1176 |
btnImportar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
1177 |
// TODO implement import
|
1178 |
btnImportar.setVisible(false);
|
1179 |
} |
1180 |
|
1181 |
return btnImportar;
|
1182 |
} |
1183 |
|
1184 |
/**
|
1185 |
* This method initializes btnExportar
|
1186 |
*
|
1187 |
* @return JButton
|
1188 |
*/
|
1189 |
private JButton getBtnExportar() { |
1190 |
if (btnExportar == null) { |
1191 |
btnExportar = new JButton(); |
1192 |
btnExportar.setPreferredSize(new java.awt.Dimension(80, 23)); |
1193 |
btnExportar.setText(PluginServices.getText(this, "exportar")); |
1194 |
btnExportar.setName("btnExportar");
|
1195 |
btnExportar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
1196 |
// TODO implement export
|
1197 |
btnExportar.setVisible(false);
|
1198 |
} |
1199 |
|
1200 |
return btnExportar;
|
1201 |
} |
1202 |
|
1203 |
/**
|
1204 |
* This method initializes btnEditar
|
1205 |
*
|
1206 |
* @return JButton
|
1207 |
*/
|
1208 |
private JButton getBtnEditar() { |
1209 |
if (btnEditar == null) { |
1210 |
btnEditar = new JButton(); |
1211 |
btnEditar.setPreferredSize(new java.awt.Dimension(80, 23)); |
1212 |
btnEditar.setText(PluginServices.getText(this, "propiedades")); |
1213 |
|
1214 |
btnEditar.setName("btnEditar");
|
1215 |
btnEditar.setMargin(new java.awt.Insets(2, 2, 2, 2)); |
1216 |
|
1217 |
btnEditar.addActionListener(new java.awt.event.ActionListener() {
|
1218 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
1219 |
ProjectProperties dlg = new ProjectProperties(p);
|
1220 |
PluginServices.getMDIManager().addView(dlg); |
1221 |
refreshProperties(); |
1222 |
} |
1223 |
}); |
1224 |
} |
1225 |
|
1226 |
return btnEditar;
|
1227 |
} |
1228 |
|
1229 |
/**
|
1230 |
* This method initializes jScrollPane
|
1231 |
*
|
1232 |
* @return JScrollPane
|
1233 |
*/
|
1234 |
private JScrollPane getJScrollPane() { |
1235 |
if (jScrollPane == null) { |
1236 |
jScrollPane = new JScrollPane(); |
1237 |
jScrollPane.setViewportView(getLstDocs()); |
1238 |
jScrollPane.setPreferredSize(new java.awt.Dimension(200, 100)); |
1239 |
jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
1240 |
} |
1241 |
|
1242 |
return jScrollPane;
|
1243 |
} |
1244 |
|
1245 |
/**
|
1246 |
* @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
|
1247 |
*/
|
1248 |
public Object getViewModel() { |
1249 |
return p;
|
1250 |
} |
1251 |
|
1252 |
/**
|
1253 |
* This method is used to get <strong>an initial</strong> ViewInfo object
|
1254 |
* for this Project Manager window. It is not intended to retrieve the
|
1255 |
* ViewInfo object in a later time.
|
1256 |
* <strong>Use PluginServices.getMDIManager().getViewInfo(view)
|
1257 |
* to retrieve the ViewInfo object at any time after the creation of the
|
1258 |
* object.
|
1259 |
*
|
1260 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getViewInfo()
|
1261 |
*/
|
1262 |
public ViewInfo getViewInfo() {
|
1263 |
//if (m_viewInfo==null) {
|
1264 |
m_viewInfo = new ViewInfo(ViewInfo.MAXIMIZABLE);
|
1265 |
//m_viewInfo = new ViewInfo(ViewInfo.MAXIMIZABLE+ViewInfo.RESIZABLE);
|
1266 |
m_viewInfo.setWidth(this.getWidth());
|
1267 |
m_viewInfo.setHeight(this.getHeight());
|
1268 |
m_viewInfo.setNormalWidth(this.getPreferredSize().width);
|
1269 |
m_viewInfo.setNormalHeight(this.getPreferredSize().height);
|
1270 |
|
1271 |
m_viewInfo.setTitle(PluginServices.getText(this, "titulo")); |
1272 |
//}
|
1273 |
return m_viewInfo;
|
1274 |
} |
1275 |
|
1276 |
/**
|
1277 |
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
|
1278 |
*/
|
1279 |
public void propertyChange(PropertyChangeEvent evt) { |
1280 |
refreshControls(); |
1281 |
} |
1282 |
|
1283 |
/**
|
1284 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#viewActivated()
|
1285 |
*/
|
1286 |
public void viewActivated() { |
1287 |
} |
1288 |
|
1289 |
/**
|
1290 |
* This method initializes jPanel4
|
1291 |
*
|
1292 |
* @return JPanel
|
1293 |
*/
|
1294 |
private JPanel getJPanel4() { |
1295 |
if (jPanel4 == null) { |
1296 |
jPanel4 = new JPanel(); |
1297 |
|
1298 |
jPanel4.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
1299 |
jPanel4.setPreferredSize(new java.awt.Dimension(414, 30)); |
1300 |
jPanel4.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); |
1301 |
jPanel4.add(getBtnImportar(), null);
|
1302 |
jPanel4.add(getBtnExportar(), null);
|
1303 |
jPanel4.add(getBtnEditar(), null);
|
1304 |
} |
1305 |
|
1306 |
return jPanel4;
|
1307 |
} |
1308 |
} // @jve:decl-index=0:visual-constraint="10,10"
|