1 package org.simantics.modeling.ui.diagram.monitor;
3 import org.simantics.common.format.Formatter;
4 import org.simantics.databoard.Bindings;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.common.utils.Logger;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.db.layer0.variable.Variable;
9 import org.simantics.db.layer0.variable.Variables;
10 import org.simantics.scl.runtime.function.FunctionImpl4;
12 public class DefaultFormattedVariableLabel extends FunctionImpl4 {
15 public Object apply(Object p0, Object p1, Object p2, Object p3) {
19 ReadGraph graph = (ReadGraph)p0;
20 Variable root = (Variable)p1;
21 Formatter formatter = (Formatter)p2;
22 String rvi = (String)p3;
24 Variable var = root.browse(graph, rvi);
26 Object value = var.getPossiblePropertyValue(graph, Variables.CONVERTED_VALUE, Bindings.STRING);
28 value = var.getValue(graph);
31 return formatter.format(value);
33 } catch (DatabaseException e) {
34 Logger.defaultLogError(e);