]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
DnD support to AxisAndVariablesExplorer
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 1 Dec 2011 13:52:45 +0000 (13:52 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 1 Dec 2011 13:52:45 +0000 (13:52 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@23386 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ontology/graph.tg
org.simantics.sysdyn.ontology/graph/ChartAxisAndVariablesViewpoint.pgraph
org.simantics.sysdyn.ontology/src/org/simantics/sysdyn/SysdynResource.java
org.simantics.sysdyn.ui/adapters.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/newComponents/NewChartHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/graphexplorer/AxisDropAction.java [new file with mode: 0644]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/graphexplorer/SeriesDropAction.java [moved from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/graphexplorer/DropAction.java with 70% similarity]

index 4dbbefac4e9ca21a63b1c48226f5e55f2aaa1729..acca8d8fa04c639e2af53d7facf25013f3d63094 100644 (file)
Binary files a/org.simantics.sysdyn.ontology/graph.tg and b/org.simantics.sysdyn.ontology/graph.tg differ
index e5c72a0cac1b8aef2672e28f8fde243d174a1377..9d3c5e9aa44053d85f978f1cf8119d1c545a75af 100644 (file)
@@ -27,8 +27,10 @@ CBC
     @VP.customLabelRule             JFREE.Series        CBC.SeriesLabelRule\r
     \r
 CBC\r
-    @VP.dropActionContribution JFREE.Axis ACTIONS.DropAction 1.0    \r
-    @VP.dropActionContribution JFREE.Series ACTIONS.DropAction 1.0        \r
+    @VP.dropActionContribution JFREE.Axis ACTIONS.SeriesDropAction 1.0    \r
+    @VP.dropActionContribution JFREE.Series ACTIONS.SeriesDropAction 1.0      \r
+    @VP.dropActionContribution JFREE.Axis ACTIONS.AxisDropAction 2.0    \r
+    @VP.dropActionContribution JFREE.Series ACTIONS.AxisDropAction 2.0          \r
     \r
 CBC\r
     VP.BrowseContext.HasVisualsContribution _ : VP.VisualsContribution\r
@@ -40,4 +42,5 @@ CBC
    \r
     \r
 ACTIONS = CAC.Actions : L0.Library\r
-ACTIONS.DropAction : ACT.DropAction    
\ No newline at end of file
+ACTIONS.SeriesDropAction : ACT.DropAction    \r
+ACTIONS.AxisDropAction : ACT.DropAction    
\ No newline at end of file
index bcebfbec6d8a68724d8eafdd435d5be72816e043..4ce26dbd916fb53a52efdd2d6fb74385ae9f7e13 100644 (file)
@@ -48,7 +48,8 @@ public class SysdynResource {
     public final Resource Center;\r
     public final Resource ChartAxisAndVariablesActionContext;\r
     public final Resource ChartAxisAndVariablesActionContext_Actions;\r
-    public final Resource ChartAxisAndVariablesActionContext_Actions_DropAction;\r
+    public final Resource ChartAxisAndVariablesActionContext_Actions_AxisDropAction;\r
+    public final Resource ChartAxisAndVariablesActionContext_Actions_SeriesDropAction;\r
     public final Resource ChartAxisAndVariablesBrowseContext;\r
     public final Resource ChartAxisAndVariablesBrowseContext_AxisChildRule;\r
     public final Resource ChartAxisAndVariablesBrowseContext_AxisLabelRule;\r
@@ -319,7 +320,8 @@ public class SysdynResource {
         public static final String Center = "http://www.simantics.org/Sysdyn-1.1/Center";\r
         public static final String ChartAxisAndVariablesActionContext = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesActionContext";\r
         public static final String ChartAxisAndVariablesActionContext_Actions = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesActionContext/Actions";\r
-        public static final String ChartAxisAndVariablesActionContext_Actions_DropAction = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesActionContext/Actions/DropAction";\r
+        public static final String ChartAxisAndVariablesActionContext_Actions_AxisDropAction = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesActionContext/Actions/AxisDropAction";\r
+        public static final String ChartAxisAndVariablesActionContext_Actions_SeriesDropAction = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesActionContext/Actions/SeriesDropAction";\r
         public static final String ChartAxisAndVariablesBrowseContext = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesBrowseContext";\r
         public static final String ChartAxisAndVariablesBrowseContext_AxisChildRule = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesBrowseContext/AxisChildRule";\r
         public static final String ChartAxisAndVariablesBrowseContext_AxisLabelRule = "http://www.simantics.org/Sysdyn-1.1/ChartAxisAndVariablesBrowseContext/AxisLabelRule";\r
@@ -600,7 +602,8 @@ public class SysdynResource {
         Center = getResourceOrNull(graph, URIs.Center);\r
         ChartAxisAndVariablesActionContext = getResourceOrNull(graph, URIs.ChartAxisAndVariablesActionContext);\r
         ChartAxisAndVariablesActionContext_Actions = getResourceOrNull(graph, URIs.ChartAxisAndVariablesActionContext_Actions);\r
-        ChartAxisAndVariablesActionContext_Actions_DropAction = getResourceOrNull(graph, URIs.ChartAxisAndVariablesActionContext_Actions_DropAction);\r
+        ChartAxisAndVariablesActionContext_Actions_AxisDropAction = getResourceOrNull(graph, URIs.ChartAxisAndVariablesActionContext_Actions_AxisDropAction);\r
+        ChartAxisAndVariablesActionContext_Actions_SeriesDropAction = getResourceOrNull(graph, URIs.ChartAxisAndVariablesActionContext_Actions_SeriesDropAction);\r
         ChartAxisAndVariablesBrowseContext = getResourceOrNull(graph, URIs.ChartAxisAndVariablesBrowseContext);\r
         ChartAxisAndVariablesBrowseContext_AxisChildRule = getResourceOrNull(graph, URIs.ChartAxisAndVariablesBrowseContext_AxisChildRule);\r
         ChartAxisAndVariablesBrowseContext_AxisLabelRule = getResourceOrNull(graph, URIs.ChartAxisAndVariablesBrowseContext_AxisLabelRule);\r
index bde90b0872d179f1299751404b4cbad8b56ac101..658f0808f33b194f73ac2030d68132ac1e4bbc80 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-0.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r     <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-0.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-0.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-0.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-0.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-0.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-0.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-0.0/StockSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r                       class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r                    class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r             <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r                   class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r                        class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.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-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />\r        <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />            \r        <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowConnectionFactory">\r            <graph/>\r        </type>                       \r                       \r               <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-0.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-0.0/HasConnector" />\r   <resource uri="http://www.simantics.org/Diagram-0.0/HasPlainConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>none 0</string>\r       </resource>\r    <resource uri="http://www.simantics.org/Diagram-0.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-0.0/ProjectBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>     \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisChildRule"/>     \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/VariableChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.VariableChildRule"/>        \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/>         \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisLabelRule"/>                  \r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/OpenWorkbook"\r            class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" />            \r    </target>         \r    \r   <target interface="org.simantics.db.layer0.adapter.DropActionFactory">\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/DropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.DropAction" />\r    </target>     \r  \r  <!-- PROFILES -->\r    <target interface="org.simantics.scenegraph.profile.Style">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/SimulationPlaybackStyle"\r            class="org.simantics.sysdyn.ui.elements2.profiles.SimulationPlaybackStyle">\r        </resource>\r                <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r            class="org.simantics.sysdyn.ui.elements2.profiles.IssueDecorationStyle">\r        </resource>\r    </target>\r    \r  <!-- Charts -->\r    <target interface="org.simantics.sysdyn.ui.trend.chart.IJFreeChart">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/Chart"\r            class="org.simantics.sysdyn.ui.trend.chart.JFreeChart">\r            <graph />\r            <this />\r        </type>\r    </target>  \r    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IDataset">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYDataset"\r            class="org.simantics.sysdyn.ui.trend.chart.XYDataset">\r            <graph />\r            <this />\r        </type>\r    </target>\r    \r     <target interface="org.simantics.sysdyn.ui.trend.chart.ITitle">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/TextTitle"\r            class="org.simantics.sysdyn.ui.trend.chart.TextTitle">\r            <graph />\r            <this />\r        </type>\r    </target>\r    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IAxis">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r            class="org.simantics.sysdyn.ui.trend.chart.NumberAxis">\r            <graph />\r            <this />\r        </type>\r    </target>\r       \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IPlot">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYPlot"\r            class="org.simantics.sysdyn.ui.trend.chart.XYPlot">\r            <graph />\r            <this />\r        </type>\r    </target>\r       \r
+<adapters>\r\r   <target interface="org.simantics.db.layer0.adapter.Realization">\r               <type uri="http://www.simantics.org/Sysdyn-0.0/Module"\r                 class="org.simantics.structural2.realization.StructuralRealization">\r                   <this />\r               </type>\r        </target>\r\r     <target interface="org.simantics.layer0.utils.triggers.ITrigger">\r      <type uri = "http://www.simantics.org/Sysdyn-0.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-0.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-0.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-0.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-0.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-0.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-0.0/StockSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r                       class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <resource uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r                    class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <resource uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <resource uri="http://www.simantics.org/Sysdyn-0.0/InputSymbol"\r                        class="org.simantics.sysdyn.ui.elements2.InputFactory" />\r\r             <type uri="http://www.simantics.org/Sysdyn-0.0/StockSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.StockFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/ModuleSymbol"\r                   class="org.simantics.sysdyn.ui.elements2.ModuleFactory" />\r             <type uri="http://www.simantics.org/Sysdyn-0.0/ValveSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.ValveFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.0/AuxiliarySymbol"\r                        class="org.simantics.sysdyn.ui.elements2.AuxiliaryFactory" />\r          <type uri="http://www.simantics.org/Sysdyn-0.0/CloudSymbol"\r                    class="org.simantics.sysdyn.ui.elements2.CloudFactory" />\r              <type uri="http://www.simantics.org/Sysdyn-0.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-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />\r        <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowEdgeFactory" />            \r        <type uri="http://www.simantics.org/Sysdyn-0.0/FlowConnection"\r            class="org.simantics.sysdyn.ui.elements2.connections.RouteFlowConnectionFactory">\r            <graph/>\r        </type>                       \r                       \r               <resource uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r                       class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-0.0/DependencyConnection"\r                   class="org.simantics.sysdyn.ui.elements2.connections.DependencyEdgeFactory" />\r         <type uri="http://www.simantics.org/Sysdyn-0.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-0.0/HasConnector" />\r   <resource uri="http://www.simantics.org/Diagram-0.0/HasPlainConnector"\r          class="org.simantics.diagram.content.ArrowConfigurer">\r         <string>none 0</string>\r       </resource>\r    <resource uri="http://www.simantics.org/Diagram-0.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-0.0/ProjectBrowseContext/ModuleTypeChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleTypeChildRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleContentChildRule"\r            class="org.simantics.sysdyn.ui.browser.childrules.ModuleContentChildRule"/>     \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisChildRule"/>     \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/VariableChildRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.VariableChildRule"/>        \r    </target>\r    \r    <target interface="org.simantics.browsing.ui.model.visuals.VisualsRule">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectBrowseContext/ModuleTypeLabelRule"\r            class="org.simantics.sysdyn.ui.browser.labelrules.ModuleTypeLabelRule"/>\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/SeriesLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesLabelRule"/>         \r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesBrowseContext/AxisLabelRule"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisLabelRule"/>                  \r    </target>    \r    \r    <target interface="org.simantics.db.layer0.adapter.ActionFactory">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewModuleType"\r            class="org.simantics.sysdyn.ui.browser.actions.NewModuleTypeAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewEnumeration"\r            class="org.simantics.sysdyn.ui.browser.actions.NewEnumerationAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/OpenWorkbook"\r            class="org.simantics.sysdyn.ui.browser.actions.OpenWorkbookAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunction"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewFunctionLibraryAction" />\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/ProjectActionContext/Actions/NewSharedFunctionLibrary"\r            class="org.simantics.sysdyn.ui.browser.actions.NewSharedFunctionLibraryAction" />            \r    </target>         \r    \r   <target interface="org.simantics.db.layer0.adapter.DropActionFactory">\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/SeriesDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.SeriesDropAction" />\r        <resource\r            uri="http://www.simantics.org/Sysdyn-0.0/ChartAxisAndVariablesActionContext/Actions/AxisDropAction"\r            class="org.simantics.sysdyn.ui.trend.chart.graphexplorer.AxisDropAction" />            \r    </target>     \r  \r  <!-- PROFILES -->\r    <target interface="org.simantics.scenegraph.profile.Style">\r        <resource uri="http://www.simantics.org/Sysdyn-0.0/SimulationPlaybackStyle"\r            class="org.simantics.sysdyn.ui.elements2.profiles.SimulationPlaybackStyle">\r        </resource>\r                <resource uri="http://www.simantics.org/Sysdyn-0.0/IssueStyle"\r            class="org.simantics.sysdyn.ui.elements2.profiles.IssueDecorationStyle">\r        </resource>\r    </target>\r    \r  <!-- Charts -->\r    <target interface="org.simantics.sysdyn.ui.trend.chart.IJFreeChart">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/Chart"\r            class="org.simantics.sysdyn.ui.trend.chart.JFreeChart">\r            <graph />\r            <this />\r        </type>\r    </target>  \r    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IDataset">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYDataset"\r            class="org.simantics.sysdyn.ui.trend.chart.XYDataset">\r            <graph />\r            <this />\r        </type>\r    </target>\r    \r     <target interface="org.simantics.sysdyn.ui.trend.chart.ITitle">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/TextTitle"\r            class="org.simantics.sysdyn.ui.trend.chart.TextTitle">\r            <graph />\r            <this />\r        </type>\r    </target>\r    \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IAxis">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/NumberAxis"\r            class="org.simantics.sysdyn.ui.trend.chart.NumberAxis">\r            <graph />\r            <this />\r        </type>\r    </target>\r       \r    <target interface="org.simantics.sysdyn.ui.trend.chart.IPlot">\r        <type uri="http://www.simantics.org/JFreeChart-1.0/XYPlot"\r            class="org.simantics.sysdyn.ui.trend.chart.XYPlot">\r            <graph />\r            <this />\r        </type>\r    </target>\r       \r
 </adapters>
\ No newline at end of file
index 3bf1b9a7845fc29bb0bb682abfb736e4b5a7ace5..85d44c57fa107d9a7c670c06f617f91ecffc19d7 100644 (file)
@@ -78,10 +78,10 @@ public class NewChartHandler extends AbstractHandler {
 \r
                 Resource domainAxis = GraphUtils.create2(g, jfree.NumberAxis,\r
                         l0.HasName, "NumberAxis" + UUID.randomUUID().toString(),\r
-                        l0.HasLabel, "domain");\r
+                        l0.HasLabel, "Domain");\r
                 Resource rangeAxis = GraphUtils.create2(g, jfree.NumberAxis,\r
                         l0.HasName, "NumberAxis" + UUID.randomUUID().toString(),\r
-                        l0.HasLabel, "range");\r
+                        l0.HasLabel, "Range");\r
 \r
                 Resource dataset = GraphUtils.create2(g, jfree.XYDataset,\r
                         l0.HasName, "XYDataset" + UUID.randomUUID().toString(),\r
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/graphexplorer/AxisDropAction.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/graphexplorer/AxisDropAction.java
new file mode 100644 (file)
index 0000000..7d3872c
--- /dev/null
@@ -0,0 +1,104 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 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.trend.chart.graphexplorer;\r
+\r
+import java.util.List;\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.common.utils.ListUtils;\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.layer0.adapter.DropActionFactory;\r
+import org.simantics.layer0.Layer0;\r
+import org.simantics.sysdyn.JFreeChartResource;\r
+import org.simantics.sysdyn.ui.trend.chart.properties.AxisAndVariablesExplorerComposite;\r
+import org.simantics.ui.SimanticsUI;\r
+import org.simantics.ui.utils.AdaptionUtils;\r
+\r
+/**\r
+ * Action for dropping axis on top of other axis or series in {@link AxisAndVariablesExplorerComposite}\r
+ * @author Teemu Lempinen\r
+ *\r
+ */\r
+public class AxisDropAction  implements DropActionFactory {\r
+\r
+    @Override\r
+    public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException {\r
+        // Make sure that both target and source are resources\r
+        Resource t = AdaptionUtils.adaptToSingle(target, Resource.class);\r
+        Resource s = AdaptionUtils.adaptToSingle(source, Resource.class);\r
+        \r
+        if(t == null || s == null)\r
+            return null;\r
+        \r
+        // Make sure that source and target are of correct type\r
+        JFreeChartResource jfree = JFreeChartResource.getInstance(g);\r
+        if(!g.isInstanceOf(s, jfree.Axis))\r
+            return null;\r
+        if(!g.isInstanceOf(t, jfree.Series) && !g.isInstanceOf(t, jfree.Axis))\r
+            return null;\r
+        \r
+        return getRunnable(t, s);\r
+    }\r
+\r
+    /**\r
+     * Get the runnable for doing the drop action \r
+     * \r
+     * @param t target resource\r
+     * @param s source resource\r
+     * @return Runnable\r
+     */\r
+    private Runnable getRunnable(final Resource t, final Resource s) {\r
+        Runnable runnable = new Runnable() {\r
+\r
+            @Override\r
+            public void run() {\r
+                SimanticsUI.getSession().asyncRequest(new WriteRequest() {\r
+\r
+                    @Override\r
+                    public void perform(WriteGraph graph) throws DatabaseException {\r
+                        if(t == null || s == null) return;\r
+                        JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
+                        Layer0 l0 = Layer0.getInstance(graph);\r
+                        Resource target = t;\r
+                        Resource source = s;\r
+                        \r
+                        // Dragged axis always exists in the same list with target axis, so it is safe to get the target index\r
+                        Resource plot = graph.getPossibleObject(source, l0.PartOf);\r
+                        Resource axisListResource = graph.getPossibleObject(plot, jfree.Plot_rangeAxisList);\r
+                        List<Resource> axisList = ListUtils.toList(graph, axisListResource);\r
+                        if(graph.isInstanceOf(target, jfree.Series)) {\r
+                            // Dropped a axis over a series -> get the axis of the series\r
+                            Resource dataset = graph.getPossibleObject(target, l0.PartOf);\r
+                            target = graph.getPossibleObject(dataset, jfree.Dataset_mapToRangeAxis);\r
+                        }\r
+                        \r
+                        // move axis to target position\r
+                        int targetIndex = axisList.indexOf(target);\r
+                        axisList.remove(source);\r
+                        axisList.add(targetIndex, source);\r
+                        \r
+                        // Update the range axis list\r
+                        graph.deny(plot, jfree.Plot_rangeAxisList);\r
+                        axisListResource = ListUtils.create(graph, axisList);\r
+                        graph.claim(plot, jfree.Plot_rangeAxisList, axisListResource);\r
+                    }\r
+\r
+                });\r
+            }\r
+        };\r
+        return runnable;\r
+    }\r
+\r
+}\r
similarity index 70%
rename from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/graphexplorer/DropAction.java
rename to org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/chart/graphexplorer/SeriesDropAction.java
index 7cb33bf40eb181ffb39c27c89ab2cdbeb3de5076..e0bd0d6345512b032d6a9eb25f0244c37d7a96d2 100644 (file)
@@ -12,6 +12,7 @@
 package org.simantics.sysdyn.ui.trend.chart.graphexplorer;\r
 \r
 import java.util.Collections;\r
+import java.util.List;\r
 \r
 import org.simantics.db.ReadGraph;\r
 import org.simantics.db.Resource;\r
@@ -29,21 +30,30 @@ import org.simantics.ui.utils.AdaptionUtils;
 \r
 /**\r
  * Drop action for explorer in {@link ChartAxisAndVariablesTab}. This action is used for dropping \r
- * both series and axis on top of each others.\r
+ * both series on axis or another sries\r
  * \r
  * @author Teemu Lempinen\r
  *\r
  */\r
-public class DropAction implements DropActionFactory {\r
+public class SeriesDropAction implements DropActionFactory {\r
 \r
     @Override\r
     public Runnable create(ReadGraph g, Object target, Object source) throws DatabaseException {\r
         // Make sure that both target and source are resources\r
         Resource t = AdaptionUtils.adaptToSingle(target, Resource.class);\r
         Resource s = AdaptionUtils.adaptToSingle(source, Resource.class);\r
-        if(t != null && s != null)\r
-            return getRunnable(t, s);\r
-        return null;\r
+        \r
+        if(t == null || s == null)\r
+            return null;\r
+        \r
+        // Make sure that source and target are of correct type\r
+        JFreeChartResource jfree = JFreeChartResource.getInstance(g);\r
+        if(!g.isInstanceOf(s, jfree.Series))\r
+            return null;\r
+        if(!g.isInstanceOf(t, jfree.Series) && !g.isInstanceOf(t, jfree.Axis))\r
+            return null;\r
+        \r
+        return getRunnable(t, s);\r
     }\r
 \r
     /**\r
@@ -67,26 +77,28 @@ public class DropAction implements DropActionFactory {
                         Layer0 l0 = Layer0.getInstance(graph);\r
                         Resource target = t;\r
                         Resource source = s;\r
+                        Resource droppedOnSeries = null;\r
 \r
                         // Dropped a series over a series -> get target dataset\r
-                        if(graph.isInstanceOf(target, jfree.Series) && graph.isInstanceOf(source, jfree.Series)) {\r
+                        if(graph.isInstanceOf(target, jfree.Series)) {\r
+                            droppedOnSeries = target;\r
                             Resource dataset = graph.getPossibleObject(target, l0.PartOf);\r
                             if(dataset != null)\r
                                 target = dataset;\r
                         }\r
 \r
                         // Dropped a series over an axis -> get target dataset\r
-                        if(graph.isInstanceOf(target, jfree.Axis) && graph.isInstanceOf(source, jfree.Series)) {\r
+                        if(graph.isInstanceOf(target, jfree.Axis)) {\r
                             Resource dataset = graph.syncRequest(new PossibleObjectWithType(target, jfree.Dataset_mapToRangeAxis_Inverse, jfree.Dataset));\r
                             if(dataset != null)\r
                                 target = dataset;\r
                         }\r
 \r
                         // Move series to a dataset\r
-                        if(graph.isInstanceOf(target, jfree.Dataset) && graph.isInstanceOf(source, jfree.Series)) {\r
-                            // Remove from old dataset\r
+                        if(graph.isInstanceOf(target, jfree.Dataset)) {\r
+                            // Remove from old dataset if it was different than the new one\r
                             Resource sourceDataset = graph.getPossibleObject(source, l0.PartOf);\r
-                            if(sourceDataset != null) {\r
+                            if(sourceDataset != null && !sourceDataset.equals(target)) {\r
                                 Resource sourceSeriesList = graph.getPossibleObject(sourceDataset, jfree.Dataset_seriesList);\r
                                 if(sourceSeriesList != null)\r
                                     ListUtils.removeElement(graph, sourceSeriesList, source);\r
@@ -99,13 +111,24 @@ public class DropAction implements DropActionFactory {
                                 targetSeriesList = ListUtils.create(graph, Collections.<Resource>emptyList());\r
                                 graph.claim(target, jfree.Dataset_seriesList, targetSeriesList);\r
                             }\r
-                            \r
-                            ListUtils.insertBack(graph, targetSeriesList, Collections.singleton(source));\r
-                            \r
+\r
+\r
+                            // Series was dropped on another series. Move the dropped series to that place and recreate the list\r
+                            if(droppedOnSeries != null) {\r
+                                List<Resource> list = ListUtils.toList(graph, targetSeriesList);\r
+                                int targetIndex = list.indexOf(droppedOnSeries);\r
+                                if(list.contains(source))\r
+                                    list.remove(source);\r
+                                list.add(targetIndex, source);\r
+                                graph.deny(target, jfree.Dataset_seriesList);\r
+                                targetSeriesList = ListUtils.create(graph, list);\r
+                                graph.claim(target, jfree.Dataset_seriesList, targetSeriesList);\r
+                            } else {\r
+                                ListUtils.insertFront(graph, targetSeriesList, Collections.singleton(source));\r
+                            }\r
+\r
                             graph.claim(target, l0.ConsistsOf, source);\r
                         }\r
-\r
-                        // TODO: Change the order of axis and series\r
                     }\r
                 });\r
             }\r