]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
First profile
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 10 Oct 2011 13:18:23 +0000 (13:18 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 10 Oct 2011 13:18:23 +0000 (13:18 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@22597 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/Profiles.pgraph [new file with mode: 0644]
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ui/META-INF/MANIFEST.MF
org.simantics.sysdyn.ui/adapters.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/profiles/SimulationPlaybackStyle.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ModelUtils.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ProfileEntries.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/DependencyFunction.java

index 75a536254a291bf81c15887ebe1d0322e376c9ad..11db7b9ecb1886238ea91dd3e64d258ac166866d 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
diff --git a/org.simantics.sysdyn.ontology/graph/Profiles.pgraph b/org.simantics.sysdyn.ontology/graph/Profiles.pgraph
new file mode 100644 (file)
index 0000000..63cb525
--- /dev/null
@@ -0,0 +1,25 @@
+L0 = <http://www.simantics.org/Layer0-1.0>\r
+L0X = <http://www.simantics.org/Layer0X-1.0>\r
+DIA = <http://www.simantics.org/Diagram-2.0>\r
+SYSDYN = <http://www.simantics.org/Sysdyn-1.0>\r
+\r
+PROFILES = SYSDYN.Profiles : L0.Library\r
+\r
+\r
+// TEMPLATE\r
+groupStyleEntry : L0.Template\r
+    @template %subject %style %group\r
+        %subject : DIA.GroupStyleProfileEntry\r
+            DIA.ProfileEntry.HasStyle %style\r
+            DIA.ProfileEntry.HasGroup %group\r
+\r
+            \r
+SYSDYN.SimulationPlaybackStyle : DIA.Style\r
+\r
+SYSDYN.AllElementsGroup : DIA.TypeGroup\r
+    L0.HasLabel "Element"\r
+    DIA.HasType DIA.Element\r
+\r
+PROFILES.SimulationPlaybackColours\r
+    L0.HasLabel "Playback colours"\r
+    @groupStyleEntry SYSDYN.SimulationPlaybackStyle SYSDYN.AllElementsGroup
\ No newline at end of file
index 68049fb4c448be245a2e2d6f1e0bb2f252b53776..77000eb8f62c44b22b95668532aa7eb0ab9f2a2f 100644 (file)
@@ -10,6 +10,7 @@ public class SysdynResource {
     \r
     public final Resource AdditionalSymbols;\r
     public final Resource AdditionalSymbols_Text;\r
+    public final Resource AllElementsGroup;\r
     public final Resource ArrayIndexes;\r
     public final Resource ArrayIndexes_Inverse;\r
     public final Resource Auxiliary;\r
@@ -140,6 +141,8 @@ public class SysdynResource {
     public final Resource ParameterExpression;\r
     public final Resource Polarity;\r
     public final Resource Polarity_Inverse;\r
+    public final Resource Profiles;\r
+    public final Resource Profiles_SimulationPlaybackColours;\r
     public final Resource ProjectActionContext;\r
     public final Resource ProjectActionContext_Actions;\r
     public final Resource ProjectActionContext_Actions_NewEnumeration;\r
@@ -169,6 +172,7 @@ public class SysdynResource {
     public final Resource ShowEnumerationIndexInCharts;\r
     public final Resource ShowEnumerationIndexInCharts_Inverse;\r
     public final Resource SimulateOnChangeExperiment;\r
+    public final Resource SimulationPlaybackStyle;\r
     public final Resource Stock;\r
     public final Resource StockExpression;\r
     public final Resource StockSymbol;\r
@@ -201,6 +205,7 @@ public class SysdynResource {
     public static class URIs {\r
         public static final String AdditionalSymbols = "http://www.simantics.org/Sysdyn-1.0/AdditionalSymbols";\r
         public static final String AdditionalSymbols_Text = "http://www.simantics.org/Sysdyn-1.0/AdditionalSymbols/Text";\r
+        public static final String AllElementsGroup = "http://www.simantics.org/Sysdyn-1.0/AllElementsGroup";\r
         public static final String ArrayIndexes = "http://www.simantics.org/Sysdyn-1.0/ArrayIndexes";\r
         public static final String ArrayIndexes_Inverse = "http://www.simantics.org/Sysdyn-1.0/ArrayIndexes/Inverse";\r
         public static final String Auxiliary = "http://www.simantics.org/Sysdyn-1.0/Auxiliary";\r
@@ -331,6 +336,8 @@ public class SysdynResource {
         public static final String ParameterExpression = "http://www.simantics.org/Sysdyn-1.0/ParameterExpression";\r
         public static final String Polarity = "http://www.simantics.org/Sysdyn-1.0/Polarity";\r
         public static final String Polarity_Inverse = "http://www.simantics.org/Sysdyn-1.0/Polarity/Inverse";\r
+        public static final String Profiles = "http://www.simantics.org/Sysdyn-1.0/Profiles";\r
+        public static final String Profiles_SimulationPlaybackColours = "http://www.simantics.org/Sysdyn-1.0/Profiles/SimulationPlaybackColours";\r
         public static final String ProjectActionContext = "http://www.simantics.org/Sysdyn-1.0/ProjectActionContext";\r
         public static final String ProjectActionContext_Actions = "http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions";\r
         public static final String ProjectActionContext_Actions_NewEnumeration = "http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewEnumeration";\r
@@ -360,6 +367,7 @@ public class SysdynResource {
         public static final String ShowEnumerationIndexInCharts = "http://www.simantics.org/Sysdyn-1.0/ShowEnumerationIndexInCharts";\r
         public static final String ShowEnumerationIndexInCharts_Inverse = "http://www.simantics.org/Sysdyn-1.0/ShowEnumerationIndexInCharts/Inverse";\r
         public static final String SimulateOnChangeExperiment = "http://www.simantics.org/Sysdyn-1.0/SimulateOnChangeExperiment";\r
+        public static final String SimulationPlaybackStyle = "http://www.simantics.org/Sysdyn-1.0/SimulationPlaybackStyle";\r
         public static final String Stock = "http://www.simantics.org/Sysdyn-1.0/Stock";\r
         public static final String StockExpression = "http://www.simantics.org/Sysdyn-1.0/StockExpression";\r
         public static final String StockSymbol = "http://www.simantics.org/Sysdyn-1.0/StockSymbol";\r
@@ -402,6 +410,7 @@ public class SysdynResource {
     public SysdynResource(ReadGraph graph) {\r
         AdditionalSymbols = getResourceOrNull(graph, URIs.AdditionalSymbols);\r
         AdditionalSymbols_Text = getResourceOrNull(graph, URIs.AdditionalSymbols_Text);\r
+        AllElementsGroup = getResourceOrNull(graph, URIs.AllElementsGroup);\r
         ArrayIndexes = getResourceOrNull(graph, URIs.ArrayIndexes);\r
         ArrayIndexes_Inverse = getResourceOrNull(graph, URIs.ArrayIndexes_Inverse);\r
         Auxiliary = getResourceOrNull(graph, URIs.Auxiliary);\r
@@ -532,6 +541,8 @@ public class SysdynResource {
         ParameterExpression = getResourceOrNull(graph, URIs.ParameterExpression);\r
         Polarity = getResourceOrNull(graph, URIs.Polarity);\r
         Polarity_Inverse = getResourceOrNull(graph, URIs.Polarity_Inverse);\r
+        Profiles = getResourceOrNull(graph, URIs.Profiles);\r
+        Profiles_SimulationPlaybackColours = getResourceOrNull(graph, URIs.Profiles_SimulationPlaybackColours);\r
         ProjectActionContext = getResourceOrNull(graph, URIs.ProjectActionContext);\r
         ProjectActionContext_Actions = getResourceOrNull(graph, URIs.ProjectActionContext_Actions);\r
         ProjectActionContext_Actions_NewEnumeration = getResourceOrNull(graph, URIs.ProjectActionContext_Actions_NewEnumeration);\r
@@ -561,6 +572,7 @@ public class SysdynResource {
         ShowEnumerationIndexInCharts = getResourceOrNull(graph, URIs.ShowEnumerationIndexInCharts);\r
         ShowEnumerationIndexInCharts_Inverse = getResourceOrNull(graph, URIs.ShowEnumerationIndexInCharts_Inverse);\r
         SimulateOnChangeExperiment = getResourceOrNull(graph, URIs.SimulateOnChangeExperiment);\r
+        SimulationPlaybackStyle = getResourceOrNull(graph, URIs.SimulationPlaybackStyle);\r
         Stock = getResourceOrNull(graph, URIs.Stock);\r
         StockExpression = getResourceOrNull(graph, URIs.StockExpression);\r
         StockSymbol = getResourceOrNull(graph, URIs.StockSymbol);\r
index 30281ccd1dc4bde8f5958fd71db8b7c894c3a0f9..d8d2338fd600171582af13ba76949f876a06ff4f 100644 (file)
@@ -46,7 +46,8 @@ Require-Bundle: org.simantics.layer0.utils;bundle-version="0.6.2",
  org.simantics.selectionview;bundle-version="1.0.0",
  org.simantics.issues;bundle-version="1.1.0",
  org.simantics.issues.ui;bundle-version="1.1.0",
- org.simantics.issues.common;bundle-version="1.1.0"
+ org.simantics.issues.common;bundle-version="1.1.0",
+ org.simantics.scenegraph.profile;bundle-version="1.0.0"
 Bundle-Activator: org.simantics.sysdyn.ui.Activator
 Bundle-ActivationPolicy: lazy
 Export-Package: org.simantics.sysdyn.ui.browser.nodes
index edbfeb085f6da13cb9fddc1d7dba2fb969c13bbe..4986006cd6996ed6b28f398e90a9ae8a041616d1 100644 (file)
@@ -10,5 +10,5 @@
         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-1.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r<!-- \r       <target interface="org.simantics.db.layer0.variable.Variable">\r         <type uri="http://www.simantics.org/Sysdyn-1.0/HistoryRealization"\r                     class="org.simantics.sysdyn.ui.project.HistoryVariable" >\r                      <this />\r               </type>\r                <type uri="http://www.simantics.org/Sysdyn-1.0/DefaultRealization"\r                     class="org.simantics.sysdyn.ui.project.DefaultVariable" >\r                      <this />\r               </type>\r        </target>\r -->\r\r        <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-1.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-1.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-1.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-1.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-1.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-1.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-1.0/StockSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                       class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <resource uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r                    class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <resource uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r             <type uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                   class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <type uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r                        class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <type uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.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-1.0/FlowConnection"\r                     class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <!-- : SYSDYN.Connection-->\r            <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowConnectionFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.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-2.0/HasConnector" />\r   <resource uri="http://www.simantics.org/Diagram-2.0/HasPlainConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>none 0</string>\r       </resource>\r    <resource uri="http://www.simantics.org/Diagram-2.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-1.0/ProjectBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>            \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/OpenWorkbook"\r            class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" />            \r    </target>              \r  \r  \r  <!-- ISSUES\r    <target interface="org.simantics.db.layer0.adapter.IssueSource">\r        <resource\r            uri="http://www.simantics.org/Sysdyn-1.0/Validations/DependencyConnections"\r            class="org.simantics.sysdyn.ui.validation.DependencyIssueSource">\r            <graph/>\r            <this />\r        </resource>\r    </target>\r     -->\r
+<adapters>\r\r   <target interface="org.simantics.db.layer0.adapter.Realization">\r               <type uri="http://www.simantics.org/Sysdyn-1.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r<!-- \r       <target interface="org.simantics.db.layer0.variable.Variable">\r         <type uri="http://www.simantics.org/Sysdyn-1.0/HistoryRealization"\r                     class="org.simantics.sysdyn.ui.project.HistoryVariable" >\r                      <this />\r               </type>\r                <type uri="http://www.simantics.org/Sysdyn-1.0/DefaultRealization"\r                     class="org.simantics.sysdyn.ui.project.DefaultVariable" >\r                      <this />\r               </type>\r        </target>\r -->\r\r        <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-1.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-1.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-1.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-1.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-1.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-1.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-1.0/StockSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                       class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <resource uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r                    class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <resource uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-1.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r             <type uri="http://www.simantics.org/Sysdyn-1.0/StockSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/ModuleSymbol"\r                   class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <type uri="http://www.simantics.org/Sysdyn-1.0/ValveSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"\r                        class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <type uri="http://www.simantics.org/Sysdyn-1.0/CloudSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-1.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-1.0/FlowConnection"\r                     class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <resource uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowEdgeFactory" />\r               <type uri="http://www.simantics.org/Sysdyn-1.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <!-- : SYSDYN.Connection-->\r            <type uri="http://www.simantics.org/Sysdyn-1.0/FlowConnection"\r                 class="org.simantics.sysdyn.ui.elements2.connections.FlowConnectionFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-1.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-2.0/HasConnector" />\r   <resource uri="http://www.simantics.org/Diagram-2.0/HasPlainConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>none 0</string>\r       </resource>\r    <resource uri="http://www.simantics.org/Diagram-2.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-1.0/ProjectBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>            \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/OpenWorkbook"\r            class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" />            \r    </target>              \r  \r  <!-- PROFILES -->\r    <target interface="org.simantics.scenegraph.profile.Style">\r        <resource uri="http://www.simantics.org/Sysdyn-1.0/SimulationPlaybackStyle"\r            class="org.simantics.sysdyn.ui.elements2.profiles.SimulationPlaybackStyle">\r        </resource>\r    </target>\r
 </adapters>
\ No newline at end of file
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/profiles/SimulationPlaybackStyle.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/profiles/SimulationPlaybackStyle.java
new file mode 100644 (file)
index 0000000..26aa368
--- /dev/null
@@ -0,0 +1,127 @@
+package org.simantics.sysdyn.ui.elements2.profiles;\r
+\r
+import java.awt.BasicStroke;\r
+import java.awt.Color;\r
+import java.awt.geom.AffineTransform;\r
+import java.awt.geom.Rectangle2D;\r
+\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.NameUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.diagram.profile.StyleBase;\r
+import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.diagram.synchronization.graph.DiagramGraphUtil;\r
+import org.simantics.issues.ontology.IssueResource;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.modeling.ModelingResources;\r
+import org.simantics.scenegraph.INode;\r
+import org.simantics.scenegraph.g2d.nodes.ShapeNode;\r
+import org.simantics.scenegraph.profile.EvaluationContext;\r
+import org.simantics.scenegraph.profile.Observer;\r
+import org.simantics.scenegraph.profile.common.ProfileVariables;\r
+import org.simantics.scenegraph.utils.GeometryUtils;\r
+import org.simantics.scenegraph.utils.NodeUtil;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+public class SimulationPlaybackStyle extends StyleBase<AffineTransform> {\r
+\r
+    public static class A extends ShapeNode {\r
+\r
+        private static final long serialVersionUID = -5273246617906214956L;\r
+\r
+        @Override\r
+        public Rectangle2D getBoundsInLocal() {\r
+            return null;\r
+        }\r
+\r
+        @Override\r
+        public Rectangle2D getBoundsInLocal(boolean b) {\r
+            return null;\r
+        }\r
+\r
+        @Override\r
+        public Rectangle2D getBounds() {\r
+            return null;\r
+        }\r
+        \r
+    }\r
+    \r
+    @Override\r
+    public AffineTransform calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource element, Variable configuration) throws DatabaseException {\r
+//        TODO: Get results from variable\r
+//        DiagramResource dr = DiagramResource.getInstance(graph);\r
+//        String rvi = graph.getPossibleRelatedValue(runtimeDiagram, dr.RuntimeDiagram_HasRVI, Bindings.STRING);\r
+        \r
+        Layer0 l0 = Layer0.getInstance(graph);\r
+        SysdynResource sr = SysdynResource.getInstance(graph);\r
+        ModelingResources mr = ModelingResources.getInstance(graph);\r
+        IssueResource issue = IssueResource.getInstance(graph);\r
+        \r
+        Resource component = graph.getPossibleObject(element, mr.ElementToComponent);\r
+        if (component == null)\r
+            return null;\r
+        \r
+        Resource config = graph.getPossibleObject(component, l0.PartOf);\r
+        \r
+        Resource model = graph.getPossibleObject(config, l0.PartOf);\r
+        if(!graph.isInstanceOf(model, sr.SysdynModel))\r
+            return null;\r
+        \r
+        for(Resource i : graph.syncRequest(new ObjectsWithType(model, l0.ConsistsOf, issue.Issue))) {\r
+            System.out.println(NameUtils.getSafeName(graph, graph.getSingleObject(i, issue.HasIssueContext)));\r
+            if(graph.getSingleObject(i, issue.HasIssueContext).equals(component)) {\r
+                AffineTransform at = DiagramGraphUtil.getAffineTransform(graph, element,  G2DResource.getInstance(graph).HasTransform, true);\r
+                return at;\r
+            }\r
+        }\r
+        \r
+        return null;\r
+//        String name = graph.getPossibleRelatedValue(config, l0.HasName, Bindings.STRING);\r
+//        if(name == null)\r
+//            return null;\r
+//        if(name.startsWith("A")) {\r
+//            AffineTransform at = DiagramGraphUtil.getAffineTransform(graph, element,  G2DResource.getInstance(graph).HasTransform, true);\r
+//            return at;\r
+//        } else {\r
+//            return null;\r
+//        }\r
+    }\r
+\r
+    @Override\r
+    public void styleResultChanged(Observer observer, Resource element, AffineTransform result) {\r
+        if (result != null)\r
+            values.put(element, result);\r
+        else\r
+            values.remove(element);\r
+        observer.update();\r
+    }\r
+\r
+    @Override\r
+    public void applyStyleForNode(EvaluationContext observer, INode _node, AffineTransform transform) {\r
+        if (transform != null) {\r
+            A node = ProfileVariables.claimChild(_node, "", "simulationPlaybackColour", A.class, observer);\r
+            if (node == null)\r
+                return;\r
+\r
+            Rectangle2D expandedElementBounds = GeometryUtils.expandRectangle( NodeUtil.getLocalElementBounds(_node), 0.5 );\r
+            node.setTransform(transform);\r
+            node.setZIndex(-1000);\r
+            node.setFill(true);\r
+            node.setColor(Color.LIGHT_GRAY);\r
+            node.setStroke(new BasicStroke(0.2f));\r
+            node.setValue("shape", expandedElementBounds);\r
+        } else {\r
+            cleanupStyleForNode(_node);\r
+        }\r
+    }\r
+\r
+    @Override\r
+    protected void cleanupStyleForNode(INode node) {\r
+        ProfileVariables.denyChild(node, "", "simulationPlaybackColour");\r
+    }\r
+\r
+}\r
+
index 088d67fe8f4aba793901ed785835c3666bcafcbb..05a1b500204b309845575fdbb7ca22f4684d386e 100644 (file)
@@ -1,8 +1,5 @@
 package org.simantics.sysdyn.ui.utils;\r
 \r
-import java.text.DateFormat;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Calendar;\r
 import java.util.UUID;\r
 \r
 import org.simantics.databoard.Bindings;\r
@@ -13,7 +10,6 @@ import org.simantics.db.common.utils.NameUtils;
 import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.adapter.Template;\r
 import org.simantics.document.DocumentResource;\r
-import org.simantics.issues.ontology.IssueResource;\r
 import org.simantics.layer0.Layer0;\r
 import org.simantics.layer0.utils.direct.GraphUtils;\r
 import org.simantics.modeling.ModelingResources;\r
@@ -141,20 +137,8 @@ public class ModelUtils {
                 }\r
             }\r
             \r
-            /*\r
-            IssueResource ISSUE = IssueResource.getInstance(g);\r
-            Resource sampleNote = g.newResource();\r
-            g.claim(sampleNote, l0.InstanceOf, null, ISSUE.TextualIssue);\r
-            g.claimLiteral(sampleNote, l0.HasName, "sampleNote");\r
-            g.claim(sampleNote, ISSUE.HasSeverity, ISSUE.Severity_Error);\r
-            g.claim(sampleNote, ISSUE.HasIssueContext, model);\r
-            g.claimLiteral(sampleNote, l0.HasLabel, "Test note", Bindings.STRING);\r
-            g.claimLiteral(sampleNote, l0.HasDescription, "= Test =\nThis is a test note.\n", Bindings.STRING);\r
-                     DateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");\r
-                     String created = format.format(Calendar.getInstance().getTime());\r
-            g.claimLiteral(sampleNote, ISSUE.HasCreationTime, created, Bindings.STRING);\r
-            g.claim(model, l0.ConsistsOf, sampleNote);\r
-            */\r
+            ProfileEntries.createStandardProfiles(g, model);\r
+            \r
             \r
         } catch (DatabaseException e ) {\r
 \r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ProfileEntries.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/utils/ProfileEntries.java
new file mode 100644 (file)
index 0000000..d285d39
--- /dev/null
@@ -0,0 +1,46 @@
+package org.simantics.sysdyn.ui.utils;\r
+\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.WriteGraph;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.diagram.profile.Profiles;\r
+import org.simantics.diagram.stubs.DiagramResource;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.SysdynResource;\r
+\r
+public class ProfileEntries  {\r
+\r
+    public static Resource createWorkProfile(WriteGraph graph, String name) throws DatabaseException {\r
+\r
+        SysdynResource sr = SysdynResource.getInstance(graph);\r
+        \r
+        return Profiles.createProfile(graph, name,\r
+                sr.Profiles_SimulationPlaybackColours);\r
+\r
+    }\r
+\r
+    public static void createStandardProfiles(WriteGraph graph, final Resource model) throws DatabaseException {\r
+\r
+        Layer0 L0 = Layer0.getInstance(graph);\r
+        DiagramResource DIA = DiagramResource.getInstance(graph);\r
+\r
+        final Resource a = createWorkProfile(graph, "A");\r
+\r
+        Resource plain = Profiles.createProfile(graph, "Plain");\r
+\r
+        graph.claim(model, DIA.HasProfile, plain);\r
+        graph.claim(model, L0.ConsistsOf, a);\r
+        graph.claim(model, L0.ConsistsOf, plain);\r
+\r
+        // FIXME: add virtual graph write back once this is fixed: https://www.simulationsite.net/redmine/issues/3296\r
+//        graph.sync(new WriteRequest(graph.getService(VirtualGraphSupport.class).getWorkspacePersistent("profiles")) {\r
+//            @Override\r
+//            public void perform(WriteGraph graph) throws DatabaseException {\r
+//                DiagramResource DIA = DiagramResource.getInstance(graph);\r
+                graph.claim(model, DIA.HasActiveProfile, plain);\r
+//            }\r
+//        });\r
+\r
+    }\r
+\r
+}\r
index e7190584acd09fb81efb5d088feb682f1de73597..828f722d795deac6a274d2fbb4a353093ca4c209 100644 (file)
@@ -166,7 +166,7 @@ public class DependencyFunction {
         Resource issue = graph.newResource();\r
         graph.claim(issue, L0.InstanceOf, null, ISSUE.Issue);\r
         graph.claim(issue, ISSUE.HasIssueContext, null, variable);\r
-        graph.claim(issue, ISSUE.HasSeverity, ISSUE.Severity_Error);\r
+        graph.claim(issue, ISSUE.HasSeverity, ISSUE.Severity_Warning);\r
         graph.claimLiteral(issue, L0.HasLabel, label, Bindings.STRING);\r
         graph.claimLiteral(issue, L0.HasName, UUID.randomUUID().toString(), Bindings.STRING);\r
         DateFormat format = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");\r