]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.district.network.ui/src/org/simantics/district/network/ui/table/TableDataProvider.java
Fixed District diagram viewer to allow moving of vertices again.
[simantics/district.git] / org.simantics.district.network.ui / src / org / simantics / district / network / ui / table / TableDataProvider.java
1 package org.simantics.district.network.ui.table;
2
3 import java.util.Collection;
4
5 import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
6
7 public class TableDataProvider implements IDataProvider {
8
9         private String[][] data = null;
10
11         @Override
12         public Object getDataValue(int columnIndex, int rowIndex) {
13                 if (data == null) {
14                         return null;
15                 } else {
16                         return data[rowIndex][columnIndex];
17                 }
18         }
19
20         @Override
21         public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
22                 
23         }
24
25         @Override
26         public int getColumnCount() {
27                 if (data == null) {
28                         return 10;
29                 } else {
30                         return data[0].length;
31                 }
32         }
33
34         @Override
35         public int getRowCount() {
36                 if (data == null) {
37                         return 10;
38                 } else {
39                         return data.length;
40                 }
41         }
42
43         public boolean isEditable(int columnIndex, int rowIndex) {
44                 return false;
45         }
46
47         public void setDataValues(Collection<Integer> pasteColumn, int pasteRow, String[][] fullData) {
48                 // start always from row index 0 and column index 0
49                 this.data = fullData;
50         }
51
52         public String[][] getCurrentData() {
53                 return data;
54         }
55
56 }