Statistics
| Revision:

svn-gvsig-desktop / branches / CqCMSDvp / libraries / libCq CMS for java.old / src / org / cresques / ui / raster / InfoPanel.java @ 2705

History | View | Annotate | Download (4.02 KB)

1
/*
2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 *
4
 * Copyright (C) 2004-5.
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
 * cresques@gmail.com
23
 */
24
package org.cresques.ui.raster;
25

    
26
import java.awt.BorderLayout;
27

    
28
import javax.swing.JPanel;
29
import javax.swing.JScrollPane;
30
import javax.swing.JTable;
31
import javax.swing.table.TableColumn;
32

    
33

    
34
/**
35
 * Panel que contiene la informaci?n sobre un raster
36
 * @author Nacho Brodin (brodin_ign@gva.es)
37
 */
38
public class InfoPanel extends JPanel {
39
    final private static long serialVersionUID = -3370601314380922368L;
40
    private JPanel jPanel = null;
41
    private JTable jTable = null;
42
    private JScrollPane jScrollPane = null;
43

    
44
    /**
45
     * Nombre del panel
46
     */
47
    public String nom = "Info";
48

    
49
    /**
50
     * Dialogo padre que contiene a este
51
     */
52
    public FilterRasterDialogPanel parent = null;
53

    
54
    /**
55
     * Propiedades guardadas en una matriz Nx2 con la forma proiedad/valor
56
     */
57
    public Object[][] props = null;
58

    
59
    /**
60
     * Cabeceras de las columnas del dialogo accesibles desde fuera para su traducci?n
61
     */
62
    public Object[] columnNames = { "Propiedad", "Valor" };
63

    
64
    /**
65
     * Constructor que asigna el objeto del panel padre y las propiedades (props) contenidas este.
66
     * Ejecuta el m?todo initialize.
67
     * @param parent Panel que contiene a este
68
     */
69
    public InfoPanel(FilterRasterDialogPanel parent) {
70
        super();
71
        this.parent = parent;
72
        this.props = parent.props;
73
        initialize();
74
    }
75

    
76
    /**
77
     * M?todo de inicializaci?n
78
     *
79
     * @return void
80
     */
81
    public void initialize() {
82
        this.setLayout(new BorderLayout());
83
        this.setSize(350, 210);
84
        this.add(getJPanel(), java.awt.BorderLayout.CENTER);
85
        initControls();
86
    }
87

    
88
    /**
89
     * Resetea los controles por defecto
90
     */
91
    public void resetTable() {
92
        this.jTable = null;
93
        this.jPanel = null;
94
        this.jScrollPane = null;
95
    }
96

    
97
    /**
98
     * Inicializa controles a sus valores por defecto
99
     */
100
    public void initControls() {
101
        TableColumn column = null;
102
        column = jTable.getColumnModel().getColumn(0);
103
        column.setPreferredWidth(10);
104
    }
105

    
106
    /**
107
     * This method initializes jPanel
108
     *
109
     * @return javax.swing.JPanel
110
     */
111
    private JPanel getJPanel() {
112
        if (jPanel == null) {
113
            jPanel = new JPanel();
114
            jPanel.setLayout(new BorderLayout());
115
            jPanel.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
116
        }
117

    
118
        return jPanel;
119
    }
120

    
121
    /**
122
     * This method initializes jTable
123
     *
124
     * @return javax.swing.JTable
125
     */
126
    private JTable getJTable() {
127
        if (jTable == null) {
128
            jTable = new JTable(props, columnNames);
129
            jTable.setShowGrid(true);
130
            jTable.setShowHorizontalLines(false);
131

    
132
            //jTable.setRowHeight(30);
133
            jTable.setCellSelectionEnabled(true);
134
        }
135

    
136
        return jTable;
137
    }
138

    
139
    /**
140
     * This method initializes jScrollPane
141
     *
142
     * @return javax.swing.JScrollPane
143
     */
144
    private JScrollPane getJScrollPane() {
145
        if (jScrollPane == null) {
146
            jScrollPane = new JScrollPane();
147
            jScrollPane.setViewportView(getJTable());
148
        }
149

    
150
        return jScrollPane;
151
    }
152
} //  @jve:decl-index=0:visual-constraint="40,32"