JFREE.Renderer <T L0.Entity
+JFREE.XYLineRenderer <T JFREE.Renderer
+JFREE.XYAreaRenderer <T JFREE.Renderer
+
JFREE.BarRenderer <T JFREE.Renderer
JFREE.StackedBarRenderer <T JFREE.Renderer
import org.simantics.db.request.Read;\r
import org.simantics.db.Session;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.service.QueryControl;\r
\r
public class JFreeChartResource {\r
\r
public final Resource Title_position;\r
public final Resource Top;\r
public final Resource ValueAxis;\r
+ public final Resource XYAreaRenderer;\r
public final Resource XYDataset;\r
+ public final Resource XYLineRenderer;\r
public final Resource XYPlot;\r
public final Resource backgroundColor;\r
public final Resource backgroundColor_Inverse;\r
public static final String Title_position = "http://www.simantics.org/JFreeChart-1.0/Title/position";\r
public static final String Top = "http://www.simantics.org/JFreeChart-1.0/Top";\r
public static final String ValueAxis = "http://www.simantics.org/JFreeChart-1.0/ValueAxis";\r
+ public static final String XYAreaRenderer = "http://www.simantics.org/JFreeChart-1.0/XYAreaRenderer";\r
public static final String XYDataset = "http://www.simantics.org/JFreeChart-1.0/XYDataset";\r
+ public static final String XYLineRenderer = "http://www.simantics.org/JFreeChart-1.0/XYLineRenderer";\r
public static final String XYPlot = "http://www.simantics.org/JFreeChart-1.0/XYPlot";\r
public static final String backgroundColor = "http://www.simantics.org/JFreeChart-1.0/backgroundColor";\r
public static final String backgroundColor_Inverse = "http://www.simantics.org/JFreeChart-1.0/backgroundColor/Inverse";\r
Title_position = getResourceOrNull(graph, URIs.Title_position);\r
Top = getResourceOrNull(graph, URIs.Top);\r
ValueAxis = getResourceOrNull(graph, URIs.ValueAxis);\r
+ XYAreaRenderer = getResourceOrNull(graph, URIs.XYAreaRenderer);\r
XYDataset = getResourceOrNull(graph, URIs.XYDataset);\r
+ XYLineRenderer = getResourceOrNull(graph, URIs.XYLineRenderer);\r
XYPlot = getResourceOrNull(graph, URIs.XYPlot);\r
backgroundColor = getResourceOrNull(graph, URIs.backgroundColor);\r
backgroundColor_Inverse = getResourceOrNull(graph, URIs.backgroundColor_Inverse);\r
Session session = graph.getSession();\r
JFreeChartResource ret = session.peekService(JFreeChartResource.class);\r
if(ret == null) {\r
- QueryControl qc = graph.getService(QueryControl.class);\r
- ret = new JFreeChartResource(qc.getIndependentGraph(graph));\r
+ ret = new JFreeChartResource(graph);\r
session.registerService(JFreeChartResource.class, ret);\r
}\r
return ret;\r
if(ret == null) {\r
ret = session.syncRequest(new Read<JFreeChartResource>() {\r
public JFreeChartResource perform(ReadGraph graph) throws DatabaseException {\r
- QueryControl qc = graph.getService(QueryControl.class);\r
- return new JFreeChartResource(qc.getIndependentGraph(graph));\r
+ return new JFreeChartResource(graph);\r
}\r
});\r
session.registerService(JFreeChartResource.class, ret);\r
import org.simantics.db.request.Read;\r
import org.simantics.db.Session;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.service.QueryControl;\r
\r
public class SysdynResource {\r
\r
Session session = graph.getSession();\r
SysdynResource ret = session.peekService(SysdynResource.class);\r
if(ret == null) {\r
- QueryControl qc = graph.getService(QueryControl.class);\r
- ret = new SysdynResource(qc.getIndependentGraph(graph));\r
+ ret = new SysdynResource(graph);\r
session.registerService(SysdynResource.class, ret);\r
}\r
return ret;\r
if(ret == null) {\r
ret = session.syncRequest(new Read<SysdynResource>() {\r
public SysdynResource perform(ReadGraph graph) throws DatabaseException {\r
- QueryControl qc = graph.getService(QueryControl.class);\r
- return new SysdynResource(qc.getIndependentGraph(graph));\r
+ return new SysdynResource(graph);\r
}\r
});\r
session.registerService(SysdynResource.class, ret);\r
VTT Technical Research Centre of Finland - initial API and implementation\r
-->\r
-<adapters>\r\r <target interface="org.simantics.db.layer0.adapter.Realization">\r <type uri="http://www.simantics.org/Sysdyn-0.0/Module"\r class="org.simantics.structural2.realization.StructuralRealization">\r <this />\r </type>\r </target>\r\r <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r <type uri = "http://www.simantics.org/Sysdyn-0.0/DiagramToCompositeMapping"\r class = "org.simantics.sysdyn.ui.editor.DiagramToCompositeMapping3">\r <graph/>\r <this />\r </type>\r </target>\r \r <target interface="org.simantics.structural.ui.modelBrowser.nodes.AbstractNode">\r <type uri="http://www.simantics.org/Sysdyn-0.0/SysdynModel"\r class="org.simantics.structural.ui.modelBrowser.nodes.ModelNode">\r <this />\r </type>\r </target> \r \r\r <target\r interface="org.simantics.browsing.ui.common.node.AbstractNode">\r <type\r uri="http://www.simantics.org/Sysdyn-0.0/SysdynModel"\r class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r <this />\r </type>\r\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.browser.nodes.SymbolNode">\r <this />\r </resource>\r\r <type\r uri="http://www.simantics.org/Simulation-1.0/Experiment"\r class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/Result"\r class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r <this />\r </type>\r \r </target>\r\r <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r <target interface="org.simantics.g2d.diagram.DiagramClass">\r <adapter uri="http://www.simantics.org/Sysdyn-0.0/ConfigurationDiagram"\r adapterClass="org.simantics.sysdyn.ui.elements2.ConfigurationDiagramClassAdapter" />\r </target>\r\r <!-- Sysdyn symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements2.InputFactory" /> \r </target>\r \r <!-- Sysdyn connections -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <!-- Edges --> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowConnectionFactory">\r <graph/>\r </type> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyConnectionFactory" />\r </target>\r \r <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r <baseType uri="http://www.simantics.org/Diagram-0.0/HasConnector" />\r <resource uri="http://www.simantics.org/Diagram-0.0/HasPlainConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>none 0</string>\r </resource>\r <resource uri="http://www.simantics.org/Diagram-0.0/HasArrowConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>fill 1</string>\r </resource>\r </target>\r \r <!-- ModelBrowser2 -->\r \r <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleTypeChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleContentChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisChildRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/VariableChildRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.VariableChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesChildRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesChildRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesChildRule"/> \r </target>\r \r <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleTypeLabelRule"\r class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisLabelRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisLabelRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesLabelRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesLabelRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelDecorationRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesLabelDecorationRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesLabelDecorationRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/> \r \r </target> \r \r <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewModuleType"\r class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewEnumeration"\r class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/OpenWorkbook"\r class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunction"\r class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunctionLibrary"\r class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" /> \r </target> \r \r <target interface="org.simantics.db.layer0.adapter.DropActionFactory">\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/SeriesDropAction"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesDropAction" />\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/AxisDropAction"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisDropAction" /> \r </target> \r \r <!-- PROFILES -->\r <target interface="org.simantics.scenegraph.profile.Style">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SimulationPlaybackStyle"\r class="org.simantics.sysdyn.ui.elements2.profiles.SimulationPlaybackStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r class="org.simantics.sysdyn.ui.elements2.profiles.IssueDecorationStyle">\r </resource>\r </target>\r \r <!-- Charts -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementFactory" />\r \r <type uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementFactory" />\r </target>\r \r <target interface="org.simantics.diagram.synchronization.graph.ElementWriter">\r <resource uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementWriter" />\r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IJFreeChart">\r <type uri="http://www.simantics.org/JFreeChart-1.0/Chart"\r class="org.simantics.sysdyn.ui.trend.chart.JFreeChart">\r <graph />\r <this />\r </type>\r </target> \r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IDataset">\r <type uri="http://www.simantics.org/JFreeChart-1.0/XYDataset"\r class="org.simantics.sysdyn.ui.trend.chart.XYDataset">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryDataset"\r class="org.simantics.sysdyn.ui.trend.chart.CategoryDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/PieDataset"\r class="org.simantics.sysdyn.ui.trend.chart.PieDataset">\r <graph />\r <this />\r </type> \r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.ITitle">\r <type uri="http://www.simantics.org/JFreeChart-1.0/TextTitle"\r class="org.simantics.sysdyn.ui.trend.chart.TextTitle">\r <graph />\r <this />\r </type>\r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IAxis">\r <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r class="org.simantics.sysdyn.ui.trend.chart.NumberAxis">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryAxis"\r class="org.simantics.sysdyn.ui.trend.chart.CategoryAxis">\r <graph />\r <this />\r </type> \r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IPlot">\r <type uri="http://www.simantics.org/JFreeChart-1.0/XYPlot"\r class="org.simantics.sysdyn.ui.trend.chart.XYPlot">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryPlot"\r class="org.simantics.sysdyn.ui.trend.chart.CategoryPlot">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/PiePlot"\r class="org.simantics.sysdyn.ui.trend.chart.PiePlot">\r <graph />\r <this />\r </type> \r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IRenderer">\r <type uri="http://www.simantics.org/JFreeChart-1.0/BarRenderer"\r class="org.simantics.sysdyn.ui.trend.chart.BarRenderer">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-1.0/StackedBarRenderer"\r class="org.simantics.sysdyn.ui.trend.chart.StackedBarRenderer">\r <graph />\r <this />\r </type> \r </target> \r \r
+<adapters>\r\r <target interface="org.simantics.db.layer0.adapter.Realization">\r <type uri="http://www.simantics.org/Sysdyn-0.0/Module"\r class="org.simantics.structural2.realization.StructuralRealization">\r <this />\r </type>\r </target>\r\r <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r <type uri = "http://www.simantics.org/Sysdyn-0.0/DiagramToCompositeMapping"\r class = "org.simantics.sysdyn.ui.editor.DiagramToCompositeMapping3">\r <graph/>\r <this />\r </type>\r </target>\r \r <target interface="org.simantics.structural.ui.modelBrowser.nodes.AbstractNode">\r <type uri="http://www.simantics.org/Sysdyn-0.0/SysdynModel"\r class="org.simantics.structural.ui.modelBrowser.nodes.ModelNode">\r <this />\r </type>\r </target> \r \r\r <target\r interface="org.simantics.browsing.ui.common.node.AbstractNode">\r <type\r uri="http://www.simantics.org/Sysdyn-0.0/SysdynModel"\r class="org.simantics.sysdyn.ui.browser.nodes.ModelNode">\r <this />\r </type>\r\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.browser.nodes.SymbolNode">\r <this />\r </resource>\r\r <type\r uri="http://www.simantics.org/Simulation-1.0/Experiment"\r class="org.simantics.sysdyn.ui.browser.nodes.ExperimentNode">\r <this />\r </type>\r \r <type\r uri="http://www.simantics.org/Sysdyn-0.0/Result"\r class="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode">\r <this />\r </type>\r \r </target>\r\r <!-- Inject default connection routing algorithm for sysdyn diagrams -->\r <target interface="org.simantics.g2d.diagram.DiagramClass">\r <adapter uri="http://www.simantics.org/Sysdyn-0.0/ConfigurationDiagram"\r adapterClass="org.simantics.sysdyn.ui.elements2.ConfigurationDiagramClassAdapter" />\r </target>\r\r <!-- Sysdyn symbols -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r class="org.simantics.sysdyn.ui.elements2.InputFactory" /> \r </target>\r \r <!-- Sysdyn connections -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <!-- Edges --> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" /> \r <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowConnectionFactory">\r <graph/>\r </type> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r class="org.simantics.sysdyn.ui.elements2.connections.DependencyConnectionFactory" />\r </target>\r \r <target interface="org.simantics.g2d.connection.EdgeVisualsConfigurer">\r <baseType uri="http://www.simantics.org/Diagram-0.0/HasConnector" />\r <resource uri="http://www.simantics.org/Diagram-0.0/HasPlainConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>none 0</string>\r </resource>\r <resource uri="http://www.simantics.org/Diagram-0.0/HasArrowConnector"\r class="org.simantics.diagram.content.ArrowConfigurer">\r <string>fill 1</string>\r </resource>\r </target>\r \r <!-- ModelBrowser2 -->\r \r <target interface="org.simantics.browsing.ui.model.children.ChildRule">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleTypeChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleContentChildRule"\r class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisChildRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/VariableChildRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.VariableChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesChildRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesChildRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesChildRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesChildRule"/> \r </target>\r \r <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleTypeLabelRule"\r class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisLabelRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisLabelRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesLabelRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesLabelRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/> \r \r <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelDecorationRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/BarSeriesBrowseContext/SeriesLabelDecorationRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/> \r <resource uri="http://www.simantics.org/Sysdyn-0.0/PieSeriesBrowseContext/SeriesLabelDecorationRule"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelDecorationRule"/> \r \r </target> \r \r <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewModuleType"\r class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewEnumeration"\r class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/OpenWorkbook"\r class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunction"\r class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunctionLibrary"\r class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" /> \r </target> \r \r <target interface="org.simantics.db.layer0.adapter.DropActionFactory">\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/SeriesDropAction"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesDropAction" />\r <resource\r uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/AxisDropAction"\r class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisDropAction" /> \r </target> \r \r <!-- PROFILES -->\r <target interface="org.simantics.scenegraph.profile.Style">\r <resource uri="http://www.simantics.org/Sysdyn-0.0/SimulationPlaybackStyle"\r class="org.simantics.sysdyn.ui.elements2.profiles.SimulationPlaybackStyle">\r </resource>\r <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r class="org.simantics.sysdyn.ui.elements2.profiles.IssueDecorationStyle">\r </resource>\r </target>\r \r <!-- Charts -->\r <target interface="org.simantics.diagram.adapter.ElementFactory">\r <resource uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementFactory" />\r \r <type uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementFactory" />\r </target>\r \r <target interface="org.simantics.diagram.synchronization.graph.ElementWriter">\r <resource uri="http://www.simantics.org/JFreeChart-1.0/ChartElement"\r class="org.simantics.sysdyn.ui.trend.chart.element.ChartElementWriter" />\r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IJFreeChart">\r <type uri="http://www.simantics.org/JFreeChart-1.0/Chart"\r class="org.simantics.sysdyn.ui.trend.chart.JFreeChart">\r <graph />\r <this />\r </type>\r </target> \r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IDataset">\r <type uri="http://www.simantics.org/JFreeChart-1.0/XYDataset"\r class="org.simantics.sysdyn.ui.trend.chart.XYDataset">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryDataset"\r class="org.simantics.sysdyn.ui.trend.chart.CategoryDataset">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/PieDataset"\r class="org.simantics.sysdyn.ui.trend.chart.PieDataset">\r <graph />\r <this />\r </type> \r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.ITitle">\r <type uri="http://www.simantics.org/JFreeChart-1.0/TextTitle"\r class="org.simantics.sysdyn.ui.trend.chart.TextTitle">\r <graph />\r <this />\r </type>\r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IAxis">\r <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r class="org.simantics.sysdyn.ui.trend.chart.NumberAxis">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryAxis"\r class="org.simantics.sysdyn.ui.trend.chart.CategoryAxis">\r <graph />\r <this />\r </type> \r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IPlot">\r <type uri="http://www.simantics.org/JFreeChart-1.0/XYPlot"\r class="org.simantics.sysdyn.ui.trend.chart.XYPlot">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-1.0/CategoryPlot"\r class="org.simantics.sysdyn.ui.trend.chart.CategoryPlot">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/PiePlot"\r class="org.simantics.sysdyn.ui.trend.chart.PiePlot">\r <graph />\r <this />\r </type> \r </target>\r \r <target interface="org.simantics.sysdyn.ui.trend.chart.IRenderer">\r \r <type uri="http://www.simantics.org/JFreeChart-1.0/XYLineRenderer"\r class="org.simantics.sysdyn.ui.trend.chart.XYLineRenderer">\r <graph />\r <this />\r </type> \r <type uri="http://www.simantics.org/JFreeChart-1.0/XYAreaRenderer"\r class="org.simantics.sysdyn.ui.trend.chart.XYAreaRenderer">\r <graph />\r <this />\r </type> \r \r <type uri="http://www.simantics.org/JFreeChart-1.0/BarRenderer"\r class="org.simantics.sysdyn.ui.trend.chart.BarRenderer">\r <graph />\r <this />\r </type>\r <type uri="http://www.simantics.org/JFreeChart-1.0/StackedBarRenderer"\r class="org.simantics.sysdyn.ui.trend.chart.StackedBarRenderer">\r <graph />\r <this />\r </type> \r </target> \r \r
</adapters>
\ No newline at end of file
l0.HasName, "NumberAxis" + UUID.randomUUID().toString());\r
Resource rangeAxis = GraphUtils.create2(g, jfree.NumberAxis,\r
l0.HasName, "NumberAxis" + UUID.randomUUID().toString());\r
+ \r
+ Resource renderer = GraphUtils.create2(g, jfree.XYLineRenderer);\r
\r
Resource dataset = GraphUtils.create2(g, jfree.XYDataset,\r
l0.HasName, "XYDataset" + UUID.randomUUID().toString(),\r
jfree.Dataset_mapToDomainAxis, domainAxis,\r
jfree.Dataset_mapToRangeAxis, rangeAxis,\r
- jfree.Dataset_seriesList, ListUtils.create(g, new ArrayList<Resource>()));\r
+ jfree.Dataset_seriesList, ListUtils.create(g, new ArrayList<Resource>()),\r
+ jfree.Dataset_renderer, renderer);\r
\r
GraphUtils.create2(g, jfree.XYPlot,\r
l0.HasName, "XYPlot" + UUID.randomUUID().toString(),\r
JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
Layer0 l0 = Layer0.getInstance(graph);\r
\r
+ \r
// Create a dataset for the axis\r
Resource dataset = GraphUtils.create2(graph, jfree.XYDataset,\r
l0.HasName, "XYDataset" + UUID.randomUUID().toString(),\r
jfree.Dataset_mapToDomainAxis, domainAxis,\r
jfree.Dataset_mapToRangeAxis, rangeAxis,\r
+ jfree.Dataset_renderer, GraphUtils.create2(graph, jfree.XYLineRenderer),\r
l0.PartOf, plot);\r
\r
return dataset;\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import org.jfree.chart.labels.StandardXYToolTipGenerator;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+\r
+/**\r
+ * Renderer representing jfree chart renderer for xy areas\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class XYAreaRenderer extends AbstractRenderer {\r
+\r
+ private org.jfree.chart.renderer.xy.XYAreaRenderer renderer;\r
+ \r
+ public XYAreaRenderer(ReadGraph graph, Resource resource) {\r
+ super(graph, resource);\r
+ }\r
+\r
+ @Override\r
+ public org.jfree.chart.renderer.AbstractRenderer getRenderer() {\r
+ if(renderer == null) {\r
+ renderer = new org.jfree.chart.renderer.xy.XYAreaRenderer();\r
+ renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());\r
+ }\r
+ return renderer;\r
+ }\r
+\r
+}
\ No newline at end of file
import org.simantics.sysdyn.adapter.VariableRVIUtils;\r
import org.simantics.sysdyn.manager.SysdynDataSet;\r
import org.simantics.ui.SimanticsUI;\r
+import org.simantics.utils.datastructures.Pair;\r
\r
/**\r
* Class representing a JFreeChart.XYDataset\r
*/\r
public class XYDataset extends AbstractDataset {\r
\r
- private XYLineAndShapeRenderer renderer;\r
+ private IRenderer renderer;\r
\r
public XYDataset(ReadGraph graph, final Resource datasetResource) {\r
super(graph, datasetResource);\r
\r
if(datasetListener == null || datasetListener.isDisposed()) {\r
datasetListener = new DataSetListener();\r
- SimanticsUI.getSession().asyncRequest(new Read<ArrayList<TempSeries>>() {\r
+ SimanticsUI.getSession().asyncRequest(new Read<Pair<ArrayList<TempSeries>, IRenderer>>() {\r
\r
@Override\r
- public ArrayList<TempSeries> perform(ReadGraph graph) throws DatabaseException {\r
+ public Pair<ArrayList<TempSeries>, IRenderer> perform(ReadGraph graph) throws DatabaseException {\r
JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
\r
+ // Renderer\r
+ IRenderer renderer = null;\r
+ Resource rendererResource = graph.getPossibleObject(resource, jfree.Dataset_renderer);\r
+ if(rendererResource != null)\r
+ renderer = graph.adapt(rendererResource, IRenderer.class);\r
+ \r
ArrayList<TempSeries> series = new ArrayList<TempSeries>();\r
\r
String realizationURI = getRealizationURI(graph);\r
\r
if(realizationURI == null)\r
- return series; // No experiment -> No results\r
+ return new Pair<ArrayList<TempSeries>, IRenderer>(series, renderer); // No experiment -> No results\r
\r
// Get a variable for the x-axis (if not time)\r
double[] domainValues = null;\r
// Get values\r
Object object = v.getPossiblePropertyValue(graph, SysdynVariableProperties.ACTIVE_DATASETS , Bindings.VARIANT);\r
if(object == null || !(object instanceof ArrayList<?>))\r
- return series;\r
+ return new Pair<ArrayList<TempSeries>, IRenderer>(series, renderer);\r
\r
ArrayList<SysdynDataSet> datasets = new ArrayList<SysdynDataSet>();\r
\r
}\r
}\r
}\r
- return series;\r
+ return new Pair<ArrayList<TempSeries>, IRenderer>(series, renderer);\r
}\r
\r
}, datasetListener); \r
}\r
}\r
\r
- private class DataSetListener implements Listener<ArrayList<TempSeries>> {\r
+ private class DataSetListener implements Listener<Pair<ArrayList<TempSeries>, IRenderer>> {\r
\r
private boolean disposed = false;\r
\r
}\r
\r
@Override\r
- public void execute(final ArrayList<TempSeries> series) {\r
+ public void execute(Pair<ArrayList<TempSeries>, IRenderer> result) {\r
+ final ArrayList<TempSeries> series = result.first;\r
+ renderer = result.second;\r
+ \r
// Modify series in AWT thread to avoid synchronization problems\r
SwingUtilities.invokeLater(new Runnable() {\r
\r
@Override\r
public void run() {\r
\r
- /*\r
- * Drawing supplier with a modified first yellow. The default first\r
- * yellow is too light to be visible against a white background\r
- */\r
- Paint[] paintSequence = ChartColor.createDefaultPaintArray();\r
- paintSequence[3] = new Color(0xFF, 0xDD, 0x00);\r
- DefaultDrawingSupplier drawingsupplier = new DefaultDrawingSupplier(\r
- paintSequence,\r
- DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE,\r
- DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,\r
- DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,\r
- DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,\r
- DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);\r
- ((AbstractXYItemRenderer)getRenderer()).getPlot().setDrawingSupplier(drawingsupplier);\r
+ org.jfree.chart.plot.XYPlot plot = ((AbstractXYItemRenderer)getRenderer()).getPlot();\r
+ if(plot != null) {\r
+ /*\r
+ * Drawing supplier with a modified first yellow. The default first\r
+ * yellow is too light to be visible against a white background\r
+ */\r
+ Paint[] paintSequence = ChartColor.createDefaultPaintArray();\r
+ paintSequence[3] = new Color(0xFF, 0xDD, 0x00);\r
+ DefaultDrawingSupplier drawingsupplier = new DefaultDrawingSupplier(\r
+ paintSequence,\r
+ DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE,\r
+ DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,\r
+ DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,\r
+ DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,\r
+ DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);\r
+ plot.setDrawingSupplier(drawingsupplier);\r
+ }\r
// Remove all series\r
for(int i = dataset.getSeriesCount() - 1; i >= 0; i-- ) {\r
dataset.removeSeries(dataset.getSeriesKey(i));\r
@Override\r
public AbstractRenderer getRenderer() {\r
if(renderer == null) {\r
- renderer = new XYLineAndShapeRenderer(true, false);\r
+ XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);\r
renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());\r
+ return renderer;\r
+ } else {\r
+ return renderer.getRenderer();\r
}\r
- return renderer;\r
}\r
\r
/**\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import org.jfree.chart.labels.StandardXYToolTipGenerator;\r
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+\r
+/**\r
+ * Renderer representing jfree chart renderer for xy lines\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class XYLineRenderer extends AbstractRenderer {\r
+\r
+ XYLineAndShapeRenderer renderer;\r
+ \r
+ public XYLineRenderer(ReadGraph graph, Resource resource) {\r
+ super(graph, resource);\r
+ }\r
+\r
+ @Override\r
+ public org.jfree.chart.renderer.AbstractRenderer getRenderer() {\r
+ if(renderer == null) {\r
+ renderer = new XYLineAndShapeRenderer(true, false);\r
+ renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());\r
+ }\r
+ return renderer;\r
+ }\r
+\r
+}\r
protected Plot newPlot() {\r
return new org.jfree.chart.plot.XYPlot(null, null, null, null);\r
}\r
- \r
+\r
@Override\r
protected void getOtherProperties(ReadGraph graph, PlotProperties properties) throws DatabaseException {\r
JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
Boolean visibleGrid = graph.getPossibleRelatedValue(resource, jfree.Plot_visibleGrid);\r
properties.otherProperties.put("visibleGrid", visibleGrid);\r
+ if(!properties.datasets.isEmpty()) {\r
+ IDataset idataset = properties.datasets.get(0);\r
+ Resource renderer = graph.getPossibleObject(idataset.getResource(), jfree.Dataset_renderer);\r
+ if(renderer != null) {\r
+ properties.otherProperties.put("renderer", graph.adapt(renderer, IRenderer.class));\r
+ }\r
+ }\r
}\r
\r
@Override\r
protected void setPlotProperties(PlotProperties properties) {\r
if(!(plot instanceof org.jfree.chart.plot.XYPlot))\r
return;\r
- \r
+\r
org.jfree.chart.plot.XYPlot xyplot = (org.jfree.chart.plot.XYPlot)plot;\r
xyplot.clearDomainAxes();\r
xyplot.clearRangeAxes();\r
\r
xyplot.setRangeGridlinesVisible(visibleGrid);\r
xyplot.setDomainGridlinesVisible(visibleGrid);\r
- \r
+\r
// Cleaner look: no outline borders\r
xyplot.setInsets(new RectangleInsets(2,5,2,10), false);\r
xyplot.setOutlineVisible(false);\r
GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn1);\r
GridLayoutFactory.fillDefaults().applyTo(labelColumn1);\r
\r
- // first column: name and title\r
+ // second column: name and title\r
Composite propertyColumn1 = new Composite(general, SWT.NONE);\r
GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyColumn1);\r
GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(propertyColumn1);\r
\r
- // first column: labels\r
+ // third column: labels\r
Composite labelColumn2 = new Composite(general, SWT.NONE);\r
GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn2);\r
GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(labelColumn2);\r
\r
- // first column: type and time\r
+ // fourth column: type and time\r
Composite propertyColumn2 = new Composite(general, SWT.NONE);\r
GridDataFactory.fillDefaults().grab(false, true).applyTo(propertyColumn2);\r
GridLayoutFactory.fillDefaults().applyTo(propertyColumn2);\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.trend.chart.properties.xyline;\r
\r
+import java.util.Collection;\r
+import java.util.LinkedHashMap;\r
+import java.util.Map;\r
+\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
import org.eclipse.jface.viewers.StructuredSelection;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.custom.ScrolledComposite;\r
import org.eclipse.swt.graphics.Point;\r
-import org.eclipse.swt.widgets.Combo;\r
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Group;\r
import org.eclipse.swt.widgets.Label;\r
import org.simantics.browsing.ui.swt.widgets.Button;\r
import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedCombo;\r
import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.ComboModifyListenerImpl;\r
+import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;\r
import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
import org.simantics.db.common.request.PossibleObjectWithType;\r
import org.simantics.db.common.request.ReadRequest;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.modeling.ui.chart.property.DoublePropertyFactory;\r
import org.simantics.modeling.ui.chart.property.DoublePropertyModifier;\r
import org.simantics.sysdyn.JFreeChartResource;\r
private ScrolledComposite sc;\r
private Composite composite;\r
private TrackedText name, title, xlabel, xvariable, xmin, xmax;\r
- private Combo type;\r
+ private TrackedCombo type;\r
private Button hgrid, htitle, hlegend;\r
private WidgetSupportImpl domainAxisSupport = new WidgetSupportImpl();\r
\r
GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
label.setText("Type:");\r
\r
- type = new Combo(c, SWT.BORDER | SWT.READ_ONLY);\r
- type.setItems(new String[] {"Line", "Fancy", "Area", "3D"});\r
- type.select(0);\r
+ type = new TrackedCombo(c, support, SWT.BORDER | SWT.READ_ONLY);\r
+ type.addModifyListener(new TypeModifyListener());\r
+ type.setItemFactory(new TypeItemFactory());\r
+ type.setSelectionFactory(new TypeSelectionFactory());\r
+ GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
\r
// Title (Which is different than name)\r
label = new Label(general, SWT.NONE);\r
}\r
});\r
}\r
+ \r
+ /**\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class TypeSelectionFactory extends ReadFactoryImpl<Resource, String> {\r
+ @Override\r
+ public String perform(ReadGraph graph, Resource chart) throws DatabaseException {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+\r
+ Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.XYPlot));\r
+ if(plot != null) {\r
+ Collection<Resource> datasets = graph.syncRequest(new ObjectsWithType(plot, l0.ConsistsOf, jfree.XYDataset));\r
+ if(!datasets.isEmpty()) {\r
+ Resource dataset = datasets.iterator().next();\r
+ if(dataset != null) {\r
+ Resource renderer = graph.syncRequest(new PossibleObjectWithType(dataset, jfree.Dataset_renderer, jfree.Renderer));\r
+ if(renderer != null && graph.isInstanceOf(renderer, jfree.XYAreaRenderer))\r
+ return "Area";\r
+ }\r
+ }\r
+ }\r
+ return "Line";\r
+ }\r
+ }\r
+\r
+ /**\r
+ * RangeItemFactory finds all inexes of a given enumeration \r
+ * and adds "Sum" and "All" to the returned indexes\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class TypeItemFactory extends ReadFactoryImpl<Resource, Map<String, Object>> {\r
+ @Override\r
+ public Map<String, Object> perform(ReadGraph graph, Resource series) throws DatabaseException {\r
+ LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>();\r
+ result.put("Line", "Line");\r
+ result.put("Area", "Area");\r
+// result.put("Stacked Area", "Stacked Area");\r
+ return result;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * TypeModifyListener for modifying the type of a bar chart \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class TypeModifyListener extends ComboModifyListenerImpl<Resource> {\r
+ @Override\r
+ public void applyText(WriteGraph graph, Resource chart, String text) throws DatabaseException {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+\r
+ Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.XYPlot));\r
+ if(plot == null)\r
+ return;\r
+\r
+ Collection<Resource> datasets = graph.syncRequest(new ObjectsWithType(plot, l0.ConsistsOf, jfree.XYDataset));\r
+ if(datasets == null || datasets.isEmpty())\r
+ return;\r
+\r
+ for(Resource dataset : datasets) {\r
+ graph.deny(dataset, jfree.Dataset_renderer);\r
+\r
+ Resource renderer;\r
+ if(text.equals("Area"))\r
+ renderer = GraphUtils.create2(graph, jfree.XYAreaRenderer);\r
+ else\r
+ renderer = GraphUtils.create2(graph, jfree.XYLineRenderer);\r
+\r
+ graph.claim(dataset, jfree.Dataset_renderer, renderer);\r
+ }\r
+ }\r
+ }\r
\r
}
\ No newline at end of file