Statistics
| Revision:

root / trunk / applications / appCatalogAndGazetteerClient / src / es / gva / cit / catalog / ui / showtree / ShowTreePanel.java @ 15558

History | View | Annotate | Download (3.34 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 es.gva.cit.catalog.ui.showtree;
43
import javax.swing.JPanel;
44
import javax.swing.JScrollPane;
45

    
46
import next.swing.JTreeTable;
47

    
48
import org.gvsig.i18n.Messages;
49

    
50
import es.gva.cit.catalog.metadataxml.XMLNode;
51
import es.gva.cit.catalog.utils.xmltreetable.XMLTreeTable;
52
import es.gva.cit.catalog.utils.xmltreetable.XMLTreeTableModel;
53

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

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

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

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

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