Statistics
| Revision:

root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / table / models / TableColorModel.java @ 12514

History | View | Annotate | Download (2.84 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.gui.beans.table.models;
20

    
21
import java.awt.Color;
22

    
23
import javax.swing.JButton;
24
import javax.swing.table.DefaultTableModel;
25
/**
26
 * Componente tabla
27
 *
28
 * @version 27/06/2007
29
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
30
 */
31
public class TableColorModel extends DefaultTableModel implements IModel {
32
        private static final long serialVersionUID = 5126848457976272945L;
33

    
34
        boolean[] canEdit = new boolean[] { true, true, false, true, false, true };
35
        Class[]   types   = new Class[] { JButton.class, String.class, String.class, Double.class, Double.class, JButton.class };
36

    
37
        public TableColorModel(String[] columnNames) {
38
                super(new Object[0][6], columnNames);
39
        }
40

    
41
        /*
42
         * (non-Javadoc)
43
         * @see javax.swing.table.DefaultTableModel#removeRow(int)
44
         */
45
        /*
46
        public void removeRow(int row) {
47
                super.setValueAt(null, row, 0);
48
                super.setValueAt("", row, 1);
49
                super.setValueAt("", row, 2);
50
                super.setValueAt("", row, 3);
51
                super.setValueAt("", row, 4);
52
                super.setValueAt(null, row, 5);
53
                super.removeRow(row);
54
        }*/
55

    
56
        /*
57
         * (non-Javadoc)
58
         * @see javax.swing.table.DefaultTableModel#setValueAt(java.lang.Object, int, int)
59
         *//*
60
        public void setValueAt(Object value, int row, int col) {
61
                super.setValueAt(value, row, col);
62
        }*/
63

    
64
        /*
65
         * (non-Javadoc)
66
         * @see org.gvsig.gui.beans.table.models.IModel#getNewLine()
67
         */
68
        public Object[] getNewLine() {
69
                return new Object[] {Color.WHITE, "", "", null, null, "255"};
70
        }
71

    
72
        /*
73
         * (non-Javadoc)
74
         * @see javax.swing.table.DefaultTableModel#addRow(java.lang.Object[])
75
         *//*
76
        public void addRow(Object[] list) {
77
                super.addRow(new Object[] { list[0], list[1], list[2], list[3], list[4], list[5] });
78
        }*/
79

    
80
        /*
81
         * (non-Javadoc)
82
         * @see javax.swing.table.AbstractTableModel#getColumnClass(int)
83
         */
84
        public Class getColumnClass(int columnIndex) {
85
                return types [columnIndex];
86
        }
87

    
88
        /*
89
         * (non-Javadoc)
90
         * @see javax.swing.table.DefaultTableModel#isCellEditable(int, int)
91
         */
92
        public boolean isCellEditable(int rowIndex, int columnIndex) {
93
                return canEdit [columnIndex];
94
        }
95
}