-package org.simantics.browsing.ui.nattable;\r
-\r
-import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;\r
-import org.simantics.browsing.ui.Column;\r
-import org.simantics.browsing.ui.content.Labeler.Modifier;\r
-\r
-\r
-public class GEColumnAccessor implements IColumnPropertyAccessor<TreeNode> {\r
- NatTableGraphExplorer ge;\r
- \r
- public GEColumnAccessor(NatTableGraphExplorer ge) {\r
- this.ge = ge;\r
- }\r
- \r
- @Override\r
- public int getColumnCount() {\r
- return ge.getColumns().length;\r
- }\r
- \r
- @Override\r
- public Object getDataValue(TreeNode rowObject, int columnIndex) {\r
- \r
- if (columnIndex > 0)\r
- return rowObject.getValueString(columnIndex);\r
- else {\r
- String val = "";\r
- for (int i = 0 ; i <rowObject.getDepth(); i++)\r
- val += " ";\r
- return val + rowObject.getValueString(columnIndex);\r
- }\r
- \r
- \r
- }\r
- \r
- \r
- @Override\r
- public void setDataValue(TreeNode rowObject, int columnIndex, Object newValue) {\r
- Modifier modifier = ge.getModifier(rowObject, columnIndex);\r
- if (modifier == null)\r
- throw new IllegalArgumentException("Items is not modifiable");\r
- modifier.modify(newValue.toString());\r
- }\r
- \r
- \r
- @Override\r
- public String getColumnProperty(int columnIndex) {\r
- return ge.getColumns()[columnIndex].getKey();\r
- }\r
- \r
- @Override\r
- public int getColumnIndex(String propertyName) {\r
- Column columns[] = ge.getColumns();\r
- for (int i = 0; i < columns.length; i++) {\r
- if (columns[i].getKey().equals(propertyName))\r
- return i;\r
- }\r
- return -1;\r
- }\r
- \r
+package org.simantics.browsing.ui.nattable;
+
+import org.eclipse.nebula.widgets.nattable.data.IColumnPropertyAccessor;
+import org.simantics.browsing.ui.Column;
+import org.simantics.browsing.ui.content.Labeler.Modifier;
+
+
+public class GEColumnAccessor implements IColumnPropertyAccessor<TreeNode> {
+ NatTableGraphExplorer ge;
+
+ public GEColumnAccessor(NatTableGraphExplorer ge) {
+ this.ge = ge;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return ge.getColumns().length;
+ }
+
+ @Override
+ public Object getDataValue(TreeNode rowObject, int columnIndex) {
+
+ if (columnIndex > 0)
+ return rowObject.getValueString(columnIndex);
+ else {
+ String val = "";
+ for (int i = 0 ; i <rowObject.getDepth(); i++)
+ val += " ";
+ return val + rowObject.getValueString(columnIndex);
+ }
+
+
+ }
+
+
+ @Override
+ public void setDataValue(TreeNode rowObject, int columnIndex, Object newValue) {
+ Modifier modifier = ge.getModifier(rowObject, columnIndex);
+ if (modifier == null)
+ throw new IllegalArgumentException("Items is not modifiable");
+ modifier.modify(newValue != null ? newValue.toString() : "");
+ }
+
+
+ @Override
+ public String getColumnProperty(int columnIndex) {
+ return ge.getColumns()[columnIndex].getKey();
+ }
+
+ @Override
+ public int getColumnIndex(String propertyName) {
+ Column columns[] = ge.getColumns();
+ for (int i = 0; i < columns.length; i++) {
+ if (columns[i].getKey().equals(propertyName))
+ return i;
+ }
+ return -1;
+ }
+
}
\ No newline at end of file