1 package org.simantics.selectionview;
3 import java.util.HashMap;
6 import org.simantics.browsing.ui.model.labels.LabelRule;
7 import org.simantics.databoard.Bindings;
8 import org.simantics.db.ReadGraph;
9 import org.simantics.db.exception.DatabaseException;
10 import org.simantics.db.layer0.variable.Variable;
11 import org.simantics.db.layer0.variable.Variables;
13 public class VariablePropertyLabelRule implements LabelRule {
16 public boolean isCompatible(Class<?> contentType) {
17 return contentType.equals(Variable.class);
21 public Map<String, String> getLabel(ReadGraph graph, Object content)
22 throws DatabaseException {
24 Variable variable = (Variable)content;
26 Map<String, String> result = new HashMap<String, String>();
28 for(Variable property : variable.getProperties(graph)) {
29 String column = property.getPossiblePropertyValue(graph, Variables.DISPLAY_COLUMN);
31 String value = property.getPossibleValue(graph, Bindings.STRING);
33 result.put(column, value);