Statistics
| Revision:

gvsig-geoprocess / org.gvsig.sextante / trunk / org.gvsig.sextante.app / org.gvsig.sextante.app.extension / src / main / java / org / gvsig / sextante / app / extension / ButtonTableModel.java @ 30

History | View | Annotate | Download (1.43 KB)

1 20 nbrodin
package org.gvsig.sextante.app.extension;
2
3
import java.util.ArrayList;
4
5
import javax.swing.table.AbstractTableModel;
6
7
import org.gvsig.andami.PluginServices;
8
9
public class ButtonTableModel extends AbstractTableModel {
10
        private static final long serialVersionUID = 1L;
11
        private final String[] NAMES;
12
        private ArrayList<Button> m_Buttons;
13
14
        public ButtonTableModel(ArrayList<Button> buttons) {
15
16
                m_Buttons = buttons;
17
                NAMES = new String[3];
18
                NAMES[0] = PluginServices.getText(this, "Icon");
19
                NAMES[1] = PluginServices.getText(this, "Name");
20
                NAMES[2] = PluginServices.getText(this, "Command");
21
22
        }
23
24
        public Class<?> getColumnClass(int columnIndex) {
25
26
                return String.class;
27
28
        }
29
30
        public int getColumnCount() {
31
32
                return 3;
33
        }
34
35
        public String getColumnName(int columnIndex) {
36
37
                return NAMES[columnIndex];
38
39
        }
40
41
        public int getRowCount() {
42
43
                return m_Buttons.size();
44
45
        }
46
47
        public void removeRow (int iRow){
48
49
                m_Buttons.remove(iRow);
50
51
            this.fireTableRowsDeleted(iRow, iRow);
52
53
        }
54
55
        public Object getValueAt(int rowIndex, int columnIndex) {
56
57
                if (columnIndex == 0){
58
                        return m_Buttons.get(rowIndex).sIconFilename;
59
                }
60
                else if (columnIndex == 1){
61
                        return m_Buttons.get(rowIndex).sName;
62
                }
63
                else if (columnIndex == 2){
64
                        return m_Buttons.get(rowIndex).sCommand;
65
                }
66
67
                return null;
68
69
        }
70
71
        public boolean isCellEditable(int rowIndex, int columnIndex) {
72
73
                return false;
74
75
        }
76
77
}