]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.charts/src/org/simantics/charts/ui/SCLChart.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.charts / src / org / simantics / charts / ui / SCLChart.java
index 5f61740e279b60e61797148eb90e033644e19b22..e6748e881a5b8bad3e14a659d5a371d166bc6bc7 100644 (file)
@@ -1,99 +1,99 @@
-/*******************************************************************************\r
- * Copyright (c) 2013 Association for Decentralized Information Management\r
- * in 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
- *     Semantum Oy - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.charts.ui;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.simantics.charts.query.AddChartItem;\r
-import org.simantics.charts.query.ChartItemDescriptor;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.db.layer0.variable.Variables;\r
-import org.simantics.modeling.subscription.SCLSubscription;\r
-\r
-/**\r
- * @author Jani Simomaa <jani.simomaa@semantum.fi>\r
- */\r
-public class SCLChart {\r
-\r
-       /**\r
-     * Creates new chart under given model\r
-     * \r
-     * @param targetModel resource of the target model\r
-     * @return resource of the chart\r
-     * @throws DatabaseException on database failures\r
-     */\r
-       public static Resource createNewChart (Resource targetModel) throws DatabaseException {\r
-\r
-               Resource chart = NewChart.createChart(targetModel);\r
-               return chart;\r
-       }\r
-\r
-       /**\r
-     * Creates new chart group under given model\r
-     * \r
-     * @param targetModel resource of the target model\r
-     * @return resource of the chartGroup\r
-     * @throws DatabaseException on database failures\r
-     */\r
-       public static Resource createNewChartGroup (Resource targetModel) throws DatabaseException {\r
-\r
-               Resource chartGroup = NewChartGroup.createChartGroup(targetModel);\r
-               return chartGroup;\r
-       }\r
-\r
-       /**\r
-     * Adds chart items to the given chart\r
-     * \r
-     * @param chart resource of the target chart\r
-     * @param variable variable of the item to be created\r
-     * @return resource of the created chart item\r
-     * @throws DatabaseException on database failures\r
-     */\r
-       public static Resource addChartItems (WriteGraph graph, Resource chart, Variable variable) throws DatabaseException {\r
-               \r
-               Resource model = Variables.getModel(graph, variable);\r
-               Resource defaultSubscriptionResource = SCLSubscription.defaultSubscriptionFolder(graph, model);\r
-               Resource subscriptionItem = SCLSubscription.addSubscriptionItems(graph, defaultSubscriptionResource, variable);\r
-               \r
-               List<ChartItemDescriptor> refs = new ArrayList<ChartItemDescriptor>(1);\r
-               refs.add( AddChartItem.createDescriptor(graph, subscriptionItem) );\r
-\r
-               AddChartItem ci = new AddChartItem(     chart, refs     );\r
-               ci.perform(graph);\r
-               \r
-               return ci.chartItem;\r
-       }\r
-\r
-       /**\r
-     * links given subscription to the given chart\r
-     * \r
-     * @param subscriptionItem resource of the subscription\r
-     * @param chart resource of the chart\r
-     * @return resource of the created chart item\r
-     * @throws DatabaseException on database failures\r
-     */\r
-       public static Resource linkSubToChart (WriteGraph graph, Resource subscriptionItem, Resource chart) throws DatabaseException {\r
-\r
-               List<ChartItemDescriptor> refs = new ArrayList<ChartItemDescriptor>(1);\r
-               refs.add( AddChartItem.createDescriptor(graph, subscriptionItem) );\r
-\r
-               AddChartItem ci = new AddChartItem(     chart, refs );          \r
-               ci.perform(graph);\r
-\r
-               return ci.chartItem;\r
-       }\r
-\r
+/*******************************************************************************
+ * Copyright (c) 2013 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Semantum Oy - initial API and implementation
+ *******************************************************************************/
+package org.simantics.charts.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.simantics.charts.query.AddChartItem;
+import org.simantics.charts.query.ChartItemDescriptor;
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.db.layer0.variable.Variables;
+import org.simantics.modeling.subscription.SCLSubscription;
+
+/**
+ * @author Jani Simomaa <jani.simomaa@semantum.fi>
+ */
+public class SCLChart {
+
+       /**
+     * Creates new chart under given model
+     * 
+     * @param targetModel resource of the target model
+     * @return resource of the chart
+     * @throws DatabaseException on database failures
+     */
+       public static Resource createNewChart (Resource targetModel) throws DatabaseException {
+
+               Resource chart = NewChart.createChart(targetModel);
+               return chart;
+       }
+
+       /**
+     * Creates new chart group under given model
+     * 
+     * @param targetModel resource of the target model
+     * @return resource of the chartGroup
+     * @throws DatabaseException on database failures
+     */
+       public static Resource createNewChartGroup (Resource targetModel) throws DatabaseException {
+
+               Resource chartGroup = NewChartGroup.createChartGroup(targetModel);
+               return chartGroup;
+       }
+
+       /**
+     * Adds chart items to the given chart
+     * 
+     * @param chart resource of the target chart
+     * @param variable variable of the item to be created
+     * @return resource of the created chart item
+     * @throws DatabaseException on database failures
+     */
+       public static Resource addChartItems (WriteGraph graph, Resource chart, Variable variable) throws DatabaseException {
+               
+               Resource model = Variables.getModel(graph, variable);
+               Resource defaultSubscriptionResource = SCLSubscription.defaultSubscriptionFolder(graph, model);
+               Resource subscriptionItem = SCLSubscription.addSubscriptionItems(graph, defaultSubscriptionResource, variable);
+               
+               List<ChartItemDescriptor> refs = new ArrayList<ChartItemDescriptor>(1);
+               refs.add( AddChartItem.createDescriptor(graph, subscriptionItem) );
+
+               AddChartItem ci = new AddChartItem(     chart, refs     );
+               ci.perform(graph);
+               
+               return ci.chartItem;
+       }
+
+       /**
+     * links given subscription to the given chart
+     * 
+     * @param subscriptionItem resource of the subscription
+     * @param chart resource of the chart
+     * @return resource of the created chart item
+     * @throws DatabaseException on database failures
+     */
+       public static Resource linkSubToChart (WriteGraph graph, Resource subscriptionItem, Resource chart) throws DatabaseException {
+
+               List<ChartItemDescriptor> refs = new ArrayList<ChartItemDescriptor>(1);
+               refs.add( AddChartItem.createDescriptor(graph, subscriptionItem) );
+
+               AddChartItem ci = new AddChartItem(     chart, refs );          
+               ci.perform(graph);
+
+               return ci.chartItem;
+       }
+
 }
\ No newline at end of file