1 package org.simantics.browsing.ui.graph.impl;
\r
3 import java.util.Map;
\r
5 import org.simantics.browsing.ui.BuiltinKeys.LabelerKey;
\r
6 import org.simantics.browsing.ui.NodeContext;
\r
7 import org.simantics.browsing.ui.PrimitiveQueryUpdater;
\r
8 import org.simantics.browsing.ui.graph.impl.contribution.LabelerContributionImpl;
\r
9 import org.simantics.browsing.ui.model.browsecontexts.BrowseContext;
\r
10 import org.simantics.db.ReadGraph;
\r
11 import org.simantics.db.UndoContext;
\r
12 import org.simantics.db.exception.DatabaseException;
\r
14 public class EvaluatorLabeler extends LabelerContributionImpl {
\r
16 final BrowseContext browseContext;
\r
17 final boolean useNodeBrowseContexts;
\r
19 public EvaluatorLabeler(PrimitiveQueryUpdater updater, NodeContext context,
\r
21 BrowseContext browseContext, boolean useNodeBrowseContexts) {
\r
22 super(updater, context, key);
\r
23 this.browseContext = browseContext;
\r
24 this.useNodeBrowseContexts = useNodeBrowseContexts;
\r
28 public Map<String, String> labels(
\r
30 NodeContext context)
\r
31 throws DatabaseException {
\r
32 boolean oldSynchronous = graph.setSynchronous(false);
\r
34 return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).getLabel(graph, context);
\r
36 graph.setSynchronous(oldSynchronous);
\r
41 public int category(ReadGraph graph,
\r
42 NodeContext context)
\r
43 throws DatabaseException {
\r
48 getModifier(ReadGraph graph, UndoContext undoContext,
\r
49 NodeContext context, String columnKey) throws DatabaseException {
\r
50 return BrowseContext.get(graph,context,browseContext,useNodeBrowseContexts).getModifier(graph, context, columnKey);
\r
53 public String toString() {
\r
54 return "EvaluatorLabeler[" + browseContext + "] " + context;
\r