]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
fixes #4377
authorluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 5 Jul 2013 09:58:53 +0000 (09:58 +0000)
committerluukkainen <luukkainen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 5 Jul 2013 09:58:53 +0000 (09:58 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27685 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.jfreechart/src/org/simantics/jfreechart/ChartSelectionTabContributor.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarSeriesPropertyComposite.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarSeriesPropertyComposite2.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/PieSeriesPropertyComposite.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/pie/PieSeriesPropertyComposite2.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

index 4855f79352decf8d263cbca804df9d30ce67c0ab..f8b0d764f6b0e825173331fdb78915c88662a896 100644 (file)
@@ -57,7 +57,7 @@ public class ChartSelectionTabContributor {
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new BarSeriesTab(),\r
+                             new BarSeriesTab(options),\r
                              9,\r
                              r,\r
                              "Variables"));\r
@@ -73,7 +73,7 @@ public class ChartSelectionTabContributor {
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new PieSeriesTab(),\r
+                             new PieSeriesTab(options),\r
                              9,\r
                              r,\r
                              "Variables"));\r
@@ -126,7 +126,7 @@ public class ChartSelectionTabContributor {
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new BarSeriesTab2(),\r
+                             new BarSeriesTab2(options),\r
                              9,\r
                              r,\r
                              "Variables"));\r
@@ -142,7 +142,7 @@ public class ChartSelectionTabContributor {
                              r,\r
                              "General"));\r
                      tabs.add(new ComparableTabContributor(\r
-                             new PieSeriesTab2(),\r
+                             new PieSeriesTab2(options),\r
                              9,\r
                              r,\r
                              "Variables"));\r
index 94b15ee5b4909bc2c7e61194b3c04b8528c33c89..ca8777e2a144348d79dd0b44ebef5d7b68023217 100644 (file)
@@ -21,6 +21,7 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
 import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
 import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.ChartPropertyOptions;\r
 import org.simantics.jfreechart.chart.properties.DoubleValidator;\r
 import org.simantics.jfreechart.chart.properties.JFreeChartPropertyColorProvider;\r
 import org.simantics.jfreechart.chart.properties.RVIFactory;\r
@@ -41,7 +42,7 @@ public class BarSeriesPropertyComposite extends Composite {
     \r
     private TrackedText variable, label, time;\r
     \r
-    public BarSeriesPropertyComposite(Composite parent, final ISessionContext context, WidgetSupport support, int style) {\r
+    public BarSeriesPropertyComposite(Composite parent, final ISessionContext context, WidgetSupport support, int options, int style) {\r
         super(parent, style);\r
         \r
         GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);\r
@@ -79,19 +80,21 @@ public class BarSeriesPropertyComposite extends Composite {
         GridDataFactory.fillDefaults().grab(true, false).applyTo(this.label.getWidget());\r
         \r
         // Time\r
-        label = new Label(this, SWT.NONE);\r
-        GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
-        label.setText("Time:");\r
-        \r
-        Composite composite = new Composite(this, SWT.NONE);\r
-        GridDataFactory.fillDefaults().applyTo(composite);\r
-        GridLayoutFactory.fillDefaults().applyTo(composite);\r
-        \r
-        time = new org.simantics.browsing.ui.swt.widgets.TrackedText(composite, support, SWT.BORDER);\r
-        time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Series_time));\r
-        time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Series_time));\r
-        time.setInputValidator(new DoubleValidator(true));\r
-        time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
-        GridDataFactory.fillDefaults().applyTo(time.getWidget());\r
+        if ((options & ChartPropertyOptions.SHOW_TIME) > 0) {\r
+               label = new Label(this, SWT.NONE);\r
+               GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+               label.setText("Time:");\r
+               \r
+               Composite composite = new Composite(this, SWT.NONE);\r
+               GridDataFactory.fillDefaults().applyTo(composite);\r
+               GridLayoutFactory.fillDefaults().applyTo(composite);\r
+               \r
+               time = new org.simantics.browsing.ui.swt.widgets.TrackedText(composite, support, SWT.BORDER);\r
+               time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Series_time));\r
+               time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Series_time));\r
+               time.setInputValidator(new DoubleValidator(true));\r
+               time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
+               GridDataFactory.fillDefaults().applyTo(time.getWidget());\r
+        }\r
     }\r
 }\r
index ec2f1dc98aeb0e2700f45e7e53bd5d0a76907559..9cb7fdc2d0912ab6b8788be2c87ee005e28fb1bf 100644 (file)
@@ -23,6 +23,7 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
 import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
 import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.ChartPropertyOptions;\r
 import org.simantics.jfreechart.chart.properties.ChartVariable;\r
 import org.simantics.jfreechart.chart.properties.ChartVariableFactory;\r
 import org.simantics.jfreechart.chart.properties.ChartVariableModifier;\r
@@ -45,7 +46,7 @@ public class BarSeriesPropertyComposite2 extends Composite {
     private TrackedText label, time;\r
     private StringChooser<ChartVariable> variable;\r
     \r
-    public BarSeriesPropertyComposite2(Composite parent, final ISessionContext context, WidgetSupport support, Collection<ChartVariable> variables, int style) {\r
+    public BarSeriesPropertyComposite2(Composite parent, final ISessionContext context, WidgetSupport support, Collection<ChartVariable> variables, int options, int style) {\r
         super(parent, style);\r
         \r
         GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);\r
@@ -95,20 +96,22 @@ public class BarSeriesPropertyComposite2 extends Composite {
         this.label.setColorProvider(new JFreeChartPropertyColorProvider(this.label.getResourceManager()));\r
         GridDataFactory.fillDefaults().grab(true, false).applyTo(this.label.getWidget());\r
         \r
-        // Time\r
-        label = new Label(this, SWT.NONE);\r
-        GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
-        label.setText("Time:");\r
-        \r
-        Composite composite = new Composite(this, SWT.NONE);\r
-        GridDataFactory.fillDefaults().applyTo(composite);\r
-        GridLayoutFactory.fillDefaults().applyTo(composite);\r
-        \r
-        time = new org.simantics.browsing.ui.swt.widgets.TrackedText(composite, support, SWT.BORDER);\r
-        time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Series_time));\r
-        time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Series_time));\r
-        time.setInputValidator(new DoubleValidator(true));\r
-        time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
-        GridDataFactory.fillDefaults().applyTo(time.getWidget());\r
+        if ((options & ChartPropertyOptions.SHOW_TIME) > 0) {\r
+               // Time\r
+               label = new Label(this, SWT.NONE);\r
+               GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+               label.setText("Time:");\r
+               \r
+               Composite composite = new Composite(this, SWT.NONE);\r
+               GridDataFactory.fillDefaults().applyTo(composite);\r
+               GridLayoutFactory.fillDefaults().applyTo(composite);\r
+               \r
+               time = new org.simantics.browsing.ui.swt.widgets.TrackedText(composite, support, SWT.BORDER);\r
+               time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Series_time));\r
+               time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Series_time));\r
+               time.setInputValidator(new DoubleValidator(true));\r
+               time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
+               GridDataFactory.fillDefaults().applyTo(time.getWidget());\r
+        }\r
     }\r
 }\r
index 459d0b327c09d751e424fa794518377757a84ab1..7eb0462344da6f08b81610901470a4dfd616668c 100644 (file)
@@ -59,10 +59,11 @@ public class BarSeriesTab extends LabelPropertyTabContributor implements Widget
     private Button add, remove;\r
     private Resource chartResource;\r
     private BarSeriesPropertyComposite spc;\r
+    private int options;\r
 \r
-\r
-    public BarSeriesTab() {\r
+    public BarSeriesTab(int options) {\r
         additionalSupport = new WidgetSupportImpl();\r
+        this.options = options;\r
     }\r
 \r
     @Override\r
@@ -123,7 +124,7 @@ public class BarSeriesTab extends LabelPropertyTabContributor implements Widget
         for(Control child : propertyContainer.getChildren()) {\r
             child.dispose();\r
         }\r
-        spc = new BarSeriesPropertyComposite(propertyContainer, context, additionalSupport, SWT.NONE);\r
+        spc = new BarSeriesPropertyComposite(propertyContainer, context, additionalSupport, options,SWT.NONE);\r
 \r
         additionalSupport.fireInput(context, selection);\r
 \r
index fc555dbc601582f88b3187f4e803a0197bb05abf..4331f92d5f4089b83f9d17867858dedad880d41f 100644 (file)
@@ -65,10 +65,11 @@ public class BarSeriesTab2 extends LabelPropertyTabContributor implements Widget
     private Button add, remove;\r
     private Resource chartResource;\r
     private BarSeriesPropertyComposite2 spc;\r
+    private int options;\r
 \r
-\r
-    public BarSeriesTab2() {\r
+    public BarSeriesTab2(int options) {\r
         additionalSupport = new WidgetSupportImpl();\r
+        this.options = options;\r
     }\r
 \r
     @Override\r
@@ -134,7 +135,7 @@ public class BarSeriesTab2 extends LabelPropertyTabContributor implements Widget
         try {\r
                Collection<ChartVariable> variables = context.getSession().syncRequest(new AllVariablesOfModel(resource));\r
                \r
-               spc = new BarSeriesPropertyComposite2(propertyContainer, context, additionalSupport, variables, SWT.NONE);\r
+               spc = new BarSeriesPropertyComposite2(propertyContainer, context, additionalSupport, variables, options, SWT.NONE);\r
        \r
                additionalSupport.fireInput(context, selection);\r
        \r
index d2b149b001c16958af125a9954edf059c43cf3a9..1dd80e8deec47130b67625e5fb1abadc660f1b67 100644 (file)
@@ -22,6 +22,7 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
 import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
 import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.ChartPropertyOptions;\r
 import org.simantics.jfreechart.chart.properties.BooleanPropertyFactory;\r
 import org.simantics.jfreechart.chart.properties.BooleanSelectionListener;\r
 import org.simantics.jfreechart.chart.properties.ColorPicker;\r
@@ -45,7 +46,7 @@ public class PieSeriesPropertyComposite extends Composite {
     \r
     private TrackedText variable, label, time;\r
     \r
-    public PieSeriesPropertyComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
+    public PieSeriesPropertyComposite(Composite parent, ISessionContext context, WidgetSupport support, int options, int style) {\r
         super(parent, style);\r
         \r
         GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);\r
@@ -91,21 +92,22 @@ public class PieSeriesPropertyComposite extends Composite {
         GridDataFactory.fillDefaults().grab(true, false).applyTo(colorPicker);\r
 \r
         // Time\r
-        label = new Label(this, SWT.NONE);\r
-        GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
-        label.setText("Time:");\r
-        \r
-        Composite composite = new Composite(this, SWT.NONE);\r
-        GridDataFactory.fillDefaults().applyTo(composite);\r
-        GridLayoutFactory.fillDefaults().applyTo(composite);\r
-        \r
-        time = new org.simantics.browsing.ui.swt.widgets.TrackedText(composite, support, SWT.BORDER);\r
-        time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Series_time));\r
-        time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Series_time));\r
-        time.setInputValidator(new DoubleValidator(true));\r
-        time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
-        GridDataFactory.fillDefaults().applyTo(time.getWidget());\r
-        \r
+        if ((options & ChartPropertyOptions.SHOW_TIME) > 0) {\r
+               label = new Label(this, SWT.NONE);\r
+               GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+               label.setText("Time:");\r
+               \r
+               Composite composite = new Composite(this, SWT.NONE);\r
+               GridDataFactory.fillDefaults().applyTo(composite);\r
+               GridLayoutFactory.fillDefaults().applyTo(composite);\r
+               \r
+               time = new org.simantics.browsing.ui.swt.widgets.TrackedText(composite, support, SWT.BORDER);\r
+               time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Series_time));\r
+               time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Series_time));\r
+               time.setInputValidator(new DoubleValidator(true));\r
+               time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
+               GridDataFactory.fillDefaults().applyTo(time.getWidget());\r
+        }\r
         // Exploded\r
         label = new Label(this, SWT.NONE);\r
         label.setText("");\r
index 70d0076e25457ec69080ca397c20c9116c4d67be..181f78ca73d2d024c4078aef987bb3e4244a7cb1 100644 (file)
@@ -24,6 +24,7 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
 import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
 import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.ChartPropertyOptions;\r
 import org.simantics.jfreechart.chart.properties.BooleanPropertyFactory;\r
 import org.simantics.jfreechart.chart.properties.BooleanSelectionListener;\r
 import org.simantics.jfreechart.chart.properties.ChartVariable;\r
@@ -49,7 +50,7 @@ public class PieSeriesPropertyComposite2 extends Composite {
     private TrackedText label, time;\r
     private StringChooser<ChartVariable> variable;\r
     \r
-    public PieSeriesPropertyComposite2(Composite parent, ISessionContext context, WidgetSupport support, Collection<ChartVariable> variables,int style) {\r
+    public PieSeriesPropertyComposite2(Composite parent, ISessionContext context, WidgetSupport support, Collection<ChartVariable> variables,int options, int style) {\r
         super(parent, style);\r
         \r
         GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);\r
@@ -96,22 +97,23 @@ public class PieSeriesPropertyComposite2 extends Composite {
         Composite colorPicker = new ColorPicker(this, context, support, SWT.NONE);\r
         GridDataFactory.fillDefaults().grab(true, false).applyTo(colorPicker);\r
 \r
-        // Time\r
-        label = new Label(this, SWT.NONE);\r
-        GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
-        label.setText("Time:");\r
-        \r
-        Composite composite = new Composite(this, SWT.NONE);\r
-        GridDataFactory.fillDefaults().applyTo(composite);\r
-        GridLayoutFactory.fillDefaults().applyTo(composite);\r
-        \r
-        time = new org.simantics.browsing.ui.swt.widgets.TrackedText(composite, support, SWT.BORDER);\r
-        time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Series_time));\r
-        time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Series_time));\r
-        time.setInputValidator(new DoubleValidator(true));\r
-        time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
-        GridDataFactory.fillDefaults().applyTo(time.getWidget());\r
-        \r
+        if ((options & ChartPropertyOptions.SHOW_TIME) > 0) {\r
+               // Time\r
+               label = new Label(this, SWT.NONE);\r
+               GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(label);\r
+               label.setText("Time:");\r
+               \r
+               Composite composite = new Composite(this, SWT.NONE);\r
+               GridDataFactory.fillDefaults().applyTo(composite);\r
+               GridLayoutFactory.fillDefaults().applyTo(composite);\r
+               \r
+               time = new org.simantics.browsing.ui.swt.widgets.TrackedText(composite, support, SWT.BORDER);\r
+               time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Series_time));\r
+               time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Series_time));\r
+               time.setInputValidator(new DoubleValidator(true));\r
+               time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
+               GridDataFactory.fillDefaults().applyTo(time.getWidget());\r
+        }\r
         // Exploded\r
         label = new Label(this, SWT.NONE);\r
         label.setText("");\r
index 34a09b342ee4b17f05e4291f10c7d19f178de0ca..4ede78c4d62f233754cb41f0251cad18e3402c19 100644 (file)
@@ -58,9 +58,11 @@ public class PieSeriesTab extends LabelPropertyTabContributor implements Widget
     private WidgetSupportImpl additionalSupport;\r
     private Button add, remove;\r
     private Resource chartResource;\r
-\r
-    public PieSeriesTab() {\r
+    private int options;\r
+    \r
+    public PieSeriesTab(int options) {\r
         additionalSupport = new WidgetSupportImpl();\r
+        this.options = options;\r
     }\r
 \r
     @Override\r
@@ -123,7 +125,7 @@ public class PieSeriesTab extends LabelPropertyTabContributor implements Widget
             child.dispose();\r
         }\r
 \r
-        PieSeriesPropertyComposite spc = new PieSeriesPropertyComposite(propertyContainer, context, additionalSupport, SWT.NONE);\r
+        PieSeriesPropertyComposite spc = new PieSeriesPropertyComposite(propertyContainer, context, additionalSupport, options,SWT.NONE);\r
         propertyContainer.setContent(spc);\r
         Point size = spc.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
         propertyContainer.setMinSize(size);\r
index aa83c72c11cf85a9f83562d687a4e10b817fc847..65f9a4a83b7c88c511a10c70eeed3f1865b19ab3 100644 (file)
@@ -64,9 +64,11 @@ public class PieSeriesTab2 extends LabelPropertyTabContributor implements Widget
     private WidgetSupportImpl additionalSupport;\r
     private Button add, remove;\r
     private Resource chartResource;\r
+    private int options;\r
 \r
-    public PieSeriesTab2() {\r
+    public PieSeriesTab2(int options) {\r
         additionalSupport = new WidgetSupportImpl();\r
+        this.options = options;\r
     }\r
 \r
     @Override\r
@@ -131,7 +133,7 @@ public class PieSeriesTab2 extends LabelPropertyTabContributor implements Widget
 \r
         try {\r
                Collection<ChartVariable> variables = context.getSession().syncRequest(new AllVariablesOfModel(resource));\r
-               PieSeriesPropertyComposite2 spc = new PieSeriesPropertyComposite2(propertyContainer, context, additionalSupport, variables, SWT.NONE);\r
+               PieSeriesPropertyComposite2 spc = new PieSeriesPropertyComposite2(propertyContainer, context, additionalSupport, variables, options, SWT.NONE);\r
                propertyContainer.setContent(spc);\r
                Point size = spc.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
                propertyContainer.setMinSize(size);\r