]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
f64435beda30edcc92d50c4f175b1fff215c7fd7
[simantics/sysdyn.git] /
1 package org.simantics.jfreechart.chart.properties;\r
2 \r
3 import java.util.Collection;\r
4 import java.util.Collections;\r
5 \r
6 import org.simantics.db.ReadGraph;\r
7 import org.simantics.db.Resource;\r
8 import org.simantics.db.exception.DatabaseException;\r
9 import org.simantics.db.request.Read;\r
10 \r
11 public class AllVariablesOfModel implements Read<Collection<ChartVariable>> {\r
12         \r
13         public Resource res;\r
14         \r
15         public AllVariablesOfModel(Resource res) {\r
16                 this.res = res;\r
17         }\r
18         \r
19         @Override\r
20         public Collection<ChartVariable> perform(ReadGraph graph) throws DatabaseException {\r
21                 if(!graph.hasStatement(res))\r
22                  return Collections.emptyList();\r
23                 IAllVariablesOfModel query = graph.adapt(res, IAllVariablesOfModel.class);\r
24                 return graph.syncRequest(query.getVariablesQuery());\r
25         }\r
26 \r
27 }\r