\r
JFreeChart jfreeChart = chart.getChart();\r
// Display the result chart\r
+ if (composite.isDisposed())\r
+ return;\r
composite.getDisplay().asyncExec(new RunnableWithObject(jfreeChart) {\r
\r
@Override\r
public RangeComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
super(parent, style);\r
support.register(this);\r
- GridLayoutFactory.fillDefaults().spacing(3, 0).margins(3, 3).applyTo(this);\r
+ GridLayoutFactory.fillDefaults().spacing(3, 0).margins(3, 0).applyTo(this);\r
GridDataFactory.fillDefaults().grab(true, false).applyTo(this);\r
composite = this;\r
}\r
\r
composite.layout();\r
\r
- if(getObject() == null)\r
+ if(getObject() == null) {\r
+ // No range, print an em dash.\r
+ Label label = new Label(composite, SWT.NONE);\r
+ label.setText("\u2014");\r
+ label.setEnabled(false);\r
+ GridDataFactory.fillDefaults().applyTo(label);\r
+ composite.layout();\r
return;\r
+ }\r
\r
// New widgetSupport for the combos\r
WidgetSupportImpl support = new WidgetSupportImpl();\r
sc.setExpandVertical(true);\r
\r
composite = new Composite(sc, SWT.NONE);\r
- GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
\r
// Domain Axis properties\r
Group domainGroup = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(domainGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(3).applyTo(domainGroup);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(domainGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(5).applyTo(domainGroup);\r
domainGroup.setText("Domain axis");\r
\r
// Label for x-axis\r
rangelabel.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel, ""));\r
rangelabel.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
rangelabel.setColorProvider(new JFreeChartPropertyColorProvider(rangelabel.getResourceManager()));\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(rangelabel.getWidget());\r
-\r
+ GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(rangelabel.getWidget());\r
+ \r
Composite axisHide = new AxisHidePropertyComposite(domainGroup, context, domainAxisSupport, SWT.NONE);\r
- GridDataFactory.fillDefaults().span(1, 3).applyTo(axisHide);\r
+ GridDataFactory.fillDefaults().span(1, 2).applyTo(axisHide);\r
\r
Label angleLabel = new Label(domainGroup, SWT.NONE);\r
angleLabel.setText("Label angle:");\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).applyTo(angleLabel);\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(angleLabel);\r
\r
Composite angleComposite = new Composite(domainGroup, SWT.NONE);\r
GridDataFactory.fillDefaults().applyTo(angleComposite);\r
angle.setMinimum(0);\r
angle.setMaximum(90);\r
angle.getWidget().setIncrement(5);\r
- GridDataFactory.fillDefaults().applyTo(angle.getWidget());\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, true).applyTo(angle.getWidget());\r
\r
// Domain Color\r
label = new Label(domainGroup, SWT.NONE);\r
label.setText("Color:");\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.END, SWT.CENTER).applyTo(label);\r
\r
Composite colorPicker = new ColorPicker(domainGroup, context, domainAxisSupport, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(colorPicker);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.BEGINNING, SWT.CENTER).applyTo(colorPicker);\r
\r
domainGroup.layout();\r
\r
// Range Axis properties\r
Group rangeGroup = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(rangeGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(3).applyTo(rangeGroup);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(5).applyTo(rangeGroup);\r
rangeGroup.setText("Range axis");\r
\r
// Label for range axis\r
rangelabel.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel, ""));\r
rangelabel.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
rangelabel.setColorProvider(new JFreeChartPropertyColorProvider(rangelabel.getResourceManager()));\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(rangelabel.getWidget());\r
+ GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(rangelabel.getWidget());\r
\r
axisHide = new AxisHidePropertyComposite(rangeGroup, context, rangeAxisSupport, SWT.NONE);\r
- GridDataFactory.fillDefaults().span(1, 4).applyTo(axisHide);\r
+ GridDataFactory.fillDefaults().span(1, 2).applyTo(axisHide);\r
\r
// Min and max values for range axis\r
label = new Label(rangeGroup, SWT.NONE);\r
label.setText("Min:");\r
\r
Composite minmax = new Composite(rangeGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(minmax);\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, true).applyTo(minmax);\r
GridLayoutFactory.fillDefaults().numColumns(3).applyTo(minmax);\r
rangemin = new TrackedText(minmax, rangeAxisSupport, SWT.BORDER);\r
rangemin.setColorProvider(new JFreeChartPropertyColorProvider(rangemin.getResourceManager()));\r
// Range Color\r
label = new Label(rangeGroup, SWT.NONE);\r
label.setText("Color:");\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.END, SWT.CENTER).applyTo(label);\r
\r
colorPicker = new ColorPicker(rangeGroup, context, rangeAxisSupport, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(colorPicker);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.BEGINNING, SWT.CENTER).applyTo(colorPicker);\r
\r
// Resize scrolled composite\r
sc.setContent(composite);\r
public AxisPropertyComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
super(parent, style);\r
\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(3).applyTo(this);\r
\r
// Label (units)\r
Label label = new Label(this, SWT.NONE);\r
units.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel, "")); // FIXME: Units \r
units.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel)); // FIXME: Units \r
units.setColorProvider(new JFreeChartPropertyColorProvider(units.getResourceManager()));\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(units.getWidget());\r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(units.getWidget());\r
\r
\r
// Minimum and maximum values\r
max.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Axis_max));\r
max.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Axis_max));\r
max.setInputValidator(new DoubleValidator(true));\r
-\r
+ \r
+ // Tick and label visibility\r
+ Composite c = new Composite(this, SWT.NONE);\r
+ GridDataFactory.fillDefaults().span(1, 2).applyTo(c);\r
+ GridLayoutFactory.fillDefaults().applyTo(c);\r
+ Composite axisHide = new AxisHidePropertyComposite(c, context, support, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(axisHide);\r
\r
// Color\r
label = new Label(this, SWT.NONE);\r
\r
Composite colorPicker = new ColorPicker(this, context, support, SWT.NONE);\r
GridDataFactory.fillDefaults().grab(true, false).applyTo(colorPicker);\r
- \r
- // Tick and label visibility\r
- Composite c = new Composite(this, SWT.NONE);\r
- GridDataFactory.fillDefaults().span(2, 1).applyTo(c);\r
- GridLayoutFactory.fillDefaults().applyTo(c);\r
- Composite axisHide = new AxisHidePropertyComposite(c, context, support, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(axisHide);\r
+\r
}\r
\r
}\r
// X-Axis properties\r
Group xgroup = new Group(composite, SWT.NONE);\r
GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(xgroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(3).applyTo(xgroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(5).applyTo(xgroup);\r
xgroup.setText("X-axis");\r
\r
// Variable for x-axis (default: empty == time)\r
xvariable.setInputValidator(new VariableExistsValidator(support, xvariable, true));\r
GridDataFactory.fillDefaults().grab(true, false).applyTo(xvariable.getWidget());\r
\r
+ // Min value for x-axis\r
+ label = new Label(xgroup, SWT.NONE);\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ label.setText("Min:");\r
+\r
+ xmin = new TrackedText(xgroup, domainAxisSupport, SWT.BORDER);\r
+ xmin.setColorProvider(new JFreeChartPropertyColorProvider(xmin.getResourceManager()));\r
+ xmin.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Axis_min));\r
+ xmin.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Axis_min));\r
+ xmin.setInputValidator(new DoubleValidator(true));\r
+ \r
+ // Axis hide buttons\r
Composite axisHide = new AxisHidePropertyComposite(xgroup, context, domainAxisSupport, SWT.NONE);\r
GridDataFactory.fillDefaults().span(1, 3).applyTo(axisHide);\r
\r
xlabel.setColorProvider(new JFreeChartPropertyColorProvider(xlabel.getResourceManager()));\r
GridDataFactory.fillDefaults().grab(true, false).applyTo(xlabel.getWidget());\r
\r
- // Min and max values for x-axis\r
+ // Max value for x-axis\r
label = new Label(xgroup, SWT.NONE);\r
GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Min:");\r
-\r
- Composite minmax = new Composite(xgroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(minmax);\r
- GridLayoutFactory.fillDefaults().numColumns(3).applyTo(minmax);\r
- xmin = new TrackedText(minmax, domainAxisSupport, SWT.BORDER);\r
- xmin.setColorProvider(new JFreeChartPropertyColorProvider(xmin.getResourceManager()));\r
- xmin.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Axis_min));\r
- xmin.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Axis_min));\r
- xmin.setInputValidator(new DoubleValidator(true));\r
-\r
- label = new Label(minmax, SWT.NONE);\r
label.setText("Max:");\r
- xmax = new TrackedText(minmax, domainAxisSupport, SWT.BORDER);\r
+ xmax = new TrackedText(xgroup, domainAxisSupport, SWT.BORDER);\r
xmax.setColorProvider(new JFreeChartPropertyColorProvider(xmax.getResourceManager()));\r
xmax.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Axis_max));\r
xmax.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Axis_max));\r
xmax.setInputValidator(new DoubleValidator(true));\r
-\r
+ GridDataFactory.fillDefaults().applyTo(xmax.getWidget());\r
+ \r
// Set the same width to both label rows\r
composite.layout();\r
GridDataFactory.fillDefaults().hint(xVariableLabel.getBounds().width, SWT.DEFAULT).align(SWT.END, SWT.CENTER).applyTo(nameLabel);\r
// Label\r
Label label = new Label(composite, SWT.NONE);\r
label.setText("Name");\r
- \r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+\r
TrackedText name = new TrackedText(composite, support, SWT.BORDER);\r
name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName));\r
name.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), name.getWidget())));\r
-\r
+ \r
// Step duration (i.e. how many time units is one step in user's perspective)\r
label = new Label(composite, SWT.NONE);\r
label.setText("Step duration");\r
- \r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+\r
TrackedText stepDuration = new TrackedText(composite, support, SWT.BORDER);\r
stepDuration.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.GameExperiment_stepDuration));\r
stepDuration.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.GameExperiment_stepDuration));\r
stepDuration.setInputValidator(new DoubleValidator());\r
stepDuration.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), stepDuration.getWidget())));\r
- GridDataFactory.fillDefaults().hint(300, SWT.DEFAULT).applyTo(name.getWidget());\r
+ GridDataFactory.fillDefaults().hint(80, SWT.DEFAULT).grab(true, false).applyTo(name.getWidget());\r
\r
// Integrator step length (i.e. how long is a integration step in the simulator. This time is stepped until stepDuration is full)\r
label = new Label(composite, SWT.NONE);\r
label.setText("Integrator step length");\r
- \r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+\r
TrackedText integratorStep = new TrackedText(composite, support, SWT.BORDER);\r
integratorStep.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.GameExperiment_stepLength));\r
integratorStep.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.GameExperiment_stepLength));\r
\r
parameterProperties = new Composite(parameterPropertyGroup, SWT.NONE);\r
GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterProperties);\r
- GridLayoutFactory.fillDefaults().numColumns(2).applyTo(parameterProperties);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(parameterProperties);\r
\r
// Label\r
label = new Label(parameterProperties, SWT.NONE);\r
variable.addModifyListener(new VariableNameModifier(variable.getWidget(), parameterSupport, SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable, SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_indexes));\r
variable.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), variable.getWidget())));\r
variable.setInputValidator(new ParameterExistsValidator(parameterSupport, variable));\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(variable.getWidget());\r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(variable.getWidget());\r
\r
label = new Label(parameterProperties, SWT.NONE);\r
label.setText("Range:");\r
return SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_indexes;\r
}\r
};\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);\r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(rangeComposite);\r
\r
// TrackedText variable = new TrackedText(parameterProperties, parameterSupport, SWT.BORDER);\r
// variable.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable));\r
}\r
});\r
\r
- label = new Label(parameterProperties, SWT.NONE);\r
- \r
DistributionPropertyWidget dpw = new DistributionPropertyWidget(parameterProperties, context, parameterSupport, SWT.NONE);\r
GridDataFactory.fillDefaults().grab(true, true).applyTo(dpw);\r
-\r
+ GridLayoutFactory.fillDefaults().margins(6, 0).applyTo(dpw);\r
}\r
\r
\r
}\r
\r
// If expression has changed (i.e. user actually selects a different item in the combo), save the previous \r
- if(lastExpression != null && !lastExpression.equals(activeExpression)) {\r
+ if(lastExpression != null \r
+ && !lastExpression.equals(activeExpression)\r
+ && expressionWidget != null) {\r
expressionWidget.save();\r
}\r
\r