import org.simantics.db.WriteGraph;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.elements.connections.DependencyEdgeClass;\r
import org.simantics.sysdyn.ui.elements.connections.DependencyNode;\r
* @author Tuomas Miettinen\r
*\r
*/\r
-public class ArrayDependencyTab extends LabelPropertyTabContributor {\r
+public class ArrayDependencyTab extends AdjustableTab {\r
\r
Button none, plus, minus, other, inside, outside;\r
TrackedText polarityText, polarityLocationText;\r
private DelayMarkWidget delayMark;\r
private ArrowHeadWidget arrowhead;\r
private Scale lineThicknessScale;\r
- \r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r
- Composite composite = new Composite(body, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);\r
- \r
- /* Add a dummy button at the begin to suck in the nonsense selection events that\r
- * the first radio button in the group of ALL the radio buttons receives when no\r
- * radio is selected and then one is selected in other group than where the first \r
- * radio button lies. \r
- */\r
- Group hiddenDefaultbuttonGroup = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup);\r
- GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup);\r
- new Button(hiddenDefaultbuttonGroup, support, SWT.RADIO);\r
- \r
- Group polarityGroup = new Group(composite, SWT.NONE);\r
- polarityGroup.setText("Polarity");\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup);\r
- GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup);\r
- \r
- none = new Button(polarityGroup, support, SWT.RADIO);\r
- none.setText("None");\r
- none.setSelectionFactory(new PolarityRadioSelectionFactory(""));\r
- none.addSelectionListener(new PolaritySelectionListener(context, ""));\r
- \r
- plus = new Button(polarityGroup, support, SWT.RADIO);\r
- plus.setText("+");\r
- plus.setSelectionFactory(new PolarityRadioSelectionFactory("+"));\r
- plus.addSelectionListener(new PolaritySelectionListener(context, "+"));\r
- \r
- minus = new Button(polarityGroup, support, SWT.RADIO);\r
- minus.setText("-");\r
- minus.setSelectionFactory(new PolarityRadioSelectionFactory("-"));\r
- minus.addSelectionListener(new PolaritySelectionListener(context, "-"));\r
- \r
- other = new Button(polarityGroup, support, SWT.RADIO);\r
- other.setText("other");\r
- other.setSelectionFactory(new OtherPolaritySelectionFactory(new String[] {null, "+", "-", ""}));\r
- \r
- polarityText = new TrackedText(polarityGroup, support, SWT.BORDER);\r
- polarityText.setTextFactory(new OtherPolarityStringPropertyFactory());\r
- polarityText.addModifyListener(new OtherPolarityStringPropertyModifier());\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget());\r
- \r
- Group locationGroup = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(locationGroup);\r
- GridLayoutFactory.fillDefaults().applyTo(locationGroup);\r
- locationGroup.setText("Location");\r
- \r
- inside = new Button(locationGroup, support, SWT.RADIO);\r
- inside.setText("Inside");\r
- inside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.INSIDE));\r
- inside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.INSIDE));\r
- \r
- outside = new Button(locationGroup, support, SWT.RADIO);\r
- outside.setText("Outside");\r
- outside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.OUTSIDE));\r
- outside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.OUTSIDE));\r
-\r
- Composite misc = new Composite(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(misc);\r
- GridLayoutFactory.fillDefaults().numColumns(3).applyTo(misc);\r
- \r
- arrowhead = new ArrowHeadWidget(misc, support, SWT.NULL);\r
- GridDataFactory.fillDefaults().applyTo(arrowhead.getWidget());\r
- delayMark = new DelayMarkWidget(misc, support, SWT.NULL);\r
- GridDataFactory.fillDefaults().applyTo(delayMark.getWidget());\r
- \r
- Group lineThicknessGroup = new Group(misc, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(lineThicknessGroup);\r
- GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup);\r
- lineThicknessGroup.setText("Line thickness:");\r
- lineThicknessScale = new Scale(lineThicknessGroup, support, SWT.HORIZONTAL);\r
- lineThicknessScale.getWidget().setMinimum(1);\r
- lineThicknessScale.getWidget().setMaximum(15);\r
- lineThicknessScale.getWidget().setPageIncrement(1);\r
- lineThicknessScale.getWidget().setIncrement(1);\r
- lineThicknessScale.setSelectionFactory(new LineThicknessRadioSelectionFactory());\r
- lineThicknessScale.addSelectionListener(new LineThicknessSelectionListener(context, lineThicknessScale));\r
- }\r
+ private Composite composite;\r
+ private Group hiddenDefaultbuttonGroup;\r
+ private Group polarityGroup;\r
+ private Group locationGroup;\r
+ private Composite misc;\r
+ private Group lineThicknessGroup;\r
\r
class LineThicknessSelectionListener extends SelectionListenerImpl<ArrayList<Resource>> {\r
Scale scale;\r
}\r
}\r
\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ ISessionContext context, WidgetSupport support) {\r
+ composite = new Composite(body, SWT.NONE);\r
+ \r
+ /* Add a dummy button at the begin to suck in the nonsense selection events that\r
+ * the first radio button in the group of ALL the radio buttons receives when no\r
+ * radio is selected and then one is selected in other group than where the first \r
+ * radio button lies. \r
+ */\r
+ hiddenDefaultbuttonGroup = new Group(composite, SWT.NONE);\r
+ new Button(hiddenDefaultbuttonGroup, support, SWT.RADIO);\r
+ \r
+ polarityGroup = new Group(composite, SWT.NONE);\r
+ polarityGroup.setText("Polarity");\r
+ \r
+ none = new Button(polarityGroup, support, SWT.RADIO);\r
+ none.setText("None");\r
+ none.setSelectionFactory(new PolarityRadioSelectionFactory(""));\r
+ none.addSelectionListener(new PolaritySelectionListener(context, ""));\r
+ \r
+ plus = new Button(polarityGroup, support, SWT.RADIO);\r
+ plus.setText("+");\r
+ plus.setSelectionFactory(new PolarityRadioSelectionFactory("+"));\r
+ plus.addSelectionListener(new PolaritySelectionListener(context, "+"));\r
+ \r
+ minus = new Button(polarityGroup, support, SWT.RADIO);\r
+ minus.setText("-");\r
+ minus.setSelectionFactory(new PolarityRadioSelectionFactory("-"));\r
+ minus.addSelectionListener(new PolaritySelectionListener(context, "-"));\r
+ \r
+ other = new Button(polarityGroup, support, SWT.RADIO);\r
+ other.setText("other");\r
+ other.setSelectionFactory(new OtherPolaritySelectionFactory(new String[] {null, "+", "-", ""}));\r
+ \r
+ polarityText = new TrackedText(polarityGroup, support, SWT.BORDER);\r
+ polarityText.setTextFactory(new OtherPolarityStringPropertyFactory());\r
+ polarityText.addModifyListener(new OtherPolarityStringPropertyModifier());\r
+ \r
+ locationGroup = new Group(composite, SWT.NONE);\r
+ locationGroup.setText("Location");\r
+ \r
+ inside = new Button(locationGroup, support, SWT.RADIO);\r
+ inside.setText("Inside");\r
+ inside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.INSIDE));\r
+ inside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.INSIDE));\r
+ \r
+ outside = new Button(locationGroup, support, SWT.RADIO);\r
+ outside.setText("Outside");\r
+ outside.setSelectionFactory(new PolarityLocationRadioSelectionFactory(DependencyNode.OUTSIDE));\r
+ outside.addSelectionListener(new PolarityLocationSelectionListener(context, DependencyNode.OUTSIDE));\r
+\r
+ misc = new Composite(composite, SWT.NONE);\r
+ \r
+ arrowhead = new ArrowHeadWidget(misc, support, SWT.NULL);\r
+ delayMark = new DelayMarkWidget(misc, support, SWT.NULL);\r
+ \r
+ lineThicknessGroup = new Group(misc, SWT.NONE);\r
+ lineThicknessGroup.setText("Line thickness:");\r
+ lineThicknessScale = new Scale(lineThicknessGroup, support, SWT.HORIZONTAL);\r
+ lineThicknessScale.getWidget().setMinimum(1);\r
+ lineThicknessScale.getWidget().setMaximum(15);\r
+ lineThicknessScale.getWidget().setPageIncrement(1);\r
+ lineThicknessScale.getWidget().setIncrement(1);\r
+ lineThicknessScale.setSelectionFactory(new LineThicknessRadioSelectionFactory());\r
+ lineThicknessScale.addSelectionListener(new LineThicknessSelectionListener(context, lineThicknessScale));\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(1).applyTo(composite);\r
+ \r
+ GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup);\r
+ GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup);\r
+ GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().applyTo(locationGroup);\r
+ GridLayoutFactory.fillDefaults().applyTo(locationGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(misc);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(misc);\r
+\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(arrowhead.getWidget());\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(delayMark.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().span(2, 1).applyTo(lineThicknessGroup);\r
+ GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);\r
+ \r
+ GridDataFactory.fillDefaults().exclude(true).applyTo(hiddenDefaultbuttonGroup);\r
+ GridLayoutFactory.fillDefaults().applyTo(hiddenDefaultbuttonGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityGroup);\r
+ GridLayoutFactory.fillDefaults().numColumns(5).applyTo(polarityGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(polarityText.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().applyTo(locationGroup);\r
+ GridLayoutFactory.fillDefaults().applyTo(locationGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(misc);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(misc);\r
+\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(arrowhead.getWidget());\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(delayMark.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().span(1, 1).applyTo(lineThicknessGroup);\r
+ GridLayoutFactory.fillDefaults().applyTo(lineThicknessGroup);\r
+ }\r
+\r
}\r