]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
refs #5090
authorjsimomaa <jsimomaa@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 11 Jul 2014 10:37:04 +0000 (10:37 +0000)
committerjsimomaa <jsimomaa@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 11 Jul 2014 10:37:04 +0000 (10:37 +0000)
Add Default constructor, hashCode() and equals() methods to LabelPropertyTabContributor so that ComparableTabContributor comparison works correctly

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

13 files changed:
org.simantics.jfreechart/src/org/simantics/jfreechart/ChartSelectionTabContributor.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/AdjustableTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/ChartTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/LabelPropertyTabContributor.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarAxisTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarGeneralPropertiesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarSeriesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarSeriesTab2.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/pie/PieGeneralPropertiesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/pie/PieSeriesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/pie/PieSeriesTab2.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineAxisAndVariablesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineGeneralPropertiesTab.java

index f8b0d764f6b0e825173331fdb78915c88662a896..df95e7144a3e43bacf2771df66f9da31582b96b9 100644 (file)
@@ -41,46 +41,46 @@ public class ChartSelectionTabContributor {
 \r
                  if(backend.isInstanceOf(plot, jfree.XYPlot)) {\r
                      tabs.add(new ComparableTabContributor(\r
-                             new XYLineGeneralPropertiesTab(),\r
+                             new XYLineGeneralPropertiesTab(r),\r
                              10,\r
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new XYLineAxisAndVariablesTab(),\r
+                             new XYLineAxisAndVariablesTab(r),\r
                              9,\r
                              r,\r
                              "Axis and Variables"));\r
                  } else if(backend.isInstanceOf(plot, jfree.CategoryPlot)) {\r
                      tabs.add(new ComparableTabContributor(\r
-                             new BarGeneralPropertiesTab(options),\r
+                             new BarGeneralPropertiesTab(r, options),\r
                              10,\r
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new BarSeriesTab(options),\r
+                             new BarSeriesTab(r, options),\r
                              9,\r
                              r,\r
                              "Variables"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new BarAxisTab(),\r
+                             new BarAxisTab(r),\r
                              8,\r
                              r,\r
                              "Axis"));                        \r
                  } else if(backend.isInstanceOf(plot, jfree.PiePlot)) {\r
                      tabs.add(new ComparableTabContributor(\r
-                             new PieGeneralPropertiesTab(options),\r
+                             new PieGeneralPropertiesTab(r, options),\r
                              10,\r
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new PieSeriesTab(options),\r
+                             new PieSeriesTab(r, options),\r
                              9,\r
                              r,\r
                              "Variables"));\r
                  }\r
 \r
                  tabs.add(new ComparableTabContributor(\r
-                         new ChartTab(),\r
+                         new ChartTab(r),\r
                          1,\r
                          r,\r
                          "Chart"));\r
@@ -110,46 +110,46 @@ public class ChartSelectionTabContributor {
 \r
                  if(backend.isInstanceOf(plot, jfree.XYPlot)) {\r
                      tabs.add(new ComparableTabContributor(\r
-                             new XYLineGeneralPropertiesTab(),\r
+                             new XYLineGeneralPropertiesTab(r),\r
                              10,\r
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new XYLineAxisAndVariablesTab(),\r
+                             new XYLineAxisAndVariablesTab(r),\r
                              9,\r
                              r,\r
                              "Axis and Variables"));\r
                  } else if(backend.isInstanceOf(plot, jfree.CategoryPlot)) {\r
                      tabs.add(new ComparableTabContributor(\r
-                             new BarGeneralPropertiesTab(options),\r
+                             new BarGeneralPropertiesTab(r, options),\r
                              10,\r
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new BarSeriesTab2(options),\r
+                             new BarSeriesTab2(r, options),\r
                              9,\r
                              r,\r
                              "Variables"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new BarAxisTab(),\r
+                             new BarAxisTab(r),\r
                              8,\r
                              r,\r
                              "Axis"));                        \r
                  } else if(backend.isInstanceOf(plot, jfree.PiePlot)) {\r
                      tabs.add(new ComparableTabContributor(\r
-                             new PieGeneralPropertiesTab(options),\r
+                             new PieGeneralPropertiesTab(r, options),\r
                              10,\r
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new PieSeriesTab2(options),\r
+                             new PieSeriesTab2(r, options),\r
                              9,\r
                              r,\r
                              "Variables"));\r
                  }\r
 \r
                  tabs.add(new ComparableTabContributor(\r
-                         new ChartTab(),\r
+                         new ChartTab(r),\r
                          1,\r
                          r,\r
                          "Chart"));\r
index 7fffd394d5ecc2ee2e4d121229288b32e2fb9dd2..a0f8308ddaa5ff8049a0d0d1e6f1ab69edb6d6c3 100644 (file)
@@ -32,6 +32,10 @@ public abstract class AdjustableTab extends LabelPropertyTabContributor {
        private static final int WIDE_SCREEN_WIDTH = 1100;\r
        protected Composite composite;\r
        \r
+       public AdjustableTab(Object id) {\r
+           super(id);\r
+       }\r
+       \r
        @Override\r
        public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport _support) {\r
                // Get size of the available area.\r
index d8d20f0e7242946018641856e812d92406e4cb30..1135348d6dd5ac8c74489835ee12566195d3e0ce 100644 (file)
@@ -28,6 +28,10 @@ import org.simantics.utils.ui.AdaptionUtils;
  */\r
 public class ChartTab extends LabelPropertyTabContributor implements Widget {\r
 \r
+    public ChartTab(Object id) {\r
+        super(id);\r
+    }\r
+\r
     private Composite parent;\r
 \r
     @Override\r
index 8c0441c48b42ee73c745a9d6f30665d51d51aa9d..14b57a98f0f5028b13a3e3c232e1b6f8f250a283 100644 (file)
@@ -24,6 +24,13 @@ import org.simantics.utils.ui.AdaptionUtils;
 \r
 public abstract class LabelPropertyTabContributor extends PropertyTabContributorImpl {\r
 \r
+    private final Object id;\r
+    \r
+    public LabelPropertyTabContributor(Object id) {\r
+        assert (id != null);\r
+        this.id = id;\r
+    }\r
+    \r
     @Override\r
     public Read<String> getPartNameReadRequest(final ISelection forSelection) {\r
 \r
@@ -63,4 +70,21 @@ public abstract class LabelPropertyTabContributor extends PropertyTabContributor
         \r
     }\r
 \r
+    @Override\r
+    public int hashCode() {\r
+        return id.hashCode();\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object obj) {\r
+        if (this == obj)\r
+            return true;\r
+        if (obj == null)\r
+            return false;\r
+        if (getClass() != obj.getClass())\r
+            return false;\r
+        LabelPropertyTabContributor other = (LabelPropertyTabContributor) obj;\r
+        return id.equals(other.id);\r
+    }\r
+\r
 }\r
index 38f7d21ef28223ba58ca4dc91ff8390149e4c915..9bb9ade9ab9ae920d8255b5dfeb59f5ba60ac519 100644 (file)
@@ -61,6 +61,10 @@ import org.simantics.utils.ui.AdaptionUtils;
  */\r
 public class BarAxisTab extends AdjustableTab implements Widget {\r
 \r
+    public BarAxisTab(Object id) {\r
+        super(id);\r
+    }\r
+\r
     private TrackedSpinner angle;\r
     private Integer angleInt = null;\r
     private WidgetSupportImpl domainAxisSupport = new WidgetSupportImpl();\r
index 370d14dc3f26b8e284d8417348878706de4162e8..79bdf9229a93f81c1979a01c6ec07e8c2028f829 100644 (file)
@@ -90,11 +90,8 @@ public class BarGeneralPropertiesTab extends AdjustableTab {
        private TrackedText fraction;\r
        private Point size;\r
     \r
-    public BarGeneralPropertiesTab() {\r
-       \r
-    }\r
-    \r
-    public BarGeneralPropertiesTab(int options) {\r
+    public BarGeneralPropertiesTab(Object id, int options) {\r
+        super(id);\r
        showTime = ((options & ChartPropertyOptions.SHOW_TIME) > 0); \r
        showFilter = ((options & ChartPropertyOptions.SHOW_FILTER) > 0);\r
     }\r
index 5a9c55a25fd158f91f01c38e4e19d83abf816b39..9d9ca5c67120a45c72c659bd66130953c856c4fc 100644 (file)
@@ -63,7 +63,8 @@ public class BarSeriesTab extends AdjustableTab implements Widget {
     private int options;\r
        private Composite buttonComposite;\r
 \r
-    public BarSeriesTab(int options) {\r
+    public BarSeriesTab(Object id, int options) {\r
+        super(id);\r
         additionalSupport = new WidgetSupportImpl();\r
         this.options = options;\r
     }\r
index 24076dda6460b6f7387937744ac1845aecf30de9..cff6d719fee8f9347e25040c4d543fdb5d666d98 100644 (file)
@@ -66,7 +66,8 @@ public class BarSeriesTab2 extends LabelPropertyTabContributor implements Widget
     private BarSeriesPropertyComposite2 spc;\r
     private int options;\r
 \r
-    public BarSeriesTab2(int options) {\r
+    public BarSeriesTab2(Object id, int options) {\r
+        super(id);\r
         additionalSupport = new WidgetSupportImpl();\r
         this.options = options;\r
     }\r
index 3185932ae240aee9f37fd8f8186fc363fa79debc..75ee2a6285aadfd7862192ca09b9fdc544afe765 100644 (file)
@@ -72,11 +72,8 @@ public class PieGeneralPropertiesTab extends AdjustableTab {
        private TrackedText fraction;\r
        private Point size;\r
     \r
-    public PieGeneralPropertiesTab() {\r
-       \r
-    }\r
-    \r
-    public PieGeneralPropertiesTab(int options) {\r
+    public PieGeneralPropertiesTab(Object id, int options) {\r
+        super(id);\r
        showTime = ((options & ChartPropertyOptions.SHOW_TIME) > 0); \r
        showFilter = ((options & ChartPropertyOptions.SHOW_FILTER) > 0);\r
     }\r
index d5cf346a84280367fbfbb69943cbd7c367d5a7ae..5fbb53c1dd5c50b2c3ef7c98123bd51e55eb82b5 100644 (file)
@@ -62,7 +62,8 @@ public class PieSeriesTab extends AdjustableTab implements Widget {
     private int options;\r
        private Composite buttonComposite;\r
     \r
-    public PieSeriesTab(int options) {\r
+    public PieSeriesTab(Object id, int options) {\r
+        super(id);\r
         additionalSupport = new WidgetSupportImpl();\r
         this.options = options;\r
     }\r
index 7103b6f8a2ffaf52dba7a57bf0aaf5d257ec217a..8d54eb5c7e7d5f1a4db3250615533b396d11430e 100644 (file)
@@ -65,7 +65,8 @@ public class PieSeriesTab2 extends LabelPropertyTabContributor implements Widget
     private Resource chartResource;\r
     private int options;\r
 \r
-    public PieSeriesTab2(int options) {\r
+    public PieSeriesTab2(Object id, int options) {\r
+        super(id);\r
         additionalSupport = new WidgetSupportImpl();\r
         this.options = options;\r
     }\r
index 98d7107e27a4409161123876c8c7b1ea780a4c8f..ea2714ec4bec3bbe2ece69b48da426b42a16d1cd 100644 (file)
@@ -65,7 +65,8 @@ public class XYLineAxisAndVariablesTab extends AdjustableTab {
     private WidgetSupportImpl additionalSupport;\r
        private Composite buttonComposite;\r
 \r
-    public XYLineAxisAndVariablesTab() {\r
+    public XYLineAxisAndVariablesTab(Object id) {\r
+        super(id);\r
         additionalSupport = new WidgetSupportImpl();\r
     }\r
 \r
index 81581d1401af3fa9abe9294032ad1504a3f1808e..3521025b39b29e0f341bfdaa5a4ceb8c1320da30 100644 (file)
@@ -71,6 +71,10 @@ import org.simantics.utils.ui.AdaptionUtils;
  */\r
 public class XYLineGeneralPropertiesTab extends AdjustableTab implements Widget {\r
 \r
+    public XYLineGeneralPropertiesTab(Object id) {\r
+        super(id);\r
+    }\r
+\r
     private ScrolledComposite sc;\r
     private TrackedText name, title, xlabel, xvariable, xmin, xmax;\r
     private TrackedCombo type;\r