Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / gui / ProjectWindow.java @ 7343

History | View | Annotate | Download (28.3 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.documents.gui;
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.util.ArrayList;
53
import java.util.Iterator;
54

    
55
import javax.swing.ButtonGroup;
56
import javax.swing.JDialog;
57
import javax.swing.JLabel;
58
import javax.swing.JList;
59
import javax.swing.JOptionPane;
60
import javax.swing.JPanel;
61
import javax.swing.JRadioButton;
62
import javax.swing.JScrollPane;
63
import javax.swing.border.TitledBorder;
64

    
65
import org.gvsig.gui.beans.swing.JButton;
66

    
67
import com.iver.andami.PluginServices;
68
import com.iver.andami.messages.NotificationManager;
69
import com.iver.andami.ui.mdiManager.IWindow;
70
import com.iver.andami.ui.mdiManager.SingletonWindow;
71
import com.iver.andami.ui.mdiManager.WindowInfo;
72
import com.iver.cit.gvsig.ProjectExtension;
73
import com.iver.cit.gvsig.project.Project;
74
import com.iver.cit.gvsig.project.documents.ProjectDocument;
75
import com.iver.cit.gvsig.project.documents.ProjectDocumentFactory;
76
import com.iver.utiles.DefaultListModel;
77
import com.iver.utiles.extensionPoints.ExtensionPoint;
78
import com.iver.utiles.extensionPoints.ExtensionPoints;
79
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
80

    
81

    
82
/**
83
 * Clase principal del proyecto donde se puede operar para crear
84
 * cualquier tipo de documento.
85
 *
86
 * @author Vicente Caballero Navarro
87
 */
88
public class ProjectWindow extends JPanel implements PropertyChangeListener,
89
        IWindow, SingletonWindow {
90
        private JPanel jPanel = null;
91
        private JRadioButton[] btnsDocuments = null;
92
        private ButtonGroup grupo = new ButtonGroup();
93
        private JPanel jPanel1 = null;
94
        private JList lstDocs = null;
95
        private JPanel jPanel2 = null;
96
        private JButton btnNuevo = null;
97
        private JButton btnPropiedades = null;
98
        private JButton btnAbrir = null;
99
        private JButton btnBorrar = null;
100
        private JButton btnRenombrar = null;
101
        private JPanel jPanel3 = null;
102
        private JLabel jLabel = null;
103
        private JLabel lblNombreSesion = null;
104
        private JLabel jLabel1 = null;
105
        private JLabel lblGuardado = null;
106
        private JLabel jLabel2 = null;
107
        private JLabel lblFecha = null;
108
        private JButton btnImportar = null;
109
        private JButton btnExportar = null;
110
        private JButton btnEditar = null;
111
        // The properties of the Project Manager window (size, position, etc):
112
        private WindowInfo m_viewInfo=null;
113

    
114
        /** Proyecto representado en la vista */
115
        private Project p;
116

    
117
        private JScrollPane jScrollPane = null;
118
        private JPanel jPanel4 = null;
119
        private JScrollPane jScrollPane1 = null;
120

    
121
        /**
122
         * This is the default constructor
123
         *
124
         * @param project Extension
125
         */
126
        public ProjectWindow() {
127
                super();
128
                initialize();
129
                refreshControls();
130
        }
131

    
132
        /**
133
         * Asigna el proyecto a la ventana
134
         *
135
         * @param p Proyecto con el que se operar? a trav?s de este di?logo
136
         */
137
        public void setProject(Project p) {
138
                this.p = p;
139
                p.addPropertyChangeListener(this);
140
                refreshControls();
141
        }
142

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

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

    
176
                        String doc=getDocumentSelected();
177
                        model = new DefaultListModel(p.getDocumentsByType(doc));
178
                        tituloMarco=doc;
179

    
180
                        lstDocs.setModel(model);
181
                        ((TitledBorder)getJPanel1().getBorder()).setTitle(tituloMarco);
182
                        getJPanel1().repaint(1);
183
                        activarBotones();
184
                }
185
        }
186

    
187
        private String getDocumentSelected() {
188
                JRadioButton btnSelected=null;
189
                for (int i=0;i<btnsDocuments.length;i++) {
190
                        if (btnsDocuments[i].isSelected()) {
191
                                btnSelected=btnsDocuments[i];
192
                                return btnSelected.getName();
193
                        }
194
                }
195

    
196
                return null;
197
        }
198

    
199
        /**
200
         * Refresca las etiquetas con la informaci?n del proyecto
201
         */
202
        private void refreshProperties() {
203
                if (p != null) {
204
                        lblNombreSesion.setText(p.getName());
205
                        String path = ProjectExtension.getPath();
206
                        if (path != null) {
207
                                File f = new File(path);
208
                                lblGuardado.setText(f.toString());
209
                        } else {
210
                                lblGuardado.setText("");
211
                        }
212
                        lblFecha.setText(p.getCreationDate());
213
                }
214
        }
215

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

    
224
        /**
225
         * This method initializes this
226
         */
227
        private void initialize() {
228
                GridBagConstraints gridBagConstraints = new GridBagConstraints();
229
                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
230
                gridBagConstraints.weightx = 1.0;
231
                gridBagConstraints.weighty = 1.0;
232
                GridBagLayout layout = new GridBagLayout();
233
                setLayout(layout);
234
                GridBagConstraints c = new GridBagConstraints();
235
                c.fill = GridBagConstraints.HORIZONTAL;
236
                c.gridy=0;
237
                c.insets = new Insets(2, 5, 2, 5);
238

    
239
                layout.setConstraints(getJPanel(),c);
240
                c.fill = GridBagConstraints.BOTH;
241
                c.gridy=1;
242
                c.weightx = 1.0;
243
                c.weighty = 1.0;
244
                layout.setConstraints(getJPanel1(),c);
245
                add(getJPanel1(), null);
246
                c.fill = GridBagConstraints.HORIZONTAL;
247
                c.weightx = 0;
248
                c.weighty = 0;
249
                c.gridy=2;
250
                layout.setConstraints(getJPanel3(),c);
251
                add(getJPanel3(), null);
252

    
253
                this.setSize(430, 544);
254
                this.setPreferredSize(new java.awt.Dimension(430, 430));
255
                this.setMinimumSize(new java.awt.Dimension(430, 430));
256
                this.add(getJScrollPane1(), gridBagConstraints);
257
                for (int i=0;i<btnsDocuments.length;i++) {
258
                        grupo.add(btnsDocuments[i]);
259
                }
260
                if (btnsDocuments.length>0)
261
                        btnsDocuments[0].setSelected(true);
262
        }
263
        private ProjectDocument createDocument(String s) {
264
                ExtensionPoints extensionPoints =
265
                        ExtensionPointsSingleton.getInstance();
266

    
267
                ExtensionPoint extensionPoint =(ExtensionPoint)extensionPoints.get("Documents");
268
                Iterator iterator = extensionPoint.keySet().iterator();
269
                while (iterator.hasNext()) {
270
                        try {
271
                                ProjectDocumentFactory documentFactory = (ProjectDocumentFactory)extensionPoint.create((String)iterator.next());
272
                                if (documentFactory.getRegisterName().equals(s)) {
273
                                        ProjectDocument document=documentFactory.createFromGUI(p);
274
                                        document.setProjectDocumentFactory(documentFactory);
275
                                        return document;
276
                                }
277
                        } catch (InstantiationException e) {
278
                                e.printStackTrace();
279
                        } catch (IllegalAccessException e) {
280
                                e.printStackTrace();
281
                        } catch (ClassCastException e) {
282
                                e.printStackTrace();
283
                        }
284
                }
285
                return null;
286
        }
287
        /**
288
         * Crea un nuevo project element
289
         *
290
         * @throws Exception DOCUMENT ME!
291
         */
292
        private void newProjectDocument() throws Exception {
293
                String s=getDocumentSelected();
294
                ProjectDocument doc=createDocument(s);
295
                if (doc!=null)
296
                        p.addDocument(doc);
297
        }
298

    
299
        /**
300
         * Abre la ventana de un nuevo project element
301
         */
302
        private void abrir() {
303
                int[] indexes = lstDocs.getSelectedIndices();
304
                for (int i=indexes.length-1;i>=0;i--) {
305
                        int index=indexes[i];
306
                        if (index == -1) {
307
                                return;
308
                        }
309
                        String s=getDocumentSelected();
310
                        ArrayList documents=p.getDocumentsByType(s);
311
                        ProjectDocument doc=(ProjectDocument)documents.get(index);
312
                        IWindow window=doc.createWindow();
313
                        PluginServices.getMDIManager().addWindow(window);
314
                }
315
        }
316

    
317
        /**
318
         * Cambia el nombre de un project element
319
         */
320
        private void renombrar() {
321
                int index = lstDocs.getSelectedIndex();
322

    
323
                if (index == -1) {
324
                        return;
325
                }
326
                String s=getDocumentSelected();
327
                ArrayList documents=p.getDocumentsByType(s);
328
                ProjectDocument doc=(ProjectDocument)documents.get(index);
329

    
330
                if (doc.isLocked()) {
331
                        JOptionPane.showMessageDialog(this,        PluginServices.getText(this, "locked_element_it_cannot_be_renamed"));
332
                        return;
333
                }
334

    
335
                JOptionPane pane = new JOptionPane();
336
                pane.setMessage(PluginServices.getText(this, "introduce_nombre"));
337
                pane.setMessageType(JOptionPane.QUESTION_MESSAGE);
338
                pane.setWantsInput(true);
339
                pane.setInitialSelectionValue(doc.getName());
340
        pane.setInputValue(doc.getName());
341
                JDialog dlg = pane.createDialog((Component) PluginServices.getMainFrame(),
342
                                PluginServices.getText(this, "renombrar"));
343
                dlg.setModal(true);
344
                dlg.show();
345

    
346
                String nuevoNombre = pane.getInputValue().toString().trim();
347

    
348
                if (nuevoNombre.length() == 0) {
349
                        return;
350
                }
351

    
352
                if (nuevoNombre == null) {
353
                        return;
354
                }
355

    
356
                for (int i=0; i<lstDocs.getModel().getSize(); i++){
357
                        if (i==index) continue;
358
                        if (((ProjectDocument)lstDocs.getModel().getElementAt(i)).getName().equals(nuevoNombre)){
359
                                JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(), PluginServices.getText(this, "elemento_ya_existe"));
360
                                return;
361
                        }
362

    
363
                }
364
                doc.setName(nuevoNombre);
365

    
366
                refreshList();
367
        }
368

    
369
        /**
370
         * Borra un project element
371
         */
372
        private void borrar() {
373
                int res = JOptionPane.showConfirmDialog((Component) PluginServices.getMainFrame(),
374
                                PluginServices.getText(this, "confirmar_borrar"),
375
                                PluginServices.getText(this, "borrar"),
376
                                JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE);
377

    
378
                if (res == JOptionPane.YES_OPTION) {
379
                        int[] indexes = lstDocs.getSelectedIndices();
380
                        for (int i=indexes.length-1;i>=0;i--) {
381
                                int index=indexes[i];
382
                                String s=getDocumentSelected();
383
                                ArrayList documents=p.getDocumentsByType(s);
384
                                ProjectDocument doc=(ProjectDocument)documents.get(index);
385
                                if (doc.isLocked()) {
386
                                        JOptionPane.showMessageDialog(this,        PluginServices.getText(this, "locked_element_it_cannot_be_deleted"));
387
                                        return;
388
                                }
389
                                PluginServices.getMDIManager().closeSingletonWindow(doc);
390
                                p.delDocument(doc);
391
                        }
392
                        refreshList();
393

    
394
                }
395
        }
396

    
397
        /**
398
         * Muestra el di?logo de propiedades de un project element
399
         */
400
        private void propiedades() {
401
                int index = lstDocs.getSelectedIndex();
402

    
403
                if (index == -1) {
404
                        return;
405
                }
406

    
407
                IWindow dlg = null;
408
                String s=getDocumentSelected();
409
                ArrayList documents=p.getDocumentsByType(s);
410
                ProjectDocument doc=(ProjectDocument) documents.get(index);
411
                if (doc.isLocked()) {
412
                        JOptionPane.showMessageDialog(this,        PluginServices.getText(this, "locked_element"));
413
                        return;
414
                }
415
                dlg=doc.getProperties();
416
                PluginServices.getMDIManager().addWindow(dlg);
417

    
418
                refreshControls();
419
                lstDocs.setSelectedIndex(index);
420
        }
421

    
422
        /**
423
         * This method initializes jPanel
424
         *
425
         * @return JPanel
426
         */
427
        private JPanel getJPanel() {
428
                if (jPanel == null) {
429
                        jPanel = new JPanel();
430

    
431
                        java.awt.FlowLayout layFlowLayout1 = new java.awt.FlowLayout();
432
                        layFlowLayout1.setHgap(15);
433
                        jPanel.setLayout(layFlowLayout1);
434
                        JRadioButton[] btns=getBtnDocuments();
435
                        for (int i=0;i<btns.length;i++) {
436
                                jPanel.add(btns[i],null);
437
                        }
438
                        jPanel.setName("tipoDocPanel");
439
                        //jPanel.setPreferredSize(new java.awt.Dimension(700, 200));
440
                        jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
441
                                        null, PluginServices.getText(this, "tipos_de_documentos"),
442
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
443
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
444
                }
445

    
446
                return jPanel;
447
        }
448

    
449
        /**
450
         * This method initializes btnVistas
451
         *
452
         * @return JRadioButton
453
         */
454
        private JRadioButton[] getBtnDocuments() {
455
                if (btnsDocuments == null) {
456
                        ExtensionPoints extensionPoints =
457
                                ExtensionPointsSingleton.getInstance();
458

    
459
                        ExtensionPoint extensionPoint =(ExtensionPoint)extensionPoints.get("Documents");
460
                        ArrayList btns=new ArrayList();
461
                        Iterator iterator = extensionPoint.keySet().iterator();
462
                        while (iterator.hasNext()) {
463
                                try {
464
                                        ProjectDocumentFactory documentFactory = (ProjectDocumentFactory)extensionPoint.create((String)iterator.next());
465
                                        JRadioButton rb=new JRadioButton();
466

    
467
                                        rb.setIcon(documentFactory.getButtonIcon());
468
                                        rb.setSelectedIcon(documentFactory.getSelectedButtonIcon());
469
                                        rb.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
470
                                        rb.setText(documentFactory.getNameType());
471
                                        rb.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
472
                                        rb.setName(documentFactory.getRegisterName());
473
                                        rb.addChangeListener(new javax.swing.event.ChangeListener() {
474
                                                        public void stateChanged(javax.swing.event.ChangeEvent e) {
475
                                                                refreshList();
476
                                                        }
477
                                                });
478
                                        btns.add(rb);
479

    
480
                                } catch (InstantiationException e) {
481
                                        e.printStackTrace();
482
                                } catch (IllegalAccessException e) {
483
                                        e.printStackTrace();
484
                                } catch (ClassCastException e) {
485
                                        e.printStackTrace();
486
                                }
487
                        }
488

    
489

    
490
                        btnsDocuments=(JRadioButton[])btns.toArray(new JRadioButton[0]);
491

    
492
                }
493

    
494
                return btnsDocuments;
495
        }
496

    
497
        /**
498
         * This method initializes jPanel1
499
         *
500
         * @return JPanel
501
         */
502
        private JPanel getJPanel1() {
503
                if (jPanel1 == null) {
504
                        jPanel1 = new JPanel();
505

    
506
                        GridBagLayout layout2 = new GridBagLayout();
507
                        GridBagConstraints c = new GridBagConstraints();
508

    
509
                        jPanel1.setLayout(layout2);
510
                        c.insets = new Insets(2, 5, 2, 5);
511
                        c.anchor = GridBagConstraints.WEST;
512
                        c.fill = GridBagConstraints.BOTH;
513
                        c.weightx= 1.0;
514
                        c.weighty = 1.0;
515
                        layout2.setConstraints(getJScrollPane(),c);
516
                        jPanel1.add(getJScrollPane());
517

    
518
                        c.anchor = GridBagConstraints.EAST;
519

    
520

    
521
                        c.fill = GridBagConstraints.NONE;
522
                        c.weightx= 0;
523
                        c.weighty = 0;
524
                        layout2.setConstraints(getJPanel2(),c);
525
                        jPanel1.add(getJPanel2());
526

    
527
                        //jPanel1.setPreferredSize(new java.awt.Dimension(430,170));
528
                        jPanel1.setMinimumSize(new java.awt.Dimension(430,170));
529
                        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(
530
                                        null,
531
                                        PluginServices.getText(this, "documentos_existentes"),
532
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
533
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
534
                }
535

    
536
                return jPanel1;
537
        }
538

    
539
        /**
540
         * This method initializes lstDocs
541
         *
542
         * @return JList
543
         */
544
        private JList getLstDocs() {
545
                if (lstDocs == null) {
546
                        lstDocs = new JList();
547
                        lstDocs.addMouseListener(new java.awt.event.MouseAdapter() {
548
                                        public ProjectDocument[] getSelecteds() {
549
                                                if (lstDocs.getSelectedIndex() < 0) {
550
                                                        return new ProjectDocument[0];
551
                                                }
552
                                                Object[] seleteds = lstDocs.getSelectedValues();
553
                                                ProjectDocument[] returnValue = new ProjectDocument[seleteds.length];
554
                                                System.arraycopy(seleteds,0,returnValue,0,seleteds.length);
555
                                                return returnValue;
556
                                        }
557

    
558
                                        public ProjectDocument getItem(java.awt.event.MouseEvent e) {
559
                                                if (lstDocs.getSelectedIndex() < 0) {
560
                                                        return null;
561
                                                }
562
                                                Component c = lstDocs.getComponentAt(e.getPoint());
563

    
564
                                                return null;
565
                                        }
566

    
567
                                        public void mouseClicked(java.awt.event.MouseEvent e) {
568
                                        /*        if (e.getButton() == java.awt.event.MouseEvent.BUTTON3) {
569
                                                        String docType;
570
                                                        ProjectDocument[] selecteds = this.getSelecteds();
571

572
                                                        if (selecteds == null) return;
573
                                                        if (btnMapas.isSelected()) {
574
                                                                docType = "Map";
575
                                                        } else if (btnTablas.isSelected()) {
576
                                                                docType = "Table";
577
                                                        } else {
578
                                                                docType = "View";
579
                                                        }
580
                                                        DocumentPopupMenu menu = new DocumentPopupMenu(docType,this.getItem(e),(ProjectDocument[])selecteds);
581
                                                        if (menu.getActionsVisibles() < 1) return;
582
                                                        lstDocs.add(menu);
583
                                                        menu.show(e.getComponent(), e.getX(), e.getY());
584
                                                        return;
585
                                                }
586
                                                if (e.getClickCount() == 2) {
587
                                                        abrir();
588
                                                }
589
*/
590
                                        }
591
                                });
592
                        lstDocs.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
593
                                        public void valueChanged(
594
                                                javax.swing.event.ListSelectionEvent e) {
595
                                                activarBotones();
596
                                        }
597
                                });
598
                }
599

    
600
                return lstDocs;
601
        }
602

    
603
        /**
604
         * This method initializes jPanel2
605
         *
606
         * @return JPanel
607
         */
608
        private JPanel getJPanel2() {
609
                if (jPanel2 == null) {
610
                        jPanel2 = new JPanel();
611

    
612
                        //FlowLayout layout = new FlowLayout();
613
                        GridLayout layout = new GridLayout(5,1);
614
                        layout.setVgap(7);
615

    
616
                        jPanel2.setLayout(layout);
617
                        jPanel2.add(getBtnNuevo(), null);
618
                        jPanel2.add(getBtnAbrir(), null);
619
                        jPanel2.add(getBtnRenombrar(), null);
620
                        jPanel2.add(getBtnBorrar(), null);
621
                        jPanel2.add(getBtnPropiedades(), null);
622
                        jPanel2.setPreferredSize(new java.awt.Dimension(100, 150));
623
                        jPanel2.setMinimumSize(new java.awt.Dimension(100, 150));
624
                        jPanel2.setMaximumSize(new java.awt.Dimension(100, 150));
625
                }
626

    
627
                return jPanel2;
628
        }
629

    
630
        /**
631
         * This method initializes btnNuevo
632
         *
633
         * @return JButton
634
         */
635
        private JButton getBtnNuevo() {
636
                if (btnNuevo == null) {
637
                        btnNuevo = new JButton();
638
                        btnNuevo.setName("btnNuevo");
639
                        btnNuevo.setText(PluginServices.getText(this, "nuevo"));
640
                        btnNuevo.setMargin(new java.awt.Insets(2, 2, 2, 2));
641
                        btnNuevo.addActionListener(new java.awt.event.ActionListener() {
642
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
643
                                                try {
644
                                                        newProjectDocument();
645
                                                } catch (Exception e1) {
646
                                                        NotificationManager.addError(e1.getLocalizedMessage(),
647
                                                                e1);
648
                                                }
649
                                        }
650
                                });
651
                }
652

    
653
                return btnNuevo;
654
        }
655

    
656
        /**
657
         * This method initializes btnPropiedades
658
         *
659
         * @return JButton
660
         */
661
        private JButton getBtnPropiedades() {
662
                if (btnPropiedades == null) {
663
                        btnPropiedades = new JButton();
664
                        btnPropiedades.setText(PluginServices.getText(this, "propiedades"));
665
                        btnPropiedades.setName("btnPropiedades");
666
                        btnPropiedades.setEnabled(false);
667
                        btnPropiedades.setMargin(new java.awt.Insets(2, 2, 2, 2));
668
                        btnPropiedades.addActionListener(new java.awt.event.ActionListener() {
669
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
670
                                                propiedades();
671
                                        }
672
                                });
673
                }
674

    
675
                return btnPropiedades;
676
        }
677

    
678
        /**
679
         * This method initializes btnAbrir
680
         *
681
         * @return JButton
682
         */
683
        private JButton getBtnAbrir() {
684
                if (btnAbrir == null) {
685
                        btnAbrir = new JButton();
686
                        btnAbrir.setName("btnAbrir");
687
                        btnAbrir.setText(PluginServices.getText(this, "abrir"));
688
                        btnAbrir.setEnabled(false);
689
                        btnAbrir.setMargin(new java.awt.Insets(2, 2, 2, 2));
690
                        btnAbrir.addActionListener(new java.awt.event.ActionListener() {
691
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
692
                                                abrir();
693
                                        }
694
                                });
695
                }
696

    
697
                return btnAbrir;
698
        }
699

    
700
        /**
701
         * This method initializes btnBorrar
702
         *
703
         * @return JButton
704
         */
705
        private JButton getBtnBorrar() {
706
                if (btnBorrar == null) {
707
                        btnBorrar = new JButton();
708
                        btnBorrar.setText(PluginServices.getText(this, "borrar"));
709
                        btnBorrar.setName("btnBorrar");
710
                        btnBorrar.setEnabled(false);
711
                        btnBorrar.setMargin(new java.awt.Insets(2, 2, 2, 2));
712
                        btnBorrar.addActionListener(new java.awt.event.ActionListener() {
713
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
714
                                                borrar();
715
                                        }
716
                                });
717
                }
718

    
719
                return btnBorrar;
720
        }
721

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

    
741
                return btnRenombrar;
742
        }
743

    
744
        /**
745
         * This method initializes jPanel3
746
         *
747
         * @return JPanel
748
         */
749
        private JPanel getJPanel3() {
750
                if (jPanel3 == null) {
751
                        jPanel3 = new JPanel();
752

    
753
                        GridBagLayout layout3 = new GridBagLayout();
754
                        GridBagConstraints c = new GridBagConstraints();
755
                        jPanel3.setLayout(layout3);
756
                        c.insets = new Insets(2, 5, 0, 5);
757
                        c.anchor = GridBagConstraints.WEST;
758
                        c.gridx =0;
759
                        c.gridy =0;
760
                        layout3.setConstraints(getJLabel(),c);
761
                        jPanel3.add(getJLabel(), null);
762
                        c.fill = GridBagConstraints.HORIZONTAL;
763
                        c.weightx=1.0;
764
                        c.gridx =1;
765
                        layout3.setConstraints(getLblNombreSesion(),c);
766
                        jPanel3.add(getLblNombreSesion(), null);
767

    
768
                        c.gridx =0;
769
                        c.gridy =1;
770
                        c.fill = GridBagConstraints.NONE;
771
                        c.weightx=0.0;
772
                        layout3.setConstraints(getJLabel1(),c);
773
                        jPanel3.add(getJLabel1(), null);
774
                        c.fill = GridBagConstraints.HORIZONTAL;
775
                        c.weightx=1.0;
776
                        c.gridx =1;
777
                        layout3.setConstraints(getLblGuardado(),c);
778
                        jPanel3.add(getLblGuardado(), null);
779

    
780
                        c.gridx =0;
781
                        c.gridy =2;
782
                        c.fill = GridBagConstraints.NONE;
783
                        c.weightx=0.0;
784
                        layout3.setConstraints(getJLabel2(),c);
785
                        jPanel3.add(getJLabel2(), null);
786

    
787
                        c.fill = GridBagConstraints.HORIZONTAL;
788
                        c.weightx=1.0;
789
                        c.gridx =1;
790
                        layout3.setConstraints(getLblFecha(),c);
791
                        jPanel3.add(getLblFecha(), null);
792
                        jPanel3.setPreferredSize(new java.awt.Dimension(430, 125));
793
                        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(
794
                                        null, PluginServices.getText(this, "propiedades_sesion"),
795
                                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
796
                                        javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
797
                        c.gridx =1;
798
                        c.gridy =4;
799
                        c.anchor = GridBagConstraints.EAST;
800
                        layout3.setConstraints(getJPanel4(),c);
801
                        jPanel3.add(getJPanel4(), null);
802
                }
803

    
804
                return jPanel3;
805
        }
806

    
807
        /**
808
         * This method initializes jLabel
809
         *
810
         * @return JLabel
811
         */
812
        private JLabel getJLabel() {
813
                if (jLabel == null) {
814
                        jLabel = new JLabel();
815
                        jLabel.setText(PluginServices.getText(this, "nombre_sesion") + ":");
816
                        jLabel.setPreferredSize(new java.awt.Dimension(150, 16));
817
                }
818

    
819
                return jLabel;
820
        }
821

    
822
        /**
823
         * This method initializes lblNombreSesion
824
         *
825
         * @return JLabel
826
         */
827
        private JLabel getLblNombreSesion() {
828
                if (lblNombreSesion == null) {
829
                        lblNombreSesion = new JLabel();
830
                        lblNombreSesion.setText("");
831
                        lblNombreSesion.setName("lblNombreSesion");
832
                        lblNombreSesion.setPreferredSize(new java.awt.Dimension(200, 16));
833
                        lblNombreSesion.setAutoscrolls(true);
834
                }
835

    
836
                return lblNombreSesion;
837
        }
838

    
839
        /**
840
         * This method initializes jLabel1
841
         *
842
         * @return JLabel
843
         */
844
        private JLabel getJLabel1() {
845
                if (jLabel1 == null) {
846
                        jLabel1 = new JLabel();
847
                        jLabel1.setText(PluginServices.getText(this, "guardado") + ":");
848
                        jLabel1.setPreferredSize(new java.awt.Dimension(150, 16));
849
                }
850

    
851
                return jLabel1;
852
        }
853

    
854
        /**
855
         * This method initializes lblGuardado
856
         *
857
         * @return JLabel
858
         */
859
        private JLabel getLblGuardado() {
860
                if (lblGuardado == null) {
861
                        lblGuardado = new JLabel();
862
                        lblGuardado.setText("");
863
                        lblGuardado.setPreferredSize(new java.awt.Dimension(200, 16));
864
                        lblGuardado.setAutoscrolls(true);
865
                }
866

    
867
                return lblGuardado;
868
        }
869

    
870
        /**
871
         * This method initializes jLabel2
872
         *
873
         * @return JLabel
874
         */
875
        private JLabel getJLabel2() {
876
                if (jLabel2 == null) {
877
                        jLabel2 = new JLabel();
878
                        jLabel2.setText(PluginServices.getText(this, "creation_date") +
879
                                ":");
880
                        jLabel2.setPreferredSize(new java.awt.Dimension(150, 16));
881
                }
882

    
883
                return jLabel2;
884
        }
885

    
886
        /**
887
         * This method initializes lblFecha
888
         *
889
         * @return JLabel
890
         */
891
        private JLabel getLblFecha() {
892
                if (lblFecha == null) {
893
                        lblFecha = new JLabel();
894
                        lblFecha.setText("");
895
                        lblFecha.setPreferredSize(new java.awt.Dimension(200, 16));
896
                        lblFecha.setAutoscrolls(true);
897
                }
898

    
899
                return lblFecha;
900
        }
901

    
902
        /**
903
         * This method initializes btnImportar
904
         *
905
         * @return JButton
906
         */
907
        private JButton getBtnImportar() {
908
                if (btnImportar == null) {
909
                        btnImportar = new JButton();
910
                        btnImportar.setPreferredSize(new java.awt.Dimension(80, 23));
911
                        btnImportar.setText(PluginServices.getText(this, "importar"));
912
                        btnImportar.setName("btnImportar");
913
                        btnImportar.setMargin(new java.awt.Insets(2, 2, 2, 2));
914
                        // TODO implement import
915
                        btnImportar.setVisible(false);
916
                }
917

    
918
                return btnImportar;
919
        }
920

    
921
        /**
922
         * This method initializes btnExportar
923
         *
924
         * @return JButton
925
         */
926
        private JButton getBtnExportar() {
927
                if (btnExportar == null) {
928
                        btnExportar = new JButton();
929
                        btnExportar.setPreferredSize(new java.awt.Dimension(80, 23));
930
                        btnExportar.setText(PluginServices.getText(this, "exportar"));
931
                        btnExportar.setName("btnExportar");
932
                        btnExportar.setMargin(new java.awt.Insets(2, 2, 2, 2));
933
                        // TODO implement export
934
                        btnExportar.setVisible(false);
935
                }
936

    
937
                return btnExportar;
938
        }
939

    
940
        /**
941
         * This method initializes btnEditar
942
         *
943
         * @return JButton
944
         */
945
        private JButton getBtnEditar() {
946
                if (btnEditar == null) {
947
                        btnEditar = new JButton();
948
                        btnEditar.setPreferredSize(new java.awt.Dimension(80, 23));
949
                        btnEditar.setText(PluginServices.getText(this, "propiedades"));
950

    
951
                        btnEditar.setName("btnEditar");
952
                        btnEditar.setMargin(new java.awt.Insets(2, 2, 2, 2));
953

    
954
                        btnEditar.addActionListener(new java.awt.event.ActionListener() {
955
                                        public void actionPerformed(java.awt.event.ActionEvent e) {
956
                                                ProjectProperties dlg = new ProjectProperties(p);
957
                                                PluginServices.getMDIManager().addWindow(dlg);
958
                                                refreshProperties();
959
                                        }
960
                                });
961
                }
962

    
963
                return btnEditar;
964
        }
965

    
966
        /**
967
         * This method initializes jScrollPane
968
         *
969
         * @return JScrollPane
970
         */
971
        private JScrollPane getJScrollPane() {
972
                if (jScrollPane == null) {
973
                        jScrollPane = new JScrollPane();
974
                        jScrollPane.setViewportView(getLstDocs());
975
                        jScrollPane.setPreferredSize(new java.awt.Dimension(200, 100));
976
                        jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
977
                }
978

    
979
                return jScrollPane;
980
        }
981

    
982
        /**
983
         * @see com.iver.mdiApp.ui.MDIManager.SingletonWindow#getWindowModel()
984
         */
985
        public Object getWindowModel() {
986
                return p;
987
        }
988

    
989
    /**
990
     * This method is used to get <strong>an initial</strong> ViewInfo object
991
     * for this Project Manager window. It is not intended to retrieve the
992
     * ViewInfo object in a later time.
993
     * <strong>Use PluginServices.getMDIManager().getViewInfo(view)
994
     * to retrieve the ViewInfo object at any time after the creation of the
995
     * object.
996
     *
997
     * @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo()
998
     */
999
        public WindowInfo getWindowInfo() {
1000
                //if (m_viewInfo==null) {
1001
                        m_viewInfo = new WindowInfo(WindowInfo.MAXIMIZABLE);
1002
                        //m_viewInfo = new ViewInfo(ViewInfo.MAXIMIZABLE+ViewInfo.RESIZABLE);
1003
                        m_viewInfo.setWidth(this.getWidth());
1004
                        m_viewInfo.setHeight(this.getHeight());
1005
                        m_viewInfo.setNormalWidth(this.getPreferredSize().width);
1006
                        m_viewInfo.setNormalHeight(this.getPreferredSize().height);
1007

    
1008
                        m_viewInfo.setTitle(PluginServices.getText(this, "titulo"));
1009
                //}
1010
                return m_viewInfo;
1011
        }
1012

    
1013
        /**
1014
         * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
1015
         */
1016
        public void propertyChange(PropertyChangeEvent evt) {
1017
                refreshControls();
1018
        }
1019

    
1020
        /**
1021
         * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
1022
         */
1023
        public void viewActivated() {
1024
        }
1025

    
1026
        /**
1027
         * This method initializes jPanel4
1028
         *
1029
         * @return JPanel
1030
         */
1031
        private JPanel getJPanel4() {
1032
                if (jPanel4 == null) {
1033
                        jPanel4 = new JPanel();
1034

    
1035
                        jPanel4.setLayout(new FlowLayout(FlowLayout.RIGHT));
1036
                        jPanel4.setPreferredSize(new java.awt.Dimension(414, 30));
1037
                        jPanel4.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
1038
                        jPanel4.add(getBtnImportar(), null);
1039
                        jPanel4.add(getBtnExportar(), null);
1040
                        jPanel4.add(getBtnEditar(), null);
1041
                }
1042

    
1043
                return jPanel4;
1044
        }
1045

    
1046
        /**
1047
         * This method initializes jScrollPane1
1048
         *
1049
         * @return javax.swing.JScrollPane
1050
         */
1051
        private JScrollPane getJScrollPane1() {
1052
                if (jScrollPane1 == null) {
1053
                        jScrollPane1 = new JScrollPane();
1054
                        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_NEVER);
1055
                        jScrollPane1.setPreferredSize(new java.awt.Dimension(433,200));
1056
                        jScrollPane1.setViewportView(getJPanel());
1057
                }
1058
                return jScrollPane1;
1059
        }
1060
}  //  @jve:decl-index=0:visual-constraint="10,10"