Statistics
| Revision:

gvsig-catalog / org.gvsig.catalog / branches / org.gvsig.catalog-CSW2.0.2 / org.gvsig.catalog / org.gvsig.catalog.lib / src / main / java / org / gvsig / catalog / ui / showtree / ShowTreePanel.java @ 55

History | View | Annotate | Download (3.33 KB)

1

    
2
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3
*
4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19
*
20
* For more information, contact:
21
*
22
*  Generalitat Valenciana
23
*   Conselleria d'Infraestructures i Transport
24
*   Av. Blasco Ib??ez, 50
25
*   46010 VALENCIA
26
*   SPAIN
27
*
28
*      +34 963862235
29
*   gvsig@gva.es
30
*      www.gvsig.gva.es
31
*
32
*    or
33
*
34
*   IVER T.I. S.A
35
*   Salamanca 50
36
*   46005 Valencia
37
*   Spain
38
*
39
*   +34 963163400
40
*   dac@iver.es
41
*/
42
package org.gvsig.catalog.ui.showtree;
43
import javax.swing.JPanel;
44
import javax.swing.JScrollPane;
45

    
46
import next.swing.JTreeTable;
47

    
48
import org.gvsig.catalog.metadataxml.XMLNode;
49
import org.gvsig.catalog.utils.xmltreetable.XMLTreeTable;
50
import org.gvsig.catalog.utils.xmltreetable.XMLTreeTableModel;
51
import org.gvsig.i18n.Messages;
52

    
53
/**
54
 * 
55
 * 
56
 * 
57
 * @author Jorge Piera Llodra (piera_jor@gva.es)
58
 */
59
public class ShowTreePanel extends JPanel {
60
/**
61
 * 
62
 * 
63
 */
64
    private XMLTreeTable treeTable = null;
65
//  @jve:decl-index=0:
66
/**
67
 * 
68
 * 
69
 */
70
    private JScrollPane jScrollPane = null;
71
/**
72
 * 
73
 * 
74
 */
75
    private XMLNode node = null;
76

    
77
/**
78
 * This method initializes
79
 * 
80
 * 
81
 * @param node 
82
 * @param translator 
83
 */
84
    public  ShowTreePanel(XMLNode node) {        
85
        super();
86
        this.node = node;
87
        
88
        initialize();
89
    } 
90

    
91
/**
92
 * This method initializes this
93
 * 
94
 */
95
    private void initialize() {        
96
        this.setSize(900, 600);
97
        this.add(getJScrollPane(), null);
98
    } 
99

    
100
/**
101
 * This method initializes jTree
102
 * 
103
 * 
104
 * @return javax.swing.JTree
105
 */
106
    public JTreeTable getTreeTable() {        
107
        if (treeTable == null) {
108
            XMLTreeTableModel model = new XMLTreeTableModel(node);
109
            model.addJScrollPaneColumn("valueColumn", "tag-value", Messages.getText("value"), 0);
110
            model.addJScrollPaneColumn("attributeColumn", "attribute",
111
                    Messages.getText("attributes"), 0);
112
            treeTable = new XMLTreeTable(model);
113
            model.configureView(treeTable);
114
          
115
        }
116
        return treeTable;
117
    } 
118

    
119
/**
120
 * This method initializes jScrollPane
121
 * 
122
 * 
123
 * @return javax.swing.JScrollPane
124
 */
125
    private JScrollPane getJScrollPane() {        
126
        if (jScrollPane == null) {
127
            jScrollPane = new JScrollPane(getTreeTable());
128
            jScrollPane.setPreferredSize(new java.awt.Dimension(775, 600));
129
            jScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
130
            jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
131
        }
132
        return jScrollPane;
133
    } 
134
 }
135
//  @jve:decl-index=0:visual-constraint="10,10"