gvsig-raster / org.gvsig.raster / branches / org.gvsig.raster.2.4 / org.gvsig.raster / org.gvsig.fmap.mapcontext.raster.swing / org.gvsig.fmap.mapcontext.raster.swing.impl / src / main / java / org / gvsig / fmap / mapcontext / raster / swing / impl / operations / OperationFactoriesTableModel.java @ 8682
History | View | Annotate | Download (3.52 KB)
1 |
/* gvSIG. Desktop Geographic Information System.
|
---|---|
2 |
*
|
3 |
* Copyright ? 2007-2017 gvSIG Association
|
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., 51 Franklin Street, Fifth Floor, Boston,
|
18 |
* MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.fmap.mapcontext.raster.swing.impl.operations; |
24 |
|
25 |
import java.util.List; |
26 |
|
27 |
import javax.swing.table.AbstractTableModel; |
28 |
|
29 |
import org.slf4j.Logger; |
30 |
import org.slf4j.LoggerFactory; |
31 |
|
32 |
import org.gvsig.raster.lib.buffer.api.BufferLocator; |
33 |
import org.gvsig.raster.lib.buffer.api.operations.OperationFactory; |
34 |
import org.gvsig.tools.ToolsLocator; |
35 |
import org.gvsig.tools.i18n.I18nManager; |
36 |
|
37 |
|
38 |
|
39 |
/**
|
40 |
* @author fdiaz
|
41 |
*
|
42 |
*/
|
43 |
public class OperationFactoriesTableModel extends AbstractTableModel { |
44 |
|
45 |
/**
|
46 |
*
|
47 |
*/
|
48 |
private static final long serialVersionUID = -2673452566361905220L; |
49 |
|
50 |
private static final Logger LOG = LoggerFactory.getLogger(OperationFactoriesTableModel.class); |
51 |
|
52 |
private static final int COLUMNS = 1; |
53 |
|
54 |
private static final int COLUMN_OPERATION = 0; |
55 |
|
56 |
List<OperationFactory> factories;
|
57 |
|
58 |
/**
|
59 |
*
|
60 |
*/
|
61 |
public OperationFactoriesTableModel() {
|
62 |
factories = BufferLocator.getOperationManager().getOperationFactories(); |
63 |
} |
64 |
|
65 |
@Override
|
66 |
public int getRowCount() { |
67 |
return factories.size();
|
68 |
} |
69 |
|
70 |
@Override
|
71 |
public int getColumnCount() { |
72 |
return COLUMNS;
|
73 |
} |
74 |
|
75 |
@Override
|
76 |
public Object getValueAt(int rowIndex, int columnIndex) { |
77 |
OperationFactory factory = factories.get(rowIndex); |
78 |
switch (columnIndex) {
|
79 |
case COLUMN_OPERATION:
|
80 |
return factory;
|
81 |
} |
82 |
return null; |
83 |
} |
84 |
|
85 |
@Override
|
86 |
public String getColumnName(int column) { |
87 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
88 |
switch (column) {
|
89 |
case COLUMN_OPERATION:
|
90 |
return i18nManager.getTranslation("_operation"); |
91 |
} |
92 |
return null; |
93 |
} |
94 |
|
95 |
@Override
|
96 |
public boolean isCellEditable(int rowIndex, int columnIndex) { |
97 |
return false; |
98 |
} |
99 |
|
100 |
@Override
|
101 |
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { |
102 |
Object value = aValue;
|
103 |
super.setValueAt(value, rowIndex, columnIndex);
|
104 |
} |
105 |
|
106 |
// /**
|
107 |
// * @param rasterStoreBand
|
108 |
// */
|
109 |
// public void add(OperationFactory factories) {
|
110 |
// factories.add(factories);
|
111 |
// }
|
112 |
//
|
113 |
// /**
|
114 |
// * @param selectedRow
|
115 |
// */
|
116 |
// public void removeElementAt(int selectedRow) {
|
117 |
// factories.remove(selectedRow);
|
118 |
// }
|
119 |
|
120 |
/**
|
121 |
* @param selectedRow
|
122 |
* @return
|
123 |
*/
|
124 |
public OperationFactory getElementAt(int selectedRow) { |
125 |
return factories.get(selectedRow);
|
126 |
} |
127 |
|
128 |
@Override
|
129 |
public Class<?> getColumnClass(int col) { |
130 |
if (col == COLUMN_OPERATION) {
|
131 |
return OperationFactory.class;
|
132 |
} |
133 |
return super.getColumnClass(col); |
134 |
} |
135 |
|
136 |
} |