]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Expression type data saved when type changed
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 11 Jan 2010 14:10:38 +0000 (14:10 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 11 Jan 2010 14:10:38 +0000 (14:10 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@13474 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/ExpressionController.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/AuxiliaryExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ConstantExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/DelayExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/IExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/LookupExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/ParameterExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/StockExpressionViewFactor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/expressions/WithLookupExpressionViewFactor.java

index 1f60cd0320e555550a4fd1c10663df660ec0b8b2..d331d23d92ce3a0222fd7de37c0fa87dae3f418e 100644 (file)
@@ -138,8 +138,8 @@ public class ExpressionController extends Composite {
 \r
             @Override\r
             public void widgetSelected(SelectionEvent e) {\r
+                getExpressionViewFactor().updateData(data);\r
                 displayExpressionView(variable, ExpressionType.valueOf(typeCombo.getItem(typeCombo.getSelectionIndex())), false);\r
-\r
             }\r
 \r
             @Override\r
index 6828ef1d737f7611814c2cdde125a641f157dc9b..e756dbf6072e4be7bb67fd78651e89cdc368979a 100644 (file)
@@ -136,4 +136,10 @@ public class AuxiliaryExpressionViewFactor implements IExpressionViewFactor {
             expression.setSelection(lastSelection.x + var.length());\r
         }\r
     }\r
+\r
+    @Override\r
+    public void updateData(Map<String, Object> data) {\r
+        if(this.expression != null && this.expression.getText() != null)\r
+            data.put("equation", this.expression.getText());\r
+    }\r
 }\r
index 708ef86c26d3baa63725b07672feaac2b5a0ebfe..4d0a1726e542f06afa75cf4015d9429d4df409cb 100644 (file)
@@ -138,4 +138,10 @@ public class ConstantExpressionViewFactor implements IExpressionViewFactor {
         }        \r
     }\r
 \r
+    @Override\r
+    public void updateData(Map<String, Object> data) {\r
+        if(this.expression != null && this.expression.getText() != null)\r
+            data.put("equation", this.expression.getText());        \r
+    }\r
+\r
 }\r
index a25455110e9c7959a9d42a305b5f7b4bcc4ef0aa..fbb6392df4d526207231dffe6a6f9af3d0503301 100644 (file)
@@ -37,4 +37,10 @@ public class DelayExpressionViewFactor implements IExpressionViewFactor {
         \r
     }\r
 \r
+    @Override\r
+    public void updateData(Map<String, Object> data) {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
 }\r
index 0cee3b46f20ae3ea9cf12bccabdd7338b5d214a3..76ca71707634bbc72067342a0074112c2f4fd8fb 100644 (file)
@@ -44,4 +44,9 @@ public interface IExpressionViewFactor {
      */\r
     void replaceSelection(String var);\r
     \r
+    /**\r
+     * Updates data from text inputs to the data map\r
+     * @param data\r
+     */\r
+    void updateData(Map<String, Object> data);\r
 }\r
index 129c64ce0952cbc73c85cf2070933e26d137cb94..98571aa96ce71e6d18f4db8e8f6973b99862dade 100644 (file)
@@ -37,4 +37,10 @@ public class LookupExpressionViewFactor implements IExpressionViewFactor {
         \r
     }\r
 \r
+    @Override\r
+    public void updateData(Map<String, Object> data) {\r
+        // TODO Auto-generated method stub\r
+        \r
+    }\r
+\r
 }\r
index a5c02fbe8b5bf2da59eef1f09219eb8986155760..cb60a2303599225fa9a9a1277a101d19d50a6bcc 100644 (file)
@@ -138,5 +138,11 @@ public class ParameterExpressionViewFactor implements IExpressionViewFactor {
         }        \r
     }\r
 \r
+    @Override\r
+    public void updateData(Map<String, Object> data) {\r
+        if(this.expression != null && this.expression.getText() != null)\r
+            data.put("equation", this.expression.getText());        \r
+    }\r
+\r
 }\r
 \r
index f10447b906553d4daad94376ee6913438a5ed424..7a920ace347b73f75d9c688f87c8ca931c352458 100644 (file)
@@ -202,5 +202,11 @@ public class StockExpressionViewFactor implements IExpressionViewFactor {
 \r
     }\r
 \r
-\r
+    @Override\r
+    public void updateData(Map<String, Object> data) {\r
+        if(this.expression != null && this.expression.getText() != null)\r
+            data.put("initialEquation", this.expression.getText());   \r
+        if(this.integral != null && this.integral.getText() != null)\r
+            data.put("integral", this.integral.getText());\r
+    }\r
 }\r
index 78a5d5a8cdefc8f642a0c064cf02b9a57eef1084..6308759b7120cd012459097da565f4ac2e8c45de 100644 (file)
@@ -183,4 +183,12 @@ public class WithLookupExpressionViewFactor implements IExpressionViewFactor {
             lastSelectedText.setSelection(lastSelection.x + var.length());\r
         }\r
     }\r
+\r
+    @Override\r
+    public void updateData(Map<String, Object> data) {\r
+        if(this.expression != null && this.expression.getText() != null)\r
+            data.put("equation", this.expression.getText());   \r
+        if(this.lookup != null && this.lookup.getText() != null)\r
+            data.put("lookup", this.lookup.getText());        \r
+    }\r
 }
\ No newline at end of file