X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.charts%2Fscl%2FSimantics%2FChart.scl;fp=bundles%2Forg.simantics.charts%2Fscl%2FSimantics%2FChart.scl;h=efbe3143f27103a0b810e7044ac04e0d2d763855;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=9f1c02c9861ef4c2b4900b89015cd409f359853a;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.charts/scl/Simantics/Chart.scl b/bundles/org.simantics.charts/scl/Simantics/Chart.scl index 9f1c02c98..efbe3143f 100644 --- a/bundles/org.simantics.charts/scl/Simantics/Chart.scl +++ b/bundles/org.simantics.charts/scl/Simantics/Chart.scl @@ -1,56 +1,56 @@ -import "Simantics/DB" -import "Simantics/Variables" -import "Simantics/Model" -import "Simantics/Entity" -import "Simantics/Subscription" - -import "http://www.simantics.org/Charts-1.2" as CHART - -type Chart = Resource -type ChartGroup = Resource -type ChartItem = Resource - -importJava "org.simantics.charts.ui.SCLChart" where - @JavaName createNewChart - """ - Creates a new Chart to the default Charts folder under the given Model parameter. Returns the created Chart. - """ - createChart :: Model -> Chart - - @JavaName createNewChart - """ - Creates a new Chart under the given ChartGroup parameter. Returns the created Chart. - """ - createChartInGroup :: ChartGroup -> Chart - - @JavaName createNewChartGroup - """ - Creates a new ChartGroup under the given Model parameter. Returns the created ChartGroup. - """ - createChartGroup :: Model -> ChartGroup - - @JavaName addChartItems - """ - Creates new chartItem with the given Variable to the given Chart and returns the created ChartItem. New Subscription item is created at the same time. - """ - addChartItems :: Chart -> Variable -> ChartItem - - @JavaName linkSubToChart - """ - Links the given Subscription to the given chart and returns the created ChartItem. - """ - linkSubToChart :: Subscription -> Chart -> ChartItem - -""" -Browses the given Model for its Charts and then returns them in a list. -""" -chartsOf :: Model -> [Chart] -chartsOf model = recurse (toResource model) - where - recurse r = do - cs = resourceChildrenOf r - charts = map fromResource $ filter isChart cs - chartGrp = filter isChartGroup cs - charts + concatMap recurse chartGrp - isChart r = isInstanceOf r CHART.TimeSeriesChart - isChartGroup r = isInstanceOf r CHART.ChartGroup +import "Simantics/DB" +import "Simantics/Variables" +import "Simantics/Model" +import "Simantics/Entity" +import "Simantics/Subscription" + +import "http://www.simantics.org/Charts-1.2" as CHART + +type Chart = Resource +type ChartGroup = Resource +type ChartItem = Resource + +importJava "org.simantics.charts.ui.SCLChart" where + @JavaName createNewChart + """ + Creates a new Chart to the default Charts folder under the given Model parameter. Returns the created Chart. + """ + createChart :: Model -> Chart + + @JavaName createNewChart + """ + Creates a new Chart under the given ChartGroup parameter. Returns the created Chart. + """ + createChartInGroup :: ChartGroup -> Chart + + @JavaName createNewChartGroup + """ + Creates a new ChartGroup under the given Model parameter. Returns the created ChartGroup. + """ + createChartGroup :: Model -> ChartGroup + + @JavaName addChartItems + """ + Creates new chartItem with the given Variable to the given Chart and returns the created ChartItem. New Subscription item is created at the same time. + """ + addChartItems :: Chart -> Variable -> ChartItem + + @JavaName linkSubToChart + """ + Links the given Subscription to the given chart and returns the created ChartItem. + """ + linkSubToChart :: Subscription -> Chart -> ChartItem + +""" +Browses the given Model for its Charts and then returns them in a list. +""" +chartsOf :: Model -> [Chart] +chartsOf model = recurse (toResource model) + where + recurse r = do + cs = resourceChildrenOf r + charts = map fromResource $ filter isChart cs + chartGrp = filter isChartGroup cs + charts + concatMap recurse chartGrp + isChart r = isInstanceOf r CHART.TimeSeriesChart + isChartGroup r = isInstanceOf r CHART.ChartGroup