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 @ 1722

History | View | Annotate | Download (3.08 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
import org.gvsig.raster.swing.pagedtable.PagedTableEvent;
38
import org.gvsig.raster.swing.pagedtable.PagedTableListener;
39

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

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

    
83
        public static void main(String[] args) {
84
                new TestPagedTablePanel();
85
        }
86

    
87
        public void actionPerformed(ActionEvent e) {
88
                // TODO Auto-generated method stub
89
                
90
        }
91

    
92
        public void tableChanged(PagedTableEvent event) {
93
                
94
        }
95

    
96
}