From e871fddb8768d8fe6e9a39073e2350f30ae4c0b5 Mon Sep 17 00:00:00 2001 From: miettinen Date: Mon, 7 Apr 2014 12:19:54 +0000 Subject: [PATCH] Small Sysdyn improvements (refs #4803): Commented out the currently useless Synthesim button. Using most profiles as default. Multiple dependency selection tab to inherit adjustable tab. Moved sensitivity chart up in the context menu and added chart tab to sensitivity chart property view. git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29253 ac1ea38d-2e2b-0410-8846-a27921b304fc --- org.simantics.sysdyn.ui/plugin.xml | 42 ++-- .../ui/properties/ArrayDependencyTab.java | 212 +++++++++++------- .../ResourceSelectionProcessor.java | 6 + .../sysdyn/utils/ProfileEntries.java | 4 + 4 files changed, 162 insertions(+), 102 deletions(-) diff --git a/org.simantics.sysdyn.ui/plugin.xml b/org.simantics.sysdyn.ui/plugin.xml index 9a671258..d9a5d7eb 100644 --- a/org.simantics.sysdyn.ui/plugin.xml +++ b/org.simantics.sysdyn.ui/plugin.xml @@ -476,11 +476,9 @@ - - - - + + @@ -787,7 +785,7 @@ @@ -972,10 +970,10 @@ @@ -989,10 +987,10 @@ @@ -1006,10 +1004,10 @@ @@ -2800,6 +2798,14 @@ type="radio" value="flow"> + diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayDependencyTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayDependencyTab.java index a94c8a14..189a5b0f 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayDependencyTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayDependencyTab.java @@ -33,7 +33,7 @@ import org.simantics.db.Resource; import org.simantics.db.WriteGraph; import org.simantics.db.exception.DatabaseException; import org.simantics.db.management.ISessionContext; -import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor; +import org.simantics.jfreechart.chart.properties.AdjustableTab; import org.simantics.sysdyn.SysdynResource; import org.simantics.sysdyn.ui.elements.connections.DependencyEdgeClass; import org.simantics.sysdyn.ui.elements.connections.DependencyNode; @@ -47,95 +47,19 @@ import org.simantics.utils.datastructures.Triple; * @author Tuomas Miettinen * */ -public class ArrayDependencyTab extends LabelPropertyTabContributor { +public class ArrayDependencyTab extends AdjustableTab { Button none, plus, minus, other, inside, outside; TrackedText polarityText, polarityLocationText; private DelayMarkWidget delayMark; private ArrowHeadWidget arrowhead; private Scale lineThicknessScale; - - @Override - public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) { - Composite composite = new Composite(body, SWT.NONE); - GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); - GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite); - - /* Add a dummy button at the begin to suck in the nonsense selection events that - * the first radio button in the group of ALL the radio buttons receives when no - * radio is selected and then one is selected in other group than where the first - * radio button lies. - */ - Group hiddenDefaultbuttonGroup = new Group(composite, SWT.NONE); - GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup); - GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup); - new Button(hiddenDefaultbuttonGroup, support, SWT.RADIO); - - Group polarityGroup = new Group(composite, SWT.NONE); - polarityGroup.setText("Polarity"); - GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup); - GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup); - - none = new Button(polarityGroup, support, SWT.RADIO); - none.setText("None"); - none.setSelectionFactory(new PolarityRadioSelectionFactory("")); - none.addSelectionListener(new PolaritySelectionListener(context, "")); - - plus = new Button(polarityGroup, support, SWT.RADIO); - plus.setText("+"); - plus.setSelectionFactory(new PolarityRadioSelectionFactory("+")); - plus.addSelectionListener(new PolaritySelectionListener(context, "+")); - - minus = new Button(polarityGroup, support, SWT.RADIO); - minus.setText("-"); - minus.setSelectionFactory(new PolarityRadioSelectionFactory("-")); - minus.addSelectionListener(new PolaritySelectionListener(context, "-")); - - other = new Button(polarityGroup, support, SWT.RADIO); - other.setText("other"); - other.setSelectionFactory(new OtherPolaritySelectionFactory(new String[] {null, "+", "-", ""})); - - polarityText = new TrackedText(polarityGroup, support, SWT.BORDER); - polarityText.setTextFactory(new OtherPolarityStringPropertyFactory()); - polarityText.addModifyListener(new OtherPolarityStringPropertyModifier()); - GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget()); - - Group locationGroup = new Group(composite, SWT.NONE); - GridDataFactory.fillDefaults().applyTo(locationGroup); - GridLayoutFactory.fillDefaults().applyTo(locationGroup); - locationGroup.setText("Location"); - - inside = new Button(locationGroup, support, SWT.RADIO); - inside.setText("Inside"); - inside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.INSIDE)); - inside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.INSIDE)); - - outside = new Button(locationGroup, support, SWT.RADIO); - outside.setText("Outside"); - outside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.OUTSIDE)); - outside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.OUTSIDE)); - - Composite misc = new Composite(composite, SWT.NONE); - GridDataFactory.fillDefaults().grab(true, true).applyTo(misc); - GridLayoutFactory.fillDefaults().numColumns(3).applyTo(misc); - - arrowhead = new ArrowHeadWidget(misc, support, SWT.NULL); - GridDataFactory.fillDefaults().applyTo(arrowhead.getWidget()); - delayMark = new DelayMarkWidget(misc, support, SWT.NULL); - GridDataFactory.fillDefaults().applyTo(delayMark.getWidget()); - - Group lineThicknessGroup = new Group(misc, SWT.NONE); - GridDataFactory.fillDefaults().applyTo(lineThicknessGroup); - GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup); - lineThicknessGroup.setText("Line thickness:"); - lineThicknessScale = new Scale(lineThicknessGroup, support, SWT.HORIZONTAL); - lineThicknessScale.getWidget().setMinimum(1); - lineThicknessScale.getWidget().setMaximum(15); - lineThicknessScale.getWidget().setPageIncrement(1); - lineThicknessScale.getWidget().setIncrement(1); - lineThicknessScale.setSelectionFactory(new LineThicknessRadioSelectionFactory()); - lineThicknessScale.addSelectionListener(new LineThicknessSelectionListener(context, lineThicknessScale)); - } + private Composite composite; + private Group hiddenDefaultbuttonGroup; + private Group polarityGroup; + private Group locationGroup; + private Composite misc; + private Group lineThicknessGroup; class LineThicknessSelectionListener extends SelectionListenerImpl> { Scale scale; @@ -345,4 +269,124 @@ public class ArrayDependencyTab extends LabelPropertyTabContributor { } } + @Override + protected void createAndAddControls(Composite body, IWorkbenchSite site, + ISessionContext context, WidgetSupport support) { + composite = new Composite(body, SWT.NONE); + + /* Add a dummy button at the begin to suck in the nonsense selection events that + * the first radio button in the group of ALL the radio buttons receives when no + * radio is selected and then one is selected in other group than where the first + * radio button lies. + */ + hiddenDefaultbuttonGroup = new Group(composite, SWT.NONE); + new Button(hiddenDefaultbuttonGroup, support, SWT.RADIO); + + polarityGroup = new Group(composite, SWT.NONE); + polarityGroup.setText("Polarity"); + + none = new Button(polarityGroup, support, SWT.RADIO); + none.setText("None"); + none.setSelectionFactory(new PolarityRadioSelectionFactory("")); + none.addSelectionListener(new PolaritySelectionListener(context, "")); + + plus = new Button(polarityGroup, support, SWT.RADIO); + plus.setText("+"); + plus.setSelectionFactory(new PolarityRadioSelectionFactory("+")); + plus.addSelectionListener(new PolaritySelectionListener(context, "+")); + + minus = new Button(polarityGroup, support, SWT.RADIO); + minus.setText("-"); + minus.setSelectionFactory(new PolarityRadioSelectionFactory("-")); + minus.addSelectionListener(new PolaritySelectionListener(context, "-")); + + other = new Button(polarityGroup, support, SWT.RADIO); + other.setText("other"); + other.setSelectionFactory(new OtherPolaritySelectionFactory(new String[] {null, "+", "-", ""})); + + polarityText = new TrackedText(polarityGroup, support, SWT.BORDER); + polarityText.setTextFactory(new OtherPolarityStringPropertyFactory()); + polarityText.addModifyListener(new OtherPolarityStringPropertyModifier()); + + locationGroup = new Group(composite, SWT.NONE); + locationGroup.setText("Location"); + + inside = new Button(locationGroup, support, SWT.RADIO); + inside.setText("Inside"); + inside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.INSIDE)); + inside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.INSIDE)); + + outside = new Button(locationGroup, support, SWT.RADIO); + outside.setText("Outside"); + outside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.OUTSIDE)); + outside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.OUTSIDE)); + + misc = new Composite(composite, SWT.NONE); + + arrowhead = new ArrowHeadWidget(misc, support, SWT.NULL); + delayMark = new DelayMarkWidget(misc, support, SWT.NULL); + + lineThicknessGroup = new Group(misc, SWT.NONE); + lineThicknessGroup.setText("Line thickness:"); + lineThicknessScale = new Scale(lineThicknessGroup, support, SWT.HORIZONTAL); + lineThicknessScale.getWidget().setMinimum(1); + lineThicknessScale.getWidget().setMaximum(15); + lineThicknessScale.getWidget().setPageIncrement(1); + lineThicknessScale.getWidget().setIncrement(1); + lineThicknessScale.setSelectionFactory(new LineThicknessRadioSelectionFactory()); + lineThicknessScale.addSelectionListener(new LineThicknessSelectionListener(context, lineThicknessScale)); + } + + @Override + protected void createControlLayoutVertical() { + GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); + GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(1).applyTo(composite); + + GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup); + GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup); + + GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup); + GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup); + + GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget()); + + GridDataFactory.fillDefaults().applyTo(locationGroup); + GridLayoutFactory.fillDefaults().applyTo(locationGroup); + + GridDataFactory.fillDefaults().grab(true, true).applyTo(misc); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(misc); + + GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(arrowhead.getWidget()); + GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(delayMark.getWidget()); + + GridDataFactory.fillDefaults().span(2, 1).applyTo(lineThicknessGroup); + GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup); + } + + @Override + protected void createControlLayoutHorizontal(boolean wideScreen) { + GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); + GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite); + + GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup); + GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup); + + GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup); + GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup); + + GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget()); + + GridDataFactory.fillDefaults().applyTo(locationGroup); + GridLayoutFactory.fillDefaults().applyTo(locationGroup); + + GridDataFactory.fillDefaults().grab(true, true).applyTo(misc); + GridLayoutFactory.fillDefaults().numColumns(3).applyTo(misc); + + GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(arrowhead.getWidget()); + GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(delayMark.getWidget()); + + GridDataFactory.fillDefaults().span(1, 1).applyTo(lineThicknessGroup); + GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup); + } + } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java index 1fb36162..49407d6b 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResourceSelectionProcessor.java @@ -32,6 +32,7 @@ import org.simantics.db.layer0.request.PossibleActiveVariableFromVariable; import org.simantics.db.layer0.variable.Variable; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.jfreechart.ChartSelectionTabContributor; +import org.simantics.jfreechart.chart.properties.ChartTab; import org.simantics.jfreechart.chart.properties.xyline.XYLineGeneralPropertiesTab; import org.simantics.layer0.Layer0; import org.simantics.modeling.ModelingResources; @@ -527,6 +528,11 @@ public class ResourceSelectionProcessor implements SelectionProcessor