]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Save sensitivity analysis results (refs #4243).
authormiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 30 Aug 2013 05:41:24 +0000 (05:41 +0000)
committermiettinen <miettinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 30 Aug 2013 05:41:24 +0000 (05:41 +0000)
A few little fixes.

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27794 ac1ea38d-2e2b-0410-8846-a27921b304fc

23 files changed:
org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/Sysdyn.pgraph
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ui/icons/chart_bar_3.png [new file with mode: 0644]
org.simantics.sysdyn.ui/icons/chart_bar_3_blackAndWhite.png [new file with mode: 0644]
org.simantics.sysdyn.ui/icons/time_rainbow.png [new file with mode: 0644]
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/ActivateResultSetDatasetAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/AbstractNodeImager.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResult.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultDecorator.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSet.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSetDecorator.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSetImager.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSetLabeler.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ExperimentNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultSetNode.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultSetActivation.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/project/SysdynProject.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/ActiveResults.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SaveResultJob.java
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SaveResultSetJob.java [new file with mode: 0644]
org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SysdynSensitivityAnalysisExperiment.java

index c032924cb0bfc845c9fa07d76e3d7eee04a7008a..93d42bb80feeec5277b605d961ed3b647e4a9b11 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index 6b4860abb9b2fa1271493604b631ad9daa6b6049..12cf962163615668183cb953848fb6164db70f21 100644 (file)
@@ -327,7 +327,8 @@ SYSDYN.SysdynModelicaFunction.Output <T SYSDYN.SysdynModelicaFunction.InterfaceV
 
 SYSDYN.Experiment <T SIMU.Experiment
     >-- SYSDYN.Experiment.result --> SYSDYN.Result <R L0.IsComposedOf
-
+    >-- SYSDYN.Experiment.resultSet --> SYSDYN.ResultSet <R L0.IsComposedOf
+    
 SYSDYN.BasicExperiment <T SYSDYN.Experiment
 
 SYSDYN.GameExperiment <T SYSDYN.Experiment
@@ -401,7 +402,6 @@ SYSDYN.Result <T L0.Entity
         @L0.symmetric
     >-- SYSDYN.Result.time --> L0.Long <R L0.HasProperty : L0.FunctionalRelation
         
-        
 SYSDYN.HistoryDataset <T SYSDYN.Result
     @L0.singleProperty L0.HasName
     @L0.singleProperty L0.HasLabel
@@ -411,6 +411,8 @@ SYSDYN.HistoryDataset <T SYSDYN.Result
     >-- SYSDYN.HistoryDataset.columns --> L0.Boolean <R L0.HasProperty  // Is the data in columns. If false, data is in rows
     >-- SYSDYN.HistoryDataset.sheet --> SHEET.Spreadsheet <R L0.IsRelatedTo : L0.FunctionalRelation
     
+SYSDYN.ResultSet <T L0.Entity
+    >-- SYSDYN.Experiment.result --> SYSDYN.Result <R L0.IsComposedOf
 
 //#####################################################################
 //#####################################################################
index dd5bebb89d9046cf578945dcdfd4188c9410a792..62b9513dc0927dc5b14b102283294297ee50b000 100644 (file)
@@ -368,6 +368,8 @@ public class SysdynResource {
     public final Resource Experiment_Run_time;\r
     public final Resource Experiment_Run_time_Inverse;\r
     public final Resource Experiment_result;\r
+    public final Resource Experiment_resultSet;\r
+    public final Resource Experiment_resultSet_Inverse;\r
     public final Resource Experiment_result_Inverse;\r
     public final Resource ExportModuleTree;\r
     public final Resource Expression;\r
@@ -542,6 +544,7 @@ public class SysdynResource {
     public final Resource Redeclaration_replacingEnumeration;\r
     public final Resource Redeclaration_replacingEnumeration_Inverse;\r
     public final Resource Result;\r
+    public final Resource ResultSet;\r
     public final Resource Result_parameterFile;\r
     public final Resource Result_parameterFile_Inverse;\r
     public final Resource Result_resultFile;\r
@@ -1102,6 +1105,8 @@ public class SysdynResource {
         public static final String Experiment_Run_time = "http://www.simantics.org/Sysdyn-1.1/Experiment/Run/time";\r
         public static final String Experiment_Run_time_Inverse = "http://www.simantics.org/Sysdyn-1.1/Experiment/Run/time/Inverse";\r
         public static final String Experiment_result = "http://www.simantics.org/Sysdyn-1.1/Experiment/result";\r
+        public static final String Experiment_resultSet = "http://www.simantics.org/Sysdyn-1.1/Experiment/resultSet";\r
+        public static final String Experiment_resultSet_Inverse = "http://www.simantics.org/Sysdyn-1.1/Experiment/resultSet/Inverse";\r
         public static final String Experiment_result_Inverse = "http://www.simantics.org/Sysdyn-1.1/Experiment/result/Inverse";\r
         public static final String ExportModuleTree = "http://www.simantics.org/Sysdyn-1.1/ExportModuleTree";\r
         public static final String Expression = "http://www.simantics.org/Sysdyn-1.1/Expression";\r
@@ -1276,6 +1281,7 @@ public class SysdynResource {
         public static final String Redeclaration_replacingEnumeration = "http://www.simantics.org/Sysdyn-1.1/Redeclaration/replacingEnumeration";\r
         public static final String Redeclaration_replacingEnumeration_Inverse = "http://www.simantics.org/Sysdyn-1.1/Redeclaration/replacingEnumeration/Inverse";\r
         public static final String Result = "http://www.simantics.org/Sysdyn-1.1/Result";\r
+        public static final String ResultSet = "http://www.simantics.org/Sysdyn-1.1/ResultSet";\r
         public static final String Result_parameterFile = "http://www.simantics.org/Sysdyn-1.1/Result/parameterFile";\r
         public static final String Result_parameterFile_Inverse = "http://www.simantics.org/Sysdyn-1.1/Result/parameterFile/Inverse";\r
         public static final String Result_resultFile = "http://www.simantics.org/Sysdyn-1.1/Result/resultFile";\r
@@ -1846,6 +1852,8 @@ public class SysdynResource {
         Experiment_Run_time = getResourceOrNull(graph, URIs.Experiment_Run_time);\r
         Experiment_Run_time_Inverse = getResourceOrNull(graph, URIs.Experiment_Run_time_Inverse);\r
         Experiment_result = getResourceOrNull(graph, URIs.Experiment_result);\r
+        Experiment_resultSet = getResourceOrNull(graph, URIs.Experiment_resultSet);\r
+        Experiment_resultSet_Inverse = getResourceOrNull(graph, URIs.Experiment_resultSet_Inverse);\r
         Experiment_result_Inverse = getResourceOrNull(graph, URIs.Experiment_result_Inverse);\r
         ExportModuleTree = getResourceOrNull(graph, URIs.ExportModuleTree);\r
         Expression = getResourceOrNull(graph, URIs.Expression);\r
@@ -2020,6 +2028,7 @@ public class SysdynResource {
         Redeclaration_replacingEnumeration = getResourceOrNull(graph, URIs.Redeclaration_replacingEnumeration);\r
         Redeclaration_replacingEnumeration_Inverse = getResourceOrNull(graph, URIs.Redeclaration_replacingEnumeration_Inverse);\r
         Result = getResourceOrNull(graph, URIs.Result);\r
+        ResultSet = getResourceOrNull(graph, URIs.ResultSet);\r
         Result_parameterFile = getResourceOrNull(graph, URIs.Result_parameterFile);\r
         Result_parameterFile_Inverse = getResourceOrNull(graph, URIs.Result_parameterFile_Inverse);\r
         Result_resultFile = getResourceOrNull(graph, URIs.Result_resultFile);\r
diff --git a/org.simantics.sysdyn.ui/icons/chart_bar_3.png b/org.simantics.sysdyn.ui/icons/chart_bar_3.png
new file mode 100644 (file)
index 0000000..15b7cae
Binary files /dev/null and b/org.simantics.sysdyn.ui/icons/chart_bar_3.png differ
diff --git a/org.simantics.sysdyn.ui/icons/chart_bar_3_blackAndWhite.png b/org.simantics.sysdyn.ui/icons/chart_bar_3_blackAndWhite.png
new file mode 100644 (file)
index 0000000..0e23ab3
Binary files /dev/null and b/org.simantics.sysdyn.ui/icons/chart_bar_3_blackAndWhite.png differ
diff --git a/org.simantics.sysdyn.ui/icons/time_rainbow.png b/org.simantics.sysdyn.ui/icons/time_rainbow.png
new file mode 100644 (file)
index 0000000..579887f
Binary files /dev/null and b/org.simantics.sysdyn.ui/icons/time_rainbow.png differ
index 31fc8981ca488f89dc4fb3c046d15bb52aa2f7be..5e5a19a94c7b0200066ae671974aa0652575c2a8 100644 (file)
             </command>\r
             <command\r
                   commandId="org.simantics.sysdyn.ui.newSensitivityAnalysisExperiment"\r
-                  icon="platform:/plugin/com.famfamfam.silk/icons/rainbow.png"\r
+                  icon="icons/time_rainbow.png"\r
                   id="org.simantics.sysdyn.ui.browser.newSensitivityAnalysisExperiment"\r
                   label="Sensitivity Analysis Experiment"\r
                   style="push">\r
                </with>\r
             </visibleWhen>\r
          </command>\r
+         <command\r
+               commandId="org.simantics.sysdyn.ui.activateResultSet"\r
+               id="org.simantics.sysdyn.ui.browser.activateResultSet"\r
+               label="Show in charts"\r
+               style="push">\r
+            <visibleWhen\r
+                  checkEnabled="true">\r
+               <with\r
+                     variable="selection">\r
+                  <test\r
+                        args="org.simantics.sysdyn.ui.browser.nodes.SimulationResultSetNode"\r
+                        property="org.simantics.sysdyn.ui.nodeClass">\r
+                  </test>\r
+               </with>\r
+            </visibleWhen>\r
+         </command>\r
          <command\r
                commandId="org.simantics.sysdyn.ui.renameNode"\r
                icon="platform:/plugin/com.famfamfam.silk/icons/textfield_rename.png"\r
             id="org.simantics.sysdyn.ui.activateResult"\r
             name="Show in charts">\r
       </command>\r
+      <command\r
+            defaultHandler="org.simantics.sysdyn.ui.handlers.ToggleResultSetActivation"\r
+            id="org.simantics.sysdyn.ui.activateResultSet"\r
+            name="Show in charts">\r
+      </command>\r
       <command\r
             defaultHandler="org.simantics.sysdyn.ui.handlers.newComponents.NewExperimentNodeHandler"\r
             id="org.simantics.sysdyn.ui.newExperiment"\r
                         args="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode"\r
                         property="org.simantics.sysdyn.ui.nodeClass">\r
                   </test>\r
+                  <test\r
+                        args="org.simantics.sysdyn.ui.browser.nodes.SimulationResultSetNode"\r
+                        property="org.simantics.sysdyn.ui.nodeClass">\r
+                  </test>\r
                   <test\r
                         args="org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode"\r
                         property="org.simantics.sysdyn.ui.nodeClass">\r
                         args="org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode"\r
                         property="org.simantics.sysdyn.ui.nodeClass">\r
                   </test>\r
+                  <test\r
+                        args="org.simantics.sysdyn.ui.browser.nodes.SimulationResultSetNode"\r
+                        property="org.simantics.sysdyn.ui.nodeClass">\r
+                  </test>\r
                   <test\r
                         args="org.simantics.sysdyn.ui.browser.nodes.ModuleTypeNode"\r
                         property="org.simantics.sysdyn.ui.nodeClass">\r
                class="org.simantics.sysdyn.ui.browser.contributions.SimulationResult"\r
                preference="2.0">\r
          </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.SimulationResultSet"\r
+               preference="2.0">\r
+         </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.Configuration"\r
                preference="2.0">\r
                class="org.simantics.sysdyn.ui.browser.contributions.SimulationResultLabeler"\r
                preference="2.0">\r
          </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.SimulationResultSetLabeler"\r
+               preference="2.0">\r
+         </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.ModuleLabeler"\r
                preference="2.0">\r
                class="org.simantics.sysdyn.ui.browser.contributions.SimulationResultImager"\r
                preference="2.0">\r
          </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.SimulationResultSetImager"\r
+               preference="2.0">\r
+         </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.ChartImager"\r
                preference="2.0">\r
                class="org.simantics.sysdyn.ui.browser.contributions.SimulationResultDecorator"\r
                preference="2.0">\r
          </implementation>\r
+         <implementation\r
+               class="org.simantics.sysdyn.ui.browser.contributions.SimulationResultSetDecorator"\r
+               preference="2.0">\r
+         </implementation>\r
          <implementation\r
                class="org.simantics.sysdyn.ui.browser.contributions.ExperimentLabelDecorator"\r
                preference="2.0">\r
             name="Activate result in charts"\r
             priority="250.0">\r
       </doubleClickAction>  \r
+      <doubleClickAction\r
+            class="org.simantics.sysdyn.ui.browser.actions.ActivateResultSetDatasetAction"\r
+            name="Activate result in charts"\r
+            priority="240.0">\r
+      </doubleClickAction> \r
       <doubleClickAction\r
             class="org.simantics.sysdyn.ui.browser.actions.OpenSheetAction"\r
             name="Open Spreadsheet"\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/ActivateResultSetDatasetAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/actions/ActivateResultSetDatasetAction.java
new file mode 100644 (file)
index 0000000..3ad688e
--- /dev/null
@@ -0,0 +1,75 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.actions;\r
+\r
+import java.util.Collection;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.ui.DoubleClickEvent;\r
+import org.simantics.ui.IDoubleClickAction;\r
+import org.simantics.ui.utils.ResourceAdaptionUtils;\r
+\r
+/**\r
+ * Activates the result datasets of a result set to be shown in charts and other result visualizations\r
+ * \r
+ * @author Tuomas Miettinen\r
+ *\r
+ */\r
+public class ActivateResultSetDatasetAction implements IDoubleClickAction {\r
+\r
+    @Override\r
+    public void doubleClickEvent(DoubleClickEvent e) throws DatabaseException {\r
+        final Resource resultSet = ResourceAdaptionUtils.toSingleResource(e.getResource());\r
+        if (resultSet == null)\r
+            return;\r
+\r
+        ReadGraph graph = e.getGraph();\r
+\r
+        if(graph.isInstanceOf(resultSet, SysdynResource.getInstance(graph).ResultSet)) {\r
+\r
+            graph.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                @Override\r
+                public void perform(WriteGraph graph) throws DatabaseException {\r
+                    SysdynResource sr = SysdynResource.getInstance(graph);\r
+                    if(graph.isInstanceOf(resultSet, sr.ResultSet)) {\r
+                       // If there is at least one result which shown, clear them all.\r
+                       // If not one result is shown, show them all.\r
+                       boolean resultShown = false;\r
+                       Collection<Resource> results = graph.getObjects(resultSet, sr.Experiment_result); \r
+                       for (Resource result : results) {\r
+                               if (graph.hasStatement(result, sr.Result_showResult)) {\r
+                                       resultShown = true;\r
+                                       break;\r
+                               }\r
+                       }\r
+                       for (Resource result : results) {\r
+                               if (resultShown) { \r
+                                       graph.denyStatement(result, sr.Result_showResult, result);\r
+                            } else {\r
+                                graph.claim(result, sr.Result_showResult, result);\r
+                            }\r
+                       }\r
+                    }                \r
+                }\r
+            });\r
+            e.consume();\r
+        }\r
+\r
+    }\r
+\r
+}\r
index 98fa0ce09833f8fd781c6f390b7e0ed19f152a77..802a846af70412098d9681eb6dd8bc1acb9588e7 100644 (file)
@@ -82,7 +82,7 @@ public class AbstractNodeImager extends ImagerContributor<AbstractNode<Resource>
             else if(graph.isInstanceOf(node.data, sr.GameExperiment))\r
                 image = "icons/time_go.png";\r
             else if(graph.isInstanceOf(node.data, sr.SensitivityAnalysisExperiment))\r
-                image = "icons/rainbow.png";\r
+                image = "icons/time_rainbow.png";\r
             else\r
                 image = "icons/time.png";\r
         } else if (node instanceof InputNode)\r
index dfa9897aed3273af07f0ca931f08dff78ef5cb59..f7bd86f0ba8b4a309a52a472fd0c9160670e6777 100644 (file)
@@ -27,19 +27,22 @@ import org.simantics.layer0.Layer0;
 import org.simantics.sysdyn.SysdynResource;\r
 import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode;\r
 import org.simantics.sysdyn.ui.browser.nodes.HistoryDataNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.SimulationResultSetNode;\r
 \r
-public class SimulationResult  extends ViewpointContributor<ExperimentNode> {\r
+public class SimulationResult  extends ViewpointContributor<AbstractNode<Resource>> {\r
 \r
-    @SuppressWarnings("unchecked")\r
     @Override\r
-    public Collection<?> getContribution(ReadGraph graph, ExperimentNode experiment) throws DatabaseException {\r
+    public Collection<?> getContribution(ReadGraph graph, AbstractNode<Resource> node) throws DatabaseException {\r
         ArrayList<AbstractNode<Resource>> result = new ArrayList<AbstractNode<Resource>>();\r
         SysdynResource sr = SysdynResource.getInstance(graph);\r
-        for(final Resource r : graph.syncRequest(new ObjectsWithType(experiment.data, sr.Experiment_result, sr.Result))) {\r
+        if (!(node instanceof ExperimentNode || node instanceof SimulationResultSetNode))\r
+               return result;\r
+        for(final Resource r : graph.syncRequest(new ObjectsWithType(node.data, sr.Experiment_result, sr.Result))) {\r
             if(graph.isInstanceOf(r, sr.HistoryDataset)) {\r
-                result.add(graph.adapt(r, AbstractNode.class));\r
-            } else {\r
                 result.add(new HistoryDataNode(r));\r
+            } else {\r
+                result.add(new SimulationResultNode<Resource>(r));\r
 \r
                 String resultPath = (String)graph.getPossibleRelatedValue(r, sr.Result_resultFile);\r
                 File file = new File(resultPath);\r
index 442e91a02dbdbaaeb346c9b8bb8af9abc726a45a..3676eba1d33d8ea56bf65450bbebb357b6a44e72 100644 (file)
@@ -35,7 +35,14 @@ public class SimulationResultDecorator extends LabelDecoratorContributor<Simulat
                 }\r
             };\r
         }\r
-        return null;\r
+        return new LabelDecorator.Stub() {\r
+\r
+            @SuppressWarnings("unchecked")\r
+            @Override\r
+            public <F> F decorateFont(F font, String column, int itemIndex) {\r
+                return (F) ((FontDescriptor) font).withStyle(SWT.NORMAL);\r
+            }\r
+        };\r
     }\r
 \r
 }\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSet.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSet.java
new file mode 100644 (file)
index 0000000..dfbe881
--- /dev/null
@@ -0,0 +1,43 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
+\r
+import org.simantics.browsing.ui.graph.contributor.viewpoint.ViewpointContributor;\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.exception.DatabaseException;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode;\r
+import org.simantics.sysdyn.ui.browser.nodes.SimulationResultSetNode;\r
+\r
+public class SimulationResultSet extends ViewpointContributor<ExperimentNode> {\r
+\r
+    @Override\r
+    public Collection<?> getContribution(ReadGraph graph, ExperimentNode experiment) throws DatabaseException {\r
+        ArrayList<SimulationResultSetNode> results = new ArrayList<SimulationResultSetNode>();\r
+        SysdynResource sr = SysdynResource.getInstance(graph);\r
+        for(final Resource r : graph.syncRequest(new ObjectsWithType(experiment.data, sr.Experiment_resultSet, sr.ResultSet))) {\r
+            results.add(new SimulationResultSetNode(r));\r
+        }\r
+        return results;\r
+    }\r
+\r
+    @Override\r
+    public String getViewpointId() {\r
+        return "Standard";\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSetDecorator.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSetDecorator.java
new file mode 100644 (file)
index 0000000..2491ee5
--- /dev/null
@@ -0,0 +1,51 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import org.eclipse.jface.resource.FontDescriptor;\r
+import org.eclipse.swt.SWT;\r
+import org.simantics.browsing.ui.content.LabelDecorator;\r
+import org.simantics.browsing.ui.graph.contributor.labeler.LabelDecoratorContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.browser.nodes.SimulationResultSetNode;\r
+\r
+public class SimulationResultSetDecorator extends LabelDecoratorContributor<SimulationResultSetNode>{\r
+\r
+    @Override\r
+    public LabelDecorator getDecorator(ReadGraph graph, SimulationResultSetNode resultSet) throws DatabaseException {\r
+       SysdynResource sr = SysdynResource.getInstance(graph);\r
+       for (Resource result : graph.getObjects(resultSet.data, sr.Experiment_result)) {\r
+               if (graph.hasStatement(result, sr.Result_showResult)) {\r
+                return new LabelDecorator.Stub() {\r
+\r
+                    @SuppressWarnings("unchecked")\r
+                    @Override\r
+                    public <F> F decorateFont(F font, String column, int itemIndex) {\r
+                        return (F) ((FontDescriptor) font).withStyle(SWT.BOLD);\r
+                    }\r
+                };\r
+               }\r
+       }\r
+        return new LabelDecorator.Stub() {\r
+\r
+            @SuppressWarnings("unchecked")\r
+            @Override\r
+            public <F> F decorateFont(F font, String column, int itemIndex) {\r
+                return (F) ((FontDescriptor) font).withStyle(SWT.NORMAL);\r
+            }\r
+        };\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSetImager.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSetImager.java
new file mode 100644 (file)
index 0000000..88c7380
--- /dev/null
@@ -0,0 +1,36 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.simantics.browsing.ui.swt.ImagerContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.Activator;\r
+import org.simantics.sysdyn.ui.browser.nodes.SimulationResultSetNode;\r
+\r
+public class SimulationResultSetImager extends ImagerContributor<SimulationResultSetNode>{\r
+\r
+    @Override\r
+    public ImageDescriptor getDescriptor(ReadGraph graph, SimulationResultSetNode resultSet) throws DatabaseException {\r
+        SysdynResource sr = SysdynResource.getInstance(graph);\r
+       for (Resource result : graph.getObjects(resultSet.data, sr.Experiment_result)) {\r
+               if (graph.hasStatement(result, sr.Result_showResult)) {\r
+                return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_bar_3.png"));\r
+               }\r
+       }\r
+        return ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/chart_bar_3_blackAndWhite.png"));\r
+    }\r
+\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSetLabeler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/contributions/SimulationResultSetLabeler.java
new file mode 100644 (file)
index 0000000..16c4259
--- /dev/null
@@ -0,0 +1,28 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.contributions;\r
+\r
+import org.simantics.browsing.ui.graph.contributor.labeler.LabelerContributor;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.ui.browser.nodes.SimulationResultSetNode;\r
+\r
+public class SimulationResultSetLabeler extends LabelerContributor<SimulationResultSetNode>{\r
+\r
+    @Override\r
+    public String getLabel(ReadGraph graph, SimulationResultSetNode resultSet) throws DatabaseException {\r
+        String name = graph.getPossibleRelatedValue(resultSet.data, Layer0.getInstance(graph).HasLabel);\r
+        return name == null ? "Experiment (no name)" : name;\r
+    }\r
+\r
+}\r
index d272900f1d1c9e772beb3fa20c1eb800858a8a57..deeb8dd7082e0fbfedcdfc9bc91818477baf6cd7 100644 (file)
@@ -77,6 +77,10 @@ public class ExperimentNode extends AbstractNode<Resource> implements IDoubleCli
                     if(results != null)\r
                         for(Resource result : results) \r
                             SimulationResultNode.unlinkResult(graph, result);\r
+                    Collection<Resource> resultSets = graph.getObjects(data, SysdynResource.getInstance(graph).Experiment_resultSet);\r
+                    if(resultSets != null)\r
+                        for(Resource resultSet : resultSets) \r
+                            SimulationResultSetNode.unlinkResultSet(graph, resultSet);\r
                     RemoverUtil.remove(graph, data);\r
                 }\r
             });\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultSetNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultSetNode.java
new file mode 100644 (file)
index 0000000..194e1c9
--- /dev/null
@@ -0,0 +1,84 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.sysdyn.ui.browser.nodes;\r
+\r
+import org.simantics.browsing.ui.common.node.AbstractNode;\r
+import org.simantics.browsing.ui.common.node.DeleteException;\r
+import org.simantics.browsing.ui.common.node.IDeletableNode;\r
+import org.simantics.browsing.ui.common.node.IDoubleClickableNode;\r
+import org.simantics.browsing.ui.common.node.IModifiableNode;\r
+import org.simantics.browsing.ui.content.Labeler.Modifier;\r
+import org.simantics.browsing.ui.graph.impl.LabelModifier;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.ObjectsWithType;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.exception.CancelTransactionException;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.util.RemoverUtil;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.sysdyn.ui.handlers.ToggleResultSetActivation;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.utils.ui.ExceptionUtils;\r
+\r
+public class SimulationResultSetNode  extends AbstractNode<Resource> implements IDoubleClickableNode, IDeletableNode, IModifiableNode {\r
+\r
+    public SimulationResultSetNode(Resource resource) {\r
+        super(resource);\r
+    }\r
+    \r
+    \r
+    @Override\r
+    public Modifier getModifier(String columnId) {\r
+        LabelModifier modifier = new LabelModifier(SimanticsUI.getSession(), data) {\r
+            @Override\r
+            public String isValid(String label) {\r
+                if (label.isEmpty())\r
+                    return "Empty label not allowed";\r
+                return null;\r
+            }\r
+        };\r
+        return modifier;\r
+    }\r
+\r
+\r
+    @Override\r
+    public void delete() throws DeleteException {\r
+        try {\r
+            SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
+                @Override\r
+                public void perform(WriteGraph graph) throws DatabaseException, CancelTransactionException {\r
+                                       unlinkResultSet(graph, data);\r
+                }\r
+            });\r
+        } catch (DatabaseException e) {\r
+            ExceptionUtils.logAndShowError(e);\r
+        }\r
+        \r
+    }\r
+    \r
+    \r
+    public static void unlinkResultSet(WriteGraph graph, Resource resultSet) throws DatabaseException  {\r
+       SysdynResource sr = SysdynResource.getInstance(graph);\r
+       for (Resource result : graph.syncRequest(new ObjectsWithType(resultSet, sr.Experiment_result, sr.Result))) {\r
+                       SimulationResultNode.unlinkResult(graph, result);\r
+       }\r
+        RemoverUtil.remove(graph, resultSet);\r
+    }\r
+\r
+       @Override\r
+       public boolean handleDoubleClick() {\r
+               Resource[] resources = {data};\r
+               ToggleResultSetActivation.toggleActivation(resources);\r
+               return true;\r
+       }\r
+}\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultSetActivation.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultSetActivation.java
new file mode 100644 (file)
index 0000000..a667a8c
--- /dev/null
@@ -0,0 +1,76 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 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;\r
+\r
+import java.util.Collection;\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.exception.DatabaseException;\r
+import org.simantics.sysdyn.SysdynResource;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.utils.ResourceAdaptionUtils;\r
+\r
+public class ToggleResultSetActivation extends AbstractHandler {\r
+\r
+    @Override\r
+    public Object execute(ExecutionEvent event) throws ExecutionException {\r
+        ISelection sel = HandlerUtil.getCurrentSelection(event);\r
+        Resource[] resources = ResourceAdaptionUtils.toResources(sel);\r
+        if (resources.length == 0)\r
+            return null;\r
+\r
+        toggleActivation(resources);\r
+\r
+        return null;\r
+    }\r
+\r
+    public static void toggleActivation(final Resource[] resources) {\r
+        try {\r
+            SimanticsUI.getSession().syncRequest(new WriteRequest() {\r
+\r
+                @Override\r
+                public void perform(WriteGraph graph) throws DatabaseException {\r
+                    SysdynResource sr = SysdynResource.getInstance(graph);\r
+                    for(Resource r : resources) {\r
+                       // If there is at least one result which shown, clear them all.\r
+                       // If not one result is shown, show them all.\r
+                       boolean resultShown = false;\r
+                       Collection<Resource> results = graph.getObjects(r, sr.Experiment_result); \r
+                       for (Resource result : results) {\r
+                               if (graph.hasStatement(result, sr.Result_showResult)) {\r
+                                       resultShown = true;\r
+                                       break;\r
+                               }\r
+                       }\r
+                       for (Resource result : results) {\r
+                               if (resultShown) { \r
+                                       graph.denyStatement(result, sr.Result_showResult, result);\r
+                            } else {\r
+                                graph.claim(result, sr.Result_showResult, result);\r
+                            }\r
+                       }\r
+                    }\r
+                }\r
+\r
+            });\r
+        } catch (DatabaseException e) {\r
+\r
+        }\r
+    }\r
+}\r
index 5fd9af0bb132b660bdbe2f2f8dd67c165a8edfab..5f00db8b671996b0ab9178901eaac21c57580838 100644 (file)
@@ -229,6 +229,14 @@ public class SysdynProject extends AbstractProjectFeature {
                                                                                        if(result != null) resultPaths.put(resultFile, result);\r
                                                                                }\r
                                                                        }\r
+                                                                       for(Resource resultSet : graph.getObjects(experiment, sr.Experiment_resultSet)) {\r
+                                                                               for(Resource result : graph.getObjects(resultSet, sr.Experiment_result)) {\r
+                                                                                       if(!graph.isInstanceOf(result, sr.HistoryDataset)) {\r
+                                                                                               String resultFile = (String)graph.getPossibleRelatedValue(result, sr.Result_resultFile);\r
+                                                                                               if(result != null) resultPaths.put(resultFile, result);\r
+                                                                                       }\r
+                                                                               }\r
+                                                                       }\r
                                                                }\r
                                                        }\r
                                                }\r
index 5e1f3fa6611aba59cf2cdb0ae63209c97b3fda16..6ae1b03547954f3ac29286a61308412b38dcb1f7 100644 (file)
@@ -54,6 +54,15 @@ public class ActiveResults implements Read<Collection<Resource>>{
                    result.add(r);\r
                 }\r
             }\r
+            Collection<Resource> experimentResultSets = graph.getObjects(experiment, SR.Experiment_resultSet);\r
+            for(Resource resultSet : experimentResultSets) {\r
+               experimentResults = graph.getObjects(resultSet, SR.Experiment_result);\r
+                for(Resource r : experimentResults) {\r
+                    if(graph.hasStatement(r, SR.Result_showResult)) {\r
+                       result.add(r);\r
+                    }\r
+                }\r
+            }\r
         }\r
         \r
         return result;\r
index 7b0ea6baadd62f9b6246932e9af4322dd4ffb633..caf06b3dd64dcb6579c15693b59bf7a7f791c4ff 100644 (file)
@@ -56,7 +56,7 @@ public class SaveResultJob extends Job {
     protected IStatus run(IProgressMonitor monitor) {\r
         this.monitor = monitor;\r
         int resultItemsNumber = sysdynResult.numberOfVariables();\r
-        monitor.beginTask("Save result", resultItemsNumber * 2);        \r
+        monitor.beginTask("Save result", resultItemsNumber * 2 + 1);        \r
         try {\r
             // Create result file\r
             file = session.syncRequest(new Read<File>() {\r
diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SaveResultSetJob.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/manager/SaveResultSetJob.java
new file mode 100644 (file)
index 0000000..2138554
--- /dev/null
@@ -0,0 +1,153 @@
+/*******************************************************************************\r
+ * Copyright (c) 2010, 2013 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.manager;\r
+\r
+import java.io.File;\r
+import java.util.ArrayList;\r
+import java.util.UUID;\r
+\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.eclipse.core.runtime.IStatus;\r
+import org.eclipse.core.runtime.Platform;\r
+import org.eclipse.core.runtime.Status;\r
+import org.eclipse.core.runtime.jobs.Job;\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.Session;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.WriteRequest;\r
+import org.simantics.db.common.request.WriteResultRequest;\r
+import org.simantics.db.common.utils.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.request.Read;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.layer0.utils.direct.GraphUtils;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+/**\r
+ * Class for saving simulation result sets.\r
+ * @author Tuomas Miettinen\r
+ *\r
+ */\r
+public class SaveResultSetJob extends Job {\r
+\r
+       private final ArrayList<MemoryResult> sysdynResults;\r
+    private final SysdynExperiment experiment;\r
+    private final Session session;\r
+    private IProgressMonitor monitor;\r
+    private File file;\r
+\r
+    public SaveResultSetJob(final SysdynExperiment experiment, Session session, final ArrayList<MemoryResult> results) {\r
+        super("Save Results");\r
+        this.experiment = experiment;\r
+        this.sysdynResults = results;\r
+        this.session = session;\r
+    }\r
+\r
+    @Override\r
+    protected IStatus run(IProgressMonitor monitor) {\r
+        this.monitor = monitor;\r
+        if (sysdynResults == null || sysdynResults.size() == 0)\r
+            return Status.CANCEL_STATUS;\r
+        int resultItemsNumber = sysdynResults.get(0).numberOfVariables() * sysdynResults.size();\r
+        monitor.beginTask("Save results", resultItemsNumber * 2 + 2);     \r
+        \r
+        try {\r
+               // Create a ResultSet, under which the individual results are stored, and\r
+               // add it under the experiment within the model browser. \r
+\r
+               final Resource resultSetResource = session.syncRequest(new WriteResultRequest<Resource>() {\r
+\r
+                       @Override\r
+                       public Resource perform(WriteGraph graph) throws DatabaseException {\r
+                               Layer0 l0 = Layer0.getInstance(graph);\r
+                               Resource model = graph.getSingleObject(experiment.getResource(), l0.PartOf);\r
+                               String name = NameUtils.findFreshName(graph, "ResultSet", model, l0.ConsistsOf, "%s%d");\r
+\r
+                               SysdynResource sr = SysdynResource.getInstance(graph);\r
+                               Resource res = GraphUtils.create2(graph, sr.ResultSet,\r
+                                               l0.HasLabel, name,\r
+                                               l0.HasName, name,\r
+                                               l0.PartOf, model,\r
+                                               sr.Result_time, System.currentTimeMillis());\r
+                               graph.claim(experiment.getResource(), sr.Experiment_resultSet, res);\r
+                                       return res;\r
+                       }\r
+               });\r
+               monitor.worked(1);\r
+               \r
+               // Save the individual results\r
+               for (int i = 0; i < sysdynResults.size(); ++i) {\r
+                       MemoryResult result = sysdynResults.get(i);\r
+                       final String name = new Integer(i+1).toString();\r
+                       // Create result file\r
+                       file = session.syncRequest(new Read<File>() {\r
+\r
+                               @Override\r
+                               public File perform(ReadGraph graph) throws DatabaseException {\r
+                                       Layer0 l0 = Layer0.getInstance(graph);\r
+                                       Resource model = graph.getSingleObject(experiment.getResource(), l0.PartOf);\r
+                                       Resource project = graph.getSingleObject(model, l0.PartOf);\r
+                                       String projectName = graph.getPossibleRelatedValue(project, l0.HasName);\r
+                                       File root = new File(Platform.getLocation().toOSString(), "www.simantics.org");\r
+                                       if(!root.isDirectory()) root.mkdir();\r
+                                       File projectRoot = new File(root, projectName);\r
+                                       if(!projectRoot.isDirectory()) projectRoot.mkdir();\r
+                                       File file = new File( projectRoot, UUID.randomUUID().toString() + ".dbb");\r
+                                       return file;\r
+                               }\r
+                       });\r
+\r
+                       // Start the saving operation\r
+                       Thread saveThread = experiment.getSaveThread(result, file, SaveResultSetJob.this.monitor);\r
+                       saveThread.run();\r
+\r
+                       // Add the result under the ResultSet within the model browser. \r
+                       session.syncRequest(new WriteRequest() {\r
+\r
+                               @Override\r
+                               public void perform(WriteGraph graph) throws DatabaseException {\r
+                                       Layer0 l0 = Layer0.getInstance(graph);\r
+                                       String resultSetName = graph.getRelatedValue(resultSetResource, l0.HasName);\r
+                                       \r
+                                       SysdynResource sr = SysdynResource.getInstance(graph);\r
+                                       Resource res = GraphUtils.create2(graph, sr.Result,\r
+                                                       l0.HasLabel, name,\r
+                                                       l0.HasName, resultSetName + "#" + name,\r
+                                                       sr.Result_resultFile, file.getAbsolutePath(),\r
+                                                       sr.Result_time, System.currentTimeMillis());\r
+                                       graph.claim(resultSetResource, sr.Experiment_result, res);\r
+                               }\r
+                       });\r
+\r
+               }\r
+\r
+               } catch (DatabaseException e1) {\r
+                       // TODO Auto-generated catch block\r
+                       e1.printStackTrace();\r
+               }\r
+\r
+        monitor.done(); \r
+        return Status.OK_STATUS;\r
+    }\r
+\r
+    @Override\r
+    public boolean belongsTo(Object family) {\r
+        return "SaveResultSetJob".equals(family);\r
+    }\r
+\r
+    @Override\r
+    protected void canceling() {\r
+\r
+    }\r
+\r
+}\r
index 182f043031f22e8a1a872bb13af23f3f8dd6c190..c543e95d91a8c55581223deeff41b8165fce0263 100644 (file)
@@ -322,8 +322,8 @@ public class SysdynSensitivityAnalysisExperiment extends SysdynExperiment {
     public void saveState() {\r
         if(results == null || !(results instanceof ArrayList<?>)) \r
             return;\r
-        //SaveResultJob saveResultJob = new SaveResultJob(SysdynSensitivityAnalysisExperiment.this, session, results);\r
-        //saveResultJob.schedule();\r
+        SaveResultSetJob saveResultSetJob = new SaveResultSetJob((SysdynExperiment)this, session, results);\r
+        saveResultSetJob.schedule();\r
     }\r
     \r
     @Override\r