1 package org.simantics.document.linking.report.evaluator;
3 import java.util.Collections;
7 import org.eclipse.jface.resource.ImageDescriptor;
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.document.linking.ontology.DocumentLink;
12 import org.simantics.document.linking.report.DocumentLine;
13 import org.simantics.objmap.graph.annotations.OrderedSetType;
16 @OrderedSetType(DocumentLink.URIs.EvaluatorTree_Root)
17 public class EvaluatorRoot extends EvaluatorNode{
19 boolean supportMultiline = true;
20 boolean supportStyles = false;
22 public boolean isSupportMultiline() {
23 return supportMultiline;
26 public void setSupportMultiline(boolean multilineSupport) {
27 this.supportMultiline = multilineSupport;
30 public void setSupportStyles(boolean allowStyles) {
31 this.supportStyles = allowStyles;
34 public boolean isSupportStyles() {
39 public String getValue(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
40 if (children.size() > 0 )
41 return children.get(0).getValue(graph, variable, context);
46 public List<DocumentLine> getLines(ReadGraph graph, Variable variable, Map<Object, Object> context) throws DatabaseException {
47 if (children.size() > 0 )
48 return children.get(0).getLines(graph, variable, context);
53 public List<Class<? extends EvaluatorItem>> getPossibleChildren(boolean add) {
54 if (add && children.size() > 0)
55 return Collections.emptyList();
56 List<Class<? extends EvaluatorItem>> classes = super.getPossibleChildren(add);
57 if (supportMultiline) {
58 if (!(children.size() == 1 && children.get(0) instanceof Lines))
59 classes.add(Lines.class);
65 public String toString() {
70 public EvaluatorRoot getRoot() {
75 public EvaluatorItem copy() {
76 EvaluatorRoot root = new EvaluatorRoot();
77 root.supportMultiline = supportMultiline;
78 root.supportStyles = supportStyles;
84 public ImageDescriptor getImage() {