1 package org.simantics.sysdyn.ui.properties;
\r
3 import org.eclipse.jface.layout.GridDataFactory;
\r
4 import org.eclipse.jface.layout.GridLayoutFactory;
\r
5 import org.eclipse.jface.resource.JFaceResources;
\r
6 import org.eclipse.jface.resource.LocalResourceManager;
\r
7 import org.eclipse.swt.SWT;
\r
8 import org.eclipse.swt.custom.ScrolledComposite;
\r
9 import org.eclipse.swt.widgets.Composite;
\r
10 import org.eclipse.swt.widgets.Label;
\r
11 import org.eclipse.ui.IWorkbenchSite;
\r
12 import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;
\r
13 import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
\r
14 import org.simantics.browsing.ui.swt.widgets.TrackedText;
\r
15 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
\r
16 import org.simantics.db.management.ISessionContext;
\r
17 import org.simantics.layer0.Layer0;
\r
18 import org.simantics.sysdyn.SysdynResource;
\r
19 import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactory;
\r
20 import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyModifier;
\r
21 import org.simantics.sysdyn.ui.properties.widgets.factories.IntegerPropertyFactory;
\r
22 import org.simantics.sysdyn.ui.properties.widgets.factories.IntegerPropertyModifier;
\r
23 import org.simantics.utils.ui.validators.DoubleValidator;
\r
24 import org.simantics.utils.ui.validators.IntegerValidator;
\r
27 * Tab for displaying sensitivity analysis experiment properties
\r
29 * @author Tuomas Miettinen
\r
32 public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributor {
\r
35 public void createControls(Composite body, IWorkbenchSite site,
\r
36 ISessionContext context, WidgetSupport support) {
\r
38 ScrolledComposite sc = new ScrolledComposite(body, SWT.H_SCROLL | SWT.V_SCROLL);
\r
39 GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);
\r
40 GridLayoutFactory.fillDefaults().applyTo(sc);
\r
42 Composite composite = new Composite(sc, SWT.NONE);
\r
43 GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
\r
44 GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);
\r
47 Label label = new Label(composite, SWT.NONE);
\r
48 label.setText("Name");
\r
50 TrackedText name = new TrackedText(composite, support, SWT.BORDER);
\r
51 name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));
\r
52 name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));
\r
53 name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName));
\r
54 name.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), name.getWidget())));
\r
56 // The propability distribution
\r
57 label = new Label(composite, SWT.NONE);
\r
58 label.setText("Propability distribution");
\r
60 TrackedText propabilityDistributionName = new TrackedText(composite, support, SWT.BORDER);
\r
61 propabilityDistributionName.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_propabilityDistribution));
\r
62 propabilityDistributionName.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_propabilityDistribution));
\r
63 //parameterName.setInputValidator(new DoubleValidator());
\r
64 propabilityDistributionName.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), propabilityDistributionName.getWidget())));
\r
66 // Parameter the value of which is varied
\r
67 label = new Label(composite, SWT.NONE);
\r
68 label.setText("Varied parameter name");
\r
70 TrackedText parameterName = new TrackedText(composite, support, SWT.BORDER);
\r
71 parameterName.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_variedParameter));
\r
72 parameterName.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_variedParameter));
\r
73 //parameterName.setInputValidator(new DoubleValidator());
\r
74 parameterName.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), parameterName.getWidget())));
\r
77 label = new Label(composite, SWT.NONE);
\r
78 label.setText("Min value");
\r
80 TrackedText minValue = new TrackedText(composite, support, SWT.BORDER);
\r
81 minValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_minValue));
\r
82 minValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_minValue));
\r
83 minValue.setInputValidator(new DoubleValidator());
\r
84 minValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), minValue.getWidget())));
\r
85 GridDataFactory.fillDefaults().hint(300, SWT.DEFAULT).applyTo(name.getWidget());
\r
88 label = new Label(composite, SWT.NONE);
\r
89 label.setText("Max value");
\r
91 TrackedText maxValue = new TrackedText(composite, support, SWT.BORDER);
\r
92 maxValue.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_maxValue));
\r
93 maxValue.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_maxValue));
\r
94 maxValue.setInputValidator(new DoubleValidator());
\r
95 maxValue.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), maxValue.getWidget())));
\r
98 label = new Label(composite, SWT.NONE);
\r
99 label.setText("Number of values");
\r
101 TrackedText numValues = new TrackedText(composite, support, SWT.BORDER);
\r
102 numValues.setTextFactory(new IntegerPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_numValues));
\r
103 numValues.addModifyListener(new IntegerPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_numValues));
\r
104 numValues.setInputValidator(new IntegerValidator());
\r
105 numValues.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), numValues.getWidget())));
\r
107 // Scrolled composite settings
\r
108 sc.setContent(composite);
\r
109 sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
\r
110 sc.setExpandHorizontal(true);
\r
111 sc.setExpandVertical(true);
\r