1 package org.simantics.document.linking.report.evaluator;
5 import org.eclipse.jface.resource.ImageDescriptor;
6 import org.simantics.db.ReadGraph;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.db.layer0.variable.Variable;
9 import org.simantics.document.linking.Activator;
10 import org.simantics.document.linking.ontology.DocumentLink;
11 import org.simantics.objmap.graph.annotations.GraphType;
12 import org.simantics.objmap.graph.annotations.RelatedGetValue;
13 import org.simantics.objmap.graph.annotations.RelatedSetValue;
16 @GraphType(DocumentLink.URIs.EvaluatorTree_Constant)
17 public class Constant extends EvaluatorLeaf implements StringEditableNode{
19 private String string;
26 public Constant(String text) {
28 throw new NullPointerException("Text is null");
33 public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
38 public String toString() {
39 return "\"" + string + "\"";
42 @RelatedGetValue(DocumentLink.URIs.EvaluatorTree_HasValue)
44 public String getValue() {
49 public String setValue(String value) {
54 @RelatedSetValue(DocumentLink.URIs.EvaluatorTree_HasValue)
55 public void _setValue(String value) {
60 public EvaluatorItem copy() {
61 return new Constant(string);
66 public ImageDescriptor getImage() {
67 return Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/textfield.png");