Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / ProjectWindow.java @ 1201

History | View | Annotate | Download (33.8 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.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.SelectableDataSource;
67
import com.iver.cit.gvsig.gui.DataBaseOpenDialog;
68
import com.iver.cit.gvsig.gui.FOpenDialog;
69
import com.iver.cit.gvsig.gui.FileOpenDialog;
70
import com.iver.cit.gvsig.gui.Table;
71
import com.iver.cit.gvsig.gui.layout.Layout;
72
import com.iver.cit.gvsig.project.castor.Project;
73
import com.iver.cit.gvsig.project.castor.ProjectElement;
74
import com.iver.cit.gvsig.project.castor.ProjectMap;
75
import com.iver.cit.gvsig.project.castor.ProjectTable;
76
import com.iver.cit.gvsig.project.castor.ProjectView;
77
import com.iver.utiles.DefaultListModel;
78

    
79

    
80
/**
81
 * Clase principal del proyecto donde se puede operar para crear vistas,
82
 * tablas, mapas, ...
83
 *
84
 * @author Fernando Gonz?lez Cort?s
85
 */
86
public class ProjectWindow extends JPanel implements PropertyChangeListener,
87
    View, SingletonView {
88
    private javax.swing.JPanel jPanel = null;
89
    private javax.swing.JRadioButton btnVistas = null;
90
    private javax.swing.JRadioButton btnTablas = null;
91
    private javax.swing.JRadioButton btnMapas = null;
92
    private ButtonGroup grupo = new ButtonGroup();
93
    private javax.swing.JPanel jPanel1 = null;
94
    private javax.swing.JList lstDocs = null;
95
    private javax.swing.JPanel jPanel2 = null;
96
    private javax.swing.JButton btnNuevo = null;
97
    private javax.swing.JButton btnPropiedades = null;
98
    private javax.swing.JButton btnAbrir = null;
99
    private javax.swing.JButton btnBorrar = null;
100
    private javax.swing.JButton btnRenombrar = null;
101
    private javax.swing.JPanel jPanel3 = null;
102
    private javax.swing.JLabel jLabel = null;
103
    private javax.swing.JLabel lblNombreSesion = null;
104
    private javax.swing.JLabel jLabel1 = null;
105
    private javax.swing.JLabel lblGuardado = null;
106
    private javax.swing.JLabel jLabel2 = null;
107
    private javax.swing.JLabel lblFecha = null;
108
    private javax.swing.JButton btnImportar = null;
109
    private javax.swing.JButton btnExportar = null;
110
    private javax.swing.JButton btnEditar = null;
111

    
112
    /** Proyecto representado en la vista */
113
    private Project p;
114

    
115
    /**
116
     * Extension con la informaci?n, entre otras, sobre las extensiones para
117
     * las tablas
118
     */
119
    private ProjectExtension projectExtension;
120
    private javax.swing.JScrollPane jScrollPane = null;
121
    private javax.swing.JPanel jPanel4 = null;
122

    
123
    /**
124
     * This is the default constructor
125
     *
126
     * @param project Extension
127
     */
128
    public ProjectWindow(ProjectExtension project) {
129
        super();
130

    
131
        initialize();
132

    
133
        projectExtension = project;
134

    
135
        refreshControls();
136
    }
137

    
138
    /**
139
     * Asigna el proyecto a la ventana
140
     *
141
     * @param p Proyecto con el que se operar? a trav?s de este di?logo
142
     */
143
    public void setProject(Project p) {
144
        this.p = p;
145
        p.addPropertyChangeListener(this);
146
        refreshControls();
147
    }
148

    
149
    /**
150
     * Activa los botones de la botonera del medio o los desactiva en funci?n
151
     * de que est? seleccionado o no un elemento de proyecto en la lista del
152
     * medio
153
     */
154
    private void activarBotones() {
155
        if (lstDocs.getSelectedIndex() != -1) {
156
            btnAbrir.setEnabled(true);
157
            btnBorrar.setEnabled(true);
158
            btnRenombrar.setEnabled(true);
159
            btnPropiedades.setEnabled(true);
160
        } else {
161
            btnAbrir.setEnabled(false);
162
            btnBorrar.setEnabled(false);
163
            btnRenombrar.setEnabled(false);
164
            btnPropiedades.setEnabled(false);
165
        }
166
    }
167

    
168
    /**
169
     * Refresca la lista de elementos de proyecto con vistas, mapas o tablas,
170
     * seg?n la opci?n activada
171
     */
172
    private void refreshList() {
173
        if (p != null) {
174
            DefaultListModel model;
175

    
176
            if (btnMapas.isSelected()) {
177
                model = new DefaultListModel(p.getMaps());
178

    
179
                //                                getBtnNuevo().setEnabled(true);
180
            } else if (btnTablas.isSelected()) {
181
                model = new DefaultListModel(p.getTables());
182

    
183
                //                getBtnNuevo().setEnabled(false);
184
            } else {
185
                model = new DefaultListModel(p.getViews());
186

    
187
                //                                getBtnNuevo().setEnabled(true);
188
            }
189

    
190
            lstDocs.setModel(model);
191

    
192
            activarBotones();
193
        }
194
    }
195

    
196
    /**
197
     * Refresca las etiquetas con la informaci?n del proyecto
198
     */
199
    private void refreshProperties() {
200
        if (p != null) {
201
            String aux;
202

    
203
            lblNombreSesion.setText(p.getName());
204

    
205
            String path = p.getPath();
206

    
207
            if (path != null) {
208
                File f = new File(path);
209
                lblGuardado.setText(f.toString());
210
            } else {
211
                lblGuardado.setText("");
212
            }
213

    
214
            lblFecha.setText(p.getCreationDate());
215
        }
216
    }
217

    
218
    /**
219
     * Refresca todo el di?logo
220
     */
221
    public void refreshControls() {
222
        refreshList();
223
        refreshProperties();
224
    }
225

    
226
    /**
227
     * This method initializes this
228
     */
229
    private void initialize() {
230
        setLayout(new java.awt.FlowLayout());
231
        add(getJPanel(), null);
232
        add(getJPanel1(), null);
233
        add(getJPanel3(), null);
234

    
235
        this.setSize(400, 450);
236
        this.setPreferredSize(new java.awt.Dimension(400, 430));
237
        grupo.add(btnVistas);
238
        grupo.add(btnTablas);
239
        grupo.add(btnMapas);
240

    
241
        btnVistas.setSelected(true);
242
    }
243

    
244
    /**
245
     * Crea un nuevo project element
246
     *
247
     * @throws Exception DOCUMENT ME!
248
     */
249
    private void nuevo() throws Exception {
250
        DateFormat df = DateFormat.getDateInstance();
251

    
252
        if (btnMapas.isSelected()) {
253
            ProjectMap map = ProjectFactory.createMap(PluginServices.getText(
254
                        this, "untitled"));
255
            map.setModel(new Layout());
256
            map.getModel().setProjectMap(map);
257
            p.addMap(map);
258
        } else if (btnTablas.isSelected()) {
259
            try {
260
                FOpenDialog fopen = new FOpenDialog();
261
                FileOpenDialog fod = new FileOpenDialog(new Class[]{FileDriver.class, GeorreferencedRasterDriver.class});
262
                DataBaseOpenDialog dbod = new DataBaseOpenDialog();
263
                dbod.setClasses(new Class[] { DBDriver.class });
264
                fopen.addTab("Fichero", fod);
265
                fopen.addTab("Base de datos", dbod);
266
                PluginServices.getMDIManager().addView(fopen);
267

    
268
                if (fopen.isAccepted()) {
269
                    JPanel panel = fopen.getSelectedTab();
270

    
271
                    if (panel instanceof FileOpenDialog) {
272
                            File[] files = fod.getFiles();
273
                            String[] driverNames = fod.getDriverNames();
274
                            for (int i = 0; i < files.length; i++) {
275
                                String name = files[i].getName();
276
                            DataSourceFactory.addFileDataSource(driverNames[i], name, files[i].getAbsolutePath(), files[i].getAbsolutePath());
277

    
278
                            DataSource dataSource = DataSourceFactory.createRandomDataSource(name);
279
                            SelectableDataSource sds = new SelectableDataSource(dataSource);
280
                            ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
281
                            ProjectTable projectTable = ProjectFactory.createTable(null, sds);
282
                            ext.getProject().addTable(projectTable);
283

    
284
                            Table t = new Table();
285
                            t.setModel(projectTable);
286
                            PluginServices.getMDIManager().addView(t);
287
                                                }
288
                    } else if (panel instanceof DataBaseOpenDialog) {
289
                        String driverName = dbod.getDriverName();
290
                        int port = -1;
291

    
292
                        try {
293
                            port = Integer.parseInt(dbod.getPort());
294
                        } catch (NumberFormatException e) {
295
                        }
296

    
297
                        String name = dbod.getHost() + "/" +
298
                            dbod.getDataBase();
299

    
300
                        if (port != -1) {
301
                            name = dbod.getHost() + ":" + port + "/" +
302
                                dbod.getDataBase();
303
                        }
304

    
305
                        String user = dbod.getUser().trim();
306
                        String password = dbod.getPassword();
307

    
308
                        if (user.equals("")) {
309
                            user = null;
310
                            password = null;
311
                        }
312

    
313
                        DataSourceFactory.addDBDataSource(name, dbod.getHost(),
314
                            port, user, password, dbod.getDataBase(),
315
                            dbod.getTable(), driverName);
316

    
317
                        DataSource dataSource = DataSourceFactory.createRandomDataSource(name);
318
                        SelectableDataSource sds = new SelectableDataSource(dataSource);
319

    
320
                        ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
321
                        ProjectTable projectTable = ProjectFactory.createTable(null, sds);
322
                        ext.getProject().addTable(projectTable);
323

    
324
                        Table t = new Table();
325
                        t.setModel(projectTable);
326
                        PluginServices.getMDIManager().addView(t);
327
                    }
328
                }
329
            } catch (DriverLoadException e) {
330
                    NotificationManager.addError("Error al cargar los drivers", e);
331
            }
332
        } else {
333
            ProjectView vista = ProjectFactory.createView(PluginServices.getText(
334
                        this, "untitled"));
335
            p.addView(vista);
336
        }
337
    }
338

    
339
    /**
340
     * Abre la ventana de un nuevo project element
341
     */
342
    private void abrir() {
343
        if (btnMapas.isSelected()) {
344
            int index = lstDocs.getSelectedIndex();
345

    
346
            if (index == -1) {
347
                return;
348
            }
349

    
350
            Layout l = (Layout)((ProjectMap) p.getMaps().get(index)).getModel();
351
            l.fullRect();
352
            PluginServices.getMDIManager().addView(l);
353
        } else if (btnTablas.isSelected()) {
354
            com.iver.cit.gvsig.gui.Table vista = new com.iver.cit.gvsig.gui.Table();
355
            int index = lstDocs.getSelectedIndex();
356

    
357
            if (index == -1) {
358
                return;
359
            }
360

    
361
            vista.setModel((ProjectTable) p.getTables().get(index));
362
            PluginServices.getMDIManager().addView(vista);
363
        } else {
364
            com.iver.cit.gvsig.gui.View vista = new com.iver.cit.gvsig.gui.View();
365
            int index = lstDocs.getSelectedIndex();
366

    
367
            if (index == -1) {
368
                return;
369
            }
370

    
371
            vista.setModel((ProjectView) p.getViews().get(index));
372
            PluginServices.getMDIManager().addView(vista);
373
            
374
        }
375
    }
376

    
377
    /**
378
     * Cambia el nombre de un project element
379
     */
380
    private void renombrar() {
381
        ProjectElement elem = null;
382
        int index = lstDocs.getSelectedIndex();
383

    
384
        if (index == -1) {
385
            return;
386
        }
387

    
388
        if (btnMapas.isSelected()) {
389
            elem = (ProjectElement) p.getMaps().get(index);
390
        } else if (btnTablas.isSelected()) {
391
            elem = (ProjectElement) p.getTables().get(index);
392
        } else {
393
            elem = (ProjectElement) p.getViews().get(index);
394
        }
395

    
396
        JOptionPane pane = new JOptionPane();
397
        pane.setMessage(PluginServices.getText(this, "introduce_nombre"));
398
        pane.setMessageType(JOptionPane.QUESTION_MESSAGE);
399
        pane.setWantsInput(true);
400
        pane.setInitialSelectionValue(elem.getName());
401

    
402
        JDialog dlg = pane.createDialog((Component) PluginServices.getMainFrame(),
403
                        PluginServices.getText(this, "renombrar"));
404
        dlg.setModal(true);
405
        dlg.show();
406

    
407
        String nuevoNombre = pane.getInputValue().toString().trim();
408

    
409
        if (nuevoNombre.length() == 0) {
410
            return;
411
        }
412

    
413
        if (nuevoNombre == null) {
414
            return;
415
        }
416

    
417
        elem.setName(nuevoNombre);
418

    
419
        refreshList();
420
    }
421

    
422
    /**
423
     * Borra un project element
424
     */
425
    private void borrar() {
426
        int res = JOptionPane.showConfirmDialog((Component) PluginServices.getMainFrame(),
427
                        PluginServices.getText(this, "confirmar_borrar"),
428
                        PluginServices.getText(this, "borrar"),
429
                JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE);
430

    
431
        if (res == JOptionPane.YES_OPTION) {
432
            int index = lstDocs.getSelectedIndex();
433

    
434
            if (btnMapas.isSelected()) {
435
                p.delMap(index);
436
            } else if (btnTablas.isSelected()) {
437
                p.delTable(index);
438
            } else {
439
                p.delView(index);
440
            }
441

    
442
            refreshList();
443
        }
444
    }
445

    
446
    /**
447
     * Muestra el di?logo de propiedades de un project element
448
     */
449
    private void propiedades() {
450
        int index = lstDocs.getSelectedIndex();
451

    
452
        if (index == -1) {
453
            return;
454
        }
455

    
456
        View dlg;
457

    
458
        if (btnMapas.isSelected()) {
459
            dlg = new MapProperties((ProjectMap) p.getMaps().get(index));
460
        } else if (btnTablas.isSelected()) {
461
            dlg = new TableProperties((ProjectTable) p.getTables().get(index));
462
        } else {
463
            dlg = new ViewProperties((ProjectView) p.getViews().get(index));
464
        }
465

    
466
        PluginServices.getMDIManager().addView(dlg);
467

    
468
        refreshControls();
469
        lstDocs.setSelectedIndex(index);
470
    }
471

    
472
    /**
473
     * This method initializes jPanel
474
     *
475
     * @return javax.swing.JPanel
476
     */
477
    private javax.swing.JPanel getJPanel() {
478
        if (jPanel == null) {
479
            jPanel = new javax.swing.JPanel();
480

    
481
            java.awt.FlowLayout layFlowLayout1 = new java.awt.FlowLayout();
482
            layFlowLayout1.setHgap(15);
483
            jPanel.setLayout(layFlowLayout1);
484
            jPanel.add(getBtnVistas(), null);
485
            jPanel.add(getBtnTablas(), null);
486
            jPanel.add(getBtnMapas(), null);
487
            jPanel.setName("tipoDocPanel");
488
            jPanel.setPreferredSize(new java.awt.Dimension(390, 125));
489
            jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
490
                    null, PluginServices.getText(this, "tipos_de_documentos"),
491
                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
492
                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
493
        }
494

    
495
        return jPanel;
496
    }
497

    
498
    /**
499
     * This method initializes btnVistas
500
     *
501
     * @return javax.swing.JRadioButton
502
     */
503
    private javax.swing.JRadioButton getBtnVistas() {
504
        if (btnVistas == null) {
505
            btnVistas = new javax.swing.JRadioButton();
506
            btnVistas.setIcon(new javax.swing.ImageIcon(
507
                    this.getClass().getClassLoader().getResource("images/Vista.png")));
508
            btnVistas.setSelectedIcon(new javax.swing.ImageIcon(
509
                    this.getClass().getClassLoader().getResource("images/Vista_sel.png")));
510
            btnVistas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
511
            btnVistas.setText(PluginServices.getText(this, "vistas"));
512
            btnVistas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
513
            btnVistas.setName("vistasBtn");
514
            btnVistas.addChangeListener(new javax.swing.event.ChangeListener() {
515
                    public void stateChanged(javax.swing.event.ChangeEvent e) {
516
                        refreshList();
517
                    }
518
                });
519
        }
520

    
521
        return btnVistas;
522
    }
523

    
524
    /**
525
     * This method initializes btnTablas
526
     *
527
     * @return javax.swing.JRadioButton
528
     */
529
    private javax.swing.JRadioButton getBtnTablas() {
530
        if (btnTablas == null) {
531
            btnTablas = new javax.swing.JRadioButton();
532
            btnTablas.setIcon(new javax.swing.ImageIcon(
533
                    this.getClass().getClassLoader().getResource("images/tablas.png")));
534
            btnTablas.setSelectedIcon(new javax.swing.ImageIcon(
535
                    this.getClass().getClassLoader().getResource("images/tablas_sel.png")));
536
            btnTablas.setText(PluginServices.getText(this, "tablas"));
537
            btnTablas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
538
            btnTablas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
539
            btnTablas.setName("tablasBtn");
540
            btnTablas.addChangeListener(new javax.swing.event.ChangeListener() {
541
                    public void stateChanged(javax.swing.event.ChangeEvent e) {
542
                        refreshList();
543
                    }
544
                });
545
        }
546

    
547
        return btnTablas;
548
    }
549

    
550
    /**
551
     * This method initializes btnMapas
552
     *
553
     * @return javax.swing.JRadioButton
554
     */
555
    private javax.swing.JRadioButton getBtnMapas() {
556
        if (btnMapas == null) {
557
            btnMapas = new javax.swing.JRadioButton();
558
            btnMapas.setIcon(new javax.swing.ImageIcon(
559
                    this.getClass().getClassLoader().getResource("images/mapas.png")));
560
            btnMapas.setSelectedIcon(new javax.swing.ImageIcon(
561
                    this.getClass().getClassLoader().getResource("images/mapas_sel.png")));
562
            btnMapas.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
563
            btnMapas.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
564
            btnMapas.setText(PluginServices.getText(this, "mapas"));
565
            btnMapas.addChangeListener(new javax.swing.event.ChangeListener() {
566
                    public void stateChanged(javax.swing.event.ChangeEvent e) {
567
                        refreshList();
568
                    }
569
                });
570
        }
571

    
572
        return btnMapas;
573
    }
574

    
575
    /**
576
     * This method initializes jPanel1
577
     *
578
     * @return javax.swing.JPanel
579
     */
580
    private javax.swing.JPanel getJPanel1() {
581
        if (jPanel1 == null) {
582
            jPanel1 = new javax.swing.JPanel();
583

    
584
            java.awt.BorderLayout layBorderLayout2 = new java.awt.BorderLayout();
585
            layBorderLayout2.setVgap(30);
586
            jPanel1.setLayout(layBorderLayout2);
587
            jPanel1.add(getJPanel2(), java.awt.BorderLayout.EAST);
588
            jPanel1.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
589
            jPanel1.setPreferredSize(new java.awt.Dimension(390, 170));
590
            jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(
591
                    null, PluginServices.getText(this, "documentos_existentes"),
592
                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
593
                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
594
        }
595

    
596
        return jPanel1;
597
    }
598

    
599
    /**
600
     * This method initializes lstDocs
601
     *
602
     * @return javax.swing.JList
603
     */
604
    private javax.swing.JList getLstDocs() {
605
        if (lstDocs == null) {
606
            lstDocs = new javax.swing.JList();
607
            lstDocs.addMouseListener(new java.awt.event.MouseAdapter() {
608
                    public void mouseClicked(java.awt.event.MouseEvent e) {
609
                        if (e.getClickCount() == 2) {
610
                            abrir();
611
                        }
612
                    }
613
                });
614
            lstDocs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
615
                    public void valueChanged(
616
                        javax.swing.event.ListSelectionEvent e) {
617
                        activarBotones();
618
                    }
619
                });
620
        }
621

    
622
        return lstDocs;
623
    }
624

    
625
    /**
626
     * This method initializes jPanel2
627
     *
628
     * @return javax.swing.JPanel
629
     */
630
    private javax.swing.JPanel getJPanel2() {
631
        if (jPanel2 == null) {
632
            jPanel2 = new javax.swing.JPanel();
633

    
634
            java.awt.FlowLayout layFlowLayout11 = new java.awt.FlowLayout();
635
            layFlowLayout11.setVgap(5);
636
            jPanel2.setLayout(layFlowLayout11);
637
            jPanel2.add(getBtnNuevo(), null);
638
            jPanel2.add(getBtnAbrir(), null);
639
            jPanel2.add(getBtnRenombrar(), null);
640
            jPanel2.add(getBtnBorrar(), null);
641
            jPanel2.add(getBtnPropiedades(), null);
642
            jPanel2.setPreferredSize(new java.awt.Dimension(100, 50));
643
        }
644

    
645
        return jPanel2;
646
    }
647

    
648
    /**
649
     * This method initializes btnNuevo
650
     *
651
     * @return javax.swing.JButton
652
     */
653
    private javax.swing.JButton getBtnNuevo() {
654
        if (btnNuevo == null) {
655
            btnNuevo = new javax.swing.JButton();
656
            btnNuevo.setPreferredSize(new java.awt.Dimension(80, 23));
657
            btnNuevo.setName("btnNuevo");
658
            btnNuevo.setText(PluginServices.getText(this, "nuevo"));
659
            btnNuevo.setMargin(new java.awt.Insets(2, 2, 2, 2));
660
            btnNuevo.addActionListener(new java.awt.event.ActionListener() {
661
                    public void actionPerformed(java.awt.event.ActionEvent e) {
662
                        try {
663
                            nuevo();
664
                        } catch (Exception e1) {
665
                            NotificationManager.addError(e1.getLocalizedMessage(),
666
                                e1);
667
                        }
668
                    }
669
                });
670
        }
671

    
672
        return btnNuevo;
673
    }
674

    
675
    /**
676
     * This method initializes btnPropiedades
677
     *
678
     * @return javax.swing.JButton
679
     */
680
    private javax.swing.JButton getBtnPropiedades() {
681
        if (btnPropiedades == null) {
682
            btnPropiedades = new javax.swing.JButton();
683
            btnPropiedades.setPreferredSize(new java.awt.Dimension(80, 23));
684
            btnPropiedades.setText(PluginServices.getText(this, "propiedades"));
685
            btnPropiedades.setName("btnPropiedades");
686
            btnPropiedades.setEnabled(false);
687
            btnPropiedades.setMargin(new java.awt.Insets(2, 2, 2, 2));
688
            btnPropiedades.addActionListener(new java.awt.event.ActionListener() {
689
                    public void actionPerformed(java.awt.event.ActionEvent e) {
690
                        propiedades();
691
                    }
692
                });
693
        }
694

    
695
        return btnPropiedades;
696
    }
697

    
698
    /**
699
     * This method initializes btnAbrir
700
     *
701
     * @return javax.swing.JButton
702
     */
703
    private javax.swing.JButton getBtnAbrir() {
704
        if (btnAbrir == null) {
705
            btnAbrir = new javax.swing.JButton();
706
            btnAbrir.setPreferredSize(new java.awt.Dimension(80, 23));
707
            btnAbrir.setName("btnAbrir");
708
            btnAbrir.setText(PluginServices.getText(this, "abrir"));
709
            btnAbrir.setEnabled(false);
710
            btnAbrir.setMargin(new java.awt.Insets(2, 2, 2, 2));
711
            btnAbrir.addActionListener(new java.awt.event.ActionListener() {
712
                    public void actionPerformed(java.awt.event.ActionEvent e) {
713
                        abrir();
714
                    }
715
                });
716
        }
717

    
718
        return btnAbrir;
719
    }
720

    
721
    /**
722
     * This method initializes btnBorrar
723
     *
724
     * @return javax.swing.JButton
725
     */
726
    private javax.swing.JButton getBtnBorrar() {
727
        if (btnBorrar == null) {
728
            btnBorrar = new javax.swing.JButton();
729
            btnBorrar.setPreferredSize(new java.awt.Dimension(80, 23));
730
            btnBorrar.setText(PluginServices.getText(this, "borrar"));
731
            btnBorrar.setName("btnBorrar");
732
            btnBorrar.setEnabled(false);
733
            btnBorrar.setMargin(new java.awt.Insets(2, 2, 2, 2));
734
            btnBorrar.addActionListener(new java.awt.event.ActionListener() {
735
                    public void actionPerformed(java.awt.event.ActionEvent e) {
736
                        borrar();
737
                    }
738
                });
739
        }
740

    
741
        return btnBorrar;
742
    }
743

    
744
    /**
745
     * This method initializes btnRenombrar
746
     *
747
     * @return javax.swing.JButton
748
     */
749
    private javax.swing.JButton getBtnRenombrar() {
750
        if (btnRenombrar == null) {
751
            btnRenombrar = new javax.swing.JButton();
752
            btnRenombrar.setPreferredSize(new java.awt.Dimension(80, 23));
753
            btnRenombrar.setName("btnRenombrar");
754
            btnRenombrar.setText(PluginServices.getText(this, "renombrar"));
755
            btnRenombrar.setEnabled(false);
756
            btnRenombrar.setMargin(new java.awt.Insets(2, 2, 2, 2));
757
            btnRenombrar.addActionListener(new java.awt.event.ActionListener() {
758
                    public void actionPerformed(java.awt.event.ActionEvent e) {
759
                        renombrar();
760
                    }
761
                });
762
        }
763

    
764
        return btnRenombrar;
765
    }
766

    
767
    /**
768
     * This method initializes jPanel3
769
     *
770
     * @return javax.swing.JPanel
771
     */
772
    private javax.swing.JPanel getJPanel3() {
773
        if (jPanel3 == null) {
774
            jPanel3 = new javax.swing.JPanel();
775

    
776
            java.awt.FlowLayout layFlowLayout3 = new java.awt.FlowLayout();
777
            layFlowLayout3.setHgap(5);
778
            layFlowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
779
            jPanel3.setLayout(layFlowLayout3);
780
            jPanel3.add(getJLabel(), null);
781
            jPanel3.add(getLblNombreSesion(), null);
782
            jPanel3.add(getJLabel1(), null);
783
            jPanel3.add(getLblGuardado(), null);
784
            jPanel3.add(getJLabel2(), null);
785
            jPanel3.add(getLblFecha(), null);
786
            jPanel3.add(getJPanel4(), null);
787
            jPanel3.setPreferredSize(new java.awt.Dimension(390, 125));
788
            jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(
789
                    null, PluginServices.getText(this, "propiedades_sesion"),
790
                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
791
                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
792
        }
793

    
794
        return jPanel3;
795
    }
796

    
797
    /**
798
     * This method initializes jLabel
799
     *
800
     * @return javax.swing.JLabel
801
     */
802
    private javax.swing.JLabel getJLabel() {
803
        if (jLabel == null) {
804
            jLabel = new javax.swing.JLabel();
805
            jLabel.setText(PluginServices.getText(this, "nombre_sesion") + ":");
806
            jLabel.setPreferredSize(new java.awt.Dimension(150, 16));
807
        }
808

    
809
        return jLabel;
810
    }
811

    
812
    /**
813
     * This method initializes lblNombreSesion
814
     *
815
     * @return javax.swing.JLabel
816
     */
817
    private javax.swing.JLabel getLblNombreSesion() {
818
        if (lblNombreSesion == null) {
819
            lblNombreSesion = new javax.swing.JLabel();
820
            lblNombreSesion.setText("");
821
            lblNombreSesion.setName("lblNombreSesion");
822
            lblNombreSesion.setPreferredSize(new java.awt.Dimension(200, 16));
823
            lblNombreSesion.setAutoscrolls(true);
824
        }
825

    
826
        return lblNombreSesion;
827
    }
828

    
829
    /**
830
     * This method initializes jLabel1
831
     *
832
     * @return javax.swing.JLabel
833
     */
834
    private javax.swing.JLabel getJLabel1() {
835
        if (jLabel1 == null) {
836
            jLabel1 = new javax.swing.JLabel();
837
            jLabel1.setText(PluginServices.getText(this, "guardado") + ":");
838
            jLabel1.setPreferredSize(new java.awt.Dimension(150, 16));
839
        }
840

    
841
        return jLabel1;
842
    }
843

    
844
    /**
845
     * This method initializes lblGuardado
846
     *
847
     * @return javax.swing.JLabel
848
     */
849
    private javax.swing.JLabel getLblGuardado() {
850
        if (lblGuardado == null) {
851
            lblGuardado = new javax.swing.JLabel();
852
            lblGuardado.setText("");
853
            lblGuardado.setPreferredSize(new java.awt.Dimension(200, 16));
854
            lblGuardado.setAutoscrolls(true);
855
        }
856

    
857
        return lblGuardado;
858
    }
859

    
860
    /**
861
     * This method initializes jLabel2
862
     *
863
     * @return javax.swing.JLabel
864
     */
865
    private javax.swing.JLabel getJLabel2() {
866
        if (jLabel2 == null) {
867
            jLabel2 = new javax.swing.JLabel();
868
            jLabel2.setText(PluginServices.getText(this, "creation_date") + ":");
869
            jLabel2.setPreferredSize(new java.awt.Dimension(150, 16));
870
        }
871

    
872
        return jLabel2;
873
    }
874

    
875
    /**
876
     * This method initializes lblFecha
877
     *
878
     * @return javax.swing.JLabel
879
     */
880
    private javax.swing.JLabel getLblFecha() {
881
        if (lblFecha == null) {
882
            lblFecha = new javax.swing.JLabel();
883
            lblFecha.setText("");
884
            lblFecha.setPreferredSize(new java.awt.Dimension(200, 16));
885
            lblFecha.setAutoscrolls(true);
886
        }
887

    
888
        return lblFecha;
889
    }
890

    
891
    /**
892
     * This method initializes btnImportar
893
     *
894
     * @return javax.swing.JButton
895
     */
896
    private javax.swing.JButton getBtnImportar() {
897
        if (btnImportar == null) {
898
            btnImportar = new javax.swing.JButton();
899
            btnImportar.setPreferredSize(new java.awt.Dimension(80, 23));
900
            btnImportar.setText(PluginServices.getText(this, "importar"));
901
            btnImportar.setMargin(new java.awt.Insets(2, 2, 2, 2));
902
        }
903

    
904
        return btnImportar;
905
    }
906

    
907
    /**
908
     * This method initializes btnExportar
909
     *
910
     * @return javax.swing.JButton
911
     */
912
    private javax.swing.JButton getBtnExportar() {
913
        if (btnExportar == null) {
914
            btnExportar = new javax.swing.JButton();
915
            btnExportar.setPreferredSize(new java.awt.Dimension(80, 23));
916
            btnExportar.setText(PluginServices.getText(this, "exportar"));
917
            btnExportar.setMargin(new java.awt.Insets(2, 2, 2, 2));
918
        }
919

    
920
        return btnExportar;
921
    }
922

    
923
    /**
924
     * This method initializes btnEditar
925
     *
926
     * @return javax.swing.JButton
927
     */
928
    private javax.swing.JButton getBtnEditar() {
929
        if (btnEditar == null) {
930
            btnEditar = new javax.swing.JButton();
931
            btnEditar.setPreferredSize(new java.awt.Dimension(80, 23));
932
            btnEditar.setText(PluginServices.getText(this, "propiedades"));
933

    
934
            btnEditar.setMargin(new java.awt.Insets(2, 2, 2, 2));
935

    
936
            final JPanel f = this;
937
            btnEditar.addActionListener(new java.awt.event.ActionListener() {
938
                    public void actionPerformed(java.awt.event.ActionEvent e) {
939
                        ProjectProperties dlg = new ProjectProperties(p);
940
                        PluginServices.getMDIManager().addView(dlg);
941
                        refreshProperties();
942
                    }
943
                });
944
        }
945

    
946
        return btnEditar;
947
    }
948

    
949
    /**
950
     * This method initializes jScrollPane
951
     *
952
     * @return javax.swing.JScrollPane
953
     */
954
    private javax.swing.JScrollPane getJScrollPane() {
955
        if (jScrollPane == null) {
956
            jScrollPane = new javax.swing.JScrollPane();
957
            jScrollPane.setViewportView(getLstDocs());
958
            jScrollPane.setPreferredSize(new java.awt.Dimension(200, 100));
959
            jScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
960
        }
961

    
962
        return jScrollPane;
963
    }
964

    
965
    /**
966
     * @see com.iver.mdiApp.ui.MDIManager.SingletonView#getViewModel()
967
     */
968
    public Object getViewModel() {
969
        return p;
970
    }
971

    
972
    /**
973
     * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
974
     */
975
    public ViewInfo getViewInfo() {
976
        ViewInfo m_viewinfo = new ViewInfo();
977
        m_viewinfo.setWidth(400);
978
        m_viewinfo.setHeight(430);
979
        m_viewinfo.setTitle(PluginServices.getText(this, "titulo"));
980
        
981
        return m_viewinfo;
982
    }
983

    
984
    /**
985
     * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
986
     */
987
    public void propertyChange(PropertyChangeEvent evt) {
988
        refreshControls();
989
    }
990

    
991
    /**
992
     * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
993
     */
994
    public void viewActivated() {
995
    }
996

    
997
    /**
998
     * This method initializes jPanel4
999
     *
1000
     * @return javax.swing.JPanel
1001
     */
1002
    private javax.swing.JPanel getJPanel4() {
1003
        if (jPanel4 == null) {
1004
            jPanel4 = new javax.swing.JPanel();
1005

    
1006
            java.awt.FlowLayout layFlowLayout2 = new java.awt.FlowLayout();
1007
            layFlowLayout2.setHgap(30);
1008
            jPanel4.setLayout(layFlowLayout2);
1009
            jPanel4.add(getBtnImportar(), null);
1010
            jPanel4.add(getBtnExportar(), null);
1011
            jPanel4.add(getBtnEditar(), null);
1012
            jPanel4.setPreferredSize(new java.awt.Dimension(360, 30));
1013
        }
1014

    
1015
        return jPanel4;
1016
    }
1017
}