-package org.simantics.selectionview;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import org.simantics.browsing.ui.model.labels.LabelRule;\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.db.layer0.variable.Variables;\r
-\r
-public class VariablePropertyLabelRule implements LabelRule {\r
- \r
- @Override\r
- public boolean isCompatible(Class<?> contentType) {\r
- return contentType.equals(Variable.class);\r
- }\r
-\r
- @Override\r
- public Map<String, String> getLabel(ReadGraph graph, Object content)\r
- throws DatabaseException {\r
- \r
- Variable variable = (Variable)content;\r
- \r
- Map<String, String> result = new HashMap<String, String>();\r
- \r
- for(Variable property : variable.getProperties(graph)) {\r
- String column = property.getPossiblePropertyValue(graph, Variables.DISPLAY_COLUMN);\r
- if(column != null) {\r
- String value = property.getPossibleValue(graph, Bindings.STRING);\r
- if (value != null)\r
- result.put(column, value);\r
- }\r
- }\r
- \r
- return result;\r
- \r
- }\r
-\r
-}\r
+package org.simantics.selectionview;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.simantics.browsing.ui.model.labels.LabelRule;
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.db.layer0.variable.Variables;
+
+public class VariablePropertyLabelRule implements LabelRule {
+
+ @Override
+ public boolean isCompatible(Class<?> contentType) {
+ return contentType.equals(Variable.class);
+ }
+
+ @Override
+ public Map<String, String> getLabel(ReadGraph graph, Object content)
+ throws DatabaseException {
+
+ Variable variable = (Variable)content;
+
+ Map<String, String> result = new HashMap<String, String>();
+
+ for(Variable property : variable.getProperties(graph)) {
+ String column = property.getPossiblePropertyValue(graph, Variables.DISPLAY_COLUMN);
+ if(column != null) {
+ String value = property.getPossibleValue(graph, Bindings.STRING);
+ if (value != null)
+ result.put(column, value);
+ }
+ }
+
+ return result;
+
+ }
+
+}