1 package org.simantics.browsing.ui.nattable;
3 import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
4 import org.simantics.browsing.ui.Column;
5 import org.simantics.browsing.ui.content.Labeler.Modifier;
8 public class GEColumnAccessor implements IColumnPropertyAccessor<TreeNode> {
9 NatTableGraphExplorer ge;
11 public GEColumnAccessor(NatTableGraphExplorer ge) {
16 public int getColumnCount() {
17 return ge.getColumns().length;
21 public Object getDataValue(TreeNode rowObject, int columnIndex) {
24 return rowObject.getValueString(columnIndex);
27 for (int i = 0 ; i <rowObject.getDepth(); i++)
29 return val + rowObject.getValueString(columnIndex);
37 public void setDataValue(TreeNode rowObject, int columnIndex, Object newValue) {
38 Modifier modifier = ge.getModifier(rowObject, columnIndex);
40 throw new IllegalArgumentException("Items is not modifiable");
41 modifier.modify(newValue.toString());
46 public String getColumnProperty(int columnIndex) {
47 return ge.getColumns()[columnIndex].getKey();
51 public int getColumnIndex(String propertyName) {
52 Column columns[] = ge.getColumns();
53 for (int i = 0; i < columns.length; i++) {
54 if (columns[i].getKey().equals(propertyName))