>-- JFREE.Axis.visibleTickMarks --> L0.Boolean <R L0.HasProperty : L0.FunctionalRelation
>-- JFREE.Axis.visibleAxisLine --> L0.Boolean <R L0.HasProperty : L0.FunctionalRelation
>-- JFREE.Axis.visibleLabel --> L0.Boolean <R L0.HasProperty : L0.FunctionalRelation
+ >-- JFREE.Axis.rotateLabelDegrees --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
JFREE.CategoryAxis <T JFREE.Axis
JFREE.ValueAxis <T JFREE.Axis
JFREE.Series <T L0.Entity
>-- JFREE.color
>-- JFREE.variableRVI --> L0.String <R L0.HasProperty
+ >-- JFREE.variableFilter --> L0.StringArray <R L0.HasProperty
+ >-- JFREE.Series.rangeList --> L0.List <R L0.HasProperty : L0.FunctionalRelation
>-- JFREE.Series.lineWidth --> L0.Integer <R L0.HasProperty : L0.FunctionalRelation
>-- JFREE.Series.exploded --> L0.Boolean <R L0.HasProperty : L0.FunctionalRelation
>-- JFREE.Series.time --> L0.Double <R L0.HasProperty : L0.FunctionalRelation
public final Resource Axis_max_Inverse;\r
public final Resource Axis_min;\r
public final Resource Axis_min_Inverse;\r
+ public final Resource Axis_rotateLabelDegrees;\r
+ public final Resource Axis_rotateLabelDegrees_Inverse;\r
public final Resource Axis_visibleAxisLine;\r
public final Resource Axis_visibleAxisLine_Inverse;\r
public final Resource Axis_visibleLabel;\r
public final Resource Series_exploded_Inverse;\r
public final Resource Series_lineWidth;\r
public final Resource Series_lineWidth_Inverse;\r
+ public final Resource Series_rangeList;\r
+ public final Resource Series_rangeList_Inverse;\r
public final Resource Series_time;\r
public final Resource Series_time_Inverse;\r
public final Resource StackedBarRenderer;\r
public final Resource subtitles_Inverse;\r
public final Resource title;\r
public final Resource title_Inverse;\r
+ public final Resource variableFilter;\r
+ public final Resource variableFilter_Inverse;\r
public final Resource variableRVI;\r
public final Resource variableRVI_Inverse;\r
public final Resource visible;\r
public static final String Axis_max_Inverse = "http://www.simantics.org/JFreeChart-1.0/Axis/max/Inverse";\r
public static final String Axis_min = "http://www.simantics.org/JFreeChart-1.0/Axis/min";\r
public static final String Axis_min_Inverse = "http://www.simantics.org/JFreeChart-1.0/Axis/min/Inverse";\r
+ public static final String Axis_rotateLabelDegrees = "http://www.simantics.org/JFreeChart-1.0/Axis/rotateLabelDegrees";\r
+ public static final String Axis_rotateLabelDegrees_Inverse = "http://www.simantics.org/JFreeChart-1.0/Axis/rotateLabelDegrees/Inverse";\r
public static final String Axis_visibleAxisLine = "http://www.simantics.org/JFreeChart-1.0/Axis/visibleAxisLine";\r
public static final String Axis_visibleAxisLine_Inverse = "http://www.simantics.org/JFreeChart-1.0/Axis/visibleAxisLine/Inverse";\r
public static final String Axis_visibleLabel = "http://www.simantics.org/JFreeChart-1.0/Axis/visibleLabel";\r
public static final String Series_exploded_Inverse = "http://www.simantics.org/JFreeChart-1.0/Series/exploded/Inverse";\r
public static final String Series_lineWidth = "http://www.simantics.org/JFreeChart-1.0/Series/lineWidth";\r
public static final String Series_lineWidth_Inverse = "http://www.simantics.org/JFreeChart-1.0/Series/lineWidth/Inverse";\r
+ public static final String Series_rangeList = "http://www.simantics.org/JFreeChart-1.0/Series/rangeList";\r
+ public static final String Series_rangeList_Inverse = "http://www.simantics.org/JFreeChart-1.0/Series/rangeList/Inverse";\r
public static final String Series_time = "http://www.simantics.org/JFreeChart-1.0/Series/time";\r
public static final String Series_time_Inverse = "http://www.simantics.org/JFreeChart-1.0/Series/time/Inverse";\r
public static final String StackedBarRenderer = "http://www.simantics.org/JFreeChart-1.0/StackedBarRenderer";\r
public static final String subtitles_Inverse = "http://www.simantics.org/JFreeChart-1.0/subtitles/Inverse";\r
public static final String title = "http://www.simantics.org/JFreeChart-1.0/title";\r
public static final String title_Inverse = "http://www.simantics.org/JFreeChart-1.0/title/Inverse";\r
+ public static final String variableFilter = "http://www.simantics.org/JFreeChart-1.0/variableFilter";\r
+ public static final String variableFilter_Inverse = "http://www.simantics.org/JFreeChart-1.0/variableFilter/Inverse";\r
public static final String variableRVI = "http://www.simantics.org/JFreeChart-1.0/variableRVI";\r
public static final String variableRVI_Inverse = "http://www.simantics.org/JFreeChart-1.0/variableRVI/Inverse";\r
public static final String visible = "http://www.simantics.org/JFreeChart-1.0/visible";\r
Axis_max_Inverse = getResourceOrNull(graph, URIs.Axis_max_Inverse);\r
Axis_min = getResourceOrNull(graph, URIs.Axis_min);\r
Axis_min_Inverse = getResourceOrNull(graph, URIs.Axis_min_Inverse);\r
+ Axis_rotateLabelDegrees = getResourceOrNull(graph, URIs.Axis_rotateLabelDegrees);\r
+ Axis_rotateLabelDegrees_Inverse = getResourceOrNull(graph, URIs.Axis_rotateLabelDegrees_Inverse);\r
Axis_visibleAxisLine = getResourceOrNull(graph, URIs.Axis_visibleAxisLine);\r
Axis_visibleAxisLine_Inverse = getResourceOrNull(graph, URIs.Axis_visibleAxisLine_Inverse);\r
Axis_visibleLabel = getResourceOrNull(graph, URIs.Axis_visibleLabel);\r
Series_exploded_Inverse = getResourceOrNull(graph, URIs.Series_exploded_Inverse);\r
Series_lineWidth = getResourceOrNull(graph, URIs.Series_lineWidth);\r
Series_lineWidth_Inverse = getResourceOrNull(graph, URIs.Series_lineWidth_Inverse);\r
+ Series_rangeList = getResourceOrNull(graph, URIs.Series_rangeList);\r
+ Series_rangeList_Inverse = getResourceOrNull(graph, URIs.Series_rangeList_Inverse);\r
Series_time = getResourceOrNull(graph, URIs.Series_time);\r
Series_time_Inverse = getResourceOrNull(graph, URIs.Series_time_Inverse);\r
StackedBarRenderer = getResourceOrNull(graph, URIs.StackedBarRenderer);\r
subtitles_Inverse = getResourceOrNull(graph, URIs.subtitles_Inverse);\r
title = getResourceOrNull(graph, URIs.title);\r
title_Inverse = getResourceOrNull(graph, URIs.title_Inverse);\r
+ variableFilter = getResourceOrNull(graph, URIs.variableFilter);\r
+ variableFilter_Inverse = getResourceOrNull(graph, URIs.variableFilter_Inverse);\r
variableRVI = getResourceOrNull(graph, URIs.variableRVI);\r
variableRVI_Inverse = getResourceOrNull(graph, URIs.variableRVI_Inverse);\r
visible = getResourceOrNull(graph, URIs.visible);\r
CBC.VariableChildRule : VP.ChildRule\r
CBC.SeriesLabelRule : VP.LabelRule\r
CBC.AxisLabelRule : VP.LabelRule\r
+CBC.SeriesLabelDecorationRule : VP.LabelDecorationRule\r
\r
CBC\r
@VP.customChildRule JFREE.Chart CBC.AxisChildRule\r
@VP.customLabelRule JFREE.Axis CBC.AxisLabelRule\r
@VP.customLabelRule JFREE.Series CBC.SeriesLabelRule\r
\r
+CBC\r
+ @VP.customLabelDecorationRule JFREE.Series CBC.SeriesLabelDecorationRule \r
+ \r
CBC\r
@VP.dropActionContribution JFREE.Axis CAC.Actions.SeriesDropAction 1.0 \r
@VP.dropActionContribution JFREE.Series CAC.Actions.SeriesDropAction 1.0 \r
\r
BSBC.SeriesChildRule : VP.ChildRule\r
BSBC.SeriesLabelRule : VP.LabelRule\r
-\r
+BSBC.SeriesLabelDecorationRule : VP.LabelDecorationRule\r
+ \r
BSBC\r
@VP.customChildRule JFREE.Chart BSBC.SeriesChildRule\r
JFREE.Series\r
BSBC \r
@VP.customLabelRule JFREE.Series BSBC.SeriesLabelRule\r
\r
+BSBC\r
+ @VP.customLabelDecorationRule JFREE.Series BSBC.SeriesLabelDecorationRule \r
+ \r
//BSBC\r
// @VP.dropActionContribution JFREE.Series BSAC.Actions.SeriesDropAction 1.0 \r
\r
\r
PSBC.SeriesChildRule : VP.ChildRule\r
PSBC.SeriesLabelRule : VP.LabelRule\r
-\r
+PSBC.SeriesLabelDecorationRule : VP.LabelDecorationRule\r
+ \r
PSBC\r
@VP.customChildRule JFREE.Chart PSBC.SeriesChildRule\r
JFREE.Series\r
PSBC \r
@VP.customLabelRule JFREE.Series PSBC.SeriesLabelRule\r
\r
+PSBC\r
+ @VP.customLabelDecorationRule JFREE.Series PSBC.SeriesLabelDecorationRule \r
+ \r
//PSBC\r
// @VP.dropActionContribution JFREE.Series PSAC.Actions.SeriesDropAction 1.0 \r
\r
public final Resource BarSeriesActionContext_Actions;\r
public final Resource BarSeriesBrowseContext;\r
public final Resource BarSeriesBrowseContext_SeriesChildRule;\r
+ public final Resource BarSeriesBrowseContext_SeriesLabelDecorationRule;\r
public final Resource BarSeriesBrowseContext_SeriesLabelRule;\r
public final Resource BasicExperiment;\r
public final Resource Bottom;\r
public final Resource ChartAxisAndVariablesBrowseContext;\r
public final Resource ChartAxisAndVariablesBrowseContext_AxisChildRule;\r
public final Resource ChartAxisAndVariablesBrowseContext_AxisLabelRule;\r
+ public final Resource ChartAxisAndVariablesBrowseContext_SeriesLabelDecorationRule;\r
public final Resource ChartAxisAndVariablesBrowseContext_SeriesLabelRule;\r
public final Resource ChartAxisAndVariablesBrowseContext_VariableChildRule;\r
public final Resource Cloud;\r
public final Resource PieSeriesActionContext_Actions;\r
public final Resource PieSeriesBrowseContext;\r
public final Resource PieSeriesBrowseContext_SeriesChildRule;\r
+ public final Resource PieSeriesBrowseContext_SeriesLabelDecorationRule;\r
public final Resource PieSeriesBrowseContext_SeriesLabelRule;\r
public final Resource PlaybackExperiment;\r
public final Resource Polarity;\r
public static final String BarSeriesActionContext_Actions = "http://www.simantics.org/Sysdyn-1.1/BarSeriesActionContext/Actions";\r
public static final String BarSeriesBrowseContext = "http://www.simantics.org/Sysdyn-1.1/BarSeriesBrowseContext";\r
public static final String BarSeriesBrowseContext_SeriesChildRule = "http://www.simantics.org/Sysdyn-1.1/BarSeriesBrowseContext/SeriesChildRule";\r
+ public static final String BarSeriesBrowseContext_SeriesLabelDecorationRule = "http://www.simantics.org/Sysdyn-1.1/BarSeriesBrowseContext/SeriesLabelDecorationRule";\r
public static final String BarSeriesBrowseContext_SeriesLabelRule = "http://www.simantics.org/Sysdyn-1.1/BarSeriesBrowseContext/SeriesLabelRule";\r
public static final String BasicExperiment = "http://www.simantics.org/Sysdyn-1.1/BasicExperiment";\r
public static final String Bottom = "http://www.simantics.org/Sysdyn-1.1/Bottom";\r
public static final String ChartAxisAndVariablesBrowseContext = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesBrowseContext";\r
public static final String ChartAxisAndVariablesBrowseContext_AxisChildRule = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesBrowseContext/AxisChildRule";\r
public static final String ChartAxisAndVariablesBrowseContext_AxisLabelRule = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesBrowseContext/AxisLabelRule";\r
+ public static final String ChartAxisAndVariablesBrowseContext_SeriesLabelDecorationRule = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesBrowseContext/SeriesLabelDecorationRule";\r
public static final String ChartAxisAndVariablesBrowseContext_SeriesLabelRule = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesBrowseContext/SeriesLabelRule";\r
public static final String ChartAxisAndVariablesBrowseContext_VariableChildRule = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesBrowseContext/VariableChildRule";\r
public static final String Cloud = "http://www.simantics.org/Sysdyn-1.1/Cloud";\r
public static final String PieSeriesActionContext_Actions = "http://www.simantics.org/Sysdyn-1.1/PieSeriesActionContext/Actions";\r
public static final String PieSeriesBrowseContext = "http://www.simantics.org/Sysdyn-1.1/PieSeriesBrowseContext";\r
public static final String PieSeriesBrowseContext_SeriesChildRule = "http://www.simantics.org/Sysdyn-1.1/PieSeriesBrowseContext/SeriesChildRule";\r
+ public static final String PieSeriesBrowseContext_SeriesLabelDecorationRule = "http://www.simantics.org/Sysdyn-1.1/PieSeriesBrowseContext/SeriesLabelDecorationRule";\r
public static final String PieSeriesBrowseContext_SeriesLabelRule = "http://www.simantics.org/Sysdyn-1.1/PieSeriesBrowseContext/SeriesLabelRule";\r
public static final String PlaybackExperiment = "http://www.simantics.org/Sysdyn-1.1/PlaybackExperiment";\r
public static final String Polarity = "http://www.simantics.org/Sysdyn-1.1/Polarity";\r
BarSeriesActionContext_Actions = getResourceOrNull(graph, URIs.BarSeriesActionContext_Actions);\r
BarSeriesBrowseContext = getResourceOrNull(graph, URIs.BarSeriesBrowseContext);\r
BarSeriesBrowseContext_SeriesChildRule = getResourceOrNull(graph, URIs.BarSeriesBrowseContext_SeriesChildRule);\r
+ BarSeriesBrowseContext_SeriesLabelDecorationRule = getResourceOrNull(graph, URIs.BarSeriesBrowseContext_SeriesLabelDecorationRule);\r
BarSeriesBrowseContext_SeriesLabelRule = getResourceOrNull(graph, URIs.BarSeriesBrowseContext_SeriesLabelRule);\r
BasicExperiment = getResourceOrNull(graph, URIs.BasicExperiment);\r
Bottom = getResourceOrNull(graph, URIs.Bottom);\r
ChartAxisAndVariablesBrowseContext = getResourceOrNull(graph, URIs.ChartAxisAndVariablesBrowseContext);\r
ChartAxisAndVariablesBrowseContext_AxisChildRule = getResourceOrNull(graph, URIs.ChartAxisAndVariablesBrowseContext_AxisChildRule);\r
ChartAxisAndVariablesBrowseContext_AxisLabelRule = getResourceOrNull(graph, URIs.ChartAxisAndVariablesBrowseContext_AxisLabelRule);\r
+ ChartAxisAndVariablesBrowseContext_SeriesLabelDecorationRule = getResourceOrNull(graph, URIs.ChartAxisAndVariablesBrowseContext_SeriesLabelDecorationRule);\r
ChartAxisAndVariablesBrowseContext_SeriesLabelRule = getResourceOrNull(graph, URIs.ChartAxisAndVariablesBrowseContext_SeriesLabelRule);\r
ChartAxisAndVariablesBrowseContext_VariableChildRule = getResourceOrNull(graph, URIs.ChartAxisAndVariablesBrowseContext_VariableChildRule);\r
Cloud = getResourceOrNull(graph, URIs.Cloud);\r
PieSeriesActionContext_Actions = getResourceOrNull(graph, URIs.PieSeriesActionContext_Actions);\r
PieSeriesBrowseContext = getResourceOrNull(graph, URIs.PieSeriesBrowseContext);\r
PieSeriesBrowseContext_SeriesChildRule = getResourceOrNull(graph, URIs.PieSeriesBrowseContext_SeriesChildRule);\r
+ PieSeriesBrowseContext_SeriesLabelDecorationRule = getResourceOrNull(graph, URIs.PieSeriesBrowseContext_SeriesLabelDecorationRule);\r
PieSeriesBrowseContext_SeriesLabelRule = getResourceOrNull(graph, URIs.PieSeriesBrowseContext_SeriesLabelRule);\r
PlaybackExperiment = getResourceOrNull(graph, URIs.PlaybackExperiment);\r
Polarity = getResourceOrNull(graph, URIs.Polarity);\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 </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.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.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>
\ No newline at end of file
import org.eclipse.jface.resource.ImageDescriptor;\r
import org.simantics.browsing.ui.swt.ImagerContributor;\r
import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.sysdyn.ui.Activator;\r
-import org.simantics.sysdyn.ui.browser.nodes.ChartNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.AbstractChartNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.BarChartNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.LineChartNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.PieChartNode;\r
\r
/**\r
- * Provides image for {@link ChartNode} in model browser\r
+ * Provides image for {@link LineChartNode} in model browser\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class ChartImager extends ImagerContributor<ChartNode> {\r
+public class ChartImager extends ImagerContributor<AbstractChartNode<Resource>> {\r
\r
@Override\r
- public ImageDescriptor getDescriptor(ReadGraph graph, ChartNode input) throws DatabaseException {\r
- return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_organisation.png"));\r
+ public ImageDescriptor getDescriptor(ReadGraph graph, AbstractChartNode<Resource> input) throws DatabaseException {\r
+ if(input instanceof BarChartNode)\r
+ return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_bar.png"));\r
+ else if(input instanceof PieChartNode)\r
+ return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_pie.png"));\r
+ else\r
+ return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_line.png"));\r
+\r
+ \r
}\r
\r
}\r
\r
import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.layer0.Layer0;\r
-import org.simantics.sysdyn.ui.browser.nodes.ChartNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.AbstractChartNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.LineChartNode;\r
\r
/**\r
- * Provides label for {@link ChartNode} in model browser\r
+ * Provides label for {@link LineChartNode} in model browser\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class ChartLabeler extends LabelerContributor<ChartNode> {\r
+public class ChartLabeler extends LabelerContributor<AbstractChartNode<Resource>> {\r
\r
@Override\r
- public String getLabel(ReadGraph graph, ChartNode chart) throws DatabaseException {\r
+ public String getLabel(ReadGraph graph, AbstractChartNode<Resource> chart) throws DatabaseException {\r
String name = graph.getPossibleRelatedValue(chart.data, Layer0.getInstance(graph).HasLabel);\r
return name == null ? "Chart (no label)" : name;\r
}\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.common.request.PossibleObjectWithType;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
-import org.simantics.sysdyn.ui.browser.nodes.ChartNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.BarChartNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.LineChartNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ChartsFolder;\r
+import org.simantics.sysdyn.ui.browser.nodes.PieChartNode;\r
\r
/**\r
* Class for creating chart nodes for model browser\r
\r
@Override\r
public Collection<?> getContribution(ReadGraph graph, ChartsFolder folder) throws DatabaseException {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ \r
ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
for(Resource chart : graph.syncRequest(\r
new ObjectsWithType(folder.data,\r
- Layer0.getInstance(graph).ConsistsOf, \r
- JFreeChartResource.getInstance(graph).Chart))) {\r
- result.add(new ChartNode(chart));\r
+ l0.ConsistsOf, \r
+ jfree.Chart))) {\r
+ Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.Plot));\r
+ if(plot != null) {\r
+ if(graph.isInstanceOf(plot, jfree.XYPlot)) {\r
+ result.add(new LineChartNode(chart));\r
+ } else if(graph.isInstanceOf(plot, jfree.CategoryPlot)) {\r
+ result.add(new BarChartNode(chart));\r
+ } else if(graph.isInstanceOf(plot, jfree.PiePlot)) {\r
+ result.add(new PieChartNode(chart));\r
+ }\r
+ }\r
}\r
return result;\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.browser.nodes;\r
+\r
+import java.util.Iterator;\r
+\r
+import org.eclipse.core.runtime.IAdaptable;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
+import org.simantics.browsing.ui.common.node.DeleteException;\r
+import org.simantics.browsing.ui.common.node.IDeletableNode;\r
+import org.simantics.browsing.ui.common.node.IDropTargetNode;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.CancelTransactionException;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.util.RemoverUtil;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.utils.ui.ExceptionUtils;\r
+\r
+public abstract class AbstractChartNode<T> extends AbstractNode<Resource> implements IDropTargetNode, IDeletableNode {\r
+\r
+ public AbstractChartNode(Resource data) {\r
+ super(data);\r
+ }\r
+\r
+\r
+ /**\r
+ * Add variable to this chart, if the dropped element(s) can be adapted to a {@link Variable} \r
+ */\r
+ @Override\r
+ public void drop(Object data) {\r
+ IStructuredSelection selection = (IStructuredSelection)data;\r
+ Iterator<?> iterator = selection.iterator();\r
+ while(iterator.hasNext()) {\r
+ Object o = iterator.next();\r
+ if(o instanceof IAdaptable) {\r
+ Variable v = (Variable) ((IAdaptable)o).getAdapter(Variable.class);\r
+ if(v != null) {\r
+ addVariableToChart(v);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Adds a variable to this chart and map it to the first rangeAxis\r
+ * @param variable\r
+ */\r
+ protected abstract void addVariableToChart(final Variable variable);\r
+\r
+ @Override\r
+ public void delete() throws DeleteException {\r
+ try {\r
+ SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
+ @Override\r
+ public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
+ RemoverUtil.remove(graph, data);\r
+ }\r
+ });\r
+ } catch (DatabaseException e) {\r
+ ExceptionUtils.logAndShowError(e);\r
+ } \r
+\r
+ }\r
+\r
+}
\ No newline at end of file
--- /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.browser.nodes;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.PossibleObjectWithType;\r
+import org.simantics.db.common.request.SingleObjectWithType;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.ui.trend.chart.ChartUtils;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Bar chart node\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class BarChartNode extends AbstractChartNode<Resource> {\r
+\r
+ public BarChartNode(Resource data) {\r
+ super(data);\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Adds a variable to this chart\r
+ * @param variable\r
+ */\r
+ @Override\r
+ protected void addVariableToChart(final Variable variable) {\r
+\r
+ SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+ @Override\r
+ public void perform(WriteGraph graph) throws DatabaseException {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+ Resource plot = graph.syncRequest(new SingleObjectWithType(data, l0.ConsistsOf, jfree.Plot));\r
+ if(plot == null)\r
+ return;\r
+\r
+ Resource dataset = graph.syncRequest(new PossibleObjectWithType(plot, l0.ConsistsOf, jfree.Dataset));\r
+ \r
+ if(dataset == null)\r
+ return;\r
+ \r
+ // Create the series and attach it to the dataset\r
+ String rvi = Variables.getRVI(graph, variable);\r
+ ChartUtils.createSeries(graph, dataset, rvi);\r
+ }\r
+ });\r
+ }\r
+\r
+}\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.browser.nodes;\r
\r
-import java.util.Iterator;\r
-\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.eclipse.jface.viewers.IStructuredSelection;\r
-import org.simantics.browsing.ui.common.node.AbstractNode;\r
-import org.simantics.browsing.ui.common.node.DeleteException;\r
-import org.simantics.browsing.ui.common.node.IDeletableNode;\r
-import org.simantics.browsing.ui.common.node.IDropTargetNode;\r
import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.request.SingleObjectWithType;\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.common.utils.ListUtils;\r
-import org.simantics.db.exception.CancelTransactionException;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.util.RemoverUtil;\r
import org.simantics.db.layer0.variable.Variable;\r
import org.simantics.db.layer0.variable.Variables;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
import org.simantics.sysdyn.ui.trend.chart.ChartUtils;\r
import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.ui.ExceptionUtils;\r
\r
/**\r
- * Node representing a chart\r
+ * Node representing a line chart\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class ChartNode extends AbstractNode<Resource> implements IDropTargetNode, IDeletableNode {\r
+public class LineChartNode extends AbstractChartNode<Resource> {\r
\r
- public ChartNode(Resource data) {\r
+ public LineChartNode(Resource data) {\r
super(data);\r
}\r
\r
- /**\r
- * Add variable to this chart, if the dropped element(s) can be adapted to a {@link Variable} \r
- */\r
- @Override\r
- public void drop(Object data) {\r
- IStructuredSelection selection = (IStructuredSelection)data;\r
- Iterator<?> iterator = selection.iterator();\r
- while(iterator.hasNext()) {\r
- Object o = iterator.next();\r
- if(o instanceof IAdaptable) {\r
- Variable v = (Variable) ((IAdaptable)o).getAdapter(Variable.class);\r
- if(v != null) {\r
- addVariableToChart(v);\r
- }\r
- }\r
- }\r
- }\r
-\r
-\r
/**\r
* Adds a variable to this chart and map it to the first rangeAxis\r
* @param variable\r
*/\r
- private void addVariableToChart(final Variable variable) {\r
+ @Override\r
+ protected void addVariableToChart(final Variable variable) {\r
\r
SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
\r
});\r
}\r
\r
- @Override\r
- public void delete() throws DeleteException {\r
- try {\r
- SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
- @Override\r
- public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
- RemoverUtil.remove(graph, data);\r
- }\r
- });\r
- } catch (DatabaseException e) {\r
- ExceptionUtils.logAndShowError(e);\r
- } \r
-\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.browser.nodes;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.PossibleObjectWithType;\r
+import org.simantics.db.common.request.SingleObjectWithType;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.ui.trend.chart.ChartUtils;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Node for pie charts\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class PieChartNode extends AbstractChartNode<Resource> {\r
+\r
+ public PieChartNode(Resource data) {\r
+ super(data);\r
+ }\r
+\r
+ /**\r
+ * Adds a variable to this chart\r
+ * @param variable\r
+ */\r
+ @Override\r
+ protected void addVariableToChart(final Variable variable) {\r
+ SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+ @Override\r
+ public void perform(WriteGraph graph) throws DatabaseException {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+ Resource plot = graph.syncRequest(new SingleObjectWithType(data, l0.ConsistsOf, jfree.Plot));\r
+ if(plot == null)\r
+ return;\r
+\r
+ Resource dataset = graph.syncRequest(new PossibleObjectWithType(plot, l0.ConsistsOf, jfree.Dataset));\r
+ \r
+ if(dataset == null)\r
+ return;\r
+ \r
+ // Create the series and attach it to the dataset\r
+ String rvi = Variables.getRVI(graph, variable);\r
+ Resource series = ChartUtils.createSeries(graph, dataset, rvi);\r
+ graph.claimLiteral(series, jfree.Series_exploded, false);\r
+ }\r
+ }); \r
+ }\r
+\r
+}\r
protected String label;\r
protected Boolean tMarksVisible, tLabelsVisible, labelVisible, lineVisible;\r
protected Color color;\r
- protected Double min, max;\r
+ protected Double min, max, rotate;\r
\r
/**\r
*\r
color = c == null ? null : G2DUtils.getColor(graph, c);\r
min = graph.getPossibleRelatedValue(axisResource, jfree.Axis_min, Bindings.DOUBLE);\r
max = graph.getPossibleRelatedValue(axisResource, jfree.Axis_max, Bindings.DOUBLE);\r
+ rotate = graph.getPossibleRelatedValue(axisResource, jfree.Axis_rotateLabelDegrees, Bindings.DOUBLE);\r
} catch (DatabaseException e) {\r
e.printStackTrace();\r
}\r
package org.simantics.sysdyn.ui.trend.chart;\r
\r
import org.jfree.chart.axis.Axis;\r
+import org.jfree.chart.axis.CategoryLabelPositions;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
\r
@Override\r
public Axis getAxis() {\r
axis = new org.jfree.chart.axis.CategoryAxis();\r
+ \r
+ if(rotate != null && rotate > 0) {\r
+ ((org.jfree.chart.axis.CategoryAxis)axis).setCategoryLabelPositions(\r
+ CategoryLabelPositions.createUpRotationLabelPositions(Math.toRadians(rotate)));\r
+ }\r
+ \r
return super.getAxis();\r
}\r
\r
import org.simantics.operation.Layer0X;\r
import org.simantics.sysdyn.JFreeChartResource;\r
import org.simantics.sysdyn.adapter.SysdynVariableProperties;\r
+import org.simantics.sysdyn.adapter.VariableRVIUtils;\r
+import org.simantics.sysdyn.manager.SysdynDataSet;\r
import org.simantics.ui.SimanticsUI;\r
\r
/**\r
try {\r
// Get a variable for the series\r
Variable v = Variables.getVariable(graph, realizationURI + rvi);\r
-\r
+ \r
// Get values\r
- double[] va = v.getPossiblePropertyValue(graph, SysdynVariableProperties.VALUES , Bindings.DOUBLE_ARRAY);\r
-\r
- if(va == null || va.length == 0)\r
- continue;\r
-\r
- // Time\r
- Double time = graph.getPossibleRelatedValue(r, jfree.Series_time, Bindings.DOUBLE);\r
-\r
- if(time == null)\r
- time = v.getPossiblePropertyValue(graph, SysdynVariableProperties.TIME, Bindings.DOUBLE);\r
-\r
- // Value\r
- Double value = null;\r
- if(time == null) {\r
- value = va[va.length - 1];\r
- } else {\r
- double[] ta = v.getPossiblePropertyValue(graph, SysdynVariableProperties.TIMES , Bindings.DOUBLE_ARRAY);\r
- for(int i = 0; i < ta.length; i++) {\r
- double t = ta[i];\r
- if(time <= t) {\r
- value = va[i]; \r
- break;\r
- }\r
+ Object object = v.getPossiblePropertyValue(graph, SysdynVariableProperties.ACTIVE_DATASETS , Bindings.VARIANT);\r
+ if(object == null || !(object instanceof ArrayList<?>))\r
+ return series;\r
+ \r
+ ArrayList<SysdynDataSet> datasets = new ArrayList<SysdynDataSet>();\r
+ \r
+ for(Object o : (ArrayList<?>)object) {\r
+ if(o instanceof SysdynDataSet)\r
+ datasets.add((SysdynDataSet)o);\r
+ }\r
+ \r
+ String[] filter = graph.getPossibleRelatedValue(r, jfree.variableFilter);\r
+ if(filter != null) {\r
+ ArrayList<SysdynDataSet> result2 = VariableRVIUtils.getDataset(datasets, filter);\r
+ if(result2 != null) {\r
+ datasets = result2;\r
}\r
-\r
- if(value == null)\r
+ }\r
+ \r
+ for(SysdynDataSet dataset : datasets) {\r
+ double[] va = dataset.values;\r
+ \r
+ \r
+ if(va == null || va.length == 0)\r
+ continue;\r
+\r
+ // Time\r
+ Double time = graph.getPossibleRelatedValue(r, jfree.Series_time, Bindings.DOUBLE);\r
+\r
+ if(time == null)\r
+ time = v.getPossiblePropertyValue(graph, SysdynVariableProperties.TIME, Bindings.DOUBLE);\r
+\r
+ // Value\r
+ Double value = null;\r
+ if(time == null) {\r
value = va[va.length - 1];\r
+ } else {\r
+ double[] ta = dataset.times;\r
+ for(int i = 0; i < ta.length; i++) {\r
+ double t = ta[i];\r
+ if(time <= t) {\r
+ value = va[i]; \r
+ break;\r
+ }\r
+ }\r
+\r
+ if(value == null)\r
+ value = va[va.length - 1];\r
+ }\r
+ String label = graph.getPossibleRelatedValue(r, Layer0.getInstance(graph).HasLabel); // Called to refresh paints when label changes\r
+ String name = dataset.name;\r
+ series.add(new TempSeries(label == null || label.isEmpty() ? name : label, "Current", value));\r
}\r
- String label = graph.getPossibleRelatedValue(r, Layer0.getInstance(graph).HasLabel); // Called to refresh paints when label changes\r
- String name = v.getName(graph);\r
- series.add(new TempSeries(label == null || label.isEmpty() ? name : label, "Current", value));\r
} catch (MissingVariableException e) {\r
// Do nothing, if variable was not found. Move on to the next series\r
}\r
\r
}, listener);\r
}\r
-// System.out.println("RETURNING CATEGORY DATASET" + dataset);\r
return dataset;\r
}\r
\r
for(int i = 0; i < series.size(); i++) {\r
TempSeries s = series.get(i);\r
dataset.addValue(s.value, s.series, s.name);\r
-// System.out.println("Added " + s.name + ": " + s.value + " to " + dataset);\r
}\r
}\r
});\r
\r
@Override\r
public Plot getPlot() {\r
- plot = new org.jfree.chart.plot.CategoryPlot(null, null, null, null);\r
- \r
+ if(plot == null) {\r
+ plot = new org.jfree.chart.plot.CategoryPlot(null, null, null, null);\r
+ } \r
/* Support using multiple axis, but prefer using only one domain and \r
* one range axis\r
*/\r
import org.eclipse.swt.widgets.Composite;\r
import org.jfree.chart.ChartPanel;\r
import org.jfree.chart.JFreeChart;\r
+import org.simantics.db.AsyncReadGraph;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.util.Simantics;\r
-import org.simantics.db.procedure.SyncListener;\r
+import org.simantics.db.procedure.AsyncListener;\r
import org.simantics.db.request.Read;\r
import org.simantics.sysdyn.JFreeChartResource;\r
import org.simantics.ui.SimanticsUI;\r
private Frame frame;\r
private ChartPanel panel;\r
private Composite composite;\r
- IJFreeChart chart;\r
+ private IJFreeChart chart;\r
\r
/**\r
* A new ChartComposite with a definition in chartResourceURI\r
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
frame = SWT_AWT.new_Frame(composite);\r
\r
- try {\r
- // Add a listener displaying the contents of the chart. Chart is re-drawn if the definition changes\r
- Simantics.getSession().syncRequest(new Read<JFreeChart>() {\r
+ // Add a listener displaying the contents of the chart. Chart is re-drawn if the definition changes\r
+ Simantics.getSession().asyncRequest(new Read<JFreeChart>() {\r
\r
- @Override\r
- public JFreeChart perform(ReadGraph graph) throws DatabaseException {\r
- // Adapt chartResource to a chart (XY, pie, bar, ...)\r
- if(graph.isInstanceOf(chartResource, JFreeChartResource.getInstance(graph).Chart)) {\r
- if(chart != null)\r
- chart.dispose();\r
- chart = graph.adapt(chartResource, IJFreeChart.class);\r
- return chart.getChart();\r
- } else {\r
- return null;\r
- }\r
+ @Override\r
+ public JFreeChart perform(ReadGraph graph) throws DatabaseException {\r
+ // Adapt chartResource to a chart (XY, pie, bar, ...)\r
+ if(graph.isInstanceOf(chartResource, JFreeChartResource.getInstance(graph).Chart)) {\r
+ if(chart != null)\r
+ chart.dispose();\r
+ chart = graph.adapt(chartResource, IJFreeChart.class);\r
+ return chart.getChart();\r
+ } else {\r
+ return null;\r
}\r
+ }\r
\r
- } , new SyncListener<JFreeChart>() {\r
+ } , new AsyncListener<JFreeChart>() {\r
\r
- @Override\r
- public boolean isDisposed() {\r
- return composite.isDisposed();\r
- }\r
+ @Override\r
+ public boolean isDisposed() {\r
+ return composite.isDisposed();\r
+ }\r
\r
- @Override\r
- public void execute(ReadGraph graph, JFreeChart chart) throws DatabaseException {\r
- if(chart == null)\r
- return;\r
- // Display the result chart\r
- composite.getDisplay().asyncExec(new RunnableWithObject(chart) {\r
-\r
- @Override\r
- public void run() {\r
- if(composite.isDisposed())\r
- return;\r
- if(panel != null)\r
- frame.remove(panel);\r
- composite.layout();\r
- panel = new ChartPanel((JFreeChart)getObject(), false, true, true, true, true);\r
- frame.add(panel);\r
- frame.repaint();\r
- frame.validate();\r
- }\r
- });\r
- }\r
+ @Override\r
+ public void execute(AsyncReadGraph graph, JFreeChart chart) {\r
+ if(chart == null)\r
+ return;\r
+ // Display the result chart\r
+ composite.getDisplay().asyncExec(new RunnableWithObject(chart) {\r
+\r
+ @Override\r
+ public void run() {\r
+ if(composite.isDisposed())\r
+ return;\r
+ if(panel != null)\r
+ frame.remove(panel);\r
+ composite.layout();\r
+ JFreeChart chart = (JFreeChart)getObject();\r
+ panel = new ChartPanel(chart, false, true, true, true, true);\r
+ frame.add(panel);\r
+ frame.repaint();\r
+ frame.validate();\r
+ }\r
+ });\r
+ }\r
\r
- @Override\r
- public void exception(ReadGraph graph, Throwable throwable) throws DatabaseException {\r
- throwable.printStackTrace();\r
- }\r
- });\r
- } catch (DatabaseException e) {\r
- e.printStackTrace();\r
- }\r
+ @Override\r
+ public void exception(AsyncReadGraph graph, Throwable throwable) {\r
+ throwable.printStackTrace();\r
+\r
+ }\r
+ });\r
}\r
\r
}\r
import java.util.ArrayList;\r
import java.util.UUID;\r
\r
+import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\r
import org.simantics.db.common.utils.ListUtils;\r
import org.simantics.db.common.utils.NameUtils;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.request.PossibleActiveExperiment;\r
+import org.simantics.db.layer0.request.PossibleModel;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.operation.Layer0X;\r
import org.simantics.sysdyn.JFreeChartResource;\r
\r
/**\r
return series;\r
}\r
\r
+ /**\r
+ * Find the current realization uri\r
+ * \r
+ * @param graph ReadGraph\r
+ * @param chartComponent A resource from a chart (consistsOf relation in a chart)\r
+ * @return current realization uri\r
+ * @throws DatabaseException\r
+ */\r
+ public static String getCurrentRealizationURI(ReadGraph graph, Resource chartComponent) throws DatabaseException {\r
+ // Find the model where the chart is located\r
+ Resource model = graph.syncRequest(new PossibleModel(chartComponent)); \r
+ if(model == null)\r
+ return null;\r
+ \r
+ // Find the variable realization of the current experiment\r
+ String realizationURI = null;\r
+ Resource realization = graph.syncRequest(new PossibleActiveExperiment(model));\r
+ if (realization == null) {\r
+ Layer0X L0X = Layer0X.getInstance(graph);\r
+ realization = graph.getPossibleObject(model, L0X.HasBaseRealization);\r
+ }\r
+ if (realization != null)\r
+ realizationURI = graph.getURI(realization);\r
+ \r
+ return realizationURI; \r
+ }\r
}\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.trend.chart;\r
\r
+import java.lang.reflect.InvocationTargetException;\r
import java.util.Collection;\r
\r
import javax.swing.SwingUtilities;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.utils.RunnableWithObject;\r
\r
/**\r
* Class representing a complete JFreeChart.Chart\r
public org.jfree.chart.JFreeChart getChart() {\r
if(plot == null)\r
return null;\r
- jfreechart = new org.jfree.chart.JFreeChart(plot.getPlot());\r
-\r
- SwingUtilities.invokeLater(new Runnable() {\r
- \r
- @Override\r
- public void run() {\r
- // setVisible does not work in TextTitle, have to use this workaround \r
- org.jfree.chart.title.TextTitle t = (org.jfree.chart.title.TextTitle)title.getTitle();\r
- if(t.isVisible())\r
- jfreechart.setTitle(t);\r
-\r
- if(legendVisible != null && !legendVisible) {\r
- for(Object title : jfreechart.getSubtitles()) {\r
- if(title instanceof LegendTitle)\r
- ((LegendTitle)title).setVisible(legendVisible);\r
+\r
+ try {\r
+ SwingUtilities.invokeAndWait(new RunnableWithObject(plot) {\r
+ @Override\r
+ public void run() {\r
+ jfreechart = new org.jfree.chart.JFreeChart(plot.getPlot());\r
+ org.jfree.chart.title.TextTitle t = (org.jfree.chart.title.TextTitle)title.getTitle();\r
+ if(t.isVisible())\r
+ jfreechart.setTitle(t);\r
+\r
+ if(legendVisible != null && !legendVisible) {\r
+ for(Object title : jfreechart.getSubtitles()) {\r
+ if(title instanceof LegendTitle) {\r
+ jfreechart.removeLegend();\r
+ }\r
+ }\r
}\r
}\r
- }\r
- });\r
+ });\r
+ } catch (InterruptedException e) {\r
+ e.printStackTrace();\r
+ } catch (InvocationTargetException e) {\r
+ e.printStackTrace();\r
+ }\r
return jfreechart;\r
}\r
\r
import org.simantics.operation.Layer0X;\r
import org.simantics.sysdyn.JFreeChartResource;\r
import org.simantics.sysdyn.adapter.SysdynVariableProperties;\r
+import org.simantics.sysdyn.adapter.VariableRVIUtils;\r
+import org.simantics.sysdyn.manager.SysdynDataSet;\r
import org.simantics.ui.SimanticsUI;\r
\r
/**\r
Resource seriesList = graph.getPossibleObject(resource, jfree.Dataset_seriesList);\r
if(seriesList != null) {\r
this.seriesList = ListUtils.toList(graph, seriesList);\r
-\r
- colorMap = new HashMap<String, Color>();\r
- explodedMap = new HashMap<String, Boolean>();\r
-\r
- for(Resource r : this.seriesList) {\r
- String rvi = graph.getPossibleRelatedValue(r, jfree.variableRVI);\r
- if(rvi == null)\r
- continue;\r
-\r
- try {\r
- Variable v = Variables.getVariable(graph, realizationURI + rvi);\r
- if(v != null) {\r
- String name = v.getName(graph);\r
- graph.getPossibleRelatedValue(r, l0.HasLabel); // Called to refresh paints when label changes\r
- // Get visual properties\r
- Resource c = graph.getPossibleObject(r, jfree.color);\r
- Color color = c == null ? null : G2DUtils.getColor(graph, c);\r
- colorMap.put(name, color);\r
- Boolean exploded = graph.getPossibleRelatedValue(r, jfree.Series_exploded, Bindings.BOOLEAN);\r
- explodedMap.put(name, exploded);\r
- }\r
- } catch (MissingVariableException e) {\r
- // Invalid or missing rvi, skip this series\r
- continue;\r
- }\r
- }\r
}\r
-\r
} catch (DatabaseException e) {\r
e.printStackTrace();\r
}\r
ArrayList<TempSeries> series = new ArrayList<TempSeries>();\r
// Get properties for all series\r
if(seriesList != null) {\r
+\r
+ colorMap = new HashMap<String, Color>();\r
+ explodedMap = new HashMap<String, Boolean>();\r
+\r
for(Resource r : seriesList) {\r
String label = graph.getPossibleRelatedValue(r, Layer0.getInstance(graph).HasLabel);\r
String rvi = graph.getPossibleRelatedValue(r, jfree.variableRVI);\r
continue;\r
\r
try {\r
+ // Get visual properties\r
+ Resource c = graph.getPossibleObject(r, jfree.color);\r
+ Color color = c == null ? null : G2DUtils.getColor(graph, c);\r
+ Boolean exploded = graph.getPossibleRelatedValue(r, jfree.Series_exploded, Bindings.BOOLEAN);\r
+\r
// Get a variable for the series\r
Variable v = Variables.getVariable(graph, realizationURI + rvi);\r
+\r
// Get values\r
- double[] va = v.getPossiblePropertyValue(graph, SysdynVariableProperties.VALUES , Bindings.DOUBLE_ARRAY);\r
-\r
- if(va == null || va.length == 0)\r
- continue;\r
-\r
- // Time\r
- Double time = graph.getPossibleRelatedValue(r, jfree.Series_time, Bindings.DOUBLE);\r
-\r
- if(time == null)\r
- time = v.getPossiblePropertyValue(graph, SysdynVariableProperties.TIME, Bindings.DOUBLE);\r
-\r
- // Value\r
- Double value = null;\r
- if(time == null) {\r
- value = va[va.length - 1];\r
- } else {\r
- double[] ta = v.getPossiblePropertyValue(graph, SysdynVariableProperties.TIMES , Bindings.DOUBLE_ARRAY);\r
- for(int i = 0; i < ta.length; i++) {\r
- double t = ta[i];\r
- if(time <= t) {\r
- value = va[i]; \r
- break;\r
- }\r
+ Object object = v.getPossiblePropertyValue(graph, SysdynVariableProperties.ACTIVE_DATASETS , Bindings.VARIANT);\r
+ if(object == null || !(object instanceof ArrayList<?>))\r
+ return series;\r
+\r
+ ArrayList<SysdynDataSet> datasets = new ArrayList<SysdynDataSet>();\r
+\r
+ for(Object o : (ArrayList<?>)object) {\r
+ if(o instanceof SysdynDataSet)\r
+ datasets.add((SysdynDataSet)o);\r
+ }\r
+\r
+ String[] filter = graph.getPossibleRelatedValue(r, jfree.variableFilter);\r
+ if(filter != null) {\r
+ ArrayList<SysdynDataSet> result2 = VariableRVIUtils.getDataset(datasets, filter);\r
+ if(result2 != null) {\r
+ datasets = result2;\r
}\r
+ }\r
+\r
+ for(SysdynDataSet dataset : datasets) {\r
+ double[] va = dataset.values;\r
+\r
+ if(va == null || va.length == 0)\r
+ continue;\r
+\r
+ // Time\r
+ Double time = graph.getPossibleRelatedValue(r, jfree.Series_time, Bindings.DOUBLE);\r
\r
- if(value == null)\r
+ if(time == null)\r
+ time = v.getPossiblePropertyValue(graph, SysdynVariableProperties.TIME, Bindings.DOUBLE);\r
+\r
+ // Value\r
+ Double value = null;\r
+ if(time == null) {\r
value = va[va.length - 1];\r
- }\r
+ } else {\r
+ double[] ta = dataset.times;\r
+ for(int i = 0; i < ta.length; i++) {\r
+ double t = ta[i];\r
+ if(time <= t) {\r
+ value = va[i]; \r
+ break;\r
+ }\r
+ }\r
\r
- series.add(new TempSeries(label == null || label.isEmpty() ? v.getName(graph) : label, value));\r
+ if(value == null)\r
+ value = va[va.length - 1];\r
+ }\r
+\r
+ String name = label == null || label.isEmpty() ? dataset.name : label;\r
+ colorMap.put(name, color);\r
+ explodedMap.put(name, exploded);\r
+ series.add(new TempSeries(name, value));\r
+ }\r
} catch (MissingVariableException e) {\r
// Do nothing, if variable was not found. Move on to the next series\r
}\r
import java.awt.Color;\r
import java.util.HashMap;\r
\r
-import javax.swing.SwingUtilities;\r
-\r
import org.jfree.chart.plot.DefaultDrawingSupplier;\r
import org.jfree.chart.plot.Plot;\r
import org.jfree.data.general.Dataset;\r
+import org.jfree.data.general.DatasetChangeEvent;\r
+import org.jfree.data.general.DatasetChangeListener;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
\r
public class PiePlot extends AbstractPlot {\r
\r
org.jfree.chart.plot.PiePlot plot;\r
+ org.jfree.data.general.PieDataset pieDataset;\r
+ DatasetChangeListener listener;\r
\r
public PiePlot(ReadGraph graph, Resource resource) {\r
super(graph, resource);\r
@Override\r
public Plot getPlot() {\r
if(plot == null) {\r
- plot = new org.jfree.chart.plot.PiePlot();\r
+ plot = new MyPiePlot();\r
}\r
\r
if(!datasets.isEmpty()) {\r
// We assume that a pie plot has only one dataset\r
- IDataset ds = datasets.get(0);\r
- final Dataset dataset = ((PieDataset)ds).getDataset();\r
- final HashMap<String, Color> colorMap = ((PieDataset)ds).getColorMap();\r
- final HashMap<String, Boolean> explodedMap = ((PieDataset)ds).getExplodedMap();\r
- if(dataset instanceof org.jfree.data.general.PieDataset) {\r
- SwingUtilities.invokeLater(new Runnable() {\r
-\r
- @Override\r
- public void run() {\r
- plot.clearSectionPaints(true);\r
- plot.setDrawingSupplier(new DefaultDrawingSupplier());\r
-\r
- org.jfree.data.general.PieDataset pieDataset = (org.jfree.data.general.PieDataset)dataset;\r
- plot.setDataset(pieDataset);\r
-\r
- for(String name : colorMap.keySet())\r
- plot.setSectionPaint(name, colorMap.get(name));\r
-\r
- for(String name : explodedMap.keySet()) {\r
- Boolean exploded = explodedMap.get(name);\r
- if(Boolean.TRUE.equals(exploded))\r
- plot.setExplodePercent(name, 0.3);\r
- } \r
- }\r
- });\r
+ final IDataset ds = datasets.get(0);\r
+ Dataset dataset = ((PieDataset)ds).getDataset();\r
+\r
+ plot.clearSectionPaints(true);\r
+ plot.setDrawingSupplier(new DefaultDrawingSupplier());\r
+\r
+ if(pieDataset != null && listener != null) {\r
+ pieDataset.removeChangeListener(listener);\r
}\r
+ \r
+ pieDataset = (org.jfree.data.general.PieDataset)dataset;\r
+ plot.setDataset(pieDataset);\r
+ \r
+ listener = new DatasetChangeListener() {\r
+ \r
+ @Override\r
+ public void datasetChanged(DatasetChangeEvent event) {\r
+ HashMap<String, Color> colorMap = ((PieDataset)ds).getColorMap();\r
+ HashMap<String, Boolean> explodedMap = ((PieDataset)ds).getExplodedMap();\r
+ \r
+ for(Object o : plot.getDataset().getKeys()) {\r
+ if(o instanceof Comparable) {\r
+ Comparable<?> key = (Comparable<?>)o;\r
+ if(explodedMap.containsKey(key) && explodedMap.get(key)) {\r
+ plot.setExplodePercent(key, 0.3);\r
+\r
+ } else {\r
+ plot.setExplodePercent(key, 0);\r
+ }\r
+ }\r
+ }\r
+ \r
+ for(String name : explodedMap.keySet()) {\r
+ Boolean exploded = explodedMap.get(name);\r
+ if(Boolean.TRUE.equals(exploded))\r
+ plot.setExplodePercent(name, 0.3);\r
+ } \r
+ \r
+ plot.setDrawingSupplier(new DefaultDrawingSupplier());\r
+\r
+ for(String name : colorMap.keySet())\r
+ plot.setSectionPaint(name, colorMap.get(name));\r
+ }\r
+ };\r
+ \r
+ pieDataset.addChangeListener(listener);\r
}\r
return plot;\r
}\r
\r
+ /**\r
+ * Pie plot class with a stricter equals condition\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class MyPiePlot extends org.jfree.chart.plot.PiePlot {\r
+\r
+ private static final long serialVersionUID = -5917620061541212934L;\r
+\r
+ @Override\r
+ public boolean equals(Object obj) {\r
+ boolean result = super.equals(obj);\r
+ if(result == true) {\r
+ org.jfree.chart.plot.PiePlot that = (org.jfree.chart.plot.PiePlot) obj;\r
+ if (this.getDataset() != that.getDataset()) {\r
+ return false; // Normally plot does not check this. We need this to properly update the charts\r
+ }\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ }\r
+\r
}\r
import org.simantics.operation.Layer0X;\r
import org.simantics.sysdyn.JFreeChartResource;\r
import org.simantics.sysdyn.adapter.SysdynVariableProperties;\r
+import org.simantics.sysdyn.adapter.VariableRVIUtils;\r
import org.simantics.sysdyn.manager.SysdynDataSet;\r
import org.simantics.ui.SimanticsUI;\r
\r
try {\r
// Get visual properties\r
Integer width = graph.getPossibleRelatedValue(r, jfree.Series_lineWidth, Bindings.INTEGER);\r
+ if(width == null) width = 1;\r
+\r
Resource c = graph.getPossibleObject(r, jfree.color);\r
Color color = c == null ? null : G2DUtils.getColor(graph, c);\r
\r
// Get a variable for the series\r
Variable v = Variables.getVariable(graph, realizationURI + rvi);\r
\r
- if(width == null) width = 1;\r
+ \r
// Get values\r
-// double[] va = v.getPossiblePropertyValue(graph, SysdynVariableProperties.VALUES , Bindings.DOUBLE_ARRAY);\r
-\r
-\r
Object object = v.getPossiblePropertyValue(graph, SysdynVariableProperties.ACTIVE_DATASETS , Bindings.VARIANT);\r
if(object == null || !(object instanceof ArrayList<?>))\r
return series;\r
- ArrayList<?> datasets = (ArrayList<?>)object;\r
- for(Object o : datasets) {\r
- if(!(o instanceof SysdynDataSet))\r
- continue;\r
+ \r
+ ArrayList<SysdynDataSet> datasets = new ArrayList<SysdynDataSet>();\r
\r
- SysdynDataSet dataset = (SysdynDataSet)o;\r
+ for(Object o : (ArrayList<?>)object) {\r
+ if(o instanceof SysdynDataSet)\r
+ datasets.add((SysdynDataSet)o);\r
+ }\r
+ \r
+ \r
+ String[] filter = graph.getPossibleRelatedValue(r, jfree.variableFilter);\r
+ if(filter != null) {\r
+ ArrayList<SysdynDataSet> result2 = VariableRVIUtils.getDataset(datasets, filter);\r
+ if(result2 != null) {\r
+ datasets = result2;\r
+ }\r
+ }\r
+ \r
+ for(SysdynDataSet dataset : datasets) {\r
double[] va = dataset.values;\r
\r
// Get domain axis values (time OR other variable) \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.graphexplorer;\r
+\r
+import org.eclipse.jface.resource.FontDescriptor;\r
+import org.simantics.browsing.ui.content.LabelDecorator;\r
+import org.simantics.browsing.ui.model.labeldecorators.LabelDecorationRule;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+\r
+public class SeriesLabelDecorationRule implements LabelDecorationRule {\r
+\r
+ @Override\r
+ public boolean isCompatible(Class<?> contentType) {\r
+ return contentType.equals(Resource.class);\r
+ }\r
+\r
+ @Override\r
+ public LabelDecorator getLabelDecorator(ReadGraph graph, Object content) throws DatabaseException {\r
+ Resource resource = AdaptionUtils.adaptToSingle(content, Resource.class);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+ if (resource != null && graph.isInstanceOf(resource, jfree.Series)) {\r
+ final String[] filter = graph.getPossibleRelatedValue(resource, jfree.variableFilter, Bindings.STRING_ARRAY);\r
+ if(filter != null) {\r
+ return new LabelDecorator.Stub() {\r
+ @Override\r
+ public String decorateLabel(String label, String column, int itemIndex) {\r
+ label += " [";\r
+ for(int i = 0; i < filter.length; i++) {\r
+ label += filter[i];\r
+ if(i < filter.length - 1)\r
+ label += ", ";\r
+ }\r
+ label += "]";\r
+ return label;\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public <F> F decorateFont(F font, String column, int itemIndex) {\r
+ return (F) ((FontDescriptor) font);\r
+ }\r
+ };\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+}\r
\r
\r
@Override\r
- public void applyText(WriteGraph graph, Resource issue, String text) throws DatabaseException {\r
+ public void applyText(WriteGraph graph, Resource resource, String text) throws DatabaseException {\r
if(active) {\r
text = "/" + text.replace('.', '/');\r
- graph.claimLiteral(issue, JFreeChartResource.getInstance(graph).variableRVI, text, Bindings.STRING);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ graph.claimLiteral(resource, jfree.variableRVI, text, Bindings.STRING);\r
+ graph.deny(resource, jfree.variableFilter);\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.properties;\r
+\r
+import java.util.Iterator;\r
+import java.util.LinkedHashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\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.layout.GridLayout;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedCombo;\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.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.common.utils.OrderedSetUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.db.procedure.Listener;\r
+import org.simantics.db.request.Read;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.trend.chart.ChartUtils;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+import org.simantics.utils.RunnableWithObject;\r
+import org.simantics.utils.datastructures.Quad;\r
+import org.simantics.utils.datastructures.Triple;\r
+\r
+/**\r
+ * Composite for range controls in chart series properties\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class RangeComposite extends Composite implements Widget {\r
+\r
+ private Composite composite;\r
+ \r
+ public RangeComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
+ super(parent, style);\r
+ support.register(this);\r
+ GridLayoutFactory.fillDefaults().spacing(3, 0).margins(3, 3).applyTo(this);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(this);\r
+ composite = this;\r
+ }\r
+\r
+ @Override\r
+ public void setInput(final ISessionContext context, final Object input) {\r
+ if(composite == null || composite.isDisposed())\r
+ return;\r
+\r
+ final Resource series = AdaptionUtils.adaptToSingle(input, Resource.class);\r
+\r
+ /*\r
+ * Listen to the enumerations assigned to the variable in this series.\r
+ * Listener is needed because the user can change the variableRVI for the series\r
+ * and that changes the options for range\r
+ */\r
+ context.getSession().asyncRequest(new Read<LinkedHashMap<String, Resource>>() {\r
+\r
+ @Override\r
+ public LinkedHashMap<String, Resource> perform(ReadGraph graph) throws DatabaseException {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+\r
+ String realizationURI = ChartUtils.getCurrentRealizationURI(graph, series);\r
+ String rvi = graph.getPossibleRelatedValue(series, jfree.variableRVI);\r
+ if(rvi == null)\r
+ return null;\r
+ \r
+ try {\r
+ // Find the variable for the current variableRVI\r
+ Variable v = Variables.getVariable(graph, realizationURI + rvi.trim());\r
+ Resource variable = v.getRepresents(graph);\r
+ \r
+ // Return the enumerations assigned to that variable\r
+ Resource arrayIndexes = graph.getPossibleObject(variable, sr.HasArrayIndexes);\r
+ if(arrayIndexes != null) {\r
+ LinkedHashMap<String, Resource> result = new LinkedHashMap<String, Resource>();\r
+ for(Resource enumeration : OrderedSetUtils.toList(graph, arrayIndexes)) {\r
+ String enumerationName = NameUtils.getSafeName(graph, enumeration);\r
+ result.put(enumerationName, enumeration);\r
+ }\r
+ return result;\r
+ }\r
+ } catch (DatabaseException e) {\r
+ // No variable was found, return null\r
+ }\r
+ return null;\r
+ }\r
+\r
+ }, new Listener<LinkedHashMap<String, Resource>>() {\r
+\r
+ @Override\r
+ public void execute(LinkedHashMap<String, Resource> result) {\r
+ if(isDisposed())\r
+ return;\r
+\r
+ // Always modify the composite, even with null result\r
+ composite.getDisplay().asyncExec(new RunnableWithObject(result) {\r
+ @Override\r
+ public void run() {\r
+ if(composite == null || composite.isDisposed())\r
+ return;\r
+\r
+ // Remove all content (even with null result)\r
+ for(Control child : composite.getChildren())\r
+ child.dispose();\r
+\r
+ if(getObject() == null)\r
+ return;\r
+\r
+ // New widgetSupport for the combos\r
+ WidgetSupportImpl support = new WidgetSupportImpl();\r
+\r
+ Label label;\r
+ TrackedCombo combo;\r
+ LinkedHashMap<?, ?> result = (LinkedHashMap<?, ?>)getObject();\r
+ Iterator<?> iterator = result.keySet().iterator();\r
+ \r
+ // For each array index (enumeration), create a label and a combo \r
+ int index = 0;\r
+ while(iterator.hasNext()) {\r
+ Object key = iterator.next();\r
+ Composite c = new Composite(composite, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(c);\r
+ GridLayoutFactory.fillDefaults().applyTo(c);\r
+ \r
+ label = new Label(c, SWT.NONE);\r
+ label.setText((String)key);\r
+ GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.END).applyTo(label);\r
+\r
+ combo = new TrackedCombo(c, support, SWT.READ_ONLY);\r
+ combo.setItemFactory(new RangeItemFactory(index, (Resource)result.get(key)));\r
+ combo.setSelectionFactory(new RangeSelectionFactory(index));\r
+ combo.addModifyListener(new RangeModifyListener(index, result.size()));\r
+ GridDataFactory.fillDefaults().applyTo(combo.getWidget());\r
+ index++;\r
+ }\r
+ \r
+ // Set the width of the combo \r
+ GridLayout gl = (GridLayout)composite.getLayout();\r
+ gl.numColumns = index;\r
+ \r
+ // Set input for the combos\r
+ support.fireInput(context, input);\r
+ \r
+ /*\r
+ * Find out if this composite is located in a scrolled composite. \r
+ * If it is, resize the scrolled composite\r
+ */\r
+ Composite previousParent = composite.getParent();\r
+ for(int i = 0; i < 5; i++) {\r
+ if(previousParent.getParent() instanceof ScrolledComposite) {\r
+ previousParent.layout();\r
+ ScrolledComposite sc = (ScrolledComposite) previousParent.getParent();\r
+ Point size = previousParent.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\r
+ break;\r
+ }\r
+ previousParent = previousParent.getParent();\r
+ }\r
+ }\r
+ }); \r
+ }\r
+\r
+ @Override\r
+ public void exception(Throwable t) {\r
+ t.printStackTrace();\r
+ }\r
+\r
+ @Override\r
+ public boolean isDisposed() {\r
+ return composite == null || composite.isDisposed();\r
+ }\r
+ });\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class RangeSelectionFactory extends ReadFactoryImpl<Resource, String> {\r
+\r
+ int index;\r
+\r
+ /**\r
+ * \r
+ * @param index Index of the enumeration in the variable\r
+ */\r
+ public RangeSelectionFactory(int index) {\r
+ this.index = index;\r
+ }\r
+\r
+ public Object getIdentity(Object inputContents) {\r
+ return new Triple<Object, Integer, Class<?>>(inputContents, index, getClass());\r
+ }\r
+\r
+ @Override\r
+ public String perform(ReadGraph graph, Resource series) throws DatabaseException {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ String[] filter = graph.getPossibleRelatedValue(series, jfree.variableFilter, Bindings.STRING_ARRAY);\r
+ \r
+ /*\r
+ * If no filter was found or the index is not applicable, return "All"\r
+ */\r
+ if(filter == null)\r
+ return "All";\r
+ else if(filter.length < index)\r
+ return "All";\r
+ else\r
+ return filter[index];\r
+ }\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 RangeItemFactory extends ReadFactoryImpl<Resource, Map<String, Object>> {\r
+\r
+ private int index;\r
+ private Resource enumeration;\r
+\r
+ /**\r
+ * \r
+ * @param index Index of the enumeration in the variable\r
+ * @param enumeration The enumeration\r
+ */\r
+ public RangeItemFactory(int index, Resource enumeration) {\r
+ this.index = index;\r
+ this.enumeration = enumeration;\r
+ }\r
+\r
+ public Object getIdentity(Object inputContents) {\r
+ return new Quad<Object, Integer, Resource, Class<?>>(inputContents, index, enumeration, getClass());\r
+ }\r
+ @Override\r
+ public Map<String, Object> perform(ReadGraph graph, Resource series) throws DatabaseException {\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ LinkedHashMap<String, Object> result = new LinkedHashMap<String, Object>();\r
+ Resource enumerationIndexes = graph.getPossibleObject(enumeration, sr.HasEnumerationIndexes);\r
+ List<Resource> indexes = OrderedSetUtils.toList(graph, enumerationIndexes);\r
+ // First add "All" and "Sum", then all of the enumeration indexes in order\r
+ result.put("All", "All");\r
+ result.put("Sum", "Sum");\r
+ for(Resource index : indexes) {\r
+ String name = NameUtils.getSafeName(graph, index);\r
+ result.put(name, name);\r
+ }\r
+ return result;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * RangeModifyListener for modifying a range filter in chart series \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class RangeModifyListener extends ComboModifyListenerImpl<Resource> {\r
+ \r
+ private int index, size;\r
+\r
+ /**\r
+ * \r
+ * @param index Index of the modified range filter\r
+ * @param size Size of the whole filter (for situations where there is no filter)\r
+ */\r
+ public RangeModifyListener(int index, int size) {\r
+ this.index = index;\r
+ this.size = size;\r
+ }\r
+\r
+ @Override\r
+ public void applyText(WriteGraph graph, Resource series, String text) throws DatabaseException {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ String[] filter = graph.getPossibleRelatedValue(series, jfree.variableFilter, Bindings.STRING_ARRAY);\r
+ \r
+ // If there is no filter, create a default filter with all indexes "All"\r
+ if(filter == null) {\r
+ filter = new String[size];\r
+ for(int i = 0; i < filter.length; i++) {\r
+ filter[i] = "All";\r
+ }\r
+ }\r
+ \r
+ // Modify the filter index\r
+ filter[index] = text;\r
+ graph.claimLiteral(series, jfree.variableFilter, filter, Bindings.STRING_ARRAY);\r
+ }\r
+ }\r
+}\r
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Group;\r
import org.eclipse.swt.widgets.Label;\r
+import org.eclipse.swt.widgets.Spinner;\r
import org.eclipse.ui.IWorkbenchSite;\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.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;\r
+import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListener;\r
+import org.simantics.browsing.ui.swt.widgets.impl.TrackedModifyEvent;\r
+import org.simantics.browsing.ui.swt.widgets.impl.Widget;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.databoard.Bindings;\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.PossibleObjectWithType;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
import org.simantics.sysdyn.ui.trend.chart.properties.JFreeChartPropertyColorProvider;\r
import org.simantics.sysdyn.ui.trend.chart.properties.TitleFactory;\r
import org.simantics.sysdyn.ui.trend.chart.properties.TitleModifier;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.TrackedSpinner;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
\r
/**\r
* General properties of a bar chart\r
private Button hgrid, htitle, hlegend;\r
private TrackedText name, title;\r
private Combo type;\r
+ private TrackedSpinner angle;\r
\r
@Override\r
public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) { \r
hlegend.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Chart_visibleLegend, true));\r
hlegend.addSelectionListener(new BooleanSelectionListener(context, null, JFreeChartResource.URIs.Chart_visibleLegend));\r
\r
+ Composite angleComposite = new Composite(composite, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(angleComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(angleComposite);\r
+ // Line width\r
+ label = new Label(angleComposite, SWT.NONE);\r
+ label.setText("Label angle:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+\r
+ angle = new TrackedSpinner(angleComposite, support, SWT.BORDER);\r
+ angle.setSelectionFactory(new AngleSelectionFactory());\r
+ angle.addModifyListener(new AngleModifyListener());\r
+ angle.setMinimum(0);\r
+ angle.setMaximum(90);\r
+ angle.getWidget().setIncrement(5);\r
+ GridDataFactory.fillDefaults().applyTo(angle.getWidget());\r
+\r
sc.setContent(composite);\r
Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
sc.setMinSize(size);\r
}\r
\r
+ /**\r
+ * ModifyListener for the angle {@link TrackedSpinner}\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class AngleModifyListener implements TextModifyListener, Widget {\r
+\r
+ private ISessionContext context;\r
+ private Object lastInput = null;\r
+\r
+ @Override\r
+ public void modifyText(TrackedModifyEvent e) {\r
+ if(context == null)\r
+ return;\r
+\r
+ // Get the text value from spinner and associated resource (input)\r
+ Spinner spinner = (Spinner)e.getWidget();\r
+ final String textValue = spinner.getText();\r
+ final Object input = lastInput;\r
+\r
+ try {\r
+ context.getSession().syncRequest(new WriteRequest() {\r
+\r
+ @Override\r
+ public void perform(WriteGraph graph) throws DatabaseException {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+\r
+ Resource chart = AdaptionUtils.adaptToSingle(input, Resource.class);\r
+ Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.CategoryPlot));\r
+ Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
+\r
+ try {\r
+ // usually reliable, since the spinner does all the checks\r
+ Double value = Double.parseDouble(textValue); \r
+ graph.claimLiteral(domainAxis, jfree.Axis_rotateLabelDegrees, value, Bindings.DOUBLE);\r
+ } catch (NumberFormatException e) {\r
+ graph.claimLiteral(domainAxis, jfree.Axis_rotateLabelDegrees, 0.0, Bindings.DOUBLE);\r
+ }\r
+ }\r
+\r
+ });\r
+ } catch (DatabaseException e1) {\r
+ e1.printStackTrace();\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public void setInput(ISessionContext context, Object parameter) {\r
+ this.context = context;\r
+ lastInput = parameter;\r
+ }\r
+\r
+ }\r
+\r
+ /**\r
+ * Class for setting the value for angle {@link TrackedSpinner}\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class AngleSelectionFactory extends ReadFactoryImpl<Resource, Integer> {\r
+\r
+ @Override\r
+ public Integer perform(ReadGraph graph, Resource chart) throws DatabaseException {\r
+ Double angle = 0.0;\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.CategoryPlot));\r
+ if(plot != null) {\r
+ Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
+ if(domainAxis != null) {\r
+ Double value = graph.getPossibleRelatedValue(domainAxis, jfree.Axis_rotateLabelDegrees);\r
+ if(value != null)\r
+ angle = value;\r
+ }\r
+ }\r
+ return angle.intValue();\r
+\r
+ }\r
+\r
+ }\r
+\r
}\r
import org.simantics.sysdyn.ui.trend.chart.properties.JFreeChartPropertyColorProvider;\r
import org.simantics.sysdyn.ui.trend.chart.properties.RVIFactory;\r
import org.simantics.sysdyn.ui.trend.chart.properties.RVIModifier;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.RangeComposite;\r
\r
/**\r
* Composite for modifying properties of a series in a bar chart\r
\r
private TrackedText variable, label;\r
\r
- public BarSeriesPropertyComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
+ public BarSeriesPropertyComposite(Composite parent, final ISessionContext context, WidgetSupport support, int style) {\r
super(parent, style);\r
\r
GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);\r
variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager()));\r
GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget());\r
\r
+ // Range\r
+ label = new Label(this, SWT.NONE);\r
+ label.setText("Range:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ \r
+ RangeComposite rangeComposite = new RangeComposite(this, context, support, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);\r
+ \r
+ \r
// Label to be displayed in chart for this series\r
label = new Label(this, SWT.NONE);\r
label.setText("Label:");\r
private WidgetSupportImpl additionalSupport;\r
private Button add, remove;\r
private Resource chartResource;\r
+ private BarSeriesPropertyComposite spc;\r
\r
\r
public BarSeriesTab() {\r
if(resource == null)\r
return;\r
\r
-\r
for(Control child : propertyContainer.getChildren()) {\r
child.dispose();\r
}\r
- BarSeriesPropertyComposite spc = new BarSeriesPropertyComposite(propertyContainer, context, additionalSupport, SWT.NONE);\r
+ spc = new BarSeriesPropertyComposite(propertyContainer, context, additionalSupport, SWT.NONE);\r
+\r
+ additionalSupport.fireInput(context, selection);\r
+\r
propertyContainer.setContent(spc);\r
Point size = spc.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
propertyContainer.setMinSize(size);\r
-\r
- additionalSupport.fireInput(context, selection);\r
}\r
\r
-\r
/**\r
* SelectionListener for adding a new variable to a plot\r
* @author Teemu Lempinen\r
\r
if(dataset != null) {\r
// Create series with no rvi\r
- Resource series = ChartUtils.createSeries(graph, dataset, null);\r
- graph.claimLiteral(series, jfree.Series_exploded, false);\r
+ ChartUtils.createSeries(graph, dataset, null);\r
}\r
}\r
}\r
hlegend.setText("Legend");\r
hlegend.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Chart_visibleLegend, true));\r
hlegend.addSelectionListener(new BooleanSelectionListener(context, null, JFreeChartResource.URIs.Chart_visibleLegend));\r
-\r
+ \r
sc.setContent(composite);\r
Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
sc.setMinSize(size);\r
import org.simantics.sysdyn.ui.trend.chart.properties.JFreeChartPropertyColorProvider;\r
import org.simantics.sysdyn.ui.trend.chart.properties.RVIFactory;\r
import org.simantics.sysdyn.ui.trend.chart.properties.RVIModifier;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.RangeComposite;\r
\r
/**\r
* Composite containing the properties of a series\r
variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager()));\r
GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget());\r
\r
+ // Range\r
+ label = new Label(this, SWT.NONE);\r
+ label.setText("Range:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ \r
+ RangeComposite rangeComposite = new RangeComposite(this, context, support, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);\r
+ \r
+ \r
// Label to be displayed in chart for this series\r
label = new Label(this, SWT.NONE);\r
label.setText("Label:");\r
import org.simantics.browsing.ui.swt.widgets.Button;\r
import org.simantics.browsing.ui.swt.widgets.GraphExplorerComposite;\r
import org.simantics.browsing.ui.swt.widgets.impl.SelectionListenerImpl;\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.Resource;\r
import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.PossibleObjectWithType;\r
import org.simantics.db.common.utils.ListUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.layer0.util.RemoverUtil;\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class PieSeriesTab extends LabelPropertyTabContributor {\r
+public class PieSeriesTab extends LabelPropertyTabContributor implements Widget {\r
\r
private GraphExplorerComposite explorer;\r
private ScrolledComposite propertyContainer;\r
private WidgetSupportImpl additionalSupport;\r
private Button add, remove;\r
+ private Resource chartResource;\r
\r
public PieSeriesTab() {\r
additionalSupport = new WidgetSupportImpl();\r
\r
@Override\r
public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) {\r
+ support.register(this);\r
Composite composite = new Composite(body, SWT.NONE);\r
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
\r
@Override\r
public void apply(WriteGraph graph, Resource input) throws DatabaseException {\r
- if(input == null)\r
- return;\r
JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
Layer0 l0 = Layer0.getInstance(graph);\r
- Resource dataset;\r
- if(graph.isInstanceOf(input, jfree.Series)) {\r
- dataset = graph.getPossibleObject(input, l0.PartOf);\r
- if(dataset != null) {\r
- // Create series with no rvi\r
- Resource series = ChartUtils.createSeries(graph, dataset, null);\r
- graph.claimLiteral(series, jfree.Series_exploded, false);\r
+ Resource dataset = null;\r
+ if(input == null) {\r
+ if(chartResource != null) {\r
+ Resource plot = graph.syncRequest(new PossibleObjectWithType(chartResource, l0.ConsistsOf, jfree.Plot));\r
+ if(plot != null)\r
+ dataset = graph.syncRequest(new PossibleObjectWithType(plot, l0.ConsistsOf, jfree.Dataset));\r
}\r
+ } else {\r
+ if(graph.isInstanceOf(input, jfree.Series)) {\r
+ dataset = graph.getPossibleObject(input, l0.PartOf);\r
+ }\r
+ }\r
+ if(dataset != null) {\r
+ // Create series with no rvi\r
+ Resource series = ChartUtils.createSeries(graph, dataset, null);\r
+ graph.claimLiteral(series, jfree.Series_exploded, false);\r
}\r
}\r
}\r
}\r
}\r
}\r
-\r
+ \r
+ @Override\r
+ public void setInput(ISessionContext context, Object input) {\r
+ chartResource = AdaptionUtils.adaptToSingle(input, Resource.class);\r
+ }\r
\r
}\r
import org.simantics.sysdyn.ui.trend.chart.properties.JFreeChartPropertyColorProvider;\r
import org.simantics.sysdyn.ui.trend.chart.properties.RVIFactory;\r
import org.simantics.sysdyn.ui.trend.chart.properties.RVIModifier;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.RangeComposite;\r
import org.simantics.sysdyn.ui.trend.chart.properties.TrackedSpinner;\r
import org.simantics.ui.utils.AdaptionUtils;\r
\r
variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager()));\r
GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget());\r
\r
+ // Range\r
+ label = new Label(this, SWT.NONE);\r
+ label.setText("Range:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ \r
+ RangeComposite rangeComposite = new RangeComposite(this, context, support, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);\r
+ \r
// Label to be displayed in chart for this series \r
label = new Label(this, SWT.NONE);\r
label.setText("Label:");\r
*******************************************************************************/\r
package org.simantics.sysdyn.adapter;\r
\r
+import java.util.ArrayList;\r
import java.util.HashMap;\r
import java.util.LinkedHashMap;\r
import java.util.List;\r
import org.simantics.db.layer0.variable.Variables;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.manager.SysdynDataSet;\r
\r
/**\r
* Utils for finding all active rvis for a single variable. A variable can have multiple \r
*\r
*/\r
public class VariableRVIUtils {\r
- \r
+\r
/**\r
* Recursive function for finding number format and label for the set of rvis. (rvis.put("Variable[1]", "Variable[index1]");\r
* At the end of the recursive calls, rvis contains all possible combinations of enumeration indexes that are\r
}\r
}\r
}\r
- \r
+\r
/**\r
* Resolves and replaces all overridden enumerations in enumerations -list\r
* \r
*/\r
public static HashMap<String, String> getActiveRVIs(ReadGraph graph, Variable variable) throws DatabaseException {\r
HashMap<String, String> rvis = new LinkedHashMap<String, String>();\r
- \r
+\r
SysdynResource sr = SysdynResource.getInstance(graph);\r
- \r
+\r
String rvi = Variables.getRVI(graph, variable);\r
- \r
+\r
Resource r = variable.getPropertyValue(graph, Variables.REPRESENTS);\r
\r
Resource arrayIndexes = graph.getPossibleObject(r, sr.HasArrayIndexes);\r
else\r
rvis.put(rvi, rvi);\r
}\r
- \r
+\r
return rvis;\r
}\r
\r
+ \r
+ /**\r
+ * Filters a list of datasets of a single variable with a given filter. Filter should contain \r
+ * as many entries as the variable has enumerations. If the variable is Var[Enum1, Enum2, Enum3]\r
+ * the filter length should be 3.\r
+ * \r
+ * Allowed filter entries are All, Sum and a name of an index.\r
+ * \r
+ * Example filtering for variable Var[Enum1, Enum2, Enum3] where all enumerations have indexes {1, 2}\r
+ * \r
+ * filter: {All, Sum, 1}\r
+ * \r
+ * Filters are applied from back to front\r
+ * \r
+ * 1 1 1\r
+ * 1 1 2 \r
+ * 1 2 1 1 1 1 \r
+ * 1 2 2 => 1 2 1 => 1 SUM(1 1, 2 1)\r
+ * 2 1 1 2 1 1 2 SUM(1 1, 2 1)\r
+ * 2 1 2 2 2 1 \r
+ * 2 2 1 \r
+ * 2 2 2 \r
+ * \r
+ * @param datasets List of SysdynDatasets for a single multidimensional variable\r
+ * @param filter filter for the datasets\r
+ * @return filtered list of SysdynDatasets\r
+ */\r
+ public static ArrayList<SysdynDataSet> getDataset(ArrayList<SysdynDataSet> datasets, String[] filter) {\r
+ // If all filters are "All", no filtering is required.\r
+ boolean doFiltering = false;\r
+ for(String f : filter) {\r
+ if(!f.equalsIgnoreCase("All")) {\r
+ // One of the filters is not All -> do filtering\r
+ doFiltering = true;\r
+ break;\r
+ }\r
+ }\r
+ \r
+ if(doFiltering == false)\r
+ return datasets;\r
+ \r
+ // Start filtering with the complete set of datasets\r
+ ArrayList<SysdynDataSet> result = datasets;\r
+ \r
+ // Go through the filter from end to start\r
+ for(int i = filter.length - 1; i >= 0; i--) {\r
+ // Get the current filter\r
+ String currentFilter = filter[i].trim();\r
+ \r
+ ArrayList<SysdynDataSet> tempResult = new ArrayList<SysdynDataSet>();\r
+ HashMap<String, SysdynDataSet> sums = new HashMap<String, SysdynDataSet>();\r
+ for(SysdynDataSet dataset : result) {\r
+ String tempIndexes = dataset.name.substring(dataset.name.indexOf('[') + 1, dataset.name.indexOf(']'));\r
+ String[] indexes = tempIndexes.split(",");\r
+ if(currentFilter.equals("All")) {\r
+ /*\r
+ * If the filter is "All", all datasets \r
+ * are kept for the next filtering\r
+ */\r
+ tempResult.add(dataset);\r
+ } else if(currentFilter.equals(indexes[i].trim())) {\r
+ /*\r
+ * If the filter equals the index of the dataset\r
+ * at the same location, the dataset is kept for the next filtering\r
+ * \r
+ * e.g. \r
+ * dataset = Var[index3, index1, index2]\r
+ * filter = {All, index1, ALL}\r
+ * i = 1 (from 0 to 2)\r
+ * \r
+ * dataset's index and filter match at location 1 (the middle index)\r
+ */\r
+ tempResult.add(dataset);\r
+ } else if(currentFilter.equals("Sum")) {\r
+ /*\r
+ * Whenever Sum is used as the filter, all datasets having the\r
+ * same indexes before the sum filter location are summed. \r
+ * \r
+ * e.g.\r
+ * filter = {1, 1, SUM}\r
+ * 1, 1, 1 \r
+ * 1, 1, 2 => 1, 1, SUM(1, 1, 1; 1, 1, 2)\r
+ * 1, 2, 1 1, 2, SUM(1, 2, 1; 1, 2, 2)\r
+ * 1, 2, 2 \r
+ */\r
+ \r
+ // Find the preceding range (e.g. index1index2index2)\r
+ String rangeBefore = "";\r
+ for(int j = 0; j < i; j++)\r
+ rangeBefore += indexes[j].trim();\r
+ \r
+ // Find if there are any datasets for that preceding range in sums\r
+ SysdynDataSet sum = sums.get(rangeBefore);\r
+ if(sum != null) {\r
+ // A sum dataset was found. Add values from this dataset to the sum dataset\r
+ for(int j = 0; j < sum.values.length; j++)\r
+ sum.values[j] = sum.values[j] + dataset.values[j];\r
+ } else {\r
+ // The first occurence of this preceding range, create a new dataset for the sum\r
+ \r
+ // Copy times and values\r
+ double[] times = new double[dataset.times.length];\r
+ for(int j = 0; j < dataset.times.length; j++)\r
+ times[j] = dataset.times[j];\r
+ double[] values = new double[dataset.values.length];\r
+ for(int j = 0; j < dataset.values.length; j++)\r
+ values[j] = dataset.values[j];\r
+ \r
+ // Create the dataset and add it to both tempResult and sums map\r
+ SysdynDataSet newDataset = new SysdynDataSet(dataset.name, dataset.result, times, values);\r
+ tempResult.add(newDataset);\r
+ sums.put(rangeBefore, newDataset);\r
+ \r
+ // Modify the name of the dataset by adding "Sum" to the current index location.\r
+ String name = newDataset.name.substring(0, newDataset.name.indexOf('[') + 1);\r
+ for(int j = 0; j < indexes.length; j++) {\r
+ if(j < i)\r
+ // Indexes before "Sum" stay the same\r
+ name += indexes[j].trim();\r
+ else if(j >= i)\r
+ // Current "Sum" index and indexes after "Sum" are copied from filter\r
+ name += filter[j].trim();\r
+\r
+ if(j < indexes.length - 1)\r
+ name += ", ";\r
+ }\r
+ name += "]";\r
+ \r
+ // Replace the sum dataset's name\r
+ newDataset.name = name;\r
+ }\r
+ \r
+ } else {\r
+ // Discard the series\r
+ }\r
+ }\r
+ \r
+ /*\r
+ * Replace result list with the filtered results and move on to next\r
+ * filter index or return the list \r
+ */\r
+ result.clear();\r
+ for(SysdynDataSet dataset : tempResult)\r
+ result.add(dataset);\r
+ }\r
+ return result;\r
+ }\r
+ \r
}\r
\r
} catch (AccessorConstructionException e) {\r
// Variable was not found\r
- System.err.println("Variable "+variable+" is not available in the history.");\r
} catch (AccessorException e) {\r
// Unable to read data from file\r
e.printStackTrace();\r