Statistics
| Revision:

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

History | View | Annotate | Download (2.26 KB)

1
package org.cresques.ui.raster;
2

    
3
import java.awt.BorderLayout;
4

    
5
import javax.swing.JPanel;
6
import javax.swing.JScrollPane;
7
import javax.swing.JTable;
8
import javax.swing.table.TableColumn;
9
/**
10
 * 
11
 * @author Nacho Brodin <brodin_ign@gva.es>
12
 *
13
 */
14
public class InfoPanel extends JPanel{
15
        
16
        private JPanel jPanel = null;
17
        private JTable jTable = null;
18
        private JScrollPane jScrollPane = null;
19
        
20
        public String                                         nom = "Info";
21
        public FilterRasterDialogPanel         parent = null;
22
        public Object[][]                                props = null;
23
        public Object[]                                        columnNames = {"Propiedad","Valor"};
24
                
25
        
26
        public InfoPanel(FilterRasterDialogPanel parent){
27
                super();
28
                this.parent = parent;
29
                this.props = parent.props;                
30
                initialize();
31
        }                
32
        
33
        /**
34
         * This method initializes this
35
         * 
36
         * @return void
37
         */
38
        public void initialize() {
39
        this.setLayout(new BorderLayout());
40
        this.setSize(350, 210);
41
        this.add(getJPanel(), java.awt.BorderLayout.CENTER);       
42
               initControls();
43
        }
44
        
45
        /**
46
         * Resetea los controles por defecto
47
         */
48
        public void resetTable(){
49
                this.jTable = null;
50
                this.jPanel = null;
51
                this.jScrollPane = null;
52
        }
53
        /**
54
         * Inicializa controles a sus valores por defecto
55
         */
56
        public void initControls(){
57
                TableColumn column = null;
58
                column = jTable.getColumnModel().getColumn(0);
59
                column.setPreferredWidth(10);  
60
        }
61
                
62
        /**
63
         * This method initializes jPanel        
64
         *         
65
         * @return javax.swing.JPanel        
66
         */    
67
        private JPanel getJPanel() {
68
                if (jPanel == null) {
69
                        jPanel = new JPanel();
70
                        jPanel.setLayout(new BorderLayout());
71
                        jPanel.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
72
                }
73
                return jPanel;
74
        }
75
        /**
76
         * This method initializes jTable        
77
         *         
78
         * @return javax.swing.JTable        
79
         */    
80
        private JTable getJTable() {
81
                if (jTable == null) {
82
                        jTable = new JTable(props, columnNames);
83
                        jTable.setShowGrid(true);
84
                        jTable.setShowHorizontalLines(false);
85
                        //jTable.setRowHeight(30);
86
                        jTable.setCellSelectionEnabled(true);
87
                }
88
                return jTable;
89
        }
90
        /**
91
         * This method initializes jScrollPane        
92
         *         
93
         * @return javax.swing.JScrollPane        
94
         */    
95
        private JScrollPane getJScrollPane() {
96
                if (jScrollPane == null) {
97
                        jScrollPane = new JScrollPane();
98
                        jScrollPane.setViewportView(getJTable());
99
                        
100
                }
101
                return jScrollPane;
102
        }
103
  }  //  @jve:decl-index=0:visual-constraint="40,32"