//#####################################################################
JFREE.Dataset <T L0.Entity
>-- JFREE.Dataset.seriesList --> L0.List <R L0.HasProperty : L0.FunctionalRelation
+ >-- JFREE.Dataset.renderer --> JFREE.Renderer <R L0.HasProperty : L0.FunctionalRelation
>-- JFREE.Dataset.mapToDomainAxis --> JFREE.Axis <R L0.HasProperty : L0.FunctionalRelation
>-- JFREE.Dataset.mapToRangeAxis --> JFREE.Axis <R L0.HasProperty : L0.FunctionalRelation
//#####################################################################
JFREE.Series <T L0.Entity
- >-- JFREE.variableRVI --> L0.String <R L0.HasProperty : L0.FunctionalRelation
- >-- JFREE.Series.lineWidth --> L0.Integer <R L0.HasProperty : L0.FunctionalRelation
>-- JFREE.color
+ >-- JFREE.variableRVI --> L0.String <R L0.HasProperty
+ >-- 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
+
+//#####################################################################
+// Renderers
+//#####################################################################
+
+JFREE.Renderer <T L0.Entity
+JFREE.BarRenderer <T JFREE.Renderer
+JFREE.StackedBarRenderer <T JFREE.Renderer
//#####################################################################
// Position
public final Resource Axis_visibleTickLabels_Inverse;\r
public final Resource Axis_visibleTickMarks;\r
public final Resource Axis_visibleTickMarks_Inverse;\r
+ public final Resource BarRenderer;\r
public final Resource Bottom;\r
public final Resource CategoryAxis;\r
public final Resource CategoryDataset;\r
public final Resource Dataset_mapToDomainAxis_Inverse;\r
public final Resource Dataset_mapToRangeAxis;\r
public final Resource Dataset_mapToRangeAxis_Inverse;\r
+ public final Resource Dataset_renderer;\r
+ public final Resource Dataset_renderer_Inverse;\r
public final Resource Dataset_seriesList;\r
public final Resource Dataset_seriesList_Inverse;\r
public final Resource ImageTitle;\r
public final Resource Plot_visibleGrid;\r
public final Resource Plot_visibleGrid_Inverse;\r
public final Resource Position;\r
+ public final Resource Renderer;\r
public final Resource Right;\r
public final Resource Series;\r
+ public final Resource Series_exploded;\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_time;\r
+ public final Resource Series_time_Inverse;\r
+ public final Resource StackedBarRenderer;\r
public final Resource TextTitle;\r
public final Resource Title;\r
public final Resource Title_position;\r
public static final String Axis_visibleTickLabels_Inverse = "http://www.simantics.org/JFreeChart-1.0/Axis/visibleTickLabels/Inverse";\r
public static final String Axis_visibleTickMarks = "http://www.simantics.org/JFreeChart-1.0/Axis/visibleTickMarks";\r
public static final String Axis_visibleTickMarks_Inverse = "http://www.simantics.org/JFreeChart-1.0/Axis/visibleTickMarks/Inverse";\r
+ public static final String BarRenderer = "http://www.simantics.org/JFreeChart-1.0/BarRenderer";\r
public static final String Bottom = "http://www.simantics.org/JFreeChart-1.0/Bottom";\r
public static final String CategoryAxis = "http://www.simantics.org/JFreeChart-1.0/CategoryAxis";\r
public static final String CategoryDataset = "http://www.simantics.org/JFreeChart-1.0/CategoryDataset";\r
public static final String Dataset_mapToDomainAxis_Inverse = "http://www.simantics.org/JFreeChart-1.0/Dataset/mapToDomainAxis/Inverse";\r
public static final String Dataset_mapToRangeAxis = "http://www.simantics.org/JFreeChart-1.0/Dataset/mapToRangeAxis";\r
public static final String Dataset_mapToRangeAxis_Inverse = "http://www.simantics.org/JFreeChart-1.0/Dataset/mapToRangeAxis/Inverse";\r
+ public static final String Dataset_renderer = "http://www.simantics.org/JFreeChart-1.0/Dataset/renderer";\r
+ public static final String Dataset_renderer_Inverse = "http://www.simantics.org/JFreeChart-1.0/Dataset/renderer/Inverse";\r
public static final String Dataset_seriesList = "http://www.simantics.org/JFreeChart-1.0/Dataset/seriesList";\r
public static final String Dataset_seriesList_Inverse = "http://www.simantics.org/JFreeChart-1.0/Dataset/seriesList/Inverse";\r
public static final String ImageTitle = "http://www.simantics.org/JFreeChart-1.0/ImageTitle";\r
public static final String Plot_visibleGrid = "http://www.simantics.org/JFreeChart-1.0/Plot/visibleGrid";\r
public static final String Plot_visibleGrid_Inverse = "http://www.simantics.org/JFreeChart-1.0/Plot/visibleGrid/Inverse";\r
public static final String Position = "http://www.simantics.org/JFreeChart-1.0/Position";\r
+ public static final String Renderer = "http://www.simantics.org/JFreeChart-1.0/Renderer";\r
public static final String Right = "http://www.simantics.org/JFreeChart-1.0/Right";\r
public static final String Series = "http://www.simantics.org/JFreeChart-1.0/Series";\r
+ public static final String Series_exploded = "http://www.simantics.org/JFreeChart-1.0/Series/exploded";\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_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 TextTitle = "http://www.simantics.org/JFreeChart-1.0/TextTitle";\r
public static final String Title = "http://www.simantics.org/JFreeChart-1.0/Title";\r
public static final String Title_position = "http://www.simantics.org/JFreeChart-1.0/Title/position";\r
Axis_visibleTickLabels_Inverse = getResourceOrNull(graph, URIs.Axis_visibleTickLabels_Inverse);\r
Axis_visibleTickMarks = getResourceOrNull(graph, URIs.Axis_visibleTickMarks);\r
Axis_visibleTickMarks_Inverse = getResourceOrNull(graph, URIs.Axis_visibleTickMarks_Inverse);\r
+ BarRenderer = getResourceOrNull(graph, URIs.BarRenderer);\r
Bottom = getResourceOrNull(graph, URIs.Bottom);\r
CategoryAxis = getResourceOrNull(graph, URIs.CategoryAxis);\r
CategoryDataset = getResourceOrNull(graph, URIs.CategoryDataset);\r
Dataset_mapToDomainAxis_Inverse = getResourceOrNull(graph, URIs.Dataset_mapToDomainAxis_Inverse);\r
Dataset_mapToRangeAxis = getResourceOrNull(graph, URIs.Dataset_mapToRangeAxis);\r
Dataset_mapToRangeAxis_Inverse = getResourceOrNull(graph, URIs.Dataset_mapToRangeAxis_Inverse);\r
+ Dataset_renderer = getResourceOrNull(graph, URIs.Dataset_renderer);\r
+ Dataset_renderer_Inverse = getResourceOrNull(graph, URIs.Dataset_renderer_Inverse);\r
Dataset_seriesList = getResourceOrNull(graph, URIs.Dataset_seriesList);\r
Dataset_seriesList_Inverse = getResourceOrNull(graph, URIs.Dataset_seriesList_Inverse);\r
ImageTitle = getResourceOrNull(graph, URIs.ImageTitle);\r
Plot_visibleGrid = getResourceOrNull(graph, URIs.Plot_visibleGrid);\r
Plot_visibleGrid_Inverse = getResourceOrNull(graph, URIs.Plot_visibleGrid_Inverse);\r
Position = getResourceOrNull(graph, URIs.Position);\r
+ Renderer = getResourceOrNull(graph, URIs.Renderer);\r
Right = getResourceOrNull(graph, URIs.Right);\r
Series = getResourceOrNull(graph, URIs.Series);\r
+ Series_exploded = getResourceOrNull(graph, URIs.Series_exploded);\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_time = getResourceOrNull(graph, URIs.Series_time);\r
+ Series_time_Inverse = getResourceOrNull(graph, URIs.Series_time_Inverse);\r
+ StackedBarRenderer = getResourceOrNull(graph, URIs.StackedBarRenderer);\r
TextTitle = getResourceOrNull(graph, URIs.TextTitle);\r
Title = getResourceOrNull(graph, URIs.Title);\r
Title_position = getResourceOrNull(graph, URIs.Title_position);\r
+++ /dev/null
-L0 = <http://www.simantics.org/Layer0-1.0>\r
-VP = <http://www.simantics.org/Viewpoint-1.1>\r
-PROJECT = <http://www.simantics.org/Project-1.1>\r
-MOD = <http://www.simantics.org/Modeling-1.1>\r
-IMAGE = <http://www.simantics.org/Image2-1.1>\r
-COLOR = <http://www.simantics.org/Color-1.0>\r
-ACT = <http://www.simantics.org/Action-1.0>\r
-JFREE = <http://www.simantics.org/JFreeChart-1.0>\r
-SYSDYN = <http://www.simantics.org/Sysdyn-1.1>\r
-\r
-CBC = SYSDYN.ChartAxisAndVariablesBrowseContext : VP.BrowseContext\r
-CAC = SYSDYN.ChartAxisAndVariablesActionContext : VP.BrowseContext\r
-\r
-CBC.AxisChildRule : VP.ChildRule\r
-CBC.VariableChildRule : VP.ChildRule\r
-CBC.SeriesLabelRule : VP.LabelRule\r
-CBC.AxisLabelRule : VP.LabelRule\r
-\r
-CBC\r
- @VP.customChildRule JFREE.Chart CBC.AxisChildRule\r
- JFREE.Axis : VP.ResourceNodeType\r
- @VP.customChildRule JFREE.Axis CBC.VariableChildRule\r
- JFREE.Series : VP.ResourceNodeType\r
-\r
-CBC \r
- @VP.customLabelRule JFREE.Axis CBC.AxisLabelRule\r
- @VP.customLabelRule JFREE.Series CBC.SeriesLabelRule\r
- \r
-CBC\r
- @VP.dropActionContribution JFREE.Axis ACTIONS.SeriesDropAction 1.0 \r
- @VP.dropActionContribution JFREE.Series ACTIONS.SeriesDropAction 1.0 \r
- @VP.dropActionContribution JFREE.Axis ACTIONS.AxisDropAction 2.0 \r
- @VP.dropActionContribution JFREE.Series ACTIONS.AxisDropAction 2.0 \r
- \r
-CBC\r
- VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
- VP.VisualsContribution.HasNodeType JFREE.Chart\r
- VP.VisualsContribution.HasRule VP.PassThruSorterRule \r
- VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
- VP.VisualsContribution.HasNodeType JFREE.Axis\r
- VP.VisualsContribution.HasRule VP.PassThruSorterRule\r
- \r
- \r
-ACTIONS = CAC.Actions : L0.Library\r
-ACTIONS.SeriesDropAction : ACT.DropAction \r
-ACTIONS.AxisDropAction : ACT.DropAction
\ No newline at end of file
--- /dev/null
+L0 = <http://www.simantics.org/Layer0-1.0>\r
+VP = <http://www.simantics.org/Viewpoint-1.1>\r
+PROJECT = <http://www.simantics.org/Project-1.1>\r
+MOD = <http://www.simantics.org/Modeling-1.1>\r
+IMAGE = <http://www.simantics.org/Image2-1.1>\r
+COLOR = <http://www.simantics.org/Color-1.0>\r
+ACT = <http://www.simantics.org/Action-1.0>\r
+JFREE = <http://www.simantics.org/JFreeChart-1.0>\r
+SYSDYN = <http://www.simantics.org/Sysdyn-1.1>\r
+\r
+///////////////////////////////////////////////\r
+// XY Line axis: axis and variables viewpoint\r
+///////////////////////////////////////////////\r
+CBC = SYSDYN.ChartAxisAndVariablesBrowseContext : VP.BrowseContext\r
+CAC = SYSDYN.ChartAxisAndVariablesActionContext : VP.BrowseContext\r
+\r
+CBC.AxisChildRule : VP.ChildRule\r
+CBC.VariableChildRule : VP.ChildRule\r
+CBC.SeriesLabelRule : VP.LabelRule\r
+CBC.AxisLabelRule : VP.LabelRule\r
+\r
+CBC\r
+ @VP.customChildRule JFREE.Chart CBC.AxisChildRule\r
+ JFREE.Axis : VP.ResourceNodeType\r
+ @VP.customChildRule JFREE.Axis CBC.VariableChildRule\r
+ JFREE.Series : VP.ResourceNodeType\r
+\r
+CBC \r
+ @VP.customLabelRule JFREE.Axis CBC.AxisLabelRule\r
+ @VP.customLabelRule JFREE.Series CBC.SeriesLabelRule\r
+ \r
+CBC\r
+ @VP.dropActionContribution JFREE.Axis CAC.Actions.SeriesDropAction 1.0 \r
+ @VP.dropActionContribution JFREE.Series CAC.Actions.SeriesDropAction 1.0 \r
+ @VP.dropActionContribution JFREE.Axis CAC.Actions.AxisDropAction 2.0 \r
+ @VP.dropActionContribution JFREE.Series CAC.Actions.AxisDropAction 2.0 \r
+ \r
+CBC\r
+ VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
+ VP.VisualsContribution.HasNodeType JFREE.Chart\r
+ VP.VisualsContribution.HasRule VP.PassThruSorterRule \r
+ VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
+ VP.VisualsContribution.HasNodeType JFREE.Axis\r
+ VP.VisualsContribution.HasRule VP.PassThruSorterRule\r
+ \r
+ \r
+CAC.Actions : L0.Library\r
+CAC.Actions.SeriesDropAction : ACT.DropAction \r
+CAC.Actions.AxisDropAction : ACT.DropAction \r
+\r
+\r
+///////////////////////////////////////////////\r
+// Bar chart: Variables viewpoint\r
+///////////////////////////////////////////////\r
+BSBC = SYSDYN.BarSeriesBrowseContext : VP.BrowseContext\r
+BSAC = SYSDYN.BarSeriesActionContext : VP.BrowseContext\r
+\r
+BSBC.SeriesChildRule : VP.ChildRule\r
+BSBC.SeriesLabelRule : VP.LabelRule\r
+\r
+BSBC\r
+ @VP.customChildRule JFREE.Chart BSBC.SeriesChildRule\r
+ JFREE.Series\r
+\r
+BSBC \r
+ @VP.customLabelRule JFREE.Series BSBC.SeriesLabelRule\r
+ \r
+//BSBC\r
+// @VP.dropActionContribution JFREE.Series BSAC.Actions.SeriesDropAction 1.0 \r
+ \r
+BSBC\r
+ VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
+ VP.VisualsContribution.HasNodeType JFREE.Chart\r
+ VP.VisualsContribution.HasRule VP.PassThruSorterRule\r
+ \r
+BSAC.Actions : L0.Library\r
+//BSAC.Actions.SeriesDropAction : ACT.DropAction \r
+\r
+\r
+///////////////////////////////////////////////\r
+// Pie chart: Variables viewpoint\r
+///////////////////////////////////////////////\r
+PSBC = SYSDYN.PieSeriesBrowseContext : VP.BrowseContext\r
+PSAC = SYSDYN.PieSeriesActionContext : VP.BrowseContext\r
+\r
+PSBC.SeriesChildRule : VP.ChildRule\r
+PSBC.SeriesLabelRule : VP.LabelRule\r
+\r
+PSBC\r
+ @VP.customChildRule JFREE.Chart PSBC.SeriesChildRule\r
+ JFREE.Series\r
+\r
+PSBC \r
+ @VP.customLabelRule JFREE.Series PSBC.SeriesLabelRule\r
+ \r
+//PSBC\r
+// @VP.dropActionContribution JFREE.Series PSAC.Actions.SeriesDropAction 1.0 \r
+ \r
+PSBC\r
+ VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
+ VP.VisualsContribution.HasNodeType JFREE.Chart\r
+ VP.VisualsContribution.HasRule VP.PassThruSorterRule\r
+ \r
+PSAC.Actions : L0.Library\r
+//PSAC.Actions.SeriesDropAction : ACT.DropAction \r
public final Resource AuxiliarySymbol;\r
public final Resource AvailableSharedFunctionLibraries;\r
public final Resource AvailableVariableIndexes;\r
+ public final Resource BarSeriesActionContext;\r
+ public final Resource BarSeriesActionContext_Actions;\r
+ public final Resource BarSeriesBrowseContext;\r
+ public final Resource BarSeriesBrowseContext_SeriesChildRule;\r
+ public final Resource BarSeriesBrowseContext_SeriesLabelRule;\r
public final Resource BasicExperiment;\r
public final Resource Bottom;\r
public final Resource Browser;\r
public final Resource NormalExpression;\r
public final Resource Orientation;\r
public final Resource ParameterExpression;\r
+ public final Resource PieSeriesActionContext;\r
+ public final Resource PieSeriesActionContext_Actions;\r
+ public final Resource PieSeriesBrowseContext;\r
+ public final Resource PieSeriesBrowseContext_SeriesChildRule;\r
+ public final Resource PieSeriesBrowseContext_SeriesLabelRule;\r
public final Resource PlaybackExperiment;\r
public final Resource Polarity;\r
public final Resource PolarityLocation;\r
public static final String AuxiliarySymbol = "http://www.simantics.org/Sysdyn-1.1/AuxiliarySymbol";\r
public static final String AvailableSharedFunctionLibraries = "http://www.simantics.org/Sysdyn-1.1/AvailableSharedFunctionLibraries";\r
public static final String AvailableVariableIndexes = "http://www.simantics.org/Sysdyn-1.1/AvailableVariableIndexes";\r
+ public static final String BarSeriesActionContext = "http://www.simantics.org/Sysdyn-1.1/BarSeriesActionContext";\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_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 Browser = "http://www.simantics.org/Sysdyn-1.1/Browser";\r
public static final String NormalExpression = "http://www.simantics.org/Sysdyn-1.1/NormalExpression";\r
public static final String Orientation = "http://www.simantics.org/Sysdyn-1.1/Orientation";\r
public static final String ParameterExpression = "http://www.simantics.org/Sysdyn-1.1/ParameterExpression";\r
+ public static final String PieSeriesActionContext = "http://www.simantics.org/Sysdyn-1.1/PieSeriesActionContext";\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_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
public static final String PolarityLocation = "http://www.simantics.org/Sysdyn-1.1/PolarityLocation";\r
AuxiliarySymbol = getResourceOrNull(graph, URIs.AuxiliarySymbol);\r
AvailableSharedFunctionLibraries = getResourceOrNull(graph, URIs.AvailableSharedFunctionLibraries);\r
AvailableVariableIndexes = getResourceOrNull(graph, URIs.AvailableVariableIndexes);\r
+ BarSeriesActionContext = getResourceOrNull(graph, URIs.BarSeriesActionContext);\r
+ BarSeriesActionContext_Actions = getResourceOrNull(graph, URIs.BarSeriesActionContext_Actions);\r
+ BarSeriesBrowseContext = getResourceOrNull(graph, URIs.BarSeriesBrowseContext);\r
+ BarSeriesBrowseContext_SeriesChildRule = getResourceOrNull(graph, URIs.BarSeriesBrowseContext_SeriesChildRule);\r
+ BarSeriesBrowseContext_SeriesLabelRule = getResourceOrNull(graph, URIs.BarSeriesBrowseContext_SeriesLabelRule);\r
BasicExperiment = getResourceOrNull(graph, URIs.BasicExperiment);\r
Bottom = getResourceOrNull(graph, URIs.Bottom);\r
Browser = getResourceOrNull(graph, URIs.Browser);\r
NormalExpression = getResourceOrNull(graph, URIs.NormalExpression);\r
Orientation = getResourceOrNull(graph, URIs.Orientation);\r
ParameterExpression = getResourceOrNull(graph, URIs.ParameterExpression);\r
+ PieSeriesActionContext = getResourceOrNull(graph, URIs.PieSeriesActionContext);\r
+ PieSeriesActionContext_Actions = getResourceOrNull(graph, URIs.PieSeriesActionContext_Actions);\r
+ PieSeriesBrowseContext = getResourceOrNull(graph, URIs.PieSeriesBrowseContext);\r
+ PieSeriesBrowseContext_SeriesChildRule = getResourceOrNull(graph, URIs.PieSeriesBrowseContext_SeriesChildRule);\r
+ PieSeriesBrowseContext_SeriesLabelRule = getResourceOrNull(graph, URIs.PieSeriesBrowseContext_SeriesLabelRule);\r
PlaybackExperiment = getResourceOrNull(graph, URIs.PlaybackExperiment);\r
Polarity = getResourceOrNull(graph, URIs.Polarity);\r
PolarityLocation = getResourceOrNull(graph, URIs.PolarityLocation);\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 </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 </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 </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 </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 </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 </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
</visibleWhen>\r
</command>\r
<command\r
- commandId="org.simantics.sysdyn.ui.newChart"\r
- id="org.simantics.sysdyn.ui.browser.newChart"\r
- label="Chart"\r
+ commandId="org.simantics.sysdyn.ui.newXYLineChart"\r
+ id="org.simantics.sysdyn.ui.browser.newXYLineChart"\r
+ label="Line Chart"\r
+ style="push">\r
+ <visibleWhen\r
+ checkEnabled="true">\r
+ <with\r
+ variable="selection">\r
+ <test\r
+ args="org.simantics.sysdyn.ui.browser.nodes.ChartsFolder"\r
+ property="org.simantics.sysdyn.ui.nodeClass">\r
+ </test>\r
+ </with>\r
+ </visibleWhen>\r
+ </command>\r
+ <command\r
+ commandId="org.simantics.sysdyn.ui.newBarChart"\r
+ id="org.simantics.sysdyn.ui.browser.newBarChart"\r
+ label="Bar Chart"\r
+ style="push">\r
+ <visibleWhen\r
+ checkEnabled="true">\r
+ <with\r
+ variable="selection">\r
+ <test\r
+ args="org.simantics.sysdyn.ui.browser.nodes.ChartsFolder"\r
+ property="org.simantics.sysdyn.ui.nodeClass">\r
+ </test>\r
+ </with>\r
+ </visibleWhen>\r
+ </command>\r
+ <command\r
+ commandId="org.simantics.sysdyn.ui.newPieChart"\r
+ id="org.simantics.sysdyn.ui.browser.newPieChart"\r
+ label="Pie Chart"\r
style="push">\r
<visibleWhen\r
checkEnabled="true">\r
name="Chart Panel Orientation">\r
</command>\r
<command\r
- defaultHandler="org.simantics.sysdyn.ui.handlers.newComponents.NewChartHandler"\r
- id="org.simantics.sysdyn.ui.newChart"\r
- name="New Chart">\r
+ defaultHandler="org.simantics.sysdyn.ui.handlers.newComponents.NewXYLineChartHandler"\r
+ id="org.simantics.sysdyn.ui.newXYLineChart"\r
+ name="New XY Line Chart">\r
+ </command>\r
+ <command\r
+ defaultHandler="org.simantics.sysdyn.ui.handlers.newComponents.NewBarChartHandler"\r
+ id="org.simantics.sysdyn.ui.newBarChart"\r
+ name="New Bar Chart">\r
+ </command>\r
+ <command\r
+ defaultHandler="org.simantics.sysdyn.ui.handlers.newComponents.NewPieChartHandler"\r
+ id="org.simantics.sysdyn.ui.newPieChart"\r
+ name="New Pie Chart">\r
</command>\r
</extension>\r
<extension\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.handlers.newComponents;\r
+\r
+import java.util.Collections;\r
+import java.util.UUID;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.ui.handlers.HandlerUtil;\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.common.utils.ListUtils;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.ui.browser.nodes.ChartsFolder;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+\r
+/**\r
+ * Handler for creating a new Bar Chart\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewBarChartHandler extends AbstractHandler {\r
+\r
+ @Override\r
+ public Object execute(ExecutionEvent event) throws ExecutionException {\r
+ \r
+ ISelection sel = HandlerUtil.getCurrentSelection(event);\r
+\r
+ ChartsFolder node = AdaptionUtils.adaptToSingle(sel, ChartsFolder.class);\r
+ if (node == null)\r
+ return null;\r
+\r
+ final Resource model = node.data; \r
+\r
+ SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+ @Override\r
+ public void perform(WriteGraph g) throws DatabaseException {\r
+ Layer0 l0 = Layer0.getInstance(g);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(g);\r
+ G2DResource g2d = G2DResource.getInstance(g);\r
+\r
+ Resource jfreechart = GraphUtils.create2(g, jfree.Chart,\r
+ l0.HasName, "BarChart" + UUID.randomUUID().toString(),\r
+ l0.HasLabel, NameUtils.findFreshLabel(g, "Bar Chart", model),\r
+ l0.PartOf, model,\r
+ jfree.Chart_visibleBorder, true,\r
+ jfree.Chart_borderWidth, 3,\r
+ jfree.Chart_visibleLegend, false\r
+ );\r
+ \r
+ g.claimLiteral(jfreechart, jfree.Chart_borderColor, g2d.Color, new float[] {0,0,0,1});\r
+\r
+ GraphUtils.create2(g, jfree.TextTitle,\r
+ l0.HasName, "TextTitle" + UUID.randomUUID().toString(),\r
+ l0.HasLabel, "Bar Chart Title",\r
+ jfree.Title_position, jfree.Top,\r
+ l0.PartOf, jfreechart);\r
+\r
+ Resource domainAxis = GraphUtils.create2(g, jfree.CategoryAxis,\r
+ l0.HasName, "CategoryAxis" + UUID.randomUUID().toString());\r
+ \r
+ Resource rangeAxis = GraphUtils.create2(g, jfree.NumberAxis,\r
+ l0.HasName, "NumberAxis" + UUID.randomUUID().toString());\r
+\r
+ Resource renderer = GraphUtils.create2(g, jfree.BarRenderer);\r
+ \r
+ Resource dataset = GraphUtils.create2(g, jfree.CategoryDataset,\r
+ l0.HasName, "CategoryDataset" + UUID.randomUUID().toString(),\r
+ jfree.Dataset_mapToDomainAxis, domainAxis,\r
+ jfree.Dataset_mapToRangeAxis, rangeAxis,\r
+ jfree.Dataset_seriesList, ListUtils.create(g, Collections.<Resource>emptyList()),\r
+ jfree.Dataset_renderer, renderer);\r
+\r
+ GraphUtils.create2(g, jfree.CategoryPlot,\r
+ l0.HasName, "Category plot" + UUID.randomUUID().toString(),\r
+ l0.PartOf, jfreechart,\r
+ jfree.Plot_domainAxis, domainAxis,\r
+ jfree.Plot_rangeAxis, rangeAxis,\r
+ jfree.Plot_rangeAxisList, ListUtils.create(g, Collections.singletonList(rangeAxis)),\r
+ l0.ConsistsOf, dataset,\r
+ l0.ConsistsOf, domainAxis,\r
+ l0.ConsistsOf, rangeAxis);\r
+ }\r
+\r
+ });\r
+ \r
+ return null;\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.handlers.newComponents;\r
+\r
+import java.util.Collections;\r
+import java.util.UUID;\r
+\r
+import org.eclipse.core.commands.AbstractHandler;\r
+import org.eclipse.core.commands.ExecutionEvent;\r
+import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.jface.viewers.ISelection;\r
+import org.eclipse.ui.handlers.HandlerUtil;\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.common.utils.ListUtils;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.ui.browser.nodes.ChartsFolder;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+\r
+/**\r
+ * Handler for craeting a new Pie Chart\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class NewPieChartHandler extends AbstractHandler {\r
+\r
+ @Override\r
+ public Object execute(ExecutionEvent event) throws ExecutionException {\r
+ \r
+ ISelection sel = HandlerUtil.getCurrentSelection(event);\r
+\r
+ ChartsFolder node = AdaptionUtils.adaptToSingle(sel, ChartsFolder.class);\r
+ if (node == null)\r
+ return null;\r
+\r
+ final Resource model = node.data; \r
+\r
+ SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+ @Override\r
+ public void perform(WriteGraph g) throws DatabaseException {\r
+ Layer0 l0 = Layer0.getInstance(g);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(g);\r
+ G2DResource g2d = G2DResource.getInstance(g);\r
+\r
+ Resource jfreechart = GraphUtils.create2(g, jfree.Chart,\r
+ l0.HasName, "PieChart" + UUID.randomUUID().toString(),\r
+ l0.HasLabel, NameUtils.findFreshLabel(g, "Pie Chart", model),\r
+ l0.PartOf, model,\r
+ jfree.Chart_visibleBorder, true,\r
+ jfree.Chart_borderWidth, 3);\r
+ g.claimLiteral(jfreechart, jfree.Chart_borderColor, g2d.Color, new float[] {0,0,0,1});\r
+\r
+ GraphUtils.create2(g, jfree.TextTitle,\r
+ l0.HasName, "TextTitle" + UUID.randomUUID().toString(),\r
+ l0.HasLabel, "Pie Chart Title",\r
+ jfree.Title_position, jfree.Top,\r
+ l0.PartOf, jfreechart);\r
+ \r
+ Resource dataset = GraphUtils.create2(g, jfree.PieDataset,\r
+ l0.HasName, "CategoryDataset" + UUID.randomUUID().toString(),\r
+ jfree.Dataset_seriesList, ListUtils.create(g, Collections.<Resource>emptyList())\r
+ );\r
+\r
+ GraphUtils.create2(g, jfree.PiePlot,\r
+ l0.HasName, "PiePlot" + UUID.randomUUID().toString(),\r
+ l0.PartOf, jfreechart,\r
+ l0.ConsistsOf, dataset\r
+ );\r
+ }\r
+\r
+ });\r
+ \r
+ return null;\r
+ }\r
+}\r
import org.simantics.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.sysdyn.JFreeChartResource;\r
-import org.simantics.sysdyn.ui.browser.nodes.ChartNode;\r
import org.simantics.sysdyn.ui.browser.nodes.ChartsFolder;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.AdaptionUtils;\r
\r
/**\r
- * Handler for creating a new {@link ChartNode} in model browser\r
+ * Handler for creating a new XYLineChart in model browser\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class NewChartHandler extends AbstractHandler {\r
+public class NewXYLineChartHandler extends AbstractHandler {\r
\r
@Override\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
l0.PartOf, jfreechart);\r
\r
Resource domainAxis = GraphUtils.create2(g, jfree.NumberAxis,\r
- l0.HasName, "NumberAxis" + UUID.randomUUID().toString(),\r
- l0.HasLabel, "Domain");\r
+ l0.HasName, "NumberAxis" + UUID.randomUUID().toString());\r
Resource rangeAxis = GraphUtils.create2(g, jfree.NumberAxis,\r
- l0.HasName, "NumberAxis" + UUID.randomUUID().toString(),\r
- l0.HasLabel, "Range");\r
+ l0.HasName, "NumberAxis" + UUID.randomUUID().toString());\r
\r
Resource dataset = GraphUtils.create2(g, jfree.XYDataset,\r
l0.HasName, "XYDataset" + UUID.randomUUID().toString(),\r
import org.simantics.sysdyn.ui.editor.DiagramViewer;\r
import org.simantics.ui.SimanticsUI;\r
\r
+/**\r
+ * Listener for playback simulations. This listener activates and reverts the playback\r
+ * profile when a playback simlation is activated or disposed.\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
public class SysdynPlaybackExperimentListener implements IExperimentListener {\r
\r
private Resource model;\r
Resource current = graph.getPossibleObject(runtimeDiagram, DIA.RuntimeDiagram_HasRuntimeProfile);\r
if(profile.equals(current)) return;\r
\r
- graph.deny(runtimeDiagram, DIA.RuntimeDiagram_HasRuntimeProfile, null, current);\r
+ if(current != null)\r
+ graph.deny(runtimeDiagram, DIA.RuntimeDiagram_HasRuntimeProfile, null, current);\r
graph.claim(runtimeDiagram, DIA.RuntimeDiagram_HasRuntimeProfile, null, profile);\r
\r
// Set this profile as the default profile for this diagram\r
import org.simantics.sysdyn.manager.SysdynPlaybackExperiment;\r
import org.simantics.ui.SimanticsUI;\r
\r
+/**\r
+ * Contribution to the main toolbar. PlaybackSliderContribution contains a slider\r
+ * that can be used to control the time in a playback experiment\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
public class PlaybackSliderContribution extends ToolBarContributionItem {\r
\r
Runnable timeListener;\r
e1.printStackTrace();\r
}\r
\r
+ // Separator ToolItem can contain a composite. Add a composite with a slider to this item\r
ToolItem ti = new ToolItem(parent, SWT.SEPARATOR);\r
\r
Composite composite = new Composite(parent, SWT.NONE);\r
\r
startTime = numbers[0];\r
endTime = numbers[1];\r
+ \r
+ // Create a DesimalFormat for rounding the time\r
final DecimalFormat format = new DecimalFormat();\r
format.setMinimumFractionDigits(0);\r
format.setMaximumFractionDigits(2);\r
symbols.setDecimalSeparator('.');\r
symbols.setGroupingSeparator(' ');\r
format.setDecimalFormatSymbols(symbols);\r
+ \r
+ // Selection listener for the slider\r
s.addSelectionListener(new SelectionListener() {\r
\r
@Override\r
spe.removeTimeListener(timeListener);\r
}\r
\r
+ // Time listener for setting the time in the slider if the time is changed somewhere else\r
timeListener = new Runnable() {\r
\r
@Override\r
startTime = spe.getStartTime();\r
endTime = spe.getEndTime();\r
}\r
- int value = (int) ((spe.getTime() - startTime) / (endTime - startTime) * 99);\r
+ int value = (int) Math.round(((spe.getTime() - startTime) / (endTime - startTime) * 99));\r
s.setSelection(value);\r
label.setText(format.format(spe.getTime()));\r
}\r
\r
public abstract class LabelPropertyTabContributor extends PropertyTabContributorImpl {\r
\r
- private boolean isDisposed = false;\r
- \r
- \r
- public void createControl(Composite parent, final IWorkbenchSite site, final ISessionContext context, final WidgetSupportImpl support) {\r
- super.createControl(parent, site, context, support);\r
- \r
- // Add dispose listener to make sure name listening receives the correct isDisposed -value\r
- parent.addDisposeListener(new DisposeListener() {\r
- \r
- @Override\r
- public void widgetDisposed(DisposeEvent e) {\r
- LabelPropertyTabContributor.this.dispose();\r
- }\r
- });\r
- }\r
- \r
- @Override\r
+ private boolean isDisposed = false;\r
+\r
+\r
+ public void createControl(Composite parent, final IWorkbenchSite site, final ISessionContext context, final WidgetSupportImpl support) {\r
+ super.createControl(parent, site, context, support);\r
+\r
+ // Add dispose listener to make sure name listening receives the correct isDisposed -value\r
+ parent.addDisposeListener(new DisposeListener() {\r
+\r
+ @Override\r
+ public void widgetDisposed(DisposeEvent e) {\r
+ LabelPropertyTabContributor.this.dispose();\r
+ }\r
+ });\r
+ }\r
+\r
+ @Override\r
public void updatePartName(ISelection forSelection, final Callback<String> updateCallback) {\r
- final Resource resource = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
- if(resource == null) {\r
- updateCallback.run("Selection properties");\r
- return;\r
- }\r
- \r
- try {\r
- SimanticsUI.getSession().syncRequest(new Read<String>() {\r
+ final Resource resource = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
+ if(resource == null) {\r
+ updateCallback.run("Selection properties");\r
+ return;\r
+ }\r
+\r
+ SimanticsUI.getSession().asyncRequest(new Read<String>() {\r
\r
- @Override\r
- public String perform(ReadGraph graph) throws DatabaseException {\r
- Layer0 l0 = Layer0.getInstance(graph);\r
- ModelingResources mr = ModelingResources.getInstance(graph);\r
- Resource r = resource;\r
- if(graph.hasStatement(r, mr.ElementToComponent)) {\r
- r = graph.getSingleObject(r, mr.ElementToComponent);\r
- }\r
- String label = graph.getPossibleRelatedValue(r, l0.HasLabel);\r
- if(label != null)\r
- return label;\r
- label = graph.getPossibleRelatedValue(r, l0.HasName);\r
- if(label != null)\r
- return label;\r
- return "No name for selection";\r
- }\r
- }, new AsyncListener<String>() {\r
+ @Override\r
+ public String perform(ReadGraph graph) throws DatabaseException {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ ModelingResources mr = ModelingResources.getInstance(graph);\r
+ Resource r = resource;\r
+ if(graph.hasStatement(r, mr.ElementToComponent)) {\r
+ r = graph.getSingleObject(r, mr.ElementToComponent);\r
+ }\r
+ String label = graph.getPossibleRelatedValue(r, l0.HasLabel);\r
+ if(label != null)\r
+ return label;\r
+ label = graph.getPossibleRelatedValue(r, l0.HasName);\r
+ if(label != null)\r
+ return label;\r
+ return "No name for selection";\r
+ }\r
+ }, new AsyncListener<String>() {\r
\r
- @Override\r
- public void execute(AsyncReadGraph graph, String result) {\r
- updateCallback.run(result);\r
- }\r
+ @Override\r
+ public void execute(AsyncReadGraph graph, String result) {\r
+ updateCallback.run(result);\r
+ }\r
\r
- @Override\r
- public void exception(AsyncReadGraph graph, Throwable throwable) {\r
- \r
- }\r
+ @Override\r
+ public void exception(AsyncReadGraph graph, Throwable throwable) {\r
\r
- @Override\r
- public boolean isDisposed() {\r
- return isDisposed;\r
- }\r
- });\r
- } catch (DatabaseException e) {\r
- updateCallback.run("Selection error in LabelPropertyTabContributor");\r
- e.printStackTrace();\r
- }\r
- \r
+ }\r
+\r
+ @Override\r
+ public boolean isDisposed() {\r
+ return isDisposed;\r
+ }\r
+ });\r
}\r
- \r
+\r
@Override\r
protected void dispose() {\r
- this.isDisposed = true;\r
+ this.isDisposed = true;\r
}\r
}\r
import org.eclipse.jface.viewers.ISelection;\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.utils.OrderedSetUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.exception.ManyObjectsForFunctionalRelationException;\r
import org.simantics.sysdyn.JFreeChartResource;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.browser.nodes.SharedFunctionsFolder;\r
-import org.simantics.sysdyn.ui.trend.chart.properties.ChartAxisAndVariablesTab;\r
import org.simantics.sysdyn.ui.trend.chart.properties.ChartTab;\r
-import org.simantics.sysdyn.ui.trend.chart.properties.GeneralChartPropertiesTab;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.bar.BarGeneralPropertiesTab;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.bar.BarSeriesTab;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.pie.PieGeneralPropertiesTab;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.pie.PieSeriesTab;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.xyline.XYLineAxisAndVariablesTab;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.xyline.XYLineGeneralPropertiesTab;\r
import org.simantics.ui.utils.AdaptionUtils;\r
\r
/**\r
r = connection;\r
}\r
}\r
- \r
+\r
// Independent variable\r
if (backend.isInstanceOf(r, sr.IndependentVariable)) {\r
Resource activeExpression = backend.getPossibleObject(r, sr.HasActiveExpression);\r
"Additional Information"));\r
return tabs;\r
}\r
- \r
+\r
// Input variable\r
if (backend.isInstanceOf(r, sr.Input)) {\r
tabs.add(new ComparableTabContributor(\r
"Additional Information"));\r
return tabs;\r
}\r
- \r
+\r
// Enumeration\r
if (backend.isInstanceOf(r, sr.Enumeration)) {\r
Object s = AdaptionUtils.adaptToSingle(selection, ISelection.class);\r
s,\r
"Enumeration"));\r
}\r
- \r
+\r
// Configuration and model. They both show the properties of the configuration\r
if ( backend.isInstanceOf(r, sr.Configuration) || backend.isInstanceOf(r, sr.SysdynModel)) {\r
if(!backend.isInstanceOf(r, sr.SysdynModel))\r
r,\r
"Model Properties"));\r
}\r
- \r
+\r
// Module\r
if (backend.isInstanceOf(r, sr.Module)){\r
tabs.add(new ComparableTabContributor(\r
"Outputs"));\r
return tabs;\r
}\r
- \r
+\r
// Playback experiment\r
if (backend.isInstanceOf(r, sr.PlaybackExperiment))\r
return Collections.singleton(\r
0,\r
r,\r
"Experiment Properties"));\r
- \r
+\r
// Default experiment\r
if (backend.isInstanceOf(r, simu.Experiment))\r
return Collections.singleton(\r
0,\r
r,\r
"Experiment Properties"));\r
- \r
+\r
// Saved simulation result\r
if (backend.isInstanceOf(r, sr.Result))\r
return Collections.singleton(\r
0,\r
r,\r
"Result Properties"));\r
- \r
+\r
// Dependency\r
if (backend.isInstanceOf(r, sr.Dependency))\r
if (backend.hasStatement(r, sr.RefersTo))\r
diaConnection,\r
"Dependency Properties"));\r
}\r
- \r
+\r
// Module symbol. Modules in modules-folder are actually symbol resources\r
if (backend.isInheritedFrom(r, sr.ModuleSymbol)) {\r
// Find the component resource\r
\r
// Chart\r
if (backend.isInstanceOf(r, jfree.Chart)) {\r
- tabs.add(new ComparableTabContributor(\r
- new GeneralChartPropertiesTab(),\r
- 10,\r
- r,\r
- "General"));\r
- tabs.add(new ComparableTabContributor(\r
- new ChartAxisAndVariablesTab(),\r
- 9,\r
- r,\r
- "Axis and Variables"));\r
- tabs.add(new ComparableTabContributor(\r
- new ChartTab(),\r
- 1,\r
- r,\r
- "Chart"));\r
- return tabs;\r
+\r
+ Collection<Resource> plots = backend.syncRequest(new ObjectsWithType(r, Layer0.getInstance(backend).ConsistsOf, jfree.Plot));\r
+ if(!plots.isEmpty()) {\r
+ Resource plot = plots.iterator().next();\r
+\r
+ if(backend.isInstanceOf(plot, jfree.XYPlot)) {\r
+ tabs.add(new ComparableTabContributor(\r
+ new XYLineGeneralPropertiesTab(),\r
+ 10,\r
+ r,\r
+ "General"));\r
+ tabs.add(new ComparableTabContributor(\r
+ new XYLineAxisAndVariablesTab(),\r
+ 9,\r
+ r,\r
+ "Axis and Variables"));\r
+ } else if(backend.isInstanceOf(plot, jfree.CategoryPlot)) {\r
+ tabs.add(new ComparableTabContributor(\r
+ new BarGeneralPropertiesTab(),\r
+ 10,\r
+ r,\r
+ "General"));\r
+ tabs.add(new ComparableTabContributor(\r
+ new BarSeriesTab(),\r
+ 9,\r
+ r,\r
+ "Variables"));\r
+ } else if(backend.isInstanceOf(plot, jfree.PiePlot)) {\r
+ tabs.add(new ComparableTabContributor(\r
+ new PieGeneralPropertiesTab(),\r
+ 10,\r
+ r,\r
+ "General"));\r
+ tabs.add(new ComparableTabContributor(\r
+ new PieSeriesTab(),\r
+ 9,\r
+ r,\r
+ "Variables"));\r
+ }\r
+ \r
+ tabs.add(new ComparableTabContributor(\r
+ new ChartTab(),\r
+ 1,\r
+ r,\r
+ "Chart"));\r
+ return tabs;\r
+\r
+ } \r
}\r
\r
} catch (ServiceException e) {\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import java.awt.Color;\r
+\r
+import org.jfree.chart.axis.Axis;\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.diagram.G2DUtils;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+\r
+/**\r
+ * Abstract axis class for all JFreeChart axis\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public abstract class AbstractAxis implements IAxis {\r
+\r
+ protected Axis axis;\r
+ protected String label;\r
+ protected Boolean tMarksVisible, tLabelsVisible, labelVisible, lineVisible;\r
+ protected Color color;\r
+ protected Double min, max;\r
+\r
+ /**\r
+ *\r
+ * @param graph ReadGraph\r
+ * @param axisResource resource of type JFreeChart.NumberAxis\r
+ */\r
+ public AbstractAxis(ReadGraph graph, Resource axisResource) {\r
+ try {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ label = graph.getPossibleRelatedValue(axisResource, l0.HasLabel);\r
+ tMarksVisible = graph.getPossibleRelatedValue(axisResource, jfree.Axis_visibleTickMarks, Bindings.BOOLEAN);\r
+ tLabelsVisible = graph.getPossibleRelatedValue(axisResource, jfree.Axis_visibleTickLabels, Bindings.BOOLEAN);\r
+ labelVisible = graph.getPossibleRelatedValue(axisResource, jfree.Axis_visibleLabel, Bindings.BOOLEAN);\r
+ lineVisible = graph.getPossibleRelatedValue(axisResource, jfree.Axis_visibleAxisLine, Bindings.BOOLEAN);\r
+ Resource c = graph.getPossibleObject(axisResource, jfree.color);\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
+ } catch (DatabaseException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+ \r
+ @Override\r
+ public void dispose() {\r
+ \r
+ }\r
+\r
+ @Override\r
+ public Axis getAxis() {\r
+ if(tMarksVisible != null && tMarksVisible == false)\r
+ axis.setTickMarksVisible(false);\r
+ if(tLabelsVisible != null && tLabelsVisible == false)\r
+ axis.setTickLabelsVisible(false);\r
+ if(lineVisible != null && lineVisible == false)\r
+ axis.setAxisLineVisible(false);\r
+ \r
+ if(color != null) {\r
+ axis.setAxisLinePaint(color);\r
+ axis.setLabelPaint(color);\r
+ axis.setTickLabelPaint(color);\r
+ axis.setTickMarkPaint(color);\r
+ }\r
+ // label exists and its visibility == null or true\r
+ if((labelVisible == null || labelVisible == true) && label != null)\r
+ axis.setLabel(label);\r
+ return axis;\r
+ }\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+\r
+\r
+/**\r
+ * Abstract dataset class for all JFreeChart datasets\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public abstract class AbstractDataset implements IDataset {\r
+\r
+ protected Resource resource;\r
+ \r
+ public AbstractDataset(ReadGraph graph, Resource resource) {\r
+ this.resource = resource;\r
+ }\r
+ \r
+ @Override\r
+ public void dispose() {\r
+ \r
+ }\r
+\r
+ @Override\r
+ public Resource getResource() {\r
+ return resource;\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+\r
+import org.jfree.chart.axis.Axis;\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.utils.ListUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+\r
+/**\r
+ * Abstract plot class for all JFreeChart plots\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public abstract class AbstractPlot implements IPlot {\r
+\r
+ protected Resource resource;\r
+ protected ArrayList<IAxis> ranges;\r
+ protected ArrayList<IAxis> domains;\r
+ protected ArrayList<IDataset> datasets;\r
+ protected HashMap<IDataset, IAxis> rangeMappings;\r
+ protected HashMap<IDataset, IAxis> domainMappings;\r
+ \r
+ public AbstractPlot(ReadGraph graph, Resource resource) {\r
+ this.resource = resource;\r
+ \r
+ try {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+ HashMap<Resource, IAxis> axisMap = new HashMap<Resource, IAxis>();\r
+ ranges = new ArrayList<IAxis>();\r
+\r
+ // Get all range axis\r
+ Resource rangeList = graph.getPossibleObject(resource, jfree.Plot_rangeAxisList);\r
+ if(rangeList != null) {\r
+ for(Resource axisResource : ListUtils.toList(graph, rangeList)) {\r
+ IAxis axis = graph.adapt(axisResource, IAxis.class);\r
+ if(axis.getAxis() instanceof Axis) {\r
+ ranges.add(axis);\r
+ axisMap.put(axisResource, axis);\r
+ }\r
+ }\r
+ }\r
+ \r
+ // Get all domain axis\r
+ // There usually is only one domain axis, but this supports also multiple domain axis\r
+ domains = new ArrayList<IAxis>();\r
+ for(Resource axisResource : graph.syncRequest(new ObjectsWithType(resource, jfree.Plot_domainAxis, jfree.Axis))) {\r
+ IAxis axis = graph.adapt(axisResource, IAxis.class);\r
+ if(axis.getAxis() instanceof Axis) {\r
+ domains.add(axis);\r
+ axisMap.put(axisResource, axis);\r
+ }\r
+ }\r
+\r
+ // Get all datasets and map them to axis\r
+ datasets = new ArrayList<IDataset>();\r
+ rangeMappings = new HashMap<IDataset, IAxis>();\r
+ domainMappings = new HashMap<IDataset, IAxis>();\r
+ for(Resource datasetResource : graph.syncRequest(new ObjectsWithType(resource, l0.ConsistsOf, jfree.Dataset))) {\r
+ IDataset dataset = graph.adapt(datasetResource, IDataset.class);\r
+ if(dataset != null) {\r
+ datasets.add(dataset);\r
+ Resource axisResource = graph.getPossibleObject(datasetResource, jfree.Dataset_mapToRangeAxis);\r
+ IAxis axis;\r
+ if(axisMap.containsKey(axisResource)) {\r
+ axis = axisMap.get(axisResource);\r
+ rangeMappings.put(dataset, axis);\r
+ }\r
+ \r
+ axisResource = graph.getPossibleObject(datasetResource, jfree.Dataset_mapToDomainAxis);\r
+ if(axisMap.containsKey(axisResource)) {\r
+ axis = axisMap.get(axisResource);\r
+ domainMappings.put(dataset, axis);\r
+ }\r
+ }\r
+ }\r
+ \r
+ } catch (DatabaseException e) {\r
+ e.printStackTrace();\r
+ }\r
+ \r
+ }\r
+ \r
+ @Override\r
+ public void dispose() {\r
+ for(IAxis axis : ranges)\r
+ axis.dispose();\r
+ \r
+ for(IAxis axis : domains)\r
+ axis.dispose();\r
+ \r
+ for(IDataset dataset : datasets)\r
+ dataset.dispose();\r
+ }\r
+\r
+ @Override\r
+ public Resource getResource() {\r
+ return resource;\r
+ }\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+\r
+/**\r
+ * Abstract renderer class for all JFreeChart renderers\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public abstract class AbstractRenderer implements IRenderer {\r
+\r
+ protected Resource resource;\r
+ \r
+ public AbstractRenderer(ReadGraph graph, Resource resource) {\r
+ this.resource = resource;\r
+ }\r
+ \r
+ @Override\r
+ public void dispose() {\r
+ }\r
+\r
+ @Override\r
+ public Resource getResource() {\r
+ return resource;\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+\r
+\r
+/**\r
+ * Normal bar renderer\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class BarRenderer extends AbstractRenderer {\r
+\r
+ public BarRenderer(ReadGraph graph, Resource resource) {\r
+ super(graph, resource);\r
+ }\r
+\r
+ private org.jfree.chart.renderer.category.BarRenderer renderer;\r
+ \r
+ @Override\r
+ public org.jfree.chart.renderer.AbstractRenderer getRenderer() {\r
+ if(renderer == null)\r
+ renderer = new org.jfree.chart.renderer.category.BarRenderer();\r
+ return renderer;\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import org.jfree.chart.axis.Axis;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+\r
+/**\r
+ * Class representing a JFreeChart.CategoryAxis\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class CategoryAxis extends AbstractAxis {\r
+\r
+ public CategoryAxis(ReadGraph graph, Resource axisResource) {\r
+ super(graph, axisResource);\r
+ }\r
+\r
+ @Override\r
+ public Axis getAxis() {\r
+ axis = new org.jfree.chart.axis.CategoryAxis();\r
+ return super.getAxis();\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import javax.swing.SwingUtilities;\r
+\r
+import org.jfree.chart.plot.DefaultDrawingSupplier;\r
+import org.jfree.chart.renderer.AbstractRenderer;\r
+import org.jfree.chart.renderer.category.BarRenderer;\r
+import org.jfree.data.category.DefaultCategoryDataset;\r
+import org.jfree.data.general.Dataset;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.utils.ListUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.exception.MissingVariableException;\r
+import org.simantics.db.layer0.request.PossibleActiveExperiment;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.db.procedure.Listener;\r
+import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ModelingResources;\r
+import org.simantics.operation.Layer0X;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.adapter.SysdynVariableProperties;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Class representing a JFreeChart.CategoryDataset\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class CategoryDataset extends AbstractDataset {\r
+\r
+ private List<Resource> seriesList;\r
+ private String realizationURI;\r
+ private IRenderer renderer;\r
+ private DefaultCategoryDataset dataset;\r
+\r
+ public CategoryDataset(ReadGraph graph, Resource resource) {\r
+ super(graph, resource);\r
+\r
+ try {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ ModelingResources mr = ModelingResources.getInstance(graph);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+ // Find the model where the chart is located\r
+ Resource model = resource;\r
+ do {\r
+ model = graph.getPossibleObject(model, l0.PartOf);\r
+ } while(model != null && !graph.isInstanceOf(model, mr.StructuralModel));\r
+\r
+ // Find the variable realization of the current experiment\r
+ 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
+ if(realizationURI == null)\r
+ return; // No experiment -> No results\r
+\r
+ Resource seriesList = graph.getPossibleObject(resource, jfree.Dataset_seriesList);\r
+ if(seriesList != null)\r
+ this.seriesList = ListUtils.toList(graph, seriesList);\r
+ \r
+ Resource rendererResource = graph.getPossibleObject(resource, jfree.Dataset_renderer);\r
+ renderer = graph.adapt(rendererResource, IRenderer.class);\r
+ \r
+ } catch (DatabaseException e) {\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+\r
+ private DatasetListener listener;\r
+ \r
+ @Override\r
+ public Dataset getDataset() {\r
+ \r
+ if(seriesList == null || seriesList.isEmpty())\r
+ return null;\r
+\r
+ if(dataset == null) {\r
+ dataset = new DefaultCategoryDataset();\r
+ }\r
+ \r
+ if(listener == null || listener.isDisposed()) {\r
+ listener = new DatasetListener();\r
+ SimanticsUI.getSession().asyncRequest(new Read<ArrayList<TempSeries>>() {\r
+\r
+ @Override\r
+ public ArrayList<TempSeries> perform(ReadGraph graph) throws DatabaseException {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+ ArrayList<TempSeries> series = new ArrayList<TempSeries>();\r
+ // Get properties for all series\r
+ if(seriesList != null) {\r
+ for(Resource r : seriesList) {\r
+ String rvi = graph.getPossibleRelatedValue(r, jfree.variableRVI);\r
+ if(rvi == null)\r
+ continue;\r
+\r
+ try {\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
+ }\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 = 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
+ }\r
+ return series;\r
+ }\r
+\r
+ }, listener);\r
+ }\r
+// System.out.println("RETURNING CATEGORY DATASET" + dataset);\r
+ return dataset;\r
+ }\r
+\r
+ @Override\r
+ public AbstractRenderer getRenderer() {\r
+ return renderer.getRenderer();\r
+ }\r
+ \r
+ private class DatasetListener implements Listener<ArrayList<TempSeries>> {\r
+ private boolean disposed = false;\r
+ \r
+ public void dispose() {\r
+ disposed = true;\r
+ }\r
+\r
+ @Override\r
+ public void execute(final ArrayList<TempSeries> series) {\r
+ // Modify series in AWT thread to avoid synchronization problems\r
+ SwingUtilities.invokeLater(new Runnable() {\r
+\r
+ @Override\r
+ public void run() {\r
+\r
+ // Remove all unused series\r
+ dataset.clear();\r
+ ((BarRenderer)getRenderer()).getPlot().setDrawingSupplier(new DefaultDrawingSupplier());\r
+ \r
+ // Add found series\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
+\r
+ @Override\r
+ public void exception(Throwable t) {\r
+ t.printStackTrace();\r
+ }\r
+\r
+ @Override\r
+ public boolean isDisposed() {\r
+ return disposed;\r
+ }\r
+ };\r
+ \r
+ @Override\r
+ public void dispose() {\r
+ super.dispose();\r
+ if(listener != null) {\r
+ listener.dispose();\r
+ listener = null;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Auxiliary class containing all information needed to define a single series\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class TempSeries {\r
+ public String name;\r
+ public String series;\r
+ public Double value;\r
+\r
+ public TempSeries(String name, String series, Double value) {\r
+ this.name = name;\r
+ this.series = series;\r
+ this.value = value;\r
+ }\r
+\r
+ @Override\r
+ public String toString() {\r
+ return "TempSeries: " + name + ", " + series + ", " + value;\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.trend.chart;\r
+\r
+import org.jfree.chart.axis.CategoryAxis;\r
+import org.jfree.chart.axis.ValueAxis;\r
+import org.jfree.chart.plot.Plot;\r
+import org.jfree.chart.renderer.category.CategoryItemRenderer;\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
+\r
+/**\r
+ * Class representing a CategoryPlot for JFreeChart\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class CategoryPlot extends AbstractPlot {\r
+ \r
+ private org.jfree.chart.plot.CategoryPlot plot;\r
+ private Boolean visibleGrid;\r
+\r
+\r
+ public CategoryPlot(ReadGraph graph, Resource resource) {\r
+ super(graph, resource);\r
+ \r
+ try {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ // Visual properties\r
+ visibleGrid = graph.getPossibleRelatedValue(resource, jfree.Plot_visibleGrid);\r
+ } catch(DatabaseException e) {\r
+ e.printStackTrace();\r
+ }\r
+\r
+ \r
+ }\r
+\r
+ @Override\r
+ public Plot getPlot() {\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
+ for(int i = 0; i < ranges.size(); i++) {\r
+ plot.setRangeAxis(i, (ValueAxis)ranges.get(i).getAxis());\r
+ }\r
+ \r
+ for(int i = 0; i < domains.size(); i++) {\r
+ plot.setDomainAxis(i, (CategoryAxis)domains.get(i).getAxis());\r
+ }\r
+ \r
+ IAxis axis;\r
+ for(int i = 0; i < datasets.size(); i++) {\r
+ IDataset dataset = datasets.get(i);\r
+ org.jfree.data.category.CategoryDataset ds = (org.jfree.data.category.CategoryDataset)dataset.getDataset();\r
+ plot.setDataset(i, ds);\r
+// System.out.println("setting dataset " + i + ": " + ds);\r
+ plot.setRenderer(i, (CategoryItemRenderer)dataset.getRenderer());\r
+ axis = rangeMappings.get(dataset);\r
+ if(axis != null && ranges.contains(axis))\r
+ plot.mapDatasetToRangeAxis(i, ranges.indexOf(axis));\r
+ axis = domainMappings.get(dataset);\r
+ if(axis != null && ranges.contains(axis))\r
+ plot.mapDatasetToDomainAxis(i, domains.indexOf(axis));\r
+ }\r
+\r
+ if(visibleGrid != null) {\r
+ plot.setRangeGridlinesVisible(visibleGrid);\r
+ plot.setDomainGridlinesVisible(false);\r
+ }\r
+ \r
+ return plot;\r
+ }\r
+\r
+}\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.awt.SWT_AWT;\r
+import org.eclipse.swt.events.DisposeEvent;\r
+import org.eclipse.swt.events.DisposeListener;\r
import org.eclipse.swt.widgets.Composite;\r
import org.jfree.chart.ChartPanel;\r
import org.jfree.chart.JFreeChart;\r
private Frame frame;\r
private ChartPanel panel;\r
private Composite composite;\r
+ IJFreeChart chart;\r
\r
/**\r
* A new ChartComposite with a definition in chartResourceURI\r
*/\r
private void CreateContent(final Resource chartResource) {\r
composite = this;\r
+ \r
+ composite.addDisposeListener(new DisposeListener() {\r
+ \r
+ @Override\r
+ public void widgetDisposed(DisposeEvent e) {\r
+ if(chart != null)\r
+ chart.dispose(); \r
+ }\r
+ });\r
+ \r
GridLayoutFactory.fillDefaults().applyTo(composite);\r
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
frame = SWT_AWT.new_Frame(composite);\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
- IJFreeChart c = graph.adapt(chartResource, IJFreeChart.class);\r
- return c.getChart();\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
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import org.jfree.data.Range;\r
+\r
+/**\r
+ * NumberAxis that supports adding only one bound, lower or upper.\r
+ * The standard NumberAxis disables auto adjusting if even one of the bounds is set\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class ExtendedNumberAxis extends org.jfree.chart.axis.NumberAxis {\r
+ private static final long serialVersionUID = 3066266986472919998L;\r
+\r
+ private Double lower = null;\r
+ private Double upper = null;\r
+ /**\r
+ * Use own lower and upper bounds to support using only one of them\r
+ */\r
+ protected void autoAdjustRange() {\r
+ super.autoAdjustRange();\r
+ Range range = getRange();\r
+ Double lower = this.lower == null ? range.getLowerBound() : this.lower;\r
+ Double upper = this.upper == null ? range.getUpperBound() : this.upper;\r
+ if(lower > upper)\r
+ upper = lower + 1;\r
+ if(upper - lower < getAutoRangeMinimumSize())\r
+ upper = lower + getAutoRangeMinimumSize();\r
+ \r
+ setRange(new Range(lower, upper), false, false);\r
+\r
+ }\r
+\r
+ public void setLower(Double lower) {\r
+ this.lower = lower;\r
+ }\r
+\r
+ public void setUpper(Double upper) {\r
+ this.upper = upper;\r
+ }\r
+\r
+}\r
\r
import org.jfree.chart.renderer.AbstractRenderer;\r
import org.jfree.data.general.Dataset;\r
+import org.simantics.db.Resource;\r
\r
/**\r
* Interface for JFreeChart.Dataset type resource\r
*/\r
public AbstractRenderer getRenderer();\r
\r
+ /**\r
+ * Returns the resource of this dataset\r
+ * \r
+ * @return\r
+ */\r
+ public Resource getResource();\r
}\r
*/\r
public void dispose();\r
\r
- /**\r
- * Returns the disposed state of the component\r
- * @return\r
- */\r
- public boolean isDisposed();\r
-\r
}\r
package org.simantics.sysdyn.ui.trend.chart;\r
\r
import org.jfree.chart.plot.Plot;\r
+import org.simantics.db.Resource;\r
import org.simantics.db.exception.DatabaseException;\r
\r
/**\r
*/\r
public Plot getPlot();\r
\r
+ /**\r
+ * Returns the resource of this plot\r
+ * \r
+ * @return\r
+ */\r
+ public Resource getResource();\r
+ \r
}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import org.jfree.chart.renderer.AbstractRenderer;\r
+import org.simantics.db.Resource;\r
+\r
+/**\r
+ * Interface for JFreeChart.Renderer type resource\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public interface IRenderer extends IJFreeChartComponent {\r
+ \r
+ /**\r
+ * Returns the JFreeChart AbstractRenderer represented by the associated resource\r
+ * \r
+ * @return JFreeChart renderer\r
+ */\r
+ public AbstractRenderer getRenderer();\r
+ \r
+ /**\r
+ * Returns the resource of this renderer\r
+ * @return\r
+ */\r
+ public Resource getResource();\r
+\r
+}\r
public class JFreeChart implements IJFreeChart {\r
\r
private org.jfree.chart.JFreeChart jfreechart;\r
- private boolean disposed = false;\r
\r
private ITitle title;\r
private Boolean legendVisible;\r
- \r
+\r
private HashMap<Resource, IPlot> plots;\r
private IPlot firstPlot = null;\r
\r
if(plots.size() == 0)\r
return null;\r
jfreechart = new org.jfree.chart.JFreeChart(firstPlot.getPlot());\r
- \r
+\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
+\r
if(legendVisible != null && !legendVisible) {\r
for(Object title : jfreechart.getSubtitles()) {\r
if(title instanceof LegendTitle)\r
\r
@Override\r
public void dispose() {\r
- disposed = true;\r
-\r
// Call dispose to title and plots to disable their possible listeners\r
title.dispose();\r
for(IPlot plot : plots.values())\r
plot.dispose();\r
}\r
\r
- @Override\r
- public boolean isDisposed() {\r
- return disposed;\r
- }\r
}\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.trend.chart;\r
\r
-import java.awt.Color;\r
-\r
import org.jfree.chart.axis.Axis;\r
-import org.jfree.data.Range;\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.diagram.G2DUtils;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.sysdyn.JFreeChartResource;\r
\r
/**\r
* Class representing a JFreeChart.NumberAxis\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class NumberAxis implements IAxis {\r
-\r
- private MyNumberAxis axis;\r
- private String label;\r
- private boolean disposed;\r
- private Boolean tMarksVisible, tLabelsVisible, labelVisible, lineVisible;\r
- private Color color;\r
- private Double min, max;\r
+public class NumberAxis extends AbstractAxis {\r
\r
/**\r
*\r
* @param axisResource resource of type JFreeChart.NumberAxis\r
*/\r
public NumberAxis(ReadGraph graph, Resource axisResource) {\r
-\r
- try {\r
- Layer0 l0 = Layer0.getInstance(graph);\r
- JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
- label = graph.getPossibleRelatedValue(axisResource, l0.HasLabel);\r
- tMarksVisible = graph.getPossibleRelatedValue(axisResource, jfree.Axis_visibleTickMarks, Bindings.BOOLEAN);\r
- tLabelsVisible = graph.getPossibleRelatedValue(axisResource, jfree.Axis_visibleTickLabels, Bindings.BOOLEAN);\r
- labelVisible = graph.getPossibleRelatedValue(axisResource, jfree.Axis_visibleLabel, Bindings.BOOLEAN);\r
- lineVisible = graph.getPossibleRelatedValue(axisResource, jfree.Axis_visibleAxisLine, Bindings.BOOLEAN);\r
- Resource c = graph.getPossibleObject(axisResource, jfree.color);\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
- } catch (DatabaseException e) {\r
- e.printStackTrace();\r
- }\r
+ super(graph, axisResource);\r
}\r
\r
\r
@Override\r
public Axis getAxis() {\r
- axis = new MyNumberAxis();\r
-\r
- if(tMarksVisible != null && tMarksVisible == false)\r
- axis.setTickMarksVisible(false);\r
- if(tLabelsVisible != null && tLabelsVisible == false)\r
- axis.setTickLabelsVisible(false);\r
- if(lineVisible != null && lineVisible == false)\r
- axis.setAxisLineVisible(false);\r
- \r
- if(color != null) {\r
- axis.setAxisLinePaint(color);\r
- axis.setLabelPaint(color);\r
- axis.setTickLabelPaint(color);\r
- axis.setTickMarkPaint(color);\r
- }\r
- // label exists and its visibility == null or true\r
- if((labelVisible == null || labelVisible == true) && label != null)\r
- axis.setLabel(label);\r
- axis.setLower(min);\r
- axis.setUpper(max);\r
- return axis;\r
+ axis = new ExtendedNumberAxis();\r
+ ((ExtendedNumberAxis)axis).setLower(min);\r
+ ((ExtendedNumberAxis)axis).setUpper(max);\r
+ return super.getAxis();\r
}\r
\r
- @Override\r
- public void dispose() {\r
- disposed = true;\r
- }\r
-\r
- @Override\r
- public boolean isDisposed() {\r
- return disposed;\r
- }\r
-\r
- /**\r
- * NumberAxis that supports adding only one bound, lower or upper.\r
- * The standard NumberAxis disables auto adjusting if even one of the bounds is set\r
- * \r
- * @author Teemu Lempinen\r
- *\r
- */\r
- private class MyNumberAxis extends org.jfree.chart.axis.NumberAxis {\r
- private static final long serialVersionUID = 3066266986472919998L;\r
-\r
- private Double lower = null;\r
- private Double upper = null;\r
- /**\r
- * Use own lower and upper bounds to support using only one of them\r
- */\r
- protected void autoAdjustRange() {\r
- super.autoAdjustRange();\r
- Range range = getRange();\r
- Double lower = this.lower == null ? range.getLowerBound() : this.lower;\r
- Double upper = this.upper == null ? range.getUpperBound() : this.upper;\r
- if(lower > upper)\r
- upper = lower + 1;\r
- if(upper - lower < getAutoRangeMinimumSize())\r
- upper = lower + getAutoRangeMinimumSize();\r
- \r
- setRange(new Range(lower, upper), false, false);\r
-\r
- }\r
-\r
- public void setLower(Double lower) {\r
- this.lower = lower;\r
- }\r
-\r
- public void setUpper(Double upper) {\r
- this.upper = upper;\r
- }\r
- } \r
}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import java.awt.Color;\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+\r
+import javax.swing.SwingUtilities;\r
+\r
+import org.jfree.chart.renderer.AbstractRenderer;\r
+import org.jfree.data.general.Dataset;\r
+import org.jfree.data.general.DefaultPieDataset;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.common.utils.ListUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.exception.MissingVariableException;\r
+import org.simantics.db.layer0.request.PossibleActiveExperiment;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.db.procedure.Listener;\r
+import org.simantics.db.request.Read;\r
+import org.simantics.diagram.G2DUtils;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ModelingResources;\r
+import org.simantics.operation.Layer0X;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.adapter.SysdynVariableProperties;\r
+import org.simantics.ui.SimanticsUI;\r
+\r
+/**\r
+ * Class representing a PieDataset in JFreeChart ontology\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class PieDataset extends AbstractDataset {\r
+\r
+ private List<Resource> seriesList;\r
+ private String realizationURI;\r
+ private DefaultPieDataset dataset;\r
+\r
+ private HashMap<String, Color> colorMap;\r
+ private HashMap<String, Boolean> explodedMap;\r
+\r
+ public PieDataset(ReadGraph graph, Resource resource) {\r
+ super(graph, resource);\r
+\r
+ try {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ ModelingResources mr = ModelingResources.getInstance(graph);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+ // Find the model where the chart is located\r
+ Resource model = resource;\r
+ do {\r
+ model = graph.getPossibleObject(model, l0.PartOf);\r
+ } while(model != null && !graph.isInstanceOf(model, mr.StructuralModel));\r
+\r
+ // Find the variable realization of the current experiment\r
+ 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
+ if(realizationURI == null)\r
+ return; // No experiment -> No results\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
+\r
+ }\r
+\r
+ /**\r
+ * Map of colors for different slices in a pie chart. Name \r
+ * indicates the key of the value.\r
+ * @return Map of colors for different slices in a pie chart\r
+ */\r
+ public HashMap<String, Color> getColorMap() {\r
+ return colorMap;\r
+ }\r
+\r
+ /**\r
+ * Map of exploded statuses for slices in a pie chart. Name\r
+ * indicates the key of the slice.\r
+ * @return\r
+ */\r
+ public HashMap<String, Boolean> getExplodedMap() {\r
+ return explodedMap;\r
+ }\r
+\r
+ @Override\r
+ public Dataset getDataset() {\r
+ if(seriesList == null || seriesList.isEmpty())\r
+ return null;\r
+\r
+ if(dataset == null) {\r
+ dataset = new DefaultPieDataset();\r
+ }\r
+\r
+ if(listener == null) {\r
+ listener = new DatasetListener();\r
+ SimanticsUI.getSession().asyncRequest(new Read<ArrayList<TempSeries>>() {\r
+\r
+ @Override\r
+ public ArrayList<TempSeries> perform(ReadGraph graph) throws DatabaseException {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+\r
+ ArrayList<TempSeries> series = new ArrayList<TempSeries>();\r
+ // Get properties for all series\r
+ if(seriesList != null) {\r
+ for(Resource r : seriesList) {\r
+ String label = graph.getPossibleRelatedValue(r, Layer0.getInstance(graph).HasLabel);\r
+ String rvi = graph.getPossibleRelatedValue(r, jfree.variableRVI);\r
+ if(rvi == null)\r
+ continue;\r
+\r
+ try {\r
+ // Get a variable for the series\r
+ Variable v = Variables.getVariable(graph, realizationURI + rvi);\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
+ }\r
+\r
+ if(value == null)\r
+ value = va[va.length - 1];\r
+ }\r
+\r
+ series.add(new TempSeries(label == null || label.isEmpty() ? v.getName(graph) : label, value));\r
+ } catch (MissingVariableException e) {\r
+ // Do nothing, if variable was not found. Move on to the next series\r
+ }\r
+ }\r
+ }\r
+ return series;\r
+ }\r
+\r
+ }, listener);\r
+ }\r
+ return dataset;\r
+ }\r
+\r
+ private DatasetListener listener;\r
+\r
+ private class DatasetListener implements Listener<ArrayList<TempSeries>> {\r
+\r
+ private boolean disposed = false;\r
+\r
+ @Override\r
+ public void execute(final ArrayList<TempSeries> series) {\r
+ // Modify series in AWT thread to avoid synchronization problems\r
+ SwingUtilities.invokeLater(new Runnable() {\r
+\r
+ @Override\r
+ public void run() {\r
+ // Remove all series\r
+ dataset.clear();\r
+\r
+ // Add found series\r
+ for(int i = 0; i < series.size(); i++) {\r
+ TempSeries s = series.get(i);\r
+ dataset.setValue(s.name, s.value);\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 disposed;\r
+ }\r
+\r
+ public void dispose() {\r
+ disposed = true;\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public AbstractRenderer getRenderer() {\r
+ // No renderer for pie chart\r
+ return null;\r
+ }\r
+\r
+ @Override\r
+ public void dispose() {\r
+ super.dispose();\r
+ if(listener != null) {\r
+ listener.dispose();\r
+ listener = null;\r
+ }\r
+ }\r
+\r
+\r
+ /**\r
+ * Auxiliary class containing all information needed to define a single series\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class TempSeries {\r
+ public String name;\r
+ public Double value;\r
+\r
+ public TempSeries(String name, Double value) {\r
+ this.name = name;\r
+ this.value = value;\r
+ }\r
+\r
+ @Override\r
+ public String toString() {\r
+ return "TempSeries: " + name + ", " + value;\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import java.awt.Color;\r
+import java.util.HashMap;\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.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+\r
+/**\r
+ * Class representing a PiePlot in JFreeChart ontology\r
+ * \r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class PiePlot extends AbstractPlot {\r
+\r
+ org.jfree.chart.plot.PiePlot plot;\r
+\r
+ public PiePlot(ReadGraph graph, Resource resource) {\r
+ super(graph, resource);\r
+ }\r
+\r
+ @Override\r
+ public Plot getPlot() {\r
+ if(plot == null) {\r
+ plot = new org.jfree.chart.plot.PiePlot();\r
+ }\r
+\r
+ if(!datasets.isEmpty()) {\r
+ // We assume that a pie plot has only one dataset\r
+ IDataset ds = datasets.get(0);\r
+ Dataset dataset = ((PieDataset)ds).getDataset();\r
+ if(dataset instanceof org.jfree.data.general.PieDataset) {\r
+ plot.clearSectionPaints(true);\r
+ plot.setDrawingSupplier(new DefaultDrawingSupplier());\r
+ plot.setDataset(null);\r
+ \r
+ org.jfree.data.general.PieDataset pieDataset = (org.jfree.data.general.PieDataset)dataset;\r
+ plot.setDataset(pieDataset);\r
+\r
+ HashMap<String, Color> colorMap = ((PieDataset)ds).getColorMap();\r
+ for(String name : colorMap.keySet())\r
+ plot.setSectionPaint(name, colorMap.get(name));\r
+\r
+ HashMap<String, Boolean> explodedMap = ((PieDataset)ds).getExplodedMap();\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
+ return plot;\r
+ }\r
+\r
+}\r
--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.trend.chart;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+\r
+/**\r
+ * Stacked bar renderer\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class StackedBarRenderer extends AbstractRenderer {\r
+\r
+ public StackedBarRenderer(ReadGraph graph, Resource resource) {\r
+ super(graph, resource);\r
+ }\r
+\r
+ private org.jfree.chart.renderer.category.StackedBarRenderer renderer;\r
+ \r
+ @Override\r
+ public org.jfree.chart.renderer.AbstractRenderer getRenderer() {\r
+ if(renderer == null)\r
+ renderer = new org.jfree.chart.renderer.category.StackedBarRenderer();\r
+ return renderer;\r
+ }\r
+\r
+}\r
private org.jfree.chart.title.TextTitle textTitle;\r
private RectangleEdge position;\r
private String text;\r
- private boolean disposed;\r
private Boolean visible;\r
\r
public TextTitle(ReadGraph graph, Resource titleResource) {\r
\r
@Override\r
public void dispose() {\r
- disposed = true;\r
- }\r
-\r
- @Override\r
- public boolean isDisposed() {\r
- return disposed;\r
}\r
\r
}\r
\r
import java.awt.BasicStroke;\r
import java.awt.Color;\r
+import java.awt.Stroke;\r
import java.util.ArrayList;\r
import java.util.List;\r
\r
import javax.swing.SwingUtilities;\r
\r
+import org.jfree.chart.plot.DefaultDrawingSupplier;\r
+import org.jfree.chart.plot.ValueMarker;\r
import org.jfree.chart.renderer.AbstractRenderer;\r
+import org.jfree.chart.renderer.xy.AbstractXYItemRenderer;\r
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;\r
import org.jfree.data.general.Dataset;\r
import org.jfree.data.xy.DefaultXYDataset;\r
+import org.jfree.ui.Layer;\r
import org.simantics.databoard.Bindings;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class XYDataset implements IDataset {\r
+public class XYDataset extends AbstractDataset {\r
\r
- private boolean disposed;\r
private XYLineAndShapeRenderer renderer;\r
private double[] domainValues;\r
private List<Resource> seriesList;\r
private String realizationURI;\r
- private Resource resource;\r
\r
public XYDataset(ReadGraph graph, final Resource datasetResource) {\r
- this.resource = datasetResource;\r
+ super(graph, datasetResource);\r
\r
try {\r
Layer0 l0 = Layer0.getInstance(graph);\r
}\r
}\r
\r
- DefaultXYDataset dataset;\r
+ private DefaultXYDataset dataset;\r
+ private DataSetListener datasetListener;\r
+ private TimeListener timeListener;\r
\r
@Override\r
public Dataset getDataset() {\r
\r
if(dataset == null) {\r
dataset = new DefaultXYDataset();\r
+ } \r
+\r
+ if(datasetListener == null || datasetListener.isDisposed()) {\r
+ datasetListener = new DataSetListener();\r
SimanticsUI.getSession().asyncRequest(new Read<ArrayList<TempSeries>>() {\r
\r
@Override\r
// Get values\r
// double[] va = v.getPossiblePropertyValue(graph, SysdynVariableProperties.VALUES , Bindings.DOUBLE_ARRAY);\r
\r
- \r
+\r
Object object = v.getPossiblePropertyValue(graph, SysdynVariableProperties.ACTIVE_DATASETS , Bindings.VARIANT);\r
if(object == null || !(object instanceof ArrayList<?>))\r
return series;\r
for(Object o : datasets) {\r
if(!(o instanceof SysdynDataSet))\r
continue;\r
- \r
+\r
SysdynDataSet dataset = (SysdynDataSet)o;\r
double[] va = dataset.values;\r
- \r
+\r
// Get domain axis values (time OR other variable) \r
double[] ta;\r
if(domainValues != null) {\r
return series;\r
}\r
\r
- }, new Listener<ArrayList<TempSeries>>() {\r
-\r
- @Override\r
- public boolean isDisposed() {\r
- return disposed;\r
- }\r
+ }, datasetListener); \r
+ }\r
\r
+ if(timeListener == null || timeListener.isDisposed()) {\r
+ timeListener = new TimeListener(new ValueMarker(0.0));\r
+ SimanticsUI.getSession().asyncRequest(new Read<Double>() {\r
@Override\r
- public void execute(final ArrayList<TempSeries> series) {\r
- // Modify series in AWT thread to avoid synchronization problems\r
- SwingUtilities.invokeLater(new Runnable() {\r
- \r
- @Override\r
- public void run() {\r
- // Remove all series\r
- for(int i = dataset.getSeriesCount() - 1; i >= 0; i-- ) {\r
- dataset.removeSeries(dataset.getSeriesKey(i));\r
+ public Double perform(ReadGraph graph) throws DatabaseException {\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ // Get properties for all series\r
+ if(seriesList != null) {\r
+ for(Resource r : seriesList) {\r
+ String rvi = graph.getPossibleRelatedValue(r, jfree.variableRVI);\r
+ if(rvi == null)\r
+ continue;\r
+ try {\r
+ // Get a variable for the series\r
+ Variable v = Variables.getVariable(graph, realizationURI + rvi);\r
+ Double time = v.getPossiblePropertyValue(graph, SysdynVariableProperties.TIME , Bindings.DOUBLE);\r
+ return time;\r
+ } catch (MissingVariableException e) {\r
+ // Do nothing, if variable was not found.\r
}\r
- \r
- // Add found series\r
- for(int i = 0; i < series.size(); i++) {\r
- TempSeries s = series.get(i);\r
- dataset.addSeries(s.name, s.values);\r
- getRenderer().setSeriesStroke(i, new BasicStroke((float)s.width));\r
- if(s.color != null)\r
- getRenderer().setSeriesPaint(i, s.color);\r
- } \r
}\r
- });\r
+ }\r
+ return null;\r
}\r
\r
+ }, timeListener);\r
+ }\r
+ return dataset;\r
+ }\r
+\r
+\r
+ private class DataSetListener implements Listener<ArrayList<TempSeries>> {\r
+\r
+ private boolean disposed = false;\r
+\r
+ public void dispose() {\r
+ disposed = true;\r
+ }\r
+\r
+ @Override\r
+ public boolean isDisposed() {\r
+ return disposed;\r
+ }\r
+\r
+ @Override\r
+ public void execute(final ArrayList<TempSeries> series) {\r
+ // Modify series in AWT thread to avoid synchronization problems\r
+ SwingUtilities.invokeLater(new Runnable() {\r
+\r
@Override\r
- public void exception(Throwable t) {\r
- t.printStackTrace();\r
+ public void run() {\r
+ ((AbstractXYItemRenderer)getRenderer()).getPlot().setDrawingSupplier(new DefaultDrawingSupplier());\r
+ // Remove all series\r
+ for(int i = dataset.getSeriesCount() - 1; i >= 0; i-- ) {\r
+ dataset.removeSeries(dataset.getSeriesKey(i));\r
+ }\r
+\r
+ // Add found series\r
+ for(int i = 0; i < series.size(); i++) {\r
+ TempSeries s = series.get(i);\r
+ dataset.addSeries(s.name, s.values);\r
+ getRenderer().setSeriesStroke(i, new BasicStroke((float)s.width));\r
+ getRenderer().setSeriesPaint(i, s.color);\r
+ } \r
}\r
+ });\r
+ }\r
+\r
+ @Override\r
+ public void exception(Throwable t) {\r
+ t.printStackTrace();\r
+ }\r
+\r
+ }\r
+\r
+\r
+ private class TimeListener implements Listener<Double> {\r
+\r
+ private ValueMarker marker;\r
+ private boolean disposed = false;\r
\r
+ public TimeListener(ValueMarker marker) {\r
+ this.marker = marker;\r
+ }\r
+\r
+ public void dispose() {\r
+ this.disposed = true;\r
+ }\r
+\r
+ @Override\r
+ public boolean isDisposed() {\r
+ return disposed;\r
+ }\r
+\r
+ @Override\r
+ public void execute(final Double time) {\r
+ // Modify in AWT thread to avoid synchronization problems\r
+ SwingUtilities.invokeLater(new Runnable() {\r
+\r
+ @Override\r
+ public void run() {\r
+ org.jfree.chart.plot.XYPlot plot = ((AbstractXYItemRenderer)getRenderer()).getPlot();\r
+\r
+ int i = 0;\r
+ for(i = 0; i < plot.getDatasetCount(); i++) {\r
+ if(plot.getDataset(i).equals(dataset))\r
+ break;\r
+ }\r
+\r
+ plot.removeDomainMarker(marker);\r
+ if(time != null) {\r
+ Stroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT,\r
+ BasicStroke.JOIN_MITER, 10.0f, new float[] {5.0f, 3.0f, 1.0f, 3.0f}, 0.0f);\r
+ marker = new ValueMarker(time, Color.red, dashStroke);\r
+ plot.addDomainMarker(i, marker, Layer.FOREGROUND);\r
+ }\r
+\r
+ }\r
});\r
- \r
- } \r
- return dataset;\r
+ }\r
+\r
+ @Override\r
+ public void exception(Throwable t) {\r
+ t.printStackTrace();\r
+ }\r
+\r
}\r
\r
@Override\r
public void dispose() {\r
- disposed = true;\r
- }\r
+ if(timeListener != null) {\r
+ timeListener.dispose();\r
+ timeListener = null;\r
+ }\r
\r
- @Override\r
- public boolean isDisposed() {\r
- return disposed;\r
+ if(datasetListener != null) {\r
+ datasetListener.dispose();\r
+ datasetListener = null;\r
+ }\r
}\r
\r
+\r
/**\r
* Auxiliary class containing all information needed to define a single series\r
* @author Teemu Lempinen\r
*******************************************************************************/\r
package org.simantics.sysdyn.ui.trend.chart;\r
\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-\r
import org.jfree.chart.axis.ValueAxis;\r
import org.jfree.chart.plot.Plot;\r
import org.jfree.chart.renderer.xy.XYItemRenderer;\r
import org.jfree.data.xy.XYDataset;\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.utils.ListUtils;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
\r
/**\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class XYPlot implements IPlot {\r
+public class XYPlot extends AbstractPlot {\r
\r
private org.jfree.chart.plot.XYPlot plot;\r
- private ArrayList<IAxis> ranges;\r
- private ArrayList<IAxis> domains;\r
- private ArrayList<IDataset> datasets;\r
- private HashMap<IDataset, IAxis> rangeMappings;\r
- private HashMap<IDataset, IAxis> domainMappings;\r
- private boolean disposed;\r
private Boolean visibleGrid;\r
- \r
+\r
+\r
public XYPlot(ReadGraph graph, Resource plotResource) {\r
+ super(graph, plotResource);\r
\r
try {\r
- Layer0 l0 = Layer0.getInstance(graph);\r
JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
-\r
- HashMap<Resource, IAxis> axisMap = new HashMap<Resource, IAxis>();\r
- ranges = new ArrayList<IAxis>();\r
-\r
- // Get all range axis\r
- Resource rangeList = graph.getPossibleObject(plotResource, jfree.Plot_rangeAxisList);\r
- if(rangeList != null) {\r
- for(Resource axisResource : ListUtils.toList(graph, rangeList)) {\r
- IAxis axis = graph.adapt(axisResource, IAxis.class);\r
- if(axis.getAxis() instanceof ValueAxis) {\r
- ranges.add(axis);\r
- axisMap.put(axisResource, axis);\r
- }\r
- }\r
- }\r
- \r
- // Get all domain axis\r
- // There usually is only one domain axis, but this supports also multiple domain axis\r
- domains = new ArrayList<IAxis>();\r
- for(Resource axisResource : graph.syncRequest(new ObjectsWithType(plotResource, jfree.Plot_domainAxis, jfree.Axis))) {\r
- IAxis axis = graph.adapt(axisResource, IAxis.class);\r
- if(axis.getAxis() instanceof ValueAxis) {\r
- domains.add(axis);\r
- axisMap.put(axisResource, axis);\r
- }\r
- }\r
-\r
- // Get all datasets and map them to axis\r
- datasets = new ArrayList<IDataset>();\r
- rangeMappings = new HashMap<IDataset, IAxis>();\r
- domainMappings = new HashMap<IDataset, IAxis>();\r
- for(Resource datasetResource : graph.syncRequest(new ObjectsWithType(plotResource, l0.ConsistsOf, jfree.Dataset))) {\r
- IDataset dataset = graph.adapt(datasetResource, IDataset.class);\r
- if(dataset.getDataset() != null && dataset.getDataset() instanceof XYDataset) {\r
- datasets.add(dataset);\r
- Resource axisResource = graph.getPossibleObject(datasetResource, jfree.Dataset_mapToRangeAxis);\r
- IAxis axis;\r
- if(axisMap.containsKey(axisResource)) {\r
- axis = axisMap.get(axisResource);\r
- rangeMappings.put(dataset, axis);\r
- }\r
- \r
- axisResource = graph.getPossibleObject(datasetResource, jfree.Dataset_mapToDomainAxis);\r
- if(axisMap.containsKey(axisResource)) {\r
- axis = axisMap.get(axisResource);\r
- domainMappings.put(dataset, axis);\r
- }\r
- }\r
- }\r
- \r
// Visual properties\r
visibleGrid = graph.getPossibleRelatedValue(plotResource, jfree.Plot_visibleGrid);\r
- \r
- } catch (DatabaseException e) {\r
+ } catch(DatabaseException e) {\r
e.printStackTrace();\r
}\r
+\r
}\r
\r
@Override\r
public Plot getPlot() {\r
+ if(plot == null)\r
+ plot = new org.jfree.chart.plot.XYPlot(null, null, null, null);\r
\r
- plot = new org.jfree.chart.plot.XYPlot(null, null, null, null);\r
+ plot.clearDomainAxes();\r
+ plot.clearRangeAxes();\r
\r
for(int i = 0; i < ranges.size(); i++) {\r
plot.setRangeAxis(i, (ValueAxis)ranges.get(i).getAxis());\r
}\r
- \r
+\r
for(int i = 0; i < domains.size(); i++) {\r
plot.setDomainAxis(i, (ValueAxis)domains.get(i).getAxis());\r
}\r
- \r
+\r
+ IAxis axis;\r
for(int i = 0; i < datasets.size(); i++) {\r
IDataset dataset = datasets.get(i);\r
plot.setDataset(i, (XYDataset)dataset.getDataset());\r
plot.setRenderer(i, (XYItemRenderer)dataset.getRenderer());\r
- plot.mapDatasetToRangeAxis(i, ranges.indexOf(rangeMappings.get(dataset)));\r
- plot.mapDatasetToDomainAxis(i, domains.indexOf(domainMappings.get(dataset)));\r
+ axis = rangeMappings.get(dataset);\r
+ if(axis != null && ranges.contains(axis))\r
+ plot.mapDatasetToRangeAxis(i, ranges.indexOf(axis));\r
+ axis = domainMappings.get(dataset);\r
+ if(axis != null && ranges.contains(axis))\r
+ plot.mapDatasetToDomainAxis(i, domains.indexOf(axis));\r
}\r
+\r
+ if(visibleGrid == null)\r
+ visibleGrid = true;\r
+\r
+ plot.setRangeGridlinesVisible(visibleGrid);\r
+ plot.setDomainGridlinesVisible(visibleGrid);\r
\r
- if(visibleGrid != null) {\r
- plot.setRangeGridlinesVisible(visibleGrid);\r
- plot.setDomainGridlinesVisible(visibleGrid);\r
- }\r
return plot;\r
}\r
- \r
- @Override\r
- public void dispose() {\r
- disposed = true;\r
- \r
- // Dispose all axis and datasets\r
- for(IAxis axis : ranges)\r
- axis.dispose();\r
- \r
- for(IAxis axis : domains)\r
- axis.dispose();\r
- \r
- for(IDataset dataset : datasets)\r
- dataset.dispose();\r
- }\r
-\r
- @Override\r
- public boolean isDisposed() {\r
- return disposed;\r
- }\r
\r
}\r
import org.simantics.db.layer0.adapter.DropActionFactory;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
-import org.simantics.sysdyn.ui.trend.chart.properties.AxisAndVariablesExplorerComposite;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.xyline.AxisAndVariablesExplorerComposite;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.AdaptionUtils;\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.graphexplorer;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.browsing.ui.model.children.ChildRule;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\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.layer0.Layer0;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+\r
+/**\r
+ * Child rule for obtaining series in a chart. \r
+ * Assumes that the chart has only one plot and that plot has only one dataset\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class SeriesChildRule implements ChildRule {\r
+\r
+ @Override\r
+ public boolean isCompatible(Class<?> contentType) {\r
+ return contentType.equals(Resource.class);\r
+ }\r
+\r
+ @Override\r
+ public Collection<?> getChildren(ReadGraph graph, Object parent) throws DatabaseException {\r
+ ArrayList<Resource> result = new ArrayList<Resource>();\r
+ if(!(parent instanceof Resource))\r
+ return result;\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ /*\r
+ * 1. we assume that there is only one plot\r
+ * 2. we assume that the only plot has only one dataset\r
+ */\r
+ Resource plot = graph.syncRequest(new PossibleObjectWithType((Resource)parent, l0.ConsistsOf, jfree.Plot));\r
+ \r
+ Resource dataset = graph.syncRequest(new PossibleObjectWithType(plot, l0.ConsistsOf, jfree.Dataset));\r
+ \r
+ Resource seriesList = graph.getPossibleObject(dataset, jfree.Dataset_seriesList);\r
+ if(seriesList != null)\r
+ for(Resource series : ListUtils.toList(graph, seriesList)) {\r
+ result.add(series);\r
+ }\r
+ return result;\r
+ }\r
+ \r
+ @Override\r
+ public Collection<?> getParents(ReadGraph graph, Object child) throws DatabaseException {\r
+ return new ArrayList<Resource>();\r
+ }\r
+\r
+}\r
import org.simantics.db.layer0.adapter.DropActionFactory;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
-import org.simantics.sysdyn.ui.trend.chart.properties.ChartAxisAndVariablesTab;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.xyline.XYLineAxisAndVariablesTab;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.AdaptionUtils;\r
\r
/**\r
- * Drop action for explorer in {@link ChartAxisAndVariablesTab}. This action is used for dropping \r
+ * Drop action for explorer in {@link XYLineAxisAndVariablesTab}. This action is used for dropping \r
* both series on axis or another sries\r
* \r
* @author Teemu Lempinen\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 org.simantics.browsing.ui.swt.widgets.impl.ReadFactoryImpl;\r
+import org.simantics.databoard.Bindings;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\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
+\r
+/**\r
+ * TextFactory for chart title\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class TitleFactory extends ReadFactoryImpl<Resource, String> {\r
+ @Override\r
+ public String perform(ReadGraph graph, Resource chart) throws DatabaseException {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Resource title = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.TextTitle));\r
+ if(title == null)\r
+ return "";\r
+ else {\r
+ String label = graph.getPossibleRelatedValue(title, l0.HasLabel, Bindings.STRING);\r
+ return label == null ? "" : label;\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.trend.chart.properties;\r
+\r
+import org.simantics.browsing.ui.swt.widgets.impl.TextModifyListenerImpl;\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.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+\r
+/**\r
+ * TitleModifier for chart title\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class TitleModifier extends TextModifyListenerImpl<Resource> {\r
+\r
+ @Override\r
+ public void applyText(WriteGraph graph, Resource chart, String text) throws DatabaseException {\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Resource title = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.TextTitle));\r
+ if(title == null) {\r
+ title = GraphUtils.create2(graph, jfree.TextTitle,\r
+ jfree.Title_position, jfree.Top);\r
+ }\r
+ graph.claimLiteral(title, l0.HasLabel, text);\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.trend.chart.properties.bar;\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.widgets.Combo;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Group;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.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.WidgetSupport;\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.properties.LabelPropertyTabContributor;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.BooleanPropertyFactory;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.BooleanSelectionListener;\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
+\r
+/**\r
+ * General properties of a bar chart\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class BarGeneralPropertiesTab extends LabelPropertyTabContributor {\r
+\r
+ private ScrolledComposite sc;\r
+ private Composite composite;\r
+ private Button hgrid, htitle, hlegend;\r
+ private TrackedText name, title;\r
+ private Combo type;\r
+\r
+ @Override\r
+ public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) { \r
+ // Scrolled composite containing all of the properties in this tab\r
+ sc = new ScrolledComposite(body, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().applyTo(sc);\r
+ sc.setExpandHorizontal(true);\r
+ sc.setExpandVertical(true);\r
+\r
+ composite = new Composite(sc, SWT.NONE);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ // General properties\r
+ Group general = new Group(composite, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(general);\r
+ general.setText("General");\r
+\r
+ // Name\r
+ Label label = new Label(general, SWT.NONE);\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ label.setText("Name:");\r
+\r
+ Composite c = new Composite(general, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(c);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(c);\r
+\r
+ name = new org.simantics.browsing.ui.swt.widgets.TrackedText(c, support, SWT.BORDER);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+ name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
+ name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
+ name.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
+\r
+ // Type\r
+ label = new Label(c, SWT.NONE);\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ label.setText("Type:");\r
+\r
+ type = new Combo(c, SWT.BORDER | SWT.READ_ONLY);\r
+ type.setItems(new String[] {"Normal", "Stacked"});\r
+ type.select(0);\r
+\r
+ // Title (Which is different than name)\r
+ label = new Label(general, SWT.NONE);\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ label.setText("Title:");\r
+\r
+ title = new org.simantics.browsing.ui.swt.widgets.TrackedText(general, support, SWT.BORDER);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(title.getWidget());\r
+ title.setTextFactory(new TitleFactory());\r
+ title.addModifyListener(new TitleModifier());\r
+ title.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
+\r
+ // Group for hide options\r
+ Group hideGroup = new Group(composite, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(hideGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
+ hideGroup.setText("Hide");\r
+\r
+ hgrid = new Button(hideGroup, support, SWT.CHECK);\r
+ hgrid.setText("Grid");\r
+ hgrid.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid, true));\r
+ hgrid.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid));\r
+ htitle = new Button(hideGroup, support, SWT.CHECK);\r
+ htitle.setText("Title");\r
+ htitle.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible, true));\r
+ htitle.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible));\r
+ hlegend = new Button(hideGroup, support, SWT.CHECK);\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
+ sc.setContent(composite);\r
+ Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\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.bar;\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.widgets.Composite;\r
+import org.eclipse.swt.widgets.Label;\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.WidgetSupport;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.layer0.Layer0;\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
+\r
+/**\r
+ * Composite for modifying properties of a series in a bar chart\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class BarSeriesPropertyComposite extends Composite {\r
+ \r
+ private TrackedText variable, label;\r
+ \r
+ public BarSeriesPropertyComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
+ super(parent, style);\r
+ \r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);\r
+\r
+ // Variable for the series\r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setText("Variable:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+\r
+ variable = new TrackedText(this, support, SWT.BORDER);\r
+ variable.setTextFactory(new RVIFactory());\r
+ variable.addModifyListener(new RVIModifier(variable.getWidget(), support));\r
+ variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager()));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget());\r
+\r
+ // Label to be displayed in chart for this series\r
+ label = new Label(this, SWT.NONE);\r
+ label.setText("Label:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+\r
+ this.label = new TrackedText(this, support, SWT.BORDER);\r
+ this.label.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel, ""));\r
+ this.label.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
+ this.label.setColorProvider(new JFreeChartPropertyColorProvider(this.label.getResourceManager()));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(this.label.getWidget());\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.bar;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.viewers.ISelectionProvider;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.custom.ScrolledComposite;\r
+import org.eclipse.swt.events.SelectionAdapter;\r
+import org.eclipse.swt.events.SelectionEvent;\r
+import org.eclipse.swt.graphics.Point;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Tree;\r
+import org.eclipse.ui.IWorkbenchSite;\r
+import org.simantics.browsing.ui.swt.SingleSelectionInputSource;\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
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.properties.LabelPropertyTabContributor;\r
+import org.simantics.sysdyn.ui.trend.chart.ChartUtils;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.xyline.AxisAndVariablesExplorerComposite;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+import org.simantics.utils.datastructures.ArrayMap;\r
+\r
+/**\r
+ * Tab containing the series of a bar chart\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class BarSeriesTab 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
+\r
+ public BarSeriesTab() {\r
+ additionalSupport = new WidgetSupportImpl();\r
+ }\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
+ // (Ontology-based) GraphExplorer displaying variables in a bar chart\r
+ explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
+ "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
+ explorer.setBrowseContexts(SysdynResource.URIs.BarSeriesBrowseContext);\r
+ explorer.setInputSource(new SingleSelectionInputSource(\r
+ Resource.class));\r
+ explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
+ explorer.finish();\r
+\r
+ ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
+ public void widgetSelected(SelectionEvent e) {\r
+ updateSelection(context);\r
+ }\r
+ });\r
+ GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
+ GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+ propertyContainer.setExpandHorizontal(true);\r
+ propertyContainer.setExpandVertical(true);\r
+\r
+ // Buttons for adding and removing variables from a pie plot\r
+ Composite buttonComposite = new Composite(composite, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+\r
+ add = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ add.setText("Add");\r
+ add.addSelectionListener(new NewVariableListener(context));\r
+\r
+ remove = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ remove.setText("Remove");\r
+ remove.addSelectionListener(new RemoveListener(context));\r
+ }\r
+\r
+ /**\r
+ * Updates the content of propertyContainer \r
+ * @param context\r
+ */\r
+ private void updateSelection(ISessionContext context) {\r
+ ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class);\r
+ IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();\r
+ final Resource resource = AdaptionUtils.adaptToSingle(selection, Resource.class);\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
+ 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
+ */\r
+ private class NewVariableListener extends SelectionListenerImpl<Resource> {\r
+\r
+ public NewVariableListener(ISessionContext context) {\r
+ super(context);\r
+ }\r
+\r
+ @Override\r
+ public void apply(WriteGraph graph, Resource input) throws DatabaseException {\r
+ Resource dataset = null;\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+\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
+\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
+ * SelectionListener for remove button\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class RemoveListener extends SelectionListenerImpl<Resource> {\r
+\r
+ public RemoveListener(ISessionContext context) {\r
+ super(context);\r
+ }\r
+\r
+ /**\r
+ * Removes selected resource from explorer\r
+ */\r
+ @Override\r
+ public void apply(WriteGraph graph, Resource input) throws DatabaseException {\r
+ if(input == null)\r
+ return; \r
+\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ Resource list = null;\r
+ if(graph.isInstanceOf(input, jfree.Series)) {\r
+ // Remove series from dataset and seriesList\r
+ Resource dataset = graph.getPossibleObject(input, l0.PartOf);\r
+ if(dataset != null)\r
+ list = graph.getPossibleObject(dataset, jfree.Dataset_seriesList);\r
+\r
+ if(list != null)\r
+ ListUtils.removeElement(graph, list, input);\r
+ RemoverUtil.remove(graph, input);\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
+}\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.pie;\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.widgets.Combo;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Group;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.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.WidgetSupport;\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.properties.LabelPropertyTabContributor;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.BooleanPropertyFactory;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.BooleanSelectionListener;\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
+\r
+/**\r
+ * General properties of a pie chart\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class PieGeneralPropertiesTab extends LabelPropertyTabContributor {\r
+\r
+ private ScrolledComposite sc;\r
+ private Composite composite;\r
+ private Button htitle, hlegend;\r
+ private TrackedText name, title;\r
+ private Combo type;\r
+\r
+ @Override\r
+ public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) { \r
+ // Scrolled composite containing all of the properties in this tab\r
+ sc = new ScrolledComposite(body, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().applyTo(sc);\r
+ sc.setExpandHorizontal(true);\r
+ sc.setExpandVertical(true);\r
+\r
+ composite = new Composite(sc, SWT.NONE);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ // General properties\r
+ Group general = new Group(composite, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(general);\r
+ general.setText("General");\r
+\r
+ // Name\r
+ Label label = new Label(general, SWT.NONE);\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ label.setText("Name:");\r
+\r
+ Composite c = new Composite(general, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(c);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(c);\r
+\r
+ name = new org.simantics.browsing.ui.swt.widgets.TrackedText(c, support, SWT.BORDER);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+ name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
+ name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
+ name.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
+\r
+ // Type\r
+ label = new Label(c, SWT.NONE);\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ label.setText("Type:");\r
+\r
+ type = new Combo(c, SWT.BORDER | SWT.READ_ONLY);\r
+ type.setItems(new String[] {"Normal", "Stacked"});\r
+ type.select(0);\r
+\r
+ // Title (Which is different than name)\r
+ label = new Label(general, SWT.NONE);\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ label.setText("Title:");\r
+\r
+ title = new org.simantics.browsing.ui.swt.widgets.TrackedText(general, support, SWT.BORDER);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(title.getWidget());\r
+ title.setTextFactory(new TitleFactory());\r
+ title.addModifyListener(new TitleModifier());\r
+ title.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
+\r
+ // Group for hide options\r
+ Group hideGroup = new Group(composite, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(hideGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
+ hideGroup.setText("Hide");\r
+\r
+ htitle = new Button(hideGroup, support, SWT.CHECK);\r
+ htitle.setText("Title");\r
+ htitle.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible, true));\r
+ htitle.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible));\r
+ hlegend = new Button(hideGroup, support, SWT.CHECK);\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
+ sc.setContent(composite);\r
+ Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\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.pie;\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.widgets.Composite;\r
+import org.eclipse.swt.widgets.Label;\r
+import org.simantics.browsing.ui.swt.widgets.Button;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;\r
+import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\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.BooleanPropertyFactory;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.BooleanSelectionListener;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.ColorPicker;\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
+\r
+/**\r
+ * Composite containing the properties of a series\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class PieSeriesPropertyComposite extends Composite {\r
+ \r
+ private TrackedText variable, label;\r
+ \r
+ public PieSeriesPropertyComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
+ super(parent, style);\r
+ \r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);\r
+\r
+ // Variable for the series\r
+ Label label = new Label(this, SWT.NONE);\r
+ label.setText("Variable:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+\r
+ variable = new TrackedText(this, support, SWT.BORDER);\r
+ variable.setTextFactory(new RVIFactory());\r
+ variable.addModifyListener(new RVIModifier(variable.getWidget(), support));\r
+ variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager()));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget());\r
+\r
+ // Label to be displayed in chart for this series\r
+ label = new Label(this, SWT.NONE);\r
+ label.setText("Label:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+\r
+ this.label = new TrackedText(this, support, SWT.BORDER);\r
+ this.label.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel, ""));\r
+ this.label.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
+ this.label.setColorProvider(new JFreeChartPropertyColorProvider(this.label.getResourceManager()));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(this.label.getWidget());\r
+\r
+ // Color\r
+ label = new Label(this, SWT.NONE);\r
+ label.setText("Color:");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+\r
+ Composite colorPicker = new ColorPicker(this, context, support, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(colorPicker);\r
+\r
+ // Exploded\r
+ label = new Label(this, SWT.NONE);\r
+ label.setText("");\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+ \r
+ Button exploded = new Button(this, support, SWT.CHECK);\r
+ exploded.setText("Exploded");\r
+ exploded.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Series_exploded));\r
+ exploded.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.Series_exploded));\r
+ GridDataFactory.fillDefaults().applyTo(exploded.getWidget());\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.pie;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.viewers.ISelectionProvider;\r
+import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.custom.ScrolledComposite;\r
+import org.eclipse.swt.events.SelectionAdapter;\r
+import org.eclipse.swt.events.SelectionEvent;\r
+import org.eclipse.swt.graphics.Point;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Control;\r
+import org.eclipse.swt.widgets.Tree;\r
+import org.eclipse.ui.IWorkbenchSite;\r
+import org.simantics.browsing.ui.swt.SingleSelectionInputSource;\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.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.utils.ListUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.util.RemoverUtil;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.properties.LabelPropertyTabContributor;\r
+import org.simantics.sysdyn.ui.trend.chart.ChartUtils;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.xyline.AxisAndVariablesExplorerComposite;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+import org.simantics.utils.datastructures.ArrayMap;\r
+\r
+/**\r
+ * Tab for modifying series in a pie chart configuration\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class PieSeriesTab extends LabelPropertyTabContributor {\r
+\r
+ private GraphExplorerComposite explorer;\r
+ private ScrolledComposite propertyContainer;\r
+ private WidgetSupportImpl additionalSupport;\r
+ private Button add, remove;\r
+\r
+ public PieSeriesTab() {\r
+ additionalSupport = new WidgetSupportImpl();\r
+ }\r
+\r
+ @Override\r
+ public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) {\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
+ // (Ontology-based) GraphExplorer displaying variables of a pie chart\r
+ explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
+ "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
+ explorer.setBrowseContexts(SysdynResource.URIs.PieSeriesBrowseContext);\r
+ explorer.setInputSource(new SingleSelectionInputSource(\r
+ Resource.class));\r
+ explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
+ explorer.finish();\r
+\r
+ ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
+ public void widgetSelected(SelectionEvent e) {\r
+ updateSelection(context);\r
+ }\r
+ });\r
+ GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
+ GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+ propertyContainer.setExpandHorizontal(true);\r
+ propertyContainer.setExpandVertical(true);\r
+\r
+\r
+ // Buttons for adding and removing variables from a pie plot\r
+ Composite buttonComposite = new Composite(composite, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+\r
+ add = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ add.setText("Add");\r
+ add.addSelectionListener(new NewVariableListener(context));\r
+\r
+ remove = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ remove.setText("Remove");\r
+ remove.addSelectionListener(new RemoveListener(context));\r
+ }\r
+\r
+ /**\r
+ * Updates the content of propertyContainer \r
+ * @param context\r
+ */\r
+ private void updateSelection(ISessionContext context) {\r
+ ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class);\r
+ IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();\r
+ final Resource resource = AdaptionUtils.adaptToSingle(selection, Resource.class);\r
+ if(resource == null)\r
+ return;\r
+\r
+ for(Control child : propertyContainer.getChildren()) {\r
+ child.dispose();\r
+ }\r
+\r
+ PieSeriesPropertyComposite spc = new PieSeriesPropertyComposite(propertyContainer, context, additionalSupport, SWT.NONE);\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
+ */\r
+ private class NewVariableListener extends SelectionListenerImpl<Resource> {\r
+\r
+ public NewVariableListener(ISessionContext context) {\r
+ super(context);\r
+ }\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
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * SelectionListener for remove button\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+ private class RemoveListener extends SelectionListenerImpl<Resource> {\r
+\r
+ public RemoveListener(ISessionContext context) {\r
+ super(context);\r
+ }\r
+\r
+ /**\r
+ * Removes selected resource from explorer\r
+ */\r
+ @Override\r
+ public void apply(WriteGraph graph, Resource input) throws DatabaseException {\r
+ if(input == null)\r
+ return; \r
+\r
+ JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ Resource list = null;\r
+ if(graph.isInstanceOf(input, jfree.Series)) {\r
+ // Remove series from dataset and seriesList\r
+ Resource dataset = graph.getPossibleObject(input, l0.PartOf);\r
+ if(dataset != null)\r
+ list = graph.getPossibleObject(dataset, jfree.Dataset_seriesList);\r
+\r
+ if(list != null)\r
+ ListUtils.removeElement(graph, list, input);\r
+ RemoverUtil.remove(graph, input);\r
+ }\r
+ }\r
+ }\r
+\r
+\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
+package org.simantics.sysdyn.ui.trend.chart.properties.xyline;\r
\r
import java.util.ArrayList;\r
import java.util.Map;\r
* Contributors:\r
* VTT Technical Research Centre of Finland - initial API and implementation\r
*******************************************************************************/\r
-package org.simantics.sysdyn.ui.trend.chart.properties;\r
+package org.simantics.sysdyn.ui.trend.chart.properties.xyline;\r
\r
import org.eclipse.jface.dialogs.IInputValidator;\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.simantics.modeling.ui.chart.property.DoublePropertyFactory;\r
import org.simantics.modeling.ui.chart.property.DoublePropertyModifier;\r
import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.AxisHidePropertyComposite;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.ColorPicker;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.JFreeChartPropertyColorProvider;\r
\r
/**\r
- * Composite for displaying axis properties in {@link ChartAxisAndVariablesTab}\r
+ * Composite for displaying axis properties in {@link XYLineAxisAndVariablesTab}\r
* \r
* @author Teemu Lempinen\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
+package org.simantics.sysdyn.ui.trend.chart.properties.xyline;\r
\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\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.ColorPicker;\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.TrackedSpinner;\r
import org.simantics.ui.utils.AdaptionUtils;\r
\r
/**\r
- * Composite for displaying series properties in {@link ChartAxisAndVariablesTab}\r
+ * Composite for displaying series properties in {@link XYLineAxisAndVariablesTab}\r
* \r
* @author Teemu Lempinen\r
*\r
variable.setColorProvider(new JFreeChartPropertyColorProvider(this.variable.getResourceManager()));\r
GridDataFactory.fillDefaults().grab(true, false).applyTo(this.variable.getWidget());\r
\r
- // Label to be displayed in chart for this series (usually same as the variable \r
+ // Label to be displayed in chart for this series \r
label = new Label(this, SWT.NONE);\r
label.setText("Label:");\r
GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
* Contributors:\r
* VTT Technical Research Centre of Finland - initial API and implementation\r
*******************************************************************************/\r
-package org.simantics.sysdyn.ui.trend.chart.properties;\r
+package org.simantics.sysdyn.ui.trend.chart.properties.xyline;\r
\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class ChartAxisAndVariablesTab extends LabelPropertyTabContributor {\r
+public class XYLineAxisAndVariablesTab extends LabelPropertyTabContributor {\r
\r
private GraphExplorerComposite explorer;\r
private ScrolledComposite propertyContainer;\r
private Button addAxis, addVariable, remove;\r
private WidgetSupportImpl additionalSupport;\r
\r
- public ChartAxisAndVariablesTab() {\r
+ public XYLineAxisAndVariablesTab() {\r
additionalSupport = new WidgetSupportImpl();\r
}\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
+package org.simantics.sysdyn.ui.trend.chart.properties.xyline;\r
\r
import org.eclipse.jface.dialogs.IInputValidator;\r
import org.eclipse.jface.layout.GridDataFactory;\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.TextModifyListenerImpl;\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.request.PossibleObjectWithType;\r
import org.simantics.db.common.request.ReadRequest;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.layer0.Layer0;\r
-import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.modeling.ui.chart.property.DoublePropertyFactory;\r
import org.simantics.modeling.ui.chart.property.DoublePropertyModifier;\r
import org.simantics.sysdyn.JFreeChartResource;\r
import org.simantics.sysdyn.ui.properties.LabelPropertyTabContributor;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.AxisHidePropertyComposite;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.BooleanPropertyFactory;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.BooleanSelectionListener;\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.TitleFactory;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.TitleModifier;\r
import org.simantics.ui.utils.AdaptionUtils;\r
\r
/**\r
* @author Teemu Lempinen\r
*\r
*/\r
-public class GeneralChartPropertiesTab extends LabelPropertyTabContributor implements Widget {\r
+public class XYLineGeneralPropertiesTab extends LabelPropertyTabContributor implements Widget {\r
\r
private ScrolledComposite sc;\r
private Composite composite;\r
- private org.simantics.browsing.ui.swt.widgets.TrackedText name, title;\r
- private TrackedText xlabel, xvariable, xmin, xmax;\r
+ private TrackedText name, title, xlabel, xvariable, xmin, xmax;\r
private Combo type;\r
private Button hgrid, htitle, hlegend;\r
private WidgetSupportImpl domainAxisSupport = new WidgetSupportImpl();\r
});\r
}\r
\r
- /**\r
- * TextFactory for chart title\r
- * @author Teemu Lempinen\r
- *\r
- */\r
- private class TitleFactory extends ReadFactoryImpl<Resource, String> {\r
- @Override\r
- public String perform(ReadGraph graph, Resource chart) throws DatabaseException {\r
- Layer0 l0 = Layer0.getInstance(graph);\r
- JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
- Resource title = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.TextTitle));\r
- if(title == null)\r
- return "";\r
- else {\r
- String label = graph.getPossibleRelatedValue(title, l0.HasLabel, Bindings.STRING);\r
- return label == null ? "" : label;\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * TitleModifier for chart title\r
- * @author Teemu Lempinen\r
- *\r
- */\r
- private class TitleModifier extends TextModifyListenerImpl<Resource> {\r
-\r
- @Override\r
- public void applyText(WriteGraph graph, Resource chart, String text) throws DatabaseException {\r
- Layer0 l0 = Layer0.getInstance(graph);\r
- JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
- Resource title = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.TextTitle));\r
- if(title == null) {\r
- title = GraphUtils.create2(graph, jfree.TextTitle,\r
- jfree.Title_position, jfree.Top);\r
- }\r
- graph.claimLiteral(title, l0.HasLabel, text);\r
- }\r
-\r
- }\r
\r
/**\r
* Validator for validating that an input is double\r
// Empty selection or pinned trend -> Do nothing\r
if(selection.isEmpty() || Boolean.TRUE.equals(PinTrend.getState()))\r
return;\r
- \r
+\r
if(selection instanceof IStructuredSelection) {\r
// Remove all previously added result listeners from model\r
if(!resultListeners.isEmpty()) {\r
* @throws DatabaseException\r
*/\r
private void updateDatasets(ReadGraph graph, Collection<Variable> variables) throws DatabaseException {\r
- \r
+\r
ArrayList<SysdynDataSet> datasets = new ArrayList<SysdynDataSet>();\r
for(Variable variable : variables) {\r
// Get all active datasets for the variable and add them to the result\r
if(activeDataSets != null && !activeDataSets.isEmpty())\r
datasets.addAll(activeDataSets);\r
}\r
- \r
+\r
selectionChanged(datasets);\r
}\r
\r
} catch (DatabaseException e) {\r
return dataSets;\r
}\r
- \r
+\r
// Remove the first '.'\r
if(rvi.length() > 1)\r
rvi = rvi.substring(1);\r
Collection<SysdynResult> activeResults = model.getAndUpdateActiveResults(g);\r
for(SysdynResult sysdynResult : activeResults) {\r
for(String currvi : rvis.keySet()) {\r
- SysdynDataSet sds = sysdynResult.getDataSet(currvi.substring(1).replace("/", "."));\r
- if(sds != null) {\r
- try {\r
- sds.name = rvis.get(currvi).substring(1).replace("/", ".");\r
- } catch (NullPointerException e) {\r
- e.printStackTrace();\r
+ if(currvi != null && currvi.length() > 0) {\r
+ SysdynDataSet sds = sysdynResult.getDataSet(currvi.substring(1).replace("/", "."));\r
+ if(sds != null) {\r
+ try {\r
+ sds.name = rvis.get(currvi).substring(1).replace("/", ".");\r
+ } catch (NullPointerException e) {\r
+ e.printStackTrace();\r
+ }\r
+ dataSets.add(sds);\r
}\r
- dataSets.add(sds);\r
}\r
}\r
}\r
* @return\r
*/\r
protected VariableValueSubscription registerSubscription(ExternalRead<?> request, Listener<Variable> procedure, String property) {\r
- if(SysdynVariableProperties.TIME.equals(property) && experiment instanceof SysdynPlaybackExperiment) {\r
+ if(SysdynVariableProperties.TIME.equals(property)) {\r
// Current time is requested from experiment\r
VariableValueSubscription subscription = new VariableValueSubscription(request, this, property, procedure);\r
experiment.addVariableValueSubscription(subscription);\r
return new ConstantPropertyVariable(this, name, exp.getTime(), Datatypes.DOUBLE);\r
} else {\r
// Experiment is not compatible, return time = 0\r
- return new ConstantPropertyVariable(this, name, 0, Datatypes.DOUBLE);\r
+ return null;\r
}\r
} else if(SysdynVariableProperties.VALUES.equals(name)) {\r
// Get the values of this variable from the currently active experiment\r