Statistics
| Revision:

gvsig-raster / org.gvsig.raster / trunk / org.gvsig.raster / org.gvsig.raster.swing / org.gvsig.raster.swing.impl / src / test / java / org / gvsig / raster / swing / impl / pagedtable / TestPagedTablePanel.java @ 1672

History | View | Annotate | Download (2.72 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.raster.swing.impl.pagedtable;
25

    
26

    
27
import java.awt.BorderLayout;
28
import java.awt.Dimension;
29
import java.awt.event.ActionEvent;
30
import java.awt.event.ActionListener;
31

    
32
import javax.swing.BorderFactory;
33
import javax.swing.JFrame;
34
import javax.swing.JPanel;
35

    
36
import org.gvsig.raster.swing.pagedtable.ModelLoader;
37

    
38
public class TestPagedTablePanel implements ActionListener {
39
        private int                          w        = 500;
40
        private int                          h        = 350;
41
        private JFrame                       frame    = new JFrame();
42
        private PagedTableImpl               desc     = null;
43

    
44
        public TestPagedTablePanel() {
45
                String[] c = new String[]{"uno", "dos", "tres"};
46
                GCPModel model = new GCPModel(c);
47
                CheckBoxColumnRenderer r = new CheckBoxColumnRenderer(this);
48
                CheckBoxColumnEditor e = new CheckBoxColumnEditor();
49
                ModelLoader modelLoader = new ModelLoaderImpl(model);
50
                modelLoader.setRenderForColumn(0, r);
51
                modelLoader.setCellEditorForColumn(0, e);
52
                modelLoader.setColumnNames(c);
53
                desc = new PagedTableImpl(modelLoader);
54
                JPanel table = (JPanel)desc.getComponent();
55
                table.setBorder(BorderFactory.createTitledBorder("My table"));
56
                
57
                JPanel p = new JPanel();
58
                p.setLayout(new BorderLayout());
59
                p.add(table, BorderLayout.CENTER);
60
                
61
                JPanel p1 = new JPanel();
62
                p1.setPreferredSize(new Dimension(80, 0));
63
                p.add(p1, BorderLayout.EAST);
64
                
65
                JPanel p2 = new JPanel();
66
                p2.setPreferredSize(new Dimension(0, 80));
67
                p.add(p2, BorderLayout.NORTH);
68
                
69
                frame.getContentPane().add(p);
70
                frame.setSize(w, h);
71
                frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
72
                frame.setVisible(true);
73
        }
74

    
75
        public static void main(String[] args) {
76
                new TestPagedTablePanel();
77
        }
78

    
79
        public void actionPerformed(ActionEvent e) {
80
                // TODO Auto-generated method stub
81
                
82
        }
83

    
84
}