\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
/**\r
* Filters CategoryDataset by creating "Other" item for filtered data.\r
* \r
+ * Filtering uses sum of absolute values as a comparison point and compares absolute values.\r
+ * If negative values are filtered, their absolute value is added to the others category. \r
+ * \r
+ * \r
* @author Marko Luukkainen <marko.luukkainen@vtt.fi>\r
*\r
*/\r
\r
import org.jfree.data.category.DefaultCategoryDataset;\r
import org.jfree.data.general.AbstractDataset;\r
-import org.jfree.data.general.DatasetChangeEvent;\r
\r
@SuppressWarnings("rawtypes")\r
public class FilteringCategoryDataset extends AbstractDataset implements org.jfree.data.category.CategoryDataset, FilteredDataset{\r
for (Object row : original.getRowKeys()) {\r
Number value = original.getValue((Comparable) row, (Comparable)column);\r
if (value != null)\r
- total+=value.doubleValue();\r
+ total+=Math.abs(value.doubleValue());\r
}\r
total *= filterFraction;\r
for (Object row : original.getRowKeys()) {\r
Number value = original.getValue((Comparable) row, (Comparable)column);\r
if (value == null)\r
continue;\r
- if (value.doubleValue() > total) {\r
+ if (Math.abs(value.doubleValue()) > total) {\r
filtered.addValue(value, (Comparable) row, (Comparable)column);\r
} else {\r
- other += value.doubleValue(); \r
+ // TODO : what is proper way to handle negative values?\r
+ other += Math.abs(value.doubleValue()); \r
}\r
}\r
if (other > 0.0) {\r
for (Object column : original.getColumnKeys()) {\r
Number value = original.getValue((Comparable) row, (Comparable)column);\r
if (value != null)\r
- total += value.doubleValue();\r
+ total += Math.abs(value.doubleValue());\r
}\r
total *= filterFraction;\r
for (Object column : original.getColumnKeys()) {\r
Number value = original.getValue((Comparable) row, (Comparable)column);\r
if (value == null)\r
continue;\r
- if (value.doubleValue() > total) {\r
+ if (Math.abs(value.doubleValue()) > total) {\r
filtered.addValue(value, (Comparable) row, (Comparable)column);\r
} else {\r
- other += value.doubleValue(); \r
+ // TODO : what is proper way to handle negative values?\r
+ other += Math.abs(value.doubleValue()); \r
}\r
}\r
if (other > 0.0) {\r
import java.util.List;\r
\r
import org.jfree.data.general.AbstractDataset;\r
-import org.jfree.data.general.DatasetChangeEvent;\r
import org.jfree.data.general.DefaultPieDataset;\r
import org.jfree.data.general.PieDataset;\r
\r
@Override\r
public Axis getAxis() {\r
axis = new ExtendedNumberAxis();\r
+ ((org.jfree.chart.axis.NumberAxis)axis).setAutoRangeIncludesZero(false);\r
((ExtendedNumberAxis)axis).setLower(min);\r
((ExtendedNumberAxis)axis).setUpper(max);\r
return super.getAxis();\r
* Contributors:\r
* VTT Technical Research Centre of Finland - initial API and implementation\r
*******************************************************************************/\r
-package org.simantics.sysdyn.ui.properties;\r
+package org.simantics.jfreechart.chart.properties;\r
\r
import org.eclipse.swt.events.ControlEvent;\r
import org.eclipse.swt.events.ControlListener;\r
}\r
}\r
\r
+ /**\r
+ * Determine if the layout uses vertical layout\r
+ * @return true iff the layout uses vertical layout\r
+ */\r
+ protected boolean isVertical() {\r
+ Point size = spp.getSize();\r
+ return size.x < size.y;\r
+ }\r
+ \r
/**\r
* Create vertical layout for controls.\r
*/\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
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.eclipse.swt.custom.ScrolledComposite;\r
import org.eclipse.swt.graphics.Point;\r
import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Display;\r
import org.eclipse.swt.widgets.Group;\r
import org.eclipse.swt.widgets.Label;\r
import org.eclipse.swt.widgets.Spinner;\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.jfreechart.chart.properties.AxisHidePropertyComposite;\r
import org.simantics.jfreechart.chart.properties.ColorPicker;\r
import org.simantics.jfreechart.chart.properties.DoubleValidator;\r
import org.simantics.jfreechart.chart.properties.JFreeChartPropertyColorProvider;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.jfreechart.chart.properties.TrackedSpinner;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.modeling.ui.chart.property.DoublePropertyFactory;\r
/**\r
* Tab for bar chart axis properties\r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
-public class BarAxisTab extends LabelPropertyTabContributor implements Widget {\r
+public class BarAxisTab extends AdjustableTab implements Widget {\r
\r
private TrackedSpinner angle;\r
private Integer angleInt = null;\r
private TrackedText rangelabel, rangemin, rangemax;\r
private ScrolledComposite sc;\r
private Composite composite;\r
-\r
-\r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r
- support.register(this);\r
-\r
- // Scrolled composite containing all of the properties in this tab\r
- sc = new ScrolledComposite(body, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(sc);\r
- sc.setExpandHorizontal(true);\r
- sc.setExpandVertical(true);\r
-\r
- composite = new Composite(sc, SWT.NONE);\r
- GridLayoutFactory.fillDefaults().numColumns(2).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
- domainGroup.setText("Domain axis");\r
-\r
- // Label for x-axis\r
- Label label = new Label(domainGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Label:");\r
-\r
- rangelabel = new TrackedText(domainGroup, domainAxisSupport, SWT.BORDER);\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
- Composite axisHide = new AxisHidePropertyComposite(domainGroup, context, domainAxisSupport, SWT.NONE);\r
- GridDataFactory.fillDefaults().span(1, 3).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
-\r
- Composite angleComposite = new Composite(domainGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(angleComposite);\r
- GridLayoutFactory.fillDefaults().applyTo(angleComposite);\r
- angle = new TrackedSpinner(angleComposite, domainAxisSupport, SWT.BORDER);\r
- angle.setSelectionFactory(new AngleSelectionFactory());\r
- angle.addModifyListener(new AngleModifyListener());\r
- angle.setMinimum(0);\r
- angle.setMaximum(90);\r
- angle.getWidget().setIncrement(5);\r
- GridDataFactory.fillDefaults().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
-\r
- Composite colorPicker = new ColorPicker(domainGroup, context, domainAxisSupport, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).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
- rangeGroup.setText("Range axis");\r
-\r
- // Label for range axis\r
- label = new Label(rangeGroup, SWT.NONE);\r
- label.setText("Label:");\r
- label.setAlignment(SWT.RIGHT);\r
- GridDataFactory.fillDefaults().hint(angleLabel.getBounds().width, SWT.DEFAULT).align(SWT.END, SWT.CENTER).applyTo(label);\r
-\r
- rangelabel = new TrackedText(rangeGroup, rangeAxisSupport, SWT.BORDER);\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
- axisHide = new AxisHidePropertyComposite(rangeGroup, context, rangeAxisSupport, SWT.NONE);\r
- GridDataFactory.fillDefaults().span(1, 4).applyTo(axisHide);\r
-\r
- // Min and max values for range axis\r
- label = new Label(rangeGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Min:");\r
-\r
- Composite minmax = new Composite(rangeGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().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
- rangemin.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Axis_min));\r
- rangemin.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Axis_min));\r
- rangemin.setInputValidator(new DoubleValidator(true));\r
-\r
- label = new Label(minmax, SWT.NONE);\r
- label.setText("Max:");\r
- rangemax = new TrackedText(minmax, rangeAxisSupport, SWT.BORDER);\r
- rangemax.setColorProvider(new JFreeChartPropertyColorProvider(rangemax.getResourceManager()));\r
- rangemax.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Axis_max));\r
- rangemax.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Axis_max));\r
- rangemax.setInputValidator(new DoubleValidator(true));\r
-\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
-\r
- colorPicker = new ColorPicker(rangeGroup, context, rangeAxisSupport, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(colorPicker);\r
-\r
- // Resize scrolled composite\r
- sc.setContent(composite);\r
- Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
- sc.setMinSize(size);\r
- }\r
+ private Group domainGroup;\r
+ private Label labelLabel;\r
+ private AxisHidePropertyComposite axisHide;\r
+ private Label angleLabel;\r
+ private Composite angleComposite;\r
+ private Label labelColor;\r
+ private ColorPicker colorPicker;\r
+ private Group rangeGroup;\r
+ private Label labelLabel2;\r
+ private Label labelMin;\r
+ private Composite minmax;\r
+ private Label labelMax;\r
+ private Label labelColor2;\r
+ private TrackedText rangelabel2;\r
+ private AxisHidePropertyComposite axisHide2;\r
+ private ColorPicker colorPicker2;\r
+ private Composite rangeComposite;\r
+ private Composite domainComposite;\r
\r
/**\r
* ModifyListener for the angle {@link TrackedSpinner}\r
JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.Plot));\r
if(plot == null) return;\r
- Resource rangeAxis = graph.getPossibleObject(plot, jfree.Plot_rangeAxis);\r
- if(rangeAxis == null) return;\r
- rangeAxisSupport.fireInput(context, new StructuredSelection(rangeAxis));\r
-\r
- Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
- if(domainAxis == null) return;\r
- domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis));\r
+ final Resource rangeAxis = graph.getPossibleObject(plot, jfree.Plot_rangeAxis);\r
+ final Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
+ if(rangeAxis == null && domainAxis == null) return;\r
+ Display.getDefault().asyncExec(new Runnable() {\r
+ \r
+ @Override\r
+ public void run() {\r
+ if (rangeAxis != null)\r
+ rangeAxisSupport.fireInput(context, new StructuredSelection(rangeAxis));\r
+ if (domainAxis != null)\r
+ domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis));\r
+ \r
+ }\r
+ });\r
}\r
});\r
}\r
+\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ ISessionContext context, WidgetSupport support) {\r
+ support.register(this);\r
+\r
+ // Scrolled composite containing all of the properties in this tab\r
+ sc = new ScrolledComposite(body, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);\r
+ sc.setExpandHorizontal(true);\r
+ sc.setExpandVertical(true);\r
+\r
+ composite = new Composite(sc, SWT.NONE);\r
+\r
+ // Domain Axis properties\r
+ domainGroup = new Group(composite, SWT.NONE);\r
+ domainGroup.setText("Domain axis");\r
+\r
+ domainComposite = new Composite(domainGroup, SWT.NONE);\r
+ \r
+ // Label for x-axis\r
+ labelLabel = new Label(domainComposite, SWT.NONE);\r
+ labelLabel.setText("Label:");\r
+\r
+ rangelabel = new TrackedText(domainComposite, domainAxisSupport, SWT.BORDER);\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
+ \r
+ angleLabel = new Label(domainComposite, SWT.NONE);\r
+ angleLabel.setText("Label angle:");\r
+\r
+ angleComposite = new Composite(domainComposite, SWT.NONE);\r
+ angle = new TrackedSpinner(angleComposite, domainAxisSupport, SWT.BORDER);\r
+ angle.setSelectionFactory(new AngleSelectionFactory());\r
+ angle.addModifyListener(new AngleModifyListener());\r
+ angle.setMinimum(0);\r
+ angle.setMaximum(90);\r
+ angle.getWidget().setIncrement(5);\r
+\r
+ // Domain Color\r
+ labelColor = new Label(domainComposite, SWT.NONE);\r
+ labelColor.setText("Color:");\r
+\r
+ colorPicker = new ColorPicker(domainComposite, context, domainAxisSupport, SWT.NONE);\r
+\r
+ axisHide = new AxisHidePropertyComposite(domainGroup, context, domainAxisSupport, SWT.NONE);\r
+\r
+ \r
+ // Range Axis properties\r
+ rangeGroup = new Group(composite, SWT.NONE);\r
+ rangeGroup.setText("Range axis");\r
+\r
+ rangeComposite = new Composite(rangeGroup, SWT.NONE);\r
+ \r
+ // Label for range axis\r
+ labelLabel2 = new Label(rangeComposite, SWT.NONE);\r
+ labelLabel2.setText("Label:");\r
+ labelLabel2.setAlignment(SWT.RIGHT);\r
+\r
+ rangelabel2 = new TrackedText(rangeComposite, rangeAxisSupport, SWT.BORDER);\r
+ rangelabel2.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel, ""));\r
+ rangelabel2.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
+ rangelabel2.setColorProvider(new JFreeChartPropertyColorProvider(rangelabel2.getResourceManager()));\r
+\r
+\r
+ // Min and max values for range axis\r
+ labelMin = new Label(rangeComposite, SWT.NONE);\r
+ labelMin.setText("Min:");\r
+\r
+ minmax = new Composite(rangeComposite, SWT.NONE);\r
+ rangemin = new TrackedText(minmax, rangeAxisSupport, SWT.BORDER);\r
+ rangemin.setColorProvider(new JFreeChartPropertyColorProvider(rangemin.getResourceManager()));\r
+ rangemin.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Axis_min));\r
+ rangemin.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Axis_min));\r
+ rangemin.setInputValidator(new DoubleValidator(true));\r
+\r
+ labelMax = new Label(minmax, SWT.NONE);\r
+ labelMax.setText("Max:");\r
+ rangemax = new TrackedText(minmax, rangeAxisSupport, SWT.BORDER);\r
+ rangemax.setColorProvider(new JFreeChartPropertyColorProvider(rangemax.getResourceManager()));\r
+ rangemax.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Axis_max));\r
+ rangemax.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Axis_max));\r
+ rangemax.setInputValidator(new DoubleValidator(true));\r
+\r
+ // Range Color\r
+ labelColor2 = new Label(rangeComposite, SWT.NONE);\r
+ labelColor2.setText("Color:");\r
+\r
+ colorPicker2 = new ColorPicker(rangeComposite, context, rangeAxisSupport, SWT.NONE);\r
+\r
+ axisHide2 = new AxisHidePropertyComposite(rangeGroup, context, rangeAxisSupport, SWT.NONE);\r
+ \r
+ // Resize scrolled composite\r
+ sc.setContent(composite);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ // Scrolled composite containing all of the properties in this tab\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(sc);\r
+\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
+\r
+ // Domain Axis properties\r
+ GridDataFactory.fillDefaults().grab(false, false).applyTo(domainGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(1).applyTo(domainGroup);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(domainComposite);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(domainComposite);\r
+\r
+ // Label for x-axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelLabel);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(rangelabel.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(angleLabel);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(angleComposite);\r
+ GridLayoutFactory.fillDefaults().applyTo(angleComposite);\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, true).applyTo(angle.getWidget());\r
+\r
+ // Domain Color\r
+ GridDataFactory.fillDefaults().grab(false, false).align(SWT.END, SWT.CENTER).applyTo(labelColor);\r
+\r
+ GridDataFactory.fillDefaults().grab(false, true).minSize(SWT.DEFAULT, 31).align(SWT.BEGINNING, SWT.CENTER).applyTo(colorPicker);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(axisHide);\r
+\r
+ domainGroup.layout();\r
+\r
+ // Range Axis properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(1).applyTo(rangeGroup);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(rangeComposite);\r
+\r
+ // Label for range axis\r
+ GridDataFactory.fillDefaults().hint(angleLabel.getBounds().width, SWT.DEFAULT).align(SWT.END, SWT.CENTER).applyTo(labelLabel2);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(rangelabel2.getWidget());\r
+\r
+ // Min and max values for range axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelMin);\r
+\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, true).applyTo(minmax);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(minmax);\r
+ GridDataFactory.fillDefaults().hint(50, SWT.DEFAULT).applyTo(rangemax.getWidget());\r
+ GridDataFactory.fillDefaults().hint(50, SWT.DEFAULT).applyTo(rangemin.getWidget());\r
+ \r
+ // Range Color\r
+ GridDataFactory.fillDefaults().grab(false, false).align(SWT.END, SWT.CENTER).applyTo(labelColor2);\r
+\r
+ GridDataFactory.fillDefaults().grab(false, true).minSize(SWT.DEFAULT, 31).align(SWT.BEGINNING, SWT.CENTER).applyTo(colorPicker2);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(axisHide2);\r
+\r
+ // Resize scrolled composite\r
+ Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ // Scrolled composite containing all of the properties in this tab\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(sc);\r
+\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
+\r
+ // Domain Axis properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(domainGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(domainGroup);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(domainComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(4).applyTo(domainComposite);\r
+\r
+ // Label for x-axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelLabel);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(rangelabel.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(angleLabel);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(angleComposite);\r
+ GridLayoutFactory.fillDefaults().applyTo(angleComposite);\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, true).applyTo(angle.getWidget());\r
+\r
+ // Domain Color\r
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.END, SWT.CENTER).applyTo(labelColor);\r
+\r
+ GridDataFactory.fillDefaults().grab(false, true).minSize(SWT.DEFAULT, SWT.DEFAULT).align(SWT.BEGINNING, SWT.CENTER).applyTo(colorPicker);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(axisHide);\r
+\r
+ domainGroup.layout();\r
+\r
+ // Range Axis properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(rangeGroup);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(4).applyTo(rangeComposite);\r
+\r
+ // Label for range axis\r
+ GridDataFactory.fillDefaults().hint(angleLabel.getBounds().width, SWT.DEFAULT).align(SWT.END, SWT.CENTER).applyTo(labelLabel2);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(rangelabel2.getWidget());\r
+\r
+ // Min and max values for range axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelMin);\r
+\r
+ GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(false, true).applyTo(minmax);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(minmax);\r
+ GridDataFactory.fillDefaults().hint(SWT.DEFAULT, SWT.DEFAULT).applyTo(rangemax.getWidget());\r
+ GridDataFactory.fillDefaults().hint(SWT.DEFAULT, SWT.DEFAULT).applyTo(rangemin.getWidget());\r
+ \r
+ // Range Color\r
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.END, SWT.CENTER).applyTo(labelColor2);\r
+\r
+ GridDataFactory.fillDefaults().grab(false, true).minSize(SWT.DEFAULT, SWT.DEFAULT).align(SWT.BEGINNING, SWT.CENTER).applyTo(colorPicker2);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(axisHide2);\r
+\r
+ // Resize scrolled composite\r
+ Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\r
+ }\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.jfreechart.ChartPropertyOptions;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.jfreechart.chart.properties.BooleanPropertyFactory;\r
import org.simantics.jfreechart.chart.properties.BooleanSelectionListener;\r
import org.simantics.jfreechart.chart.properties.DoublePropertyFactory2;\r
import org.simantics.jfreechart.chart.properties.DoublePropertyModifier2;\r
import org.simantics.jfreechart.chart.properties.DoubleValidator;\r
import org.simantics.jfreechart.chart.properties.JFreeChartPropertyColorProvider;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.jfreechart.chart.properties.TitleFactory;\r
import org.simantics.jfreechart.chart.properties.TitleModifier;\r
import org.simantics.layer0.Layer0;\r
/**\r
* General properties of a bar chart\r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
-public class BarGeneralPropertiesTab extends LabelPropertyTabContributor {\r
+public class BarGeneralPropertiesTab extends AdjustableTab {\r
\r
private ScrolledComposite sc;\r
private Composite composite;\r
\r
private boolean showTime = true;\r
private boolean showFilter = false;\r
+ private Group general;\r
+ private Composite labelColumn1;\r
+ private Composite propertyColumn1;\r
+ private Composite labelColumn2;\r
+ private Composite propertyColumn2;\r
+ private Label labelName;\r
+ private Label labelTitle;\r
+ private Label labelTime;\r
+ private Label labelType;\r
+ private Group typeGroup;\r
+ private Label labelOrientation;\r
+ private Group hideGroup;\r
+ private Label labelUse;\r
+ private Label labelPercent;\r
+ private Group filteringGroup;\r
+ private Button useFilter;\r
+ private TrackedText fraction;\r
+ private Point size;\r
\r
public BarGeneralPropertiesTab() {\r
\r
showFilter = ((options & ChartPropertyOptions.SHOW_FILTER) > 0);\r
}\r
\r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) { \r
- // Scrolled composite containing all of the properties in this tab\r
- sc = new ScrolledComposite(body, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
- GridLayoutFactory.fillDefaults().applyTo(sc);\r
- sc.setExpandHorizontal(true);\r
- sc.setExpandVertical(true);\r
-\r
- composite = new Composite(sc, SWT.NONE);\r
- if (showFilter)\r
- GridLayoutFactory.fillDefaults().numColumns(4).margins(3, 3).applyTo(composite);\r
- else\r
- GridLayoutFactory.fillDefaults().numColumns(3).margins(3, 3).applyTo(composite);\r
-\r
- // General properties\r
- Group general = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(4).applyTo(general);\r
- general.setText("General");\r
-\r
- // first column: labels\r
- Composite labelColumn1 = new Composite(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn1);\r
- GridLayoutFactory.fillDefaults().applyTo(labelColumn1);\r
- \r
- // second column: name and title\r
- Composite propertyColumn1 = new Composite(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyColumn1);\r
- GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(propertyColumn1);\r
- \r
- // third column: labels\r
- Composite labelColumn2 = new Composite(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn2);\r
- GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(labelColumn2);\r
- \r
- // fourth column: type and time\r
- Composite propertyColumn2 = new Composite(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).applyTo(propertyColumn2);\r
- GridLayoutFactory.fillDefaults().applyTo(propertyColumn2);\r
- \r
- // Name\r
- Label label = new Label(labelColumn1, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Name:");\r
-\r
- name = new org.simantics.browsing.ui.swt.widgets.TrackedText(propertyColumn1, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
- name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
- name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
- name.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
-\r
- // Type\r
-// label = new Label(labelColumn2, SWT.NONE);\r
-// GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
-// label.setText("Type:");\r
-//\r
-// type = new TrackedCombo(propertyColumn2, support, SWT.BORDER | SWT.READ_ONLY);\r
-// type.addModifyListener(new TypeModifyListener());\r
-// type.setItemFactory(new TypeItemFactory());\r
-// type.setSelectionFactory(new TypeSelectionFactory());\r
-// GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
- label = new Label(labelColumn2, SWT.NONE);\r
- label = new Label(propertyColumn2, SWT.NONE);\r
- \r
- // Title (Which is different than name)\r
- label = new Label(labelColumn1, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Title:");\r
-\r
- title = new org.simantics.browsing.ui.swt.widgets.TrackedText(propertyColumn1, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(title.getWidget());\r
- title.setTextFactory(new TitleFactory());\r
- title.addModifyListener(new TitleModifier());\r
- title.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
-\r
- if (showTime) {\r
- // Time\r
- label = new Label(labelColumn2, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Time:");\r
- \r
- time = new org.simantics.browsing.ui.swt.widgets.TrackedText(propertyColumn2, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(time.getWidget());\r
- time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Chart_time));\r
- time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Chart_time));\r
- time.setInputValidator(new DoubleValidator(true));\r
- time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
- }\r
- \r
- Group typeGroup = new Group(composite,SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(typeGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(typeGroup);\r
- typeGroup.setText("Visuals");\r
- \r
- label = new Label(typeGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Type:");\r
-\r
- type = new TrackedCombo(typeGroup, support, SWT.BORDER | SWT.READ_ONLY);\r
- type.addModifyListener(new TypeModifyListener());\r
- type.setItemFactory(new TypeItemFactory());\r
- type.setSelectionFactory(new TypeSelectionFactory());\r
- GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
- \r
- label = new Label(typeGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Orientation:");\r
- \r
- orientation = new TrackedCombo(typeGroup, support, SWT.BORDER | SWT.READ_ONLY);\r
- orientation.addModifyListener(new OrientationModifyListener());\r
- orientation.setItemFactory(new OrientationItemFactory());\r
- orientation.setSelectionFactory(new OrientationSelectionFactory());\r
- GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
-\r
- \r
- // Group for hide options\r
- Group hideGroup = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(hideGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
- hideGroup.setText("Hide");\r
-\r
- hgrid = new Button(hideGroup, support, SWT.CHECK);\r
- hgrid.setText("Grid");\r
- hgrid.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid, true));\r
- hgrid.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid));\r
- htitle = new Button(hideGroup, support, SWT.CHECK);\r
- htitle.setText("Title");\r
- htitle.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible, true));\r
- htitle.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible));\r
- hlegend = new Button(hideGroup, support, SWT.CHECK);\r
- hlegend.setText("Legend");\r
- hlegend.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Chart_visibleLegend, true));\r
- hlegend.addSelectionListener(new BooleanSelectionListener(context, null, JFreeChartResource.URIs.Chart_visibleLegend));\r
-\r
- if (showFilter) {\r
- Group filteringGroup = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(filteringGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(filteringGroup);\r
- filteringGroup.setText("Filter");\r
- label = new Label(filteringGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Use:");\r
- Button useFilter = new Button(filteringGroup, support, SWT.CHECK);\r
- useFilter.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Filter_used, false));\r
- useFilter.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Filter_used));\r
- label = new Label(filteringGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Percent:");\r
- TrackedText fraction = new TrackedText(filteringGroup, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fraction.getWidget());\r
- fraction.setTextFactory(new DoublePropertyFactory2(JFreeChartResource.URIs.Plot,JFreeChartResource.URIs.Filter_fraction));\r
- fraction.addModifyListener(new DoublePropertyModifier2(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Filter_fraction));\r
- fraction.setInputValidator(new DoubleValidator(true));\r
- fraction.setColorProvider(new JFreeChartPropertyColorProvider(fraction.getResourceManager()));\r
- }\r
- \r
- // Resize scrolled composite\r
- sc.setContent(composite);\r
- Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
- sc.setMinSize(size);\r
- \r
- \r
- }\r
-\r
/**\r
* \r
* @author Teemu Lempinen\r
}\r
}\r
\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ ISessionContext context, WidgetSupport support) {\r
+ // Scrolled composite containing all of the properties in this tab\r
+ sc = new ScrolledComposite(body, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);\r
+ sc.setExpandHorizontal(true);\r
+ sc.setExpandVertical(true);\r
+\r
+ composite = new Composite(sc, SWT.NONE);\r
+\r
+ // General properties\r
+ general = new Group(composite, SWT.NONE);\r
+ general.setText("General");\r
+\r
+ // first column: labels\r
+ labelColumn1 = new Composite(general, SWT.NONE);\r
+ \r
+ // second column: name and title\r
+ propertyColumn1 = new Composite(general, SWT.NONE);\r
+ \r
+ // third column: labels\r
+ labelColumn2 = new Composite(general, SWT.NONE);\r
+ \r
+ // fourth column: type and time\r
+ propertyColumn2 = new Composite(general, SWT.NONE);\r
+ \r
+ // Name\r
+ labelName = new Label(labelColumn1, SWT.NONE);\r
+ labelName.setText("Name:");\r
+\r
+ name = new org.simantics.browsing.ui.swt.widgets.TrackedText(propertyColumn1, support, SWT.BORDER);\r
+ name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
+ name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
+ name.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
+\r
+ labelTitle = new Label(labelColumn2, SWT.NONE);\r
+ labelTitle = new Label(propertyColumn2, SWT.NONE);\r
+ \r
+ // Title (Which is different than name)\r
+ labelTitle = new Label(labelColumn1, SWT.NONE);\r
+ labelTitle.setText("Title:");\r
+\r
+ title = new org.simantics.browsing.ui.swt.widgets.TrackedText(propertyColumn1, support, SWT.BORDER);\r
+ title.setTextFactory(new TitleFactory());\r
+ title.addModifyListener(new TitleModifier());\r
+ title.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
+\r
+ if (showTime) {\r
+ // Time\r
+ labelTime = new Label(labelColumn2, SWT.NONE);\r
+ labelTime.setText("Time:");\r
+ \r
+ time = new org.simantics.browsing.ui.swt.widgets.TrackedText(propertyColumn2, support, SWT.BORDER);\r
+ time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Chart_time));\r
+ time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Chart_time));\r
+ time.setInputValidator(new DoubleValidator(true));\r
+ time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
+ }\r
+ \r
+ typeGroup = new Group(composite,SWT.NONE);\r
+ typeGroup.setText("Visuals");\r
+ \r
+ labelType = new Label(typeGroup, SWT.NONE);\r
+ labelType.setText("Type:");\r
+\r
+ type = new TrackedCombo(typeGroup, support, SWT.BORDER | SWT.READ_ONLY);\r
+ type.addModifyListener(new TypeModifyListener());\r
+ type.setItemFactory(new TypeItemFactory());\r
+ type.setSelectionFactory(new TypeSelectionFactory());\r
+ \r
+ labelOrientation = new Label(typeGroup, SWT.NONE);\r
+ labelOrientation.setText("Orientation:");\r
+ \r
+ orientation = new TrackedCombo(typeGroup, support, SWT.BORDER | SWT.READ_ONLY);\r
+ orientation.addModifyListener(new OrientationModifyListener());\r
+ orientation.setItemFactory(new OrientationItemFactory());\r
+ orientation.setSelectionFactory(new OrientationSelectionFactory());\r
+\r
+ \r
+ // Group for hide options\r
+ hideGroup = new Group(composite, SWT.NONE);\r
+ hideGroup.setText("Hide");\r
+\r
+ hgrid = new Button(hideGroup, support, SWT.CHECK);\r
+ hgrid.setText("Grid");\r
+ hgrid.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid, true));\r
+ hgrid.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid));\r
+ htitle = new Button(hideGroup, support, SWT.CHECK);\r
+ htitle.setText("Title");\r
+ htitle.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible, true));\r
+ htitle.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible));\r
+ hlegend = new Button(hideGroup, support, SWT.CHECK);\r
+ hlegend.setText("Legend");\r
+ hlegend.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Chart_visibleLegend, true));\r
+ hlegend.addSelectionListener(new BooleanSelectionListener(context, null, JFreeChartResource.URIs.Chart_visibleLegend));\r
+\r
+ if (showFilter) {\r
+ filteringGroup = new Group(composite, SWT.NONE);\r
+ filteringGroup.setText("Filter");\r
+ labelUse = new Label(filteringGroup, SWT.NONE);\r
+ labelUse.setText("Use:");\r
+ useFilter = new Button(filteringGroup, support, SWT.CHECK);\r
+ useFilter.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Filter_used, false));\r
+ useFilter.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Filter_used));\r
+ labelPercent = new Label(filteringGroup, SWT.NONE);\r
+ labelPercent.setText("Percent:");\r
+ fraction = new TrackedText(filteringGroup, support, SWT.BORDER);\r
+ fraction.setTextFactory(new DoublePropertyFactory2(JFreeChartResource.URIs.Plot,JFreeChartResource.URIs.Filter_fraction));\r
+ fraction.addModifyListener(new DoublePropertyModifier2(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Filter_fraction));\r
+ fraction.setInputValidator(new DoubleValidator(true));\r
+ fraction.setColorProvider(new JFreeChartPropertyColorProvider(fraction.getResourceManager()));\r
+ }\r
+ \r
+ // Resize scrolled composite\r
+ sc.setContent(composite);\r
+ \r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ // Scrolled composite containing all of the properties in this tab\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().applyTo(sc);\r
+\r
+ if (showFilter)\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+ else\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+\r
+ // General properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(general);\r
+\r
+ // first column: labels\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn1);\r
+ GridLayoutFactory.fillDefaults().applyTo(labelColumn1);\r
+ \r
+ // second column: name and title\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyColumn1);\r
+ GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(propertyColumn1);\r
+ \r
+ // third column: labels\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn2);\r
+ GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(labelColumn2);\r
+ \r
+ // fourth column: type and time\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(propertyColumn2);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyColumn2);\r
+ \r
+ // Name\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelName);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelTitle);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(title.getWidget());\r
+\r
+ if (showTime) {\r
+ // Time\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelTime);\r
+ \r
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(time.getWidget());\r
+ }\r
+ \r
+ GridDataFactory.fillDefaults().applyTo(typeGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(typeGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelType);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelOrientation);\r
+ \r
+ GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
+\r
+ // Group for hide options\r
+ GridDataFactory.fillDefaults().applyTo(hideGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
+\r
+ if (showFilter) {\r
+ GridDataFactory.fillDefaults().applyTo(filteringGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(filteringGroup);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelUse);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelPercent);\r
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fraction.getWidget());\r
+ }\r
+ \r
+ size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ // Scrolled composite containing all of the properties in this tab\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().applyTo(sc);\r
+\r
+ if (showFilter)\r
+ GridLayoutFactory.fillDefaults().numColumns(4).margins(3, 3).applyTo(composite);\r
+ else\r
+ GridLayoutFactory.fillDefaults().numColumns(3).margins(3, 3).applyTo(composite);\r
+\r
+ // General properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(4).applyTo(general);\r
+\r
+ // first column: labels\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn1);\r
+ GridLayoutFactory.fillDefaults().applyTo(labelColumn1);\r
+ \r
+ // second column: name and title\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyColumn1);\r
+ GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(propertyColumn1);\r
+ \r
+ // third column: labels\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn2);\r
+ GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(labelColumn2);\r
+ \r
+ // fourth column: type and time\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(propertyColumn2);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyColumn2);\r
+ \r
+ // Name\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelName);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelTitle);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(title.getWidget());\r
+\r
+ if (showTime) {\r
+ // Time\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelTime);\r
+ \r
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(time.getWidget());\r
+ }\r
+ \r
+ GridDataFactory.fillDefaults().applyTo(typeGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(typeGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelType);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelOrientation);\r
+ \r
+ GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
+\r
+ // Group for hide options\r
+ GridDataFactory.fillDefaults().applyTo(hideGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
+\r
+ if (showFilter) {\r
+ GridDataFactory.fillDefaults().applyTo(filteringGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(filteringGroup);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelUse);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelPercent);\r
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fraction.getWidget());\r
+ }\r
+ \r
+ size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\r
+ }\r
+\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.layer0.util.RemoverUtil;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.jfreechart.chart.ChartUtils;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.jfreechart.chart.properties.xyline.AxisAndVariablesExplorerComposite;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
/**\r
* Tab containing the series of a bar chart\r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
-public class BarSeriesTab extends LabelPropertyTabContributor implements Widget {\r
+public class BarSeriesTab extends AdjustableTab implements Widget {\r
\r
private GraphExplorerComposite explorer;\r
private ScrolledComposite propertyContainer;\r
private Resource chartResource;\r
private BarSeriesPropertyComposite spc;\r
private int options;\r
+ private Composite composite;\r
+ private Composite buttonComposite;\r
\r
public BarSeriesTab(int options) {\r
additionalSupport = new WidgetSupportImpl();\r
this.options = options;\r
}\r
\r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) {\r
- support.register(this);\r
- Composite composite = new Composite(body, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
- GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
-\r
- // (Ontology-based) GraphExplorer displaying variables in a bar chart\r
- explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
- "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
- explorer.setBrowseContexts(JFreeChartResource.URIs.BarSeriesBrowseContext);\r
- explorer.setInputSource(new SingleSelectionInputSource(\r
- Resource.class));\r
- explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
- explorer.finish();\r
-\r
- ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
- public void widgetSelected(SelectionEvent e) {\r
- updateSelection(context);\r
- }\r
- });\r
- GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
-\r
- // Scrolled composite for displaying properties of a selection in explorer\r
- propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
- GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
- propertyContainer.setExpandHorizontal(true);\r
- propertyContainer.setExpandVertical(true);\r
-\r
- // Buttons for adding and removing variables from a pie plot\r
- Composite buttonComposite = new Composite(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
- GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
-\r
- add = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
- add.setText("Add");\r
- add.addSelectionListener(new NewVariableListener(context));\r
-\r
- remove = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
- remove.setText("Remove");\r
- remove.addSelectionListener(new RemoveListener(context));\r
- }\r
-\r
/**\r
* Updates the content of propertyContainer \r
* @param context\r
chartResource = AdaptionUtils.adaptToSingle(input, Resource.class);\r
}\r
\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ final ISessionContext context, WidgetSupport support) {\r
+ support.register(this);\r
+ composite = new Composite(body, SWT.NONE);\r
+\r
+ // (Ontology-based) GraphExplorer displaying variables in a bar chart\r
+ explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
+ "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
+ explorer.setBrowseContexts(JFreeChartResource.URIs.BarSeriesBrowseContext);\r
+ explorer.setInputSource(new SingleSelectionInputSource(\r
+ Resource.class));\r
+ explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
+ explorer.finish();\r
+\r
+ ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
+ public void widgetSelected(SelectionEvent e) {\r
+ updateSelection(context);\r
+ }\r
+ });\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
+ propertyContainer.setExpandHorizontal(true);\r
+ propertyContainer.setExpandVertical(true);\r
+\r
+ // Buttons for adding and removing variables from a pie plot\r
+ buttonComposite = new Composite(composite, SWT.NONE);\r
+\r
+ add = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ add.setText("Add");\r
+ add.addSelectionListener(new NewVariableListener(context));\r
+\r
+ remove = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ remove.setText("Remove");\r
+ remove.addSelectionListener(new RemoveListener(context));\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().hint(150, 200).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().hint(150, 130).span(1, 1).grab(true, false).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+\r
+ // Buttons for adding and removing variables from a pie plot\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+\r
+ // Buttons for adding and removing variables from a pie plot\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ }\r
+\r
\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\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.AdjustableTab;\r
import org.simantics.jfreechart.chart.properties.BooleanPropertyFactory;\r
import org.simantics.jfreechart.chart.properties.BooleanSelectionListener;\r
import org.simantics.jfreechart.chart.properties.DoublePropertyFactory2;\r
import org.simantics.jfreechart.chart.properties.DoublePropertyModifier2;\r
import org.simantics.jfreechart.chart.properties.DoubleValidator;\r
import org.simantics.jfreechart.chart.properties.JFreeChartPropertyColorProvider;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.jfreechart.chart.properties.TitleFactory;\r
import org.simantics.jfreechart.chart.properties.TitleModifier;\r
import org.simantics.layer0.Layer0;\r
/**\r
* General properties of a pie chart\r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
-public class PieGeneralPropertiesTab extends LabelPropertyTabContributor {\r
+public class PieGeneralPropertiesTab extends AdjustableTab {\r
\r
private ScrolledComposite sc;\r
private Composite composite;\r
\r
private boolean showTime = true;\r
private boolean showFilter = false;\r
+ private Group general;\r
+ private Composite labelColumn1;\r
+ private Composite propertyColumn1;\r
+ private Composite labelColumn2;\r
+ private Composite propertyColumn2;\r
+ private Label labelName;\r
+ private Label labelTitle;\r
+ private Label labelTime;\r
+ private Group hideGroup;\r
+ private Group filteringGroup;\r
+ private Label labelUse;\r
+ private Label labelPercent;\r
+ private Button useFilter;\r
+ private TrackedText fraction;\r
+ private Point size;\r
\r
public PieGeneralPropertiesTab() {\r
\r
showFilter = ((options & ChartPropertyOptions.SHOW_FILTER) > 0);\r
}\r
\r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) { \r
- // Scrolled composite containing all of the properties in this tab\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ ISessionContext context, WidgetSupport support) {\r
+ // Scrolled composite containing all of the properties in this tab\r
sc = new ScrolledComposite(body, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
- GridLayoutFactory.fillDefaults().applyTo(sc);\r
sc.setExpandHorizontal(true);\r
sc.setExpandVertical(true);\r
\r
composite = new Composite(sc, SWT.NONE);\r
- if (showFilter)\r
- GridLayoutFactory.fillDefaults().numColumns(3).margins(3, 3).applyTo(composite);\r
- else\r
- GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
\r
// General properties\r
- Group general = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(4).applyTo(general);\r
+ general = new Group(composite, SWT.NONE);\r
general.setText("General");\r
\r
// first column: labels\r
- Composite labelColumn1 = new Composite(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn1);\r
- GridLayoutFactory.fillDefaults().applyTo(labelColumn1);\r
+ labelColumn1 = new Composite(general, SWT.NONE);\r
\r
// first column: name and title\r
- Composite propertyColumn1 = new Composite(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyColumn1);\r
- GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(propertyColumn1);\r
+ propertyColumn1 = new Composite(general, SWT.NONE);\r
\r
// first column: labels\r
- Composite labelColumn2 = new Composite(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn2);\r
- GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(labelColumn2);\r
+ labelColumn2 = new Composite(general, SWT.NONE);\r
\r
// first column: type and time\r
- Composite propertyColumn2 = new Composite(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).applyTo(propertyColumn2);\r
- GridLayoutFactory.fillDefaults().applyTo(propertyColumn2);\r
+ propertyColumn2 = new Composite(general, SWT.NONE);\r
\r
// Name\r
- Label label = new Label(labelColumn1, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Name:");\r
+ labelName = new Label(labelColumn1, SWT.NONE);\r
+ labelName.setText("Name:");\r
\r
name = new org.simantics.browsing.ui.swt.widgets.TrackedText(propertyColumn1, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
name.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
\r
// Dummy data for now. Waiting for different pie chart types\r
- label = new Label(labelColumn2, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).applyTo(label);\r
- label.setText("");\r
+ labelTitle = new Label(labelColumn2, SWT.NONE);\r
+ labelTitle.setText("");\r
\r
- label = new Label(propertyColumn2, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).applyTo(label);\r
- label.setText("");\r
+ labelTitle = new Label(propertyColumn2, SWT.NONE);\r
+ labelTitle.setText("");\r
\r
// Title (Which is different than name)\r
- label = new Label(labelColumn1, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Title:");\r
+ labelTitle = new Label(labelColumn1, SWT.NONE);\r
+ labelTitle.setText("Title:");\r
\r
title = new org.simantics.browsing.ui.swt.widgets.TrackedText(propertyColumn1, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(title.getWidget());\r
title.setTextFactory(new TitleFactory());\r
title.addModifyListener(new TitleModifier());\r
title.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
\r
if (showTime) {\r
// Time\r
- label = new Label(labelColumn2, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Time:");\r
+ labelTime = new Label(labelColumn2, SWT.NONE);\r
+ labelTime.setText("Time:");\r
\r
time = new org.simantics.browsing.ui.swt.widgets.TrackedText(propertyColumn2, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(time.getWidget());\r
time.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Chart_time));\r
time.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Chart_time));\r
time.setInputValidator(new DoubleValidator(true));\r
time.setColorProvider(new JFreeChartPropertyColorProvider(time.getResourceManager()));\r
}\r
// Group for hide options\r
- Group hideGroup = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(hideGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
+ hideGroup = new Group(composite, SWT.NONE);\r
hideGroup.setText("Hide");\r
\r
htitle = new Button(hideGroup, support, SWT.CHECK);\r
hlabels.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleLabels));\r
\r
if (showFilter) {\r
- Group filteringGroup = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(filteringGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(filteringGroup);\r
+ filteringGroup = new Group(composite, SWT.NONE);\r
filteringGroup.setText("Filter");\r
- label = new Label(filteringGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Use:");\r
- Button useFilter = new Button(filteringGroup, support, SWT.CHECK);\r
+ labelUse = new Label(filteringGroup, SWT.NONE);\r
+ labelUse.setText("Use:");\r
+ useFilter = new Button(filteringGroup, support, SWT.CHECK);\r
useFilter.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Filter_used, false));\r
useFilter.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Filter_used));\r
- label = new Label(filteringGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Percent:");\r
- TrackedText fraction = new TrackedText(filteringGroup, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fraction.getWidget());\r
+ labelPercent = new Label(filteringGroup, SWT.NONE);\r
+ labelPercent.setText("Percent:");\r
+ fraction = new TrackedText(filteringGroup, support, SWT.BORDER);\r
fraction.setTextFactory(new DoublePropertyFactory2(JFreeChartResource.URIs.Plot,JFreeChartResource.URIs.Filter_fraction));\r
fraction.addModifyListener(new DoublePropertyModifier2(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Filter_fraction));\r
fraction.setInputValidator(new DoubleValidator(true));\r
}\r
\r
sc.setContent(composite);\r
- Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ // Scrolled composite containing all of the properties in this tab\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().applyTo(sc);\r
+\r
+ if (showFilter)\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+ else\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+\r
+ // General properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(general);\r
+\r
+ // first column: labels\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn1);\r
+ GridLayoutFactory.fillDefaults().applyTo(labelColumn1);\r
+ \r
+ // first column: name and title\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyColumn1);\r
+ GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(propertyColumn1);\r
+ \r
+ // first column: labels\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn2);\r
+ GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(labelColumn2);\r
+ \r
+ // first column: type and time\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(propertyColumn2);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyColumn2);\r
+ \r
+ // Name\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelName);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+\r
+ // Dummy data for now. Waiting for different pie chart types\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelTitle);\r
+ \r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelTitle);\r
+ \r
+ // Title (Which is different than name)\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelTitle);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(title.getWidget());\r
+\r
+ if (showTime) {\r
+ // Time\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelTime);\r
+ \r
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(time.getWidget());\r
+ }\r
+ // Group for hide options\r
+ GridDataFactory.fillDefaults().applyTo(hideGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
+\r
+ if (showFilter) {\r
+ GridDataFactory.fillDefaults().applyTo(filteringGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(filteringGroup);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelUse);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelPercent);\r
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fraction.getWidget());\r
+ }\r
+ \r
+ size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
sc.setMinSize(size);\r
- }\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ // Scrolled composite containing all of the properties in this tab\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().applyTo(sc);\r
+\r
+ if (showFilter)\r
+ GridLayoutFactory.fillDefaults().numColumns(3).margins(3, 3).applyTo(composite);\r
+ else\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ // General properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(4).applyTo(general);\r
+\r
+ // first column: labels\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn1);\r
+ GridLayoutFactory.fillDefaults().applyTo(labelColumn1);\r
+ \r
+ // first column: name and title\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyColumn1);\r
+ GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(propertyColumn1);\r
+ \r
+ // first column: labels\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelColumn2);\r
+ GridLayoutFactory.fillDefaults().spacing(0, LayoutConstants.getSpacing().y).applyTo(labelColumn2);\r
+ \r
+ // first column: type and time\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(propertyColumn2);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyColumn2);\r
+ \r
+ // Name\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelName);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+\r
+ // Dummy data for now. Waiting for different pie chart types\r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelTitle);\r
+ \r
+ GridDataFactory.fillDefaults().grab(false, true).applyTo(labelTitle);\r
+ \r
+ // Title (Which is different than name)\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelTitle);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(title.getWidget());\r
+\r
+ if (showTime) {\r
+ // Time\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelTime);\r
+ \r
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(time.getWidget());\r
+ }\r
+ // Group for hide options\r
+ GridDataFactory.fillDefaults().applyTo(hideGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
+\r
+ if (showFilter) {\r
+ GridDataFactory.fillDefaults().applyTo(filteringGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(filteringGroup);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelUse);\r
+ GridDataFactory.fillDefaults().grab(false, true).align(SWT.END, SWT.CENTER).applyTo(labelPercent);\r
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fraction.getWidget());\r
+ }\r
+ \r
+ size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\r
+ }\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.layer0.util.RemoverUtil;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.jfreechart.chart.ChartUtils;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.jfreechart.chart.properties.xyline.AxisAndVariablesExplorerComposite;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
/**\r
* Tab for modifying series in a pie chart configuration\r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
-public class PieSeriesTab extends LabelPropertyTabContributor implements Widget {\r
+public class PieSeriesTab extends AdjustableTab implements Widget {\r
\r
private GraphExplorerComposite explorer;\r
private ScrolledComposite propertyContainer;\r
private Button add, remove;\r
private Resource chartResource;\r
private int options;\r
+ private Composite composite;\r
+ private Composite buttonComposite;\r
\r
public PieSeriesTab(int options) {\r
additionalSupport = new WidgetSupportImpl();\r
this.options = options;\r
}\r
\r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) {\r
- support.register(this);\r
- Composite composite = new Composite(body, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
- GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
-\r
- // (Ontology-based) GraphExplorer displaying variables of a pie chart\r
- explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
- "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
- explorer.setBrowseContexts(JFreeChartResource.URIs.PieSeriesBrowseContext);\r
- explorer.setInputSource(new SingleSelectionInputSource(\r
- Resource.class));\r
- explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
- explorer.finish();\r
-\r
- ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
- public void widgetSelected(SelectionEvent e) {\r
- updateSelection(context);\r
- }\r
- });\r
- GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
-\r
- // Scrolled composite for displaying properties of a selection in explorer\r
- propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
- GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
- propertyContainer.setExpandHorizontal(true);\r
- propertyContainer.setExpandVertical(true);\r
-\r
-\r
- // Buttons for adding and removing variables from a pie plot\r
- Composite buttonComposite = new Composite(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
- GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
-\r
- add = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
- add.setText("Add");\r
- add.addSelectionListener(new NewVariableListener(context));\r
-\r
- remove = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
- remove.setText("Remove");\r
- remove.addSelectionListener(new RemoveListener(context));\r
- }\r
-\r
/**\r
* Updates the content of propertyContainer \r
* @param context\r
chartResource = AdaptionUtils.adaptToSingle(input, Resource.class);\r
}\r
\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ final ISessionContext context, WidgetSupport support) {\r
+ support.register(this);\r
+ composite = new Composite(body, SWT.NONE);\r
+\r
+ // (Ontology-based) GraphExplorer displaying variables of a pie chart\r
+ explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
+ "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
+ explorer.setBrowseContexts(JFreeChartResource.URIs.PieSeriesBrowseContext);\r
+ explorer.setInputSource(new SingleSelectionInputSource(\r
+ Resource.class));\r
+ explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
+ explorer.finish();\r
+\r
+ ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
+ public void widgetSelected(SelectionEvent e) {\r
+ updateSelection(context);\r
+ }\r
+ });\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
+ propertyContainer.setExpandHorizontal(true);\r
+ propertyContainer.setExpandVertical(true);\r
+\r
+\r
+ // Buttons for adding and removing variables from a pie plot\r
+ buttonComposite = new Composite(composite, SWT.NONE);\r
+\r
+ add = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ add.setText("Add");\r
+ add.addSelectionListener(new NewVariableListener(context));\r
+\r
+ remove = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ remove.setText("Remove");\r
+ remove.addSelectionListener(new RemoveListener(context));\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().hint(150, 200).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().hint(150, 190).span(1, 1).grab(true, false).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+\r
+ // Buttons for adding and removing variables from a pie plot\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+\r
+ // Buttons for adding and removing variables from a pie plot\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ }\r
+\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
* Composite for displaying axis properties in {@link XYLineAxisAndVariablesTab}\r
* \r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
public class AxisPropertyComposite extends Composite {\r
Button tlabels, tmarks;\r
\r
public AxisPropertyComposite(Composite parent, ISessionContext context, WidgetSupport support, int style) {\r
+ super(parent, style);\r
+ init(parent, context, support, style, false);\r
+ }\r
+\r
+ public AxisPropertyComposite(Composite parent, ISessionContext context, WidgetSupport support, int style, boolean vertical) {\r
super(parent, style);\r
- \r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(this);\r
+ init(parent, context, support, style, vertical);\r
+ }\r
+ \r
+ private void init(Composite parent, ISessionContext context, WidgetSupport support, int style, boolean vertical) {\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(vertical ? 2 : 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(vertical ? 1 : 2, 1).applyTo(units.getWidget());\r
\r
\r
// Minimum and maximum values\r
min.setTextFactory(new DoublePropertyFactory(JFreeChartResource.URIs.Axis_min));\r
min.addModifyListener(new DoublePropertyModifier(context, JFreeChartResource.URIs.Axis_min));\r
min.setInputValidator(new DoubleValidator(true));\r
-\r
+ GridDataFactory.fillDefaults().hint(55, SWT.DEFAULT).applyTo(min.getWidget());\r
+ \r
label = new Label(minmax, SWT.NONE);\r
label.setText("Max:");\r
max = new TrackedText(minmax, support, SWT.BORDER);\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
+ GridDataFactory.fillDefaults().hint(55, SWT.DEFAULT).applyTo(max.getWidget());\r
\r
+ Composite hideComposite = null;\r
+ if (!vertical) {\r
+ // Tick and label visibility\r
+ hideComposite = new Composite(this, SWT.NONE);\r
+ GridDataFactory.fillDefaults().span(1, 2).applyTo(hideComposite);\r
+ }\r
+ \r
// Color\r
label = new Label(this, SWT.NONE);\r
label.setText("Color:");\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
+ if (vertical) {\r
+ // Tick and label visibility\r
+ hideComposite = new Composite(this, SWT.NONE);\r
+ GridDataFactory.fillDefaults().span(2, 1).applyTo(hideComposite);\r
+ }\r
+ \r
+ // Fill hideComposite\r
+ GridLayoutFactory.fillDefaults().applyTo(hideComposite);\r
+ Composite axisHide = new AxisHidePropertyComposite(hideComposite, context, support, SWT.NONE);\r
+ GridDataFactory.fillDefaults().applyTo(axisHide);\r
+ \r
+ }\r
\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.db.request.Read;\r
import org.simantics.jfreechart.chart.ChartUtils;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.JFreeChartResource;\r
import org.simantics.ui.SimanticsUI;\r
* PropertyTab displaying properties of axis and variables of a chart\r
* \r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
-public class XYLineAxisAndVariablesTab extends LabelPropertyTabContributor {\r
+public class XYLineAxisAndVariablesTab extends AdjustableTab {\r
\r
private GraphExplorerComposite explorer;\r
private ScrolledComposite propertyContainer;\r
private Button addAxis, addVariable, remove;\r
private WidgetSupportImpl additionalSupport;\r
+ private Composite composite;\r
+ private Composite buttonComposite;\r
\r
public XYLineAxisAndVariablesTab() {\r
additionalSupport = new WidgetSupportImpl();\r
}\r
\r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) {\r
- Composite composite = new Composite(body, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
- GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
-\r
- // (Ontology-based) GraphExplorer displaying range axis and variables mapped to those axis\r
- explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
- "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
- explorer.setBrowseContexts(JFreeChartResource.URIs.ChartAxisAndVariablesBrowseContext);\r
- explorer.setInputSource(new SingleSelectionInputSource(\r
- Resource.class));\r
- explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
- explorer.finish();\r
-\r
- ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
- public void widgetSelected(SelectionEvent e) {\r
- updateSelection(context);\r
- }\r
- });\r
- GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
-\r
- // Scrolled composite for displaying properties of a selection in explorer\r
- propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
- GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
- propertyContainer.setExpandHorizontal(true);\r
- propertyContainer.setExpandVertical(true);\r
-\r
- // Buttons for adding axis and variables and removing selected items from explorer\r
- Composite buttonComposite = new Composite(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
- GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
-\r
- addAxis = new Button(buttonComposite, support, SWT.NONE);\r
- addAxis.setText("Add axis");\r
- addAxis.addSelectionListener(new NewAxisListener(context));\r
-\r
- addVariable = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
- addVariable.setText("Add variable");\r
- addVariable.addSelectionListener(new NewVariableListener(context));\r
-\r
- remove = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
- remove.setText("Remove");\r
- remove.addSelectionListener(new RemoveListener(context));\r
- }\r
-\r
/**\r
* Updates the content of propertyContainer \r
* @param context\r
}\r
\r
if(typeUri.equals(JFreeChartResource.URIs.Axis)) {\r
- AxisPropertyComposite apc = new AxisPropertyComposite(propertyContainer, context, additionalSupport, SWT.NONE);\r
+ AxisPropertyComposite apc = new AxisPropertyComposite(propertyContainer, context, additionalSupport, SWT.NONE, isVertical());\r
propertyContainer.setContent(apc);\r
Point size = apc.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
propertyContainer.setMinSize(size);\r
RemoverUtil.remove(graph, input);\r
}\r
}\r
+\r
+\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ final ISessionContext context, WidgetSupport support) {\r
+ composite = new Composite(body, SWT.NONE);\r
+\r
+ // (Ontology-based) GraphExplorer displaying range axis and variables mapped to those axis\r
+ explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
+ "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
+ explorer.setBrowseContexts(JFreeChartResource.URIs.ChartAxisAndVariablesBrowseContext);\r
+ explorer.setInputSource(new SingleSelectionInputSource(\r
+ Resource.class));\r
+ explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
+ explorer.finish();\r
+\r
+ ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
+ public void widgetSelected(SelectionEvent e) {\r
+ updateSelection(context);\r
+ }\r
+ });\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
+ propertyContainer.setExpandHorizontal(true);\r
+ propertyContainer.setExpandVertical(true);\r
+\r
+ // Buttons for adding axis and variables and removing selected items from explorer\r
+ buttonComposite = new Composite(composite, SWT.NONE);\r
+\r
+ addAxis = new Button(buttonComposite, support, SWT.NONE);\r
+ addAxis.setText("Add axis");\r
+ addAxis.addSelectionListener(new NewAxisListener(context));\r
+\r
+ addVariable = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ addVariable.setText("Add variable");\r
+ addVariable.addSelectionListener(new NewVariableListener(context));\r
+\r
+ remove = new Button(buttonComposite, additionalSupport, SWT.NONE);\r
+ remove.setText("Remove");\r
+ remove.addSelectionListener(new RemoveListener(context));\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().hint(220, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 210).span(1, 1).grab(true, false).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+\r
+ // Buttons for adding axis and variables and removing selected items from explorer\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().hint(SWT.DEFAULT, SWT.DEFAULT).span(1, 2).grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+\r
+ // Buttons for adding axis and variables and removing selected items from explorer\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ }\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.eclipse.swt.custom.ScrolledComposite;\r
import org.eclipse.swt.graphics.Point;\r
import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Display;\r
import org.eclipse.swt.widgets.Group;\r
import org.eclipse.swt.widgets.Label;\r
import org.eclipse.ui.IWorkbenchSite;\r
import org.simantics.db.common.request.ReadRequest;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.jfreechart.chart.properties.AxisHidePropertyComposite;\r
import org.simantics.jfreechart.chart.properties.BooleanPropertyFactory;\r
import org.simantics.jfreechart.chart.properties.BooleanSelectionListener;\r
import org.simantics.jfreechart.chart.properties.DoubleValidator;\r
import org.simantics.jfreechart.chart.properties.JFreeChartPropertyColorProvider;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.jfreechart.chart.properties.RVIFactory;\r
import org.simantics.jfreechart.chart.properties.RVIModifier;\r
import org.simantics.jfreechart.chart.properties.TitleFactory;\r
* PropertyTab displaying general properties and x-axis properties of a chart\r
* \r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
-public class XYLineGeneralPropertiesTab extends LabelPropertyTabContributor implements Widget {\r
+public class XYLineGeneralPropertiesTab extends AdjustableTab implements Widget {\r
\r
private ScrolledComposite sc;\r
private Composite composite;\r
private TrackedCombo type;\r
private Button hgrid, htitle, hlegend;\r
private WidgetSupportImpl domainAxisSupport = new WidgetSupportImpl();\r
-\r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) { \r
- support.register(this);\r
-\r
- // Scrolled composite containing all of the properties in this tab\r
- sc = new ScrolledComposite(body, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
- GridLayoutFactory.fillDefaults().applyTo(sc);\r
- sc.setExpandHorizontal(true);\r
- sc.setExpandVertical(true);\r
-\r
- composite = new Composite(sc, SWT.NONE);\r
- GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
-\r
- // General properties\r
- Group general = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(general);\r
- general.setText("General");\r
-\r
- // Name\r
- Label nameLabel = new Label(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(nameLabel);\r
- nameLabel.setText("Name:");\r
- nameLabel.setAlignment(SWT.RIGHT);\r
-\r
- Composite c = new Composite(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(c);\r
- GridLayoutFactory.fillDefaults().numColumns(3).applyTo(c);\r
-\r
- name = new org.simantics.browsing.ui.swt.widgets.TrackedText(c, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
- name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
- name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
- name.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
-\r
- // Type\r
- Label label = new Label(c, SWT.NONE);\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Type:");\r
-\r
- type = new TrackedCombo(c, support, SWT.BORDER | SWT.READ_ONLY);\r
- type.addModifyListener(new TypeModifyListener());\r
- type.setItemFactory(new TypeItemFactory());\r
- type.setSelectionFactory(new TypeSelectionFactory());\r
- GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
-\r
- // Title (Which is different than name)\r
- label = new Label(general, SWT.NONE);\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Title:");\r
-\r
- title = new org.simantics.browsing.ui.swt.widgets.TrackedText(general, support, SWT.BORDER);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(title.getWidget());\r
- title.setTextFactory(new TitleFactory());\r
- title.addModifyListener(new TitleModifier());\r
- title.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
-\r
- // Group for hide options\r
- Group hideGroup = new Group(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(hideGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
- hideGroup.setText("Hide");\r
-\r
- hgrid = new Button(hideGroup, support, SWT.CHECK);\r
- hgrid.setText("Grid");\r
- hgrid.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid, true));\r
- hgrid.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid));\r
- htitle = new Button(hideGroup, support, SWT.CHECK);\r
- htitle.setText("Title");\r
- htitle.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible, true));\r
- htitle.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible));\r
- hlegend = new Button(hideGroup, support, SWT.CHECK);\r
- hlegend.setText("Legend");\r
- hlegend.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Chart_visibleLegend, true));\r
- hlegend.addSelectionListener(new BooleanSelectionListener(context, null, JFreeChartResource.URIs.Chart_visibleLegend));\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
- xgroup.setText("X-axis");\r
-\r
- // Variable for x-axis (default: empty == time)\r
- Label xVariableLabel = new Label(xgroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(xVariableLabel);\r
- xVariableLabel.setText("Variable:");\r
-\r
- xvariable = new TrackedText(xgroup, domainAxisSupport, SWT.BORDER);\r
- xvariable.setTextFactory(new RVIFactory());\r
- xvariable.addModifyListener(new RVIModifier(xvariable.getWidget(), domainAxisSupport));\r
- xvariable.setColorProvider(new JFreeChartPropertyColorProvider(xvariable.getResourceManager()));\r
- xvariable.setInputValidator(new VariableExistsValidator(support, xvariable, true));\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(xvariable.getWidget());\r
- \r
- Composite axisHide = new AxisHidePropertyComposite(xgroup, context, domainAxisSupport, SWT.NONE);\r
- GridDataFactory.fillDefaults().span(1, 3).applyTo(axisHide);\r
-\r
- // Label for x-axis\r
- label = new Label(xgroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
- label.setText("Label:");\r
-\r
- xlabel = new TrackedText(xgroup, domainAxisSupport, SWT.BORDER);\r
- xlabel.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel, ""));\r
- xlabel.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\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
- 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.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
- // 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
- \r
- sc.setContent(composite);\r
- Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
- sc.setMinSize(size);\r
- }\r
+ private Group general;\r
+ private Label nameLabel;\r
+ private Label labelTitle;\r
+ private Label labelType;\r
+ private Group hideGroup;\r
+ private Group xgroup;\r
+ private Label xVariableLabel;\r
+ private Label labelMin;\r
+ private AxisHidePropertyComposite axisHide;\r
+ private Label labelLabel;\r
+ private Label labelMax;\r
+ private Composite xColumn1;\r
+ private Composite xColumn2;\r
\r
@Override\r
public void setInput(final ISessionContext context, Object input) {\r
JFreeChartResource jfree = JFreeChartResource.getInstance(graph);\r
Resource plot = graph.syncRequest(new PossibleObjectWithType(chart, l0.ConsistsOf, jfree.Plot));\r
if(plot == null) return;\r
- Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
+ final Resource domainAxis = graph.getPossibleObject(plot, jfree.Plot_domainAxis);\r
if(domainAxis == null) return;\r
- domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis));\r
+ Display.getDefault().asyncExec(new Runnable() {\r
+ @Override\r
+ public void run() {\r
+ domainAxisSupport.fireInput(context, new StructuredSelection(domainAxis));\r
+ }\r
+ });\r
+ \r
}\r
});\r
}\r
}\r
}\r
\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ ISessionContext context, WidgetSupport support) {\r
+ support.register(this);\r
+\r
+ // Scrolled composite containing all of the properties in this tab\r
+ sc = new ScrolledComposite(body, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL);\r
+ sc.setExpandHorizontal(true);\r
+ sc.setExpandVertical(true);\r
+\r
+ composite = new Composite(sc, SWT.NONE);\r
+\r
+ // General properties\r
+ general = new Group(composite, SWT.NONE);\r
+ general.setText("General");\r
+\r
+ // Name\r
+ nameLabel = new Label(general, SWT.NONE);\r
+ nameLabel.setText("Name:");\r
+ nameLabel.setAlignment(SWT.RIGHT);\r
+\r
+ name = new org.simantics.browsing.ui.swt.widgets.TrackedText(general, support, SWT.BORDER);\r
+ name.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel));\r
+ name.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
+ name.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
+\r
+ // Type\r
+ labelType = new Label(general, SWT.NONE);\r
+ labelType.setText("Type:");\r
+\r
+ type = new TrackedCombo(general, support, SWT.BORDER | SWT.READ_ONLY);\r
+ type.addModifyListener(new TypeModifyListener());\r
+ type.setItemFactory(new TypeItemFactory());\r
+ type.setSelectionFactory(new TypeSelectionFactory());\r
+\r
+ // Title (Which is different than name)\r
+ labelTitle = new Label(general, SWT.NONE);\r
+ labelTitle.setText("Title:");\r
+\r
+ title = new org.simantics.browsing.ui.swt.widgets.TrackedText(general, support, SWT.BORDER);\r
+ title.setTextFactory(new TitleFactory());\r
+ title.addModifyListener(new TitleModifier());\r
+ title.setColorProvider(new JFreeChartPropertyColorProvider(name.getResourceManager()));\r
+\r
+ // Group for hide options\r
+ hideGroup = new Group(composite, SWT.NONE);\r
+ hideGroup.setText("Hide");\r
+\r
+ hgrid = new Button(hideGroup, support, SWT.CHECK);\r
+ hgrid.setText("Grid");\r
+ hgrid.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid, true));\r
+ hgrid.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.Plot, JFreeChartResource.URIs.Plot_visibleGrid));\r
+ htitle = new Button(hideGroup, support, SWT.CHECK);\r
+ htitle.setText("Title");\r
+ htitle.setSelectionFactory(new BooleanPropertyFactory(JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible, true));\r
+ htitle.addSelectionListener(new BooleanSelectionListener(context, JFreeChartResource.URIs.TextTitle, JFreeChartResource.URIs.visible));\r
+ hlegend = new Button(hideGroup, support, SWT.CHECK);\r
+ hlegend.setText("Legend");\r
+ hlegend.setSelectionFactory(new BooleanPropertyFactory(null, JFreeChartResource.URIs.Chart_visibleLegend, true));\r
+ hlegend.addSelectionListener(new BooleanSelectionListener(context, null, JFreeChartResource.URIs.Chart_visibleLegend));\r
+\r
+\r
+ // X-Axis properties\r
+ xgroup = new Group(composite, SWT.NONE);\r
+ xgroup.setText("X-axis");\r
+\r
+ xColumn1 = new Composite(xgroup, SWT.NONE);\r
+ \r
+ // Variable for x-axis (default: empty == time)\r
+ xVariableLabel = new Label(xColumn1, SWT.NONE);\r
+ xVariableLabel.setText("Variable:");\r
+ \r
+ xvariable = new TrackedText(xColumn1, domainAxisSupport, SWT.BORDER);\r
+ xvariable.setTextFactory(new RVIFactory());\r
+ xvariable.addModifyListener(new RVIModifier(xvariable.getWidget(), domainAxisSupport));\r
+ xvariable.setColorProvider(new JFreeChartPropertyColorProvider(xvariable.getResourceManager()));\r
+ xvariable.setInputValidator(new VariableExistsValidator(support, xvariable, true));\r
+ \r
+ // Label for x-axis\r
+ labelLabel = new Label(xColumn1, SWT.NONE);\r
+ labelLabel.setText("Label:");\r
+ \r
+ xlabel = new TrackedText(xColumn1, domainAxisSupport, SWT.BORDER);\r
+ xlabel.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasLabel, ""));\r
+ xlabel.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasLabel));\r
+ xlabel.setColorProvider(new JFreeChartPropertyColorProvider(xlabel.getResourceManager()));\r
+\r
+ xColumn2 = new Composite(xgroup, SWT.NONE);\r
+ \r
+ // Min value for x-axis\r
+ labelMin = new Label(xColumn2, SWT.NONE);\r
+ labelMin.setText("Min:");\r
+ labelMin.setAlignment(SWT.RIGHT);\r
+\r
+ xmin = new TrackedText(xColumn2, 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
+ // Max value for x-axis\r
+ labelMax = new Label(xColumn2, SWT.NONE);\r
+ labelMax.setText("Max:");\r
+ \r
+ xmax = new TrackedText(xColumn2, 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
+ // Axis hide buttons\r
+ axisHide = new AxisHidePropertyComposite(composite, context, domainAxisSupport, SWT.NONE);\r
+\r
+ sc.setContent(composite);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ // Scrolled composite containing all of the properties in this tab\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().applyTo(sc);\r
+\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+\r
+ // General properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(general);\r
+\r
+ // Name\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(nameLabel);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+\r
+ // Type\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelType);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
+\r
+ // Title (Which is different than name)\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelTitle);\r
+\r
+ GridDataFactory.fillDefaults().span(1, 1).grab(true, false).applyTo(title.getWidget());\r
+\r
+ // Group for hide options\r
+ GridDataFactory.fillDefaults().applyTo(hideGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
+\r
+ // X-Axis properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(xgroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(1).applyTo(xgroup);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(xColumn1);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(xColumn1);\r
+ \r
+ // Variable for x-axis (default: empty == time)\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(xVariableLabel);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(xvariable.getWidget());\r
+ \r
+ // Label for x-axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelLabel);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(xlabel.getWidget());\r
+\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(xColumn2);\r
+\r
+ // Min value for x-axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelMin);\r
+ GridDataFactory.fillDefaults().applyTo(xmin.getWidget());\r
+ \r
+ // Max value for x-axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelMax);\r
+ GridDataFactory.fillDefaults().applyTo(xmax.getWidget());\r
+ \r
+ // Axis hide buttons\r
+ GridDataFactory.fillDefaults().applyTo(axisHide);\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
+ GridDataFactory.fillDefaults().hint(xVariableLabel.getBounds().width, SWT.DEFAULT).align(SWT.END, SWT.CENTER).applyTo(labelMin);\r
+ \r
+ Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ // Scrolled composite containing all of the properties in this tab\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(sc);\r
+ GridLayoutFactory.fillDefaults().applyTo(sc);\r
+\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ // General properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(general);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(4).applyTo(general);\r
+\r
+ // Name\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(nameLabel);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+\r
+ // Type\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelType);\r
+\r
+ GridDataFactory.fillDefaults().applyTo(type.getWidget());\r
+\r
+ // Title (Which is different than name)\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelTitle);\r
+\r
+ GridDataFactory.fillDefaults().span(3, 1).grab(true, false).applyTo(title.getWidget());\r
+\r
+ // Group for hide options\r
+ GridDataFactory.fillDefaults().applyTo(hideGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(hideGroup);\r
+\r
+ // X-Axis properties\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(xgroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(xgroup);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(xColumn1);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(xColumn1);\r
+ \r
+ // Variable for x-axis (default: empty == time)\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(xVariableLabel);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(xvariable.getWidget());\r
+ \r
+ // Label for x-axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelLabel);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(xlabel.getWidget());\r
+\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(xColumn2);\r
+\r
+ // Min value for x-axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelMin);\r
+ GridDataFactory.fillDefaults().applyTo(xmin.getWidget());\r
+ \r
+ // Max value for x-axis\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelMax);\r
+ GridDataFactory.fillDefaults().applyTo(xmax.getWidget());\r
+ \r
+ // Axis hide buttons\r
+ GridDataFactory.fillDefaults().applyTo(axisHide);\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
+ \r
+ Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ sc.setMinSize(size);\r
+ }\r
+\r
}
\ No newline at end of file
<feature\r
id="org.simantics.sysdyn"\r
label="Simantics System Dynamics Feature"\r
- version="1.7.0.qualifier"\r
+ version="1.8.0.qualifier"\r
provider-name="VTT Technical Research Centre of Finland">\r
\r
<description url="http://www.example.com/description">\r
--- /dev/null
+The molecules in this folder are collected from:\r
+\r
+Hines, Jim. 2005. Molecules of Structure - Building Blocks for System Dynamics Models. Version 2.02. Available at: http://www.systemswiki.org/images/a/a8/Molecule.pdf .\r
--- /dev/null
+The sample models in this folder are collected from the "System Zoo" books by Bossel:\r
+\r
+Hartmut Bossel. 2007. System Zoo 2 Simulation Models - Climate, Ecosystems, Resources. BoD.\r
+* Discovery And Exploitation Of Resources\r
+* Global Carbon Cycle\r
+* Predator And Limited Prey\r
+* Resource Exploitation Use Recycling\r
+* Tourists Environments And Hotel Facilities\r
+\r
+Hartmut Bossel. 2007. System Zoo 3 Simulation Models - Economy, Society, Development. BoD.\r
+\r
+\r
Bundle-ManifestVersion: 2
Bundle-Name: Simantics System Dynamics UI
Bundle-SymbolicName: org.simantics.sysdyn.ui;singleton:=true
-Bundle-Version: 1.7.0.qualifier
+Bundle-Version: 1.8.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.simantics.layer0.utils;bundle-version="0.6.2",
org.simantics.scenegraph;bundle-version="0.9.0",
<handler\r
class="org.simantics.sysdyn.ui.handlers.imports.ImportModelHandler"\r
commandId="org.simantics.sysdyn.ui.importModel">\r
- <activeWhen></activeWhen>\r
</handler>\r
<handler\r
class="org.simantics.sysdyn.ui.handlers.exports.ExportModelHandler"\r
\r
@Override\r
public boolean handleDoubleClick() {\r
- return true;\r
+ return false;\r
}\r
\r
}\r
}\r
\r
public static Arc2D createArc(Arc2D arc, Shape beginBounds, Shape endBounds, double angle) {\r
+ if (beginBounds == null || endBounds == null)\r
+ return new Arc2D.Double();\r
double x0 = beginBounds.getBounds2D().getCenterX();\r
double y0 = beginBounds.getBounds2D().getCenterY();\r
double x1 = endBounds.getBounds2D().getCenterX();\r
@Override\r
public void textEditingStarted() {\r
TextNode node = (TextNode) e.getHint(SG_NODE);\r
+ if (node == null)\r
+ return;\r
textBeforeEdit = node.getText();\r
\r
if(component != null) return;\r
project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
IExperiment experiment = manager.getActiveExperiment();\r
if (experiment != null)\r
- experiment.shutdown();\r
+ experiment.shutdown(null);\r
return null;\r
}\r
\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.eclipse.core.runtime.IStatus;\r
import org.eclipse.core.runtime.Status;\r
+import org.eclipse.core.runtime.SubMonitor;\r
import org.eclipse.core.runtime.jobs.Job;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.RequestProcessor;\r
new Job(jobName) {\r
@Override\r
protected IStatus run(final IProgressMonitor monitor) {\r
- return SysdynExperimentActivator.activate(monitor, project, experimentManager, experiment);\r
+ try {\r
+ return SysdynExperimentActivator.activate(monitor, project, experimentManager, experiment);\r
+ } finally {\r
+ monitor.done();\r
+ }\r
}\r
}.schedule();\r
}\r
}\r
\r
private IStatus activateExperiment(final IProgressMonitor monitor, final IProject project, final IExperimentManager manager, final Resource experimentResource) {\r
- monitor.beginTask("Activating experiment", IProgressMonitor.UNKNOWN);\r
- try {\r
- SysdynExperimentManagerListener.listenManager(manager);\r
- IExperiment[] experiments = manager.getExperiments();\r
- for(IExperiment e : experiments)\r
- if(e.getState() != ExperimentState.DISPOSED)\r
- e.shutdown();\r
- \r
- final Semaphore activated = new Semaphore(0);\r
- final DataContainer<Throwable> problem = new DataContainer<Throwable>();\r
- manager.startExperiment(experimentResource, new IExperimentActivationListener() {\r
+ final SubMonitor mon = SubMonitor.convert(monitor, "Activating experiment", 100000);\r
\r
- @Override\r
- public void onExperimentActivated(final IExperiment experiment) {\r
- MessageService.defaultLog(new org.eclipse.core.runtime.Status(IStatus.INFO, "org.simantics.simulation.ui", 0, "Activated experiment " + experiment.getIdentifier() , null));\r
- activated.release();\r
- }\r
- @Override\r
- public void onFailure(Throwable e) {\r
- problem.set(e);\r
- activated.release();\r
- }\r
- @Override\r
- public void onMessage(IStatus message) {\r
- MessageService.getDefault().log(message);\r
- /*ILogger logger = MessageService.getDefault();\r
+ SysdynExperimentManagerListener.listenManager(manager);\r
+ IExperiment[] experiments = manager.getExperiments();\r
+ SubMonitor shutdownMon = mon.newChild(10000);\r
+ int workPerExperiment;\r
+ if (experiments.length > 0)\r
+ workPerExperiment = 10000 / experiments.length;\r
+ else\r
+ workPerExperiment = 10000;\r
+ for(IExperiment e : experiments)\r
+ if(e.getState() != ExperimentState.DISPOSED)\r
+ e.shutdown(shutdownMon.newChild(workPerExperiment));\r
+ mon.setWorkRemaining(90000);\r
+\r
+ final Semaphore activated = new Semaphore(0);\r
+ final DataContainer<Throwable> problem = new DataContainer<Throwable>();\r
+ manager.startExperiment(experimentResource, new IExperimentActivationListener() {\r
+\r
+ @Override\r
+ public void onExperimentActivated(final IExperiment experiment) {\r
+ MessageService.defaultLog(new org.eclipse.core.runtime.Status(IStatus.INFO, "org.simantics.simulation.ui", 0, "Activated experiment " + experiment.getIdentifier() , null));\r
+ activated.release();\r
+ }\r
+ @Override\r
+ public void onFailure(Throwable e) {\r
+ problem.set(e);\r
+ activated.release();\r
+ }\r
+ @Override\r
+ public void onMessage(IStatus message) {\r
+ MessageService.getDefault().log(message);\r
+ /*ILogger logger = MessageService.getDefault();\r
MultiStatus init = new MultiStatus(Activator.PLUGIN_ID, 0, "Activating experiment", null);\r
for (String msg : messages) {\r
init.add(new Status(IStatus.INFO, Activator.PLUGIN_ID, msg));\r
}\r
logger.log(init);*/\r
+ }\r
+ @Override\r
+ public IProgressMonitor getProgressMonitor() {\r
+ return mon;\r
+ }\r
+ }, true);\r
+ try {\r
+ activated.acquire();\r
+ Throwable t = problem.get();\r
+ if (t != null) {\r
+ if (t instanceof ExperimentLoadingFailed) {\r
+ ErrorLogger.defaultLogError(t);\r
+ ShowMessage.showError("Experiment Activation Failed", t.getMessage());\r
+ } else {\r
+ ExceptionUtils.logAndShowError(t);\r
}\r
- }, true);\r
- try {\r
- activated.acquire();\r
- Throwable t = problem.get();\r
- if (t != null) {\r
- if (t instanceof ExperimentLoadingFailed) {\r
- ErrorLogger.defaultLogError(t);\r
- ShowMessage.showError("Experiment Activation Failed", t.getMessage());\r
- } else {\r
- ExceptionUtils.logAndShowError(t);\r
- }\r
- }\r
-\r
- return Status.OK_STATUS;\r
- //return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Experiment activation failed, see exception for details.", problem.get());\r
- } catch (InterruptedException e) {\r
- return Status.CANCEL_STATUS;\r
}\r
- } finally {\r
- monitor.done();\r
+\r
+ return Status.OK_STATUS;\r
+ //return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Experiment activation failed, see exception for details.", problem.get());\r
+ } catch (InterruptedException e) {\r
+ return Status.CANCEL_STATUS;\r
}\r
}\r
\r
if(path.isEmpty() || !(new File(path).exists()))\r
path = Platform.getLocation().toOSString();\r
fd.setFilterPath(path);\r
- String[] filterExt = {"*.tg"};\r
+ String[] filterExt = {"*.sysdynFunctions"};\r
fd.setFilterExtensions(filterExt);\r
fd.setOverwrite(true);\r
final String selected = fd.open();\r
\r
import org.eclipse.core.commands.ExecutionEvent;\r
import org.eclipse.core.commands.ExecutionException;\r
+import org.eclipse.ui.handlers.HandlerUtil;\r
import org.simantics.db.Resource;\r
+import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
\r
/**\r
* Exports a selected model asking the location.\r
@Override\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
\r
+ status = WorkbenchUtils.getStatusLine( HandlerUtil.getActiveSite(event) );\r
+ \r
final Resource model = determineModel(event);\r
if (model == null)\r
return null;\r
\r
String selected = getAbsolutePath(model, event, true);\r
\r
- if (selected != null)\r
+ if (selected != null) {\r
createFile(model, selected);\r
- \r
+ setExportStatus(model, selected);\r
+ }\r
+ \r
return null;\r
}\r
\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
import org.simantics.utils.ui.AdaptionUtils;\r
+import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
\r
/**\r
* Exports a selected model without asking the location.\r
@Override\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
\r
+ status = WorkbenchUtils.getStatusLine( HandlerUtil.getActiveSite(event) );\r
+ \r
final Resource model = determineModel(event);\r
if (model == null)\r
return null;\r
\r
String selected = getAbsolutePath(model, event, false);\r
\r
- if (selected != null)\r
+ if (selected != null) {\r
createFile(model, selected);\r
- \r
- return null;\r
+ setExportStatus(model, selected);\r
+ }\r
+ \r
+ return null;\r
}\r
\r
@Override\r
import org.eclipse.core.commands.ExecutionEvent;\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.core.runtime.Platform;\r
+import org.eclipse.jface.action.IStatusLineManager;\r
import org.eclipse.jface.viewers.ISelection;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.widgets.FileDialog;\r
import org.simantics.sysdyn.ui.utils.imports.ImportUtilsUI;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
+import org.simantics.utils.ui.workbench.WorkbenchUtils;\r
\r
/**\r
* Exports a selected model\r
*/\r
public class ExportModelHandler extends AbstractHandler {\r
\r
+ protected static IStatusLineManager status;\r
+\r
@Override\r
public Object execute(ExecutionEvent event) throws ExecutionException {\r
\r
+ status = WorkbenchUtils.getStatusLine( HandlerUtil.getActiveSite(event) );\r
+ \r
final Resource model = determineModel(event);\r
if (model == null)\r
return null;\r
\r
String selected = getAbsolutePath(model, event, true);\r
\r
- if (selected != null)\r
+ if (selected != null) {\r
createFile(model, selected);\r
+ setExportStatus(model, selected);\r
+ }\r
\r
- return null;\r
+ return null;\r
}\r
-\r
+ \r
+ /**\r
+ * Create the export file.\r
+ * @param model Model which is exported.\r
+ * @param fileName Full name of the file.\r
+ */\r
+ protected void setExportStatus(final Resource model, final String fileName) {\r
+ try {\r
+ String modelName = SimanticsUI.getSession().syncRequest(new Read<String>() {\r
+ \r
+ @Override\r
+ public String perform(ReadGraph graph) throws DatabaseException {\r
+ if (!graph.hasStatement(model, Layer0.getInstance(graph).PartOf))\r
+ return null;\r
+ Layer0 l0 = Layer0.getInstance(graph);\r
+ return graph.syncRequest(new PossibleRelatedValue<String>(model, l0.HasName, Bindings.STRING ));\r
+ }\r
+ \r
+ });\r
+ \r
+ if (modelName != null)\r
+ setStatus("Saved model \"" + modelName + "\" to " + fileName);\r
+ \r
+ } catch (DatabaseException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+ \r
/**\r
* Create the export file.\r
* @param model Model which is exported.\r
fd.setFileName(name);\r
\r
fd.setFilterPath(path);\r
- String[] filterExt = {"*.tg"};\r
+ String[] filterExt = {"*.sysdyn"};\r
fd.setFilterExtensions(filterExt);\r
fd.setOverwrite(true);\r
fullPath = fd.open();\r
return selected;\r
\r
}\r
+ \r
+ protected static void setStatus(final String message) {\r
+ if (status != null)\r
+ status.setMessage(message);\r
+ }\r
+\r
}\r
if(path.isEmpty() || !(new File(path).exists()))\r
path = Platform.getLocation().toOSString();\r
fd.setFilterPath(path);\r
- String[] filterExt = {"*.tg"};\r
+ String[] filterExt = {"*.sysdynModule"};\r
fd.setFilterExtensions(filterExt);\r
fd.setOverwrite(true);\r
final String selected = fd.open();\r
if(path.isEmpty() || !(new File(path).exists()))\r
path = Platform.getLocation().toOSString();\r
fd.setFilterPath(path);\r
- String[] filterExt = {"*.tg"};\r
+ String[] filterExt = {"*.sysdynFunctions; *.tg", "*.*"};\r
fd.setFilterExtensions(filterExt);\r
final String selected = fd.open();\r
if(selected == null) return null;\r
import org.eclipse.core.commands.ExecutionException;\r
import org.eclipse.core.runtime.IProgressMonitor;\r
import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.core.runtime.Platform;\r
import org.eclipse.core.runtime.jobs.Job;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.widgets.FileDialog;\r
fd.setText("Import Model");\r
\r
String path = Activator.getDefault().getPreferenceStore().getString(ImportUtilsUI.IMPORTMODELTPATH);\r
- if(path.isEmpty() || !(new File(path).exists()))\r
- path = Platform.getLocation().toOSString();\r
+ if(path.isEmpty() || !(new File(path).exists())){\r
+ String execDir = System.getProperty("user.dir");\r
+ String slash = System.getProperty("file.separator");\r
+ path = execDir + slash + "sampleModels"; \r
+ }\r
+ \r
fd.setFilterPath(path);\r
- String[] filterExt = {"*.tg"};\r
+ String[] filterExt = {"*.sysdyn; *.tg", "*.*"};\r
fd.setFilterExtensions(filterExt);\r
final String selected = fd.open();\r
if(selected == null) return null;\r
if(path.isEmpty() || !(new File(path).exists()))\r
path = Platform.getLocation().toOSString();\r
fd.setFilterPath(path);\r
- String[] filterExt = {"*.tg"};\r
+ String[] filterExt = {"*.sysdynModule; *.tg", "*.*"};\r
fd.setFilterExtensions(filterExt);\r
final String selected = fd.open();\r
if(selected == null) return null;\r
\r
- Job job = new DatabaseJob("Import model") {\r
+ Job job = new DatabaseJob("Import module") {\r
\r
@Override\r
protected IStatus run(IProgressMonitor monitor) {\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
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.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.elements.connections.DependencyEdgeClass;\r
import org.simantics.sysdyn.ui.elements.connections.DependencyNode;\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
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.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.elements.connections.FlowConnectionStyle;\r
\r
import org.simantics.db.common.utils.NameUtils;\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.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.properties.widgets.ColumnKeys;\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2012, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.diagram.stubs.DiagramResource;\r
+import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.utils.datastructures.Callback;\r
\r
/**\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.issues.ontology.IssueResource;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.operation.Layer0X;\r
import org.simantics.sysdyn.SysdynResource;\r
map.put("euler", "euler");\r
map.put("rungekutta", "rungekutta");\r
map.put("dassl", "dassl");\r
- map.put("dassl2", "dassl2");\r
map.put("inline-euler", "inline-euler");\r
map.put("inline-rungekutta", "inline-rungekutta");\r
+ map.put("dasslwort", "dasslwort");\r
+ map.put("dasslSymJac", "dasslSymJac");\r
+ map.put("dasslNumJac", "dasslNumJac");\r
+ map.put("dasslColorSymJac", "dasslColorSymJac");\r
+ map.put("dasslInternalNumJac", "dasslInternalNumJac");\r
+ map.put("qss", "qss");\r
return map;\r
}\r
});\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
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.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
import org.simantics.utils.datastructures.Pair;\r
import org.simantics.utils.datastructures.Triple;\r
\r
-public class DependencyTab extends LabelPropertyTabContributor {\r
+/**\r
+ * Tab displaying dependency properties.\r
+ * \r
+ * @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
+ *\r
+ */\r
+public class DependencyTab extends AdjustableTab {\r
\r
Button none, plus, minus, other, inside, outside;\r
TrackedText polarityText, polarityLocationText;\r
Scale lineThicknessScale;\r
private DelayMarkWidget delayMark;\r
private ArrowHeadWidget arrowhead;\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
- 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 StringPropertyFactory(SysdynResource.URIs.DependencyConnection_polarity));\r
- polarityText.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.DependencyConnection_polarity));\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().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(arrowhead.getWidget());\r
- delayMark = new DelayMarkWidget(misc, support, SWT.NULL);\r
- GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).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 polarityGroup;\r
+ private Group locationGroup;\r
+ private Composite misc;\r
+ private Group lineThicknessGroup;\r
\r
class LineThicknessSelectionListener extends SelectionListenerImpl<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
+ 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 StringPropertyFactory(SysdynResource.URIs.DependencyConnection_polarity));\r
+ polarityText.addModifyListener(new StringPropertyModifier(context, SysdynResource.URIs.DependencyConnection_polarity));\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().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().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
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.layer0.variable.Variables;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.db.request.Read;\r
+import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.simulation.ontology.SimulationResource;\r
/*******************************************************************************\r
- * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2012, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.procedure.AsyncListener;\r
import org.simantics.db.request.Read;\r
import org.simantics.db.service.VirtualGraphSupport;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.manager.SysdynModel;\r
super.createControls(body, site, context, _support);\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
GridDataFactory.fillDefaults().span(wideScreen ? 4 : 3, 1).grab(true, true).applyTo(expressionComposite);\r
}\r
\r
+ @Override\r
protected void createControlLayoutVertical() {\r
GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
GridDataFactory.fillDefaults().span(3, 1).grab(true, true).hint(SWT.DEFAULT, 300).applyTo(shortcutTabWidget.getWidget());\r
}\r
\r
+ @Override\r
protected void createAndAddControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport _support) {\r
// Composite for the whole tab\r
Composite composite = new Composite(body, SWT.NONE);\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.eclipse.ui.IWorkbenchSite;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
\r
public class ExperimentTab extends LabelPropertyTabContributor {\r
\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.common.request.WriteRequest;\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.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.handlers.RemoveNodeHandler;\r
import org.simantics.sysdyn.ui.handlers.exports.ExportExternalFunctionFilesHandler;\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
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.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.elements.connections.FlowConnectionStyle;\r
\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
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.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.FunctionLibraryNameInputValidator;\r
\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
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.chart.properties.AdjustableTab;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.ui.properties.widgets.FunctionLabelFactory;\r
import org.simantics.sysdyn.ui.properties.widgets.expressions.ExpressionField;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.FunctionNameInputValidator;\r
import org.simantics.sysdyn.ui.properties.widgets.functions.FunctionCodeWidget;\r
\r
-public class FunctionTab extends LabelPropertyTabContributor {\r
+public class FunctionTab extends AdjustableTab {\r
\r
ExpressionField modelicaCode;\r
+ private Composite composite;\r
+ private TrackedText nameText;\r
+ private Group modelicaGroup;\r
+ private Label startLabel;\r
+ private Label endLabel;\r
+ private Group documentationGroup;\r
+ private TrackedText information;\r
\r
@Override\r
- public void createControls(Composite body, IWorkbenchSite site,\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
ISessionContext context, WidgetSupport support) {\r
- \r
- Composite composite = new Composite(body, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
- GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+ composite = new Composite(body, SWT.NONE);\r
\r
- TrackedText nameText = new TrackedText(composite, support, SWT.BORDER);\r
+ nameText = new TrackedText(composite, support, SWT.BORDER);\r
nameText.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasName));\r
nameText.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasName));\r
nameText.setInputValidator(new FunctionNameInputValidator(support));\r
- GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(nameText.getWidget());\r
\r
\r
- Group modelicaGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);\r
+ modelicaGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);\r
modelicaGroup.setText("Modelica code");\r
- GridDataFactory.fillDefaults().grab(true, true).minSize(150, 0).applyTo(modelicaGroup);\r
- GridLayoutFactory.fillDefaults().spacing(0, 0).margins(3, 3).applyTo(modelicaGroup);\r
\r
- Label startLabel = new Label(modelicaGroup, support, SWT.NONE);\r
+ startLabel = new Label(modelicaGroup, support, SWT.NONE);\r
startLabel.setTextFactory(new FunctionLabelFactory(Layer0.URIs.HasName, false));\r
\r
new FunctionCodeWidget(modelicaGroup, support, SWT.BORDER);\r
Resource library = graph.getSingleObject(input, Layer0.getInstance(graph).PartOf);\r
FunctionUtils.updateFunctionFileForLibrary(graph, library);\r
}\r
- });\r
+ });*/\r
\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(modelicaCode.getWidget());\r
- */\r
- Label endLabel = new Label(modelicaGroup, support, SWT.NONE);\r
+ endLabel = new Label(modelicaGroup, support, SWT.NONE);\r
endLabel.setTextFactory(new FunctionLabelFactory(Layer0.URIs.HasName, true));\r
\r
- Group documentationGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);\r
+ documentationGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);\r
documentationGroup.setText("Documentation");\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(documentationGroup);\r
- GridLayoutFactory.fillDefaults().spacing(0, 0).margins(3, 3).applyTo(documentationGroup);\r
\r
- TrackedText information = new TrackedText(documentationGroup, support, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);\r
+ information = new TrackedText(documentationGroup, support, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);\r
information.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasDescription));\r
information.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasDescription));\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().span(1, 1).grab(true, false).applyTo(nameText.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, true).minSize(150, 0).applyTo(modelicaGroup);\r
+ GridLayoutFactory.fillDefaults().spacing(0, 0).margins(3, 3).applyTo(modelicaGroup);\r
+ \r
+ /*\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(modelicaCode.getWidget());\r
+ */\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(documentationGroup);\r
+ GridLayoutFactory.fillDefaults().spacing(0, 0).margins(3, 3).applyTo(documentationGroup);\r
+\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(information.getWidget());\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(nameText.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, true).minSize(150, 0).applyTo(modelicaGroup);\r
+ GridLayoutFactory.fillDefaults().spacing(0, 0).margins(3, 3).applyTo(modelicaGroup);\r
+ \r
+ /*\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(modelicaCode.getWidget());\r
+ */\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(documentationGroup);\r
+ GridLayoutFactory.fillDefaults().spacing(0, 0).margins(3, 3).applyTo(documentationGroup);\r
+\r
GridDataFactory.fillDefaults().grab(true, true).applyTo(information.getWidget());\r
- }\r
+ }\r
\r
}\r
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.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactory;\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
- * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2012, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.common.utils.NameUtils;\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.layer0.Layer0;\r
import org.simantics.simulation.ontology.SimulationResource;\r
import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
/*******************************************************************************\r
- * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2012, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
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.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.manager.SysdynModel;\r
+++ /dev/null
-/*******************************************************************************\r
- * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.sysdyn.ui.properties;\r
-\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.swt.events.DisposeEvent;\r
-import org.eclipse.swt.events.DisposeListener;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.IWorkbenchSite;\r
-import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupportImpl;\r
-import org.simantics.db.AsyncReadGraph;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.db.management.ISessionContext;\r
-import org.simantics.db.procedure.AsyncListener;\r
-import org.simantics.db.request.Read;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.modeling.ModelingResources;\r
-import org.simantics.selectionview.PropertyTabContributorImpl;\r
-import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.datastructures.Callback;\r
-import org.simantics.utils.ui.AdaptionUtils;\r
-\r
-public abstract class LabelPropertyTabContributor extends PropertyTabContributorImpl {\r
-\r
- private boolean isDisposed = false;\r
-\r
-\r
- public void createControl(Composite parent, final IWorkbenchSite site, final ISessionContext context, final WidgetSupportImpl support) {\r
- super.createControl(parent, site, context, support);\r
-\r
- // Add dispose listener to make sure name listening receives the correct isDisposed -value\r
- parent.addDisposeListener(new DisposeListener() {\r
-\r
- @Override\r
- public void widgetDisposed(DisposeEvent e) {\r
- LabelPropertyTabContributor.this.dispose();\r
- }\r
- });\r
- }\r
-\r
- @Override\r
- public void updatePartName(ISelection forSelection, final Callback<String> updateCallback) {\r
- final Variable variable = AdaptionUtils.adaptToSingle(forSelection, Variable.class);\r
- final Resource resource = AdaptionUtils.adaptToSingle(forSelection, Resource.class);\r
- if(resource == null && variable == null) {\r
- updateCallback.run("Selection properties");\r
- return;\r
- }\r
-\r
- SimanticsUI.getSession().asyncRequest(new Read<String>() {\r
-\r
- @Override\r
- public String perform(ReadGraph graph) throws DatabaseException {\r
- Layer0 l0 = Layer0.getInstance(graph);\r
- ModelingResources mr = ModelingResources.getInstance(graph);\r
- \r
- Resource r;\r
- if(variable != null) {\r
- r = (Resource)variable.getRepresents(graph);\r
- } else {\r
- r = resource;\r
- }\r
- \r
- if(graph.hasStatement(r, mr.ElementToComponent)) {\r
- r = graph.getSingleObject(r, mr.ElementToComponent);\r
- }\r
- String label = graph.getPossibleRelatedValue(r, l0.HasLabel);\r
- if(label != null)\r
- return label;\r
- label = graph.getPossibleRelatedValue(r, l0.HasName);\r
- if(label != null)\r
- return label;\r
- return "No name for selection";\r
- }\r
- }, new AsyncListener<String>() {\r
-\r
- @Override\r
- public void execute(AsyncReadGraph graph, String result) {\r
- updateCallback.run(result);\r
- }\r
-\r
- @Override\r
- public void exception(AsyncReadGraph graph, Throwable throwable) {\r
-\r
- }\r
-\r
- @Override\r
- public boolean isDisposed() {\r
- return isDisposed;\r
- }\r
- });\r
- }\r
-\r
- @Override\r
- protected void dispose() {\r
- this.isDisposed = true;\r
- }\r
-}\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
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.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.properties.widgets.ChartTableWidget;\r
import org.simantics.sysdyn.ui.properties.widgets.ChartWidget;\r
import org.simantics.db.common.utils.ListUtils;\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.modeling.ModelingResources;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.utils.LoopUtils;\r
/*******************************************************************************\r
- * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2012, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.common.request.ObjectsWithType;\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.layer0.Layer0;\r
import org.simantics.structural.stubs.StructuralResource2;\r
import org.simantics.sysdyn.SysdynResource;\r
/*******************************************************************************\r
- * Copyright (c) 2010, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2012, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.common.request.ObjectsWithType;\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.layer0.Layer0;\r
import org.simantics.structural.stubs.StructuralResource2;\r
import org.simantics.sysdyn.SysdynResource;\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2012 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2012, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
import org.simantics.db.Resource;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.properties.widgets.ColumnKeys;\r
import org.simantics.utils.datastructures.ArrayMap;\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
import org.simantics.db.Resource;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.properties.widgets.ColumnKeys;\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
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.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.ModuleTypeNameInputValidator;\r
\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.layer0.util.RemoverUtil;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
import org.simantics.layer0.utils.direct.GraphUtils;\r
import org.simantics.utils.datastructures.Triple;\r
import org.simantics.utils.ui.color.Color;\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.eclipse.ui.IWorkbenchSite;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
\r
public class ReferenceDependencyTab extends LabelPropertyTabContributor {\r
\r
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.eclipse.ui.IWorkbenchSite;\r
import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
import org.simantics.db.management.ISessionContext;\r
+import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
\r
public class ResultTab extends LabelPropertyTabContributor {\r
\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.db.request.Read;\r
import org.simantics.jfreechart.chart.ChartUtils;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.jfreechart.chart.properties.RangeComposite;\r
import org.simantics.jfreechart.chart.properties.xyline.AxisAndVariablesExplorerComposite;\r
import org.simantics.layer0.Layer0;\r
* @author Tuomas Miettinen\r
*\r
*/\r
-public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributor implements Widget {\r
+public class SensitivityAnalysisExperimentTab extends AdjustableTab implements Widget {\r
\r
private GraphExplorerComposite explorer;\r
private WidgetSupportImpl parameterSupport = new WidgetSupportImpl();\r
private boolean dirtyMethod = false;\r
\r
private DisposableListener<Collection<Resource>> contentListener;\r
+ private RemoveFocusBeforeExperimentComposite composite;\r
+ private Composite labelComposite;\r
+ private Label labelName;\r
+ private Label labelNumber;\r
+ private Label labelMethod;\r
+ private TrackedCombo methodSelector;\r
+ private Label labelSeed;\r
+ private TrackedText seed;\r
+ private Tree tree;\r
+ private Composite buttonComposite;\r
+ private Group parameterPropertyGroup;\r
+ private Label labelVariable;\r
+ private TrackedText variable;\r
+ private Label labelRange;\r
+ private RangeComposite rangeComposite;\r
+ private Label labelDistribution;\r
+ private TrackedCombo distributionSelector;\r
+ private DistributionPropertyWidget dpw;\r
+ private TrackedText name;\r
+ private TrackedText n;\r
+ private Button addVariable;\r
\r
@Override\r
public void createControls(Composite body, IWorkbenchSite site,\r
final ISessionContext context, final WidgetSupport support) {\r
support.register(this);\r
+ super.createControls(body, site, context, support);\r
+ }\r
\r
- Composite composite = new RemoveFocusBeforeExperimentComposite(body, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
+ /**\r
+ * Updates the content of propertyContainer \r
+ * @param context\r
+ */\r
+ private void updateSelection(ISessionContext context) {\r
+ ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class);\r
+ IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();\r
+ parameterSupport.fireInput(context, selection);\r
+\r
+ propertyContainer.setContent(content);\r
+ Point size = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ propertyContainer.setMinSize(size);\r
+ }\r
+\r
+\r
+ @Override\r
+ public void setInput(ISessionContext context, Object input) {\r
+ experiment = AdaptionUtils.adaptToSingle(input, Resource.class);\r
+ if(contentListener == null) {\r
+ contentListener = new DisposableListener<Collection<Resource>>() {\r
+\r
+ @Override\r
+ public void execute(Collection<Resource> result) {\r
+ if(remove != null && !remove.getWidget().isDisposed() && result != null) {\r
+ remove.getWidget().getDisplay().asyncExec(new RunnableWithObject(result) {\r
+ @Override\r
+ public void run() {\r
+ if(!remove.getWidget().isDisposed()) {\r
+ @SuppressWarnings("unchecked")\r
+ Collection<Resource> result = (Collection<Resource>) getObject();\r
+ if(result.size() > 1)\r
+ remove.getWidget().setEnabled(true);\r
+ else\r
+ remove.getWidget().setEnabled(false);\r
+ }\r
+ }\r
+ });\r
+\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public void exception(Throwable t) {\r
+ t.printStackTrace();\r
+ }\r
+ };\r
+\r
+ SimanticsUI.getSession().asyncRequest(new Read<Collection<Resource>> () {\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {\r
+ return (Collection<Resource>) new ParameterChildRule().getChildren(graph, experiment);\r
+ }\r
+\r
+ }, contentListener);\r
+ }\r
+\r
+ }\r
+\r
+\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ final ISessionContext context, final WidgetSupport support) {\r
+\r
+ composite = new RemoveFocusBeforeExperimentComposite(body, SWT.NONE);\r
\r
// Scrolled composite for displaying properties of a selection in explorer\r
propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyContainer);\r
- GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
propertyContainer.setExpandHorizontal(true);\r
propertyContainer.setExpandVertical(true);\r
\r
content = new Composite(propertyContainer, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(content);\r
- GridLayoutFactory.fillDefaults().numColumns(2).applyTo(content);\r
\r
// Label\r
- Composite labelComposite = new Composite(content, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(labelComposite);\r
- GridLayoutFactory.fillDefaults().numColumns(8).applyTo(labelComposite);\r
- Label label = new Label(labelComposite, SWT.NONE);\r
- label.setText("Name");\r
+ labelComposite = new Composite(content, SWT.NONE);\r
+ labelName = new Label(labelComposite, SWT.NONE);\r
+ labelName.setText("Name");\r
\r
- TrackedText name = new TrackedText(labelComposite, support, SWT.BORDER);\r
+ name = new TrackedText(labelComposite, 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
- GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
\r
- label = new Label(labelComposite, SWT.NONE);\r
- label.setText("Number of runs");\r
+ labelNumber = new Label(labelComposite, SWT.NONE);\r
+ labelNumber.setText("Number of runs");\r
\r
- TrackedText n = new TrackedText(labelComposite, support, SWT.BORDER);\r
+ n = new TrackedText(labelComposite, support, SWT.BORDER);\r
n.setTextFactory(new IntegerPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_numberOfValues));\r
n.addModifyListener(new IntegerPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_numberOfValues));\r
n.setInputValidator(new IntegerValidator());\r
n.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), n.getWidget())));\r
- GridDataFactory.fillDefaults().hint(50, SWT.DEFAULT).applyTo(n.getWidget());\r
\r
- label = new Label(labelComposite, SWT.NONE);\r
- label.setText("Method");\r
+ labelMethod = new Label(labelComposite, SWT.NONE);\r
+ labelMethod.setText("Method");\r
\r
- TrackedCombo methodSelector = new TrackedCombo(labelComposite, support, SWT.DROP_DOWN);\r
+ methodSelector = new TrackedCombo(labelComposite, support, SWT.DROP_DOWN);\r
methodSelector.setItemFactory(new ReadFactoryImpl<Resource, Map<String,Object>>() {\r
\r
@Override\r
}\r
});\r
\r
- label = new Label(labelComposite, SWT.NONE);\r
- label.setText("Seed");\r
+ labelSeed = new Label(labelComposite, SWT.NONE);\r
+ labelSeed.setText("Seed");\r
\r
- TrackedText seed = new TrackedText(labelComposite, support, SWT.BORDER);\r
+ seed = new TrackedText(labelComposite, support, SWT.BORDER);\r
seed.setTextFactory(new IntegerPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_randomSeed));\r
seed.addModifyListener(new IntegerPropertyModifier(context, SysdynResource.URIs.SensitivityAnalysisExperiment_randomSeed));\r
seed.setInputValidator(new IntegerValidator());\r
seed.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), seed.getWidget())));\r
- GridDataFactory.fillDefaults().hint(50, SWT.DEFAULT).applyTo(seed.getWidget());\r
\r
// (Ontology-based) GraphExplorer displaying range axis and variables mapped to those axis\r
explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
}\r
};\r
\r
- Tree tree = explorer.getExplorerControl();\r
+ tree = explorer.getExplorerControl();\r
tree.addListener(SWT.Activate, listener);\r
tree.addListener(SWT.Show, listener);\r
tree.addListener(SWT.Paint,listener);\r
});\r
\r
\r
- GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
-\r
- Composite buttonComposite = new Composite(explorer, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
- GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ buttonComposite = new Composite(explorer, SWT.NONE);\r
\r
- Button addVariable = new Button(buttonComposite, support, SWT.NONE);\r
+ addVariable = new Button(buttonComposite, support, SWT.NONE);\r
addVariable.setText("Add parameter");\r
addVariable.addSelectionListener(new SelectionListenerImpl<Resource>(context) {\r
\r
}\r
\r
});\r
-\r
propertyContainer.setContent(content);\r
- Point tsize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
- propertyContainer.setMinSize(tsize);\r
\r
\r
- Group parameterPropertyGroup = new Group(content, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterPropertyGroup);\r
- GridLayoutFactory.fillDefaults().applyTo(parameterPropertyGroup);\r
+ parameterPropertyGroup = new Group(content, SWT.NONE);\r
\r
parameterProperties = new Composite(parameterPropertyGroup, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterProperties);\r
- GridLayoutFactory.fillDefaults().numColumns(2).applyTo(parameterProperties);\r
\r
// Label\r
- label = new Label(parameterProperties, SWT.NONE);\r
- label.setText("Variable:");\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ labelVariable = new Label(parameterProperties, SWT.NONE);\r
+ labelVariable.setText("Variable:");\r
\r
- TrackedText variable = new TrackedText(parameterProperties, parameterSupport, SWT.BORDER);\r
+ variable = new TrackedText(parameterProperties, parameterSupport, SWT.BORDER);\r
variable.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable));\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
\r
- label = new Label(parameterProperties, SWT.NONE);\r
- label.setText("Range:");\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ labelRange = new Label(parameterProperties, SWT.NONE);\r
+ labelRange.setText("Range:");\r
\r
- RangeComposite rangeComposite = new RangeComposite(parameterProperties, context, parameterSupport, SWT.NONE) {\r
+ rangeComposite = new RangeComposite(parameterProperties, context, parameterSupport, SWT.NONE) {\r
@Override\r
protected Resource getIndexRelation(ReadGraph graph) {\r
return SysdynResource.getInstance(graph).SensitivityAnalysisExperiment_Parameter_indexes;\r
}\r
};\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeComposite);\r
\r
// TrackedText variable = new TrackedText(parameterProperties, parameterSupport, SWT.BORDER);\r
// variable.setTextFactory(new StringPropertyFactory(SysdynResource.URIs.SensitivityAnalysisExperiment_Parameter_variable));\r
// variable.setColorProvider(new SysdynBasicColorProvider(new LocalResourceManager(JFaceResources.getResources(), variable.getWidget())));\r
// GridDataFactory.fillDefaults().grab(true, false).applyTo(variable.getWidget());\r
\r
- label = new Label(parameterProperties, SWT.NONE);\r
- label.setText("Distribution:");\r
- GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);\r
+ labelDistribution = new Label(parameterProperties, SWT.NONE);\r
+ labelDistribution.setText("Distribution:");\r
\r
- TrackedCombo distributionSelector = new TrackedCombo(parameterProperties, parameterSupport, SWT.DROP_DOWN);\r
+ distributionSelector = new TrackedCombo(parameterProperties, parameterSupport, SWT.DROP_DOWN);\r
distributionSelector.setItemFactory(new ReadFactoryImpl<Resource, Map<String,Object>>() {\r
\r
@Override\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
+ dpw = new DistributionPropertyWidget(parameterProperties, context, parameterSupport, SWT.NONE);\r
}\r
\r
\r
- /**\r
- * Updates the content of propertyContainer \r
- * @param context\r
- */\r
- private void updateSelection(ISessionContext context) {\r
- ISelectionProvider selectionProvider = (ISelectionProvider)explorer.getAdapter(ISelectionProvider.class);\r
- IStructuredSelection selection = (IStructuredSelection)selectionProvider.getSelection();\r
- parameterSupport.fireInput(context, selection);\r
-\r
- propertyContainer.setContent(content);\r
- Point size = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
- propertyContainer.setMinSize(size);\r
- }\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
+ \r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(content);\r
+ GridLayoutFactory.fillDefaults().numColumns(1).applyTo(content);\r
\r
+ // Label\r
+ GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(labelComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(labelComposite);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().hint(50, SWT.DEFAULT).applyTo(n.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().hint(50, SWT.DEFAULT).applyTo(seed.getWidget());\r
\r
- @Override\r
- public void setInput(ISessionContext context, Object input) {\r
- experiment = AdaptionUtils.adaptToSingle(input, Resource.class);\r
- if(contentListener == null) {\r
- contentListener = new DisposableListener<Collection<Resource>>() {\r
+ GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+ \r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ \r
+ Point tsize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ propertyContainer.setMinSize(tsize);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterPropertyGroup);\r
+ GridLayoutFactory.fillDefaults().applyTo(parameterPropertyGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterProperties);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(parameterProperties);\r
\r
- @Override\r
- public void execute(Collection<Resource> result) {\r
- if(remove != null && !remove.getWidget().isDisposed() && result != null) {\r
- remove.getWidget().getDisplay().asyncExec(new RunnableWithObject(result) {\r
- @Override\r
- public void run() {\r
- if(!remove.getWidget().isDisposed()) {\r
- @SuppressWarnings("unchecked")\r
- Collection<Resource> result = (Collection<Resource>) getObject();\r
- if(result.size() > 1)\r
- remove.getWidget().setEnabled(true);\r
- else\r
- remove.getWidget().setEnabled(false);\r
- }\r
- }\r
- });\r
+ // Label\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelVariable);\r
\r
- }\r
- }\r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(variable.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelRange);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(rangeComposite);\r
+ \r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelDistribution);\r
+ \r
+ GridDataFactory.fillDefaults().span(3, 1).grab(true, true).applyTo(dpw);\r
+ GridLayoutFactory.fillDefaults().margins(6, 0).applyTo(dpw);\r
+ }\r
+ \r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(composite);\r
+ \r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(content);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(content);\r
\r
- @Override\r
- public void exception(Throwable t) {\r
- t.printStackTrace();\r
- }\r
- };\r
+ // Label\r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(labelComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(8).applyTo(labelComposite);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().hint(50, SWT.DEFAULT).applyTo(n.getWidget());\r
+ \r
+ GridDataFactory.fillDefaults().hint(50, SWT.DEFAULT).applyTo(seed.getWidget());\r
\r
- SimanticsUI.getSession().asyncRequest(new Read<Collection<Resource>> () {\r
+ GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public Collection<Resource> perform(ReadGraph graph) throws DatabaseException {\r
- return (Collection<Resource>) new ParameterChildRule().getChildren(graph, experiment);\r
- }\r
+ GridDataFactory.fillDefaults().applyTo(buttonComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);\r
+ \r
+ Point tsize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
+ propertyContainer.setMinSize(tsize);\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterPropertyGroup);\r
+ GridLayoutFactory.fillDefaults().applyTo(parameterPropertyGroup);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(parameterProperties);\r
+ GridLayoutFactory.fillDefaults().numColumns(3).applyTo(parameterProperties);\r
\r
- }, contentListener);\r
- }\r
+ // Label\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelVariable);\r
\r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(variable.getWidget());\r
\r
- }\r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelRange);\r
+ \r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(rangeComposite);\r
+ \r
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(labelDistribution);\r
+\r
+ GridDataFactory.fillDefaults().span(1, 1).grab(true, true).applyTo(dpw);\r
+ GridLayoutFactory.fillDefaults().margins(6, 0).applyTo(dpw);\r
\r
+ }\r
+ \r
}\r
/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2007, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.common.request.WriteRequest;\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.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.ui.browser.nodes.SharedFunctionLibraryNode;\r
/*******************************************************************************\r
- * Copyright (c) 2010, 2011 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2011, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.request.Read;\r
import org.simantics.diagram.G2DUtils;\r
import org.simantics.diagram.stubs.G2DResource;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.modeling.ModelingResources;\r
import org.simantics.sysdyn.SysdynResource;\r
/**\r
* Information tab for additional information of variables. \r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
-public class VariableInformationTab extends LabelPropertyTabContributor implements Widget {\r
+public class VariableInformationTab extends AdjustableTab implements Widget {\r
private Composite orientationComposite;\r
private WidgetSupport support;\r
private Resource component;\r
private org.simantics.browsing.ui.swt.widgets.Label sample;\r
private LocalResourceManager resourceManager;\r
\r
-\r
@Override\r
public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r
this.support = support;\r
// Create a ResourceManager to dispose images when the widget is disposed.\r
this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), body);\r
\r
+ super.createControls(body, site, context, support);\r
+ }\r
\r
- final Composite composite = new Composite(body, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
- GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+ private Read<Pair<Font, Color>> fontAndColorRead;\r
+ private Composite composite;\r
+ private Group informationGroup;\r
+ private TrackedText information;\r
+ private Group rangeGroup;\r
+ private Label label;\r
+ private TrackedText rangeStart;\r
+ private TrackedText rangeEnd;\r
+ private TrackedText rangeStep;\r
+ private Composite fontComposite;\r
+ private Button b;\r
+\r
+ @Override\r
+ public void setInput(ISessionContext context, Object input) {\r
+ component = AdaptionUtils.adaptToSingle(input, Resource.class);\r
+ // is the displayed variable a valve?\r
+ Boolean isValve = false;\r
+ try {\r
+ isValve = context.getSession().syncRequest(new Read<Boolean>() {\r
+\r
+ @Override\r
+ public Boolean perform(ReadGraph graph) throws DatabaseException {\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ return graph.isInstanceOf(component, sr.Valve);\r
+ }\r
+\r
+ });\r
+ } catch (DatabaseException e) {\r
+ e.printStackTrace();\r
+ }\r
+ // if it is a valve, display the orientation information\r
+ if(isValve) {\r
+ ValveOrientationGroup vog = new ValveOrientationGroup(orientationComposite, context, support, SWT.NONE);\r
+ vog.setInput(context, input);\r
+ ValveTextLocationGroup vtlg = new ValveTextLocationGroup(orientationComposite, context, support, SWT.NONE);\r
+ vtlg.setInput(context, input);\r
+ orientationComposite.getParent().layout();\r
+ }\r
+\r
+ // Read font and color information for sample text\r
+ if(fontAndColorRead == null) {\r
+ fontAndColorRead = new Read<Pair<Font, Color>>() {\r
\r
- Group informationGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);\r
+ @Override\r
+ public Pair<Font, Color> perform(ReadGraph graph) throws DatabaseException {\r
+ Font font = null;\r
+ Color color = null;\r
+ if(component != null) {\r
+ Resource element = graph.getPossibleObject(component, ModelingResources.getInstance(graph).ComponentToElement);\r
+ if(element != null) {\r
+ G2DResource g2d = G2DResource.getInstance(graph);\r
+ Resource fontResource = graph.getPossibleObject(element, g2d.HasFont);\r
+ if(fontResource != null)\r
+ font = G2DUtils.getFont(graph, fontResource);\r
+ Resource colorResource = graph.getPossibleObject(element, g2d.HasColor);\r
+ if(colorResource != null)\r
+ color = G2DUtils.getColor(graph, colorResource);\r
+ }\r
+ }\r
+ return new Pair<Font, Color>(font, color);\r
+ }\r
+ };\r
+\r
+ SimanticsUI.getSession().asyncRequest(fontAndColorRead, new Listener<Pair<Font, Color>>() {\r
+\r
+ @Override\r
+ public void execute(final Pair<Font, Color> result) {\r
+ final Display device;\r
+ try {\r
+ device = sample.getWidget().getDisplay();\r
+ } catch (SWTException e) {\r
+ // Widget is disposed, the GUI probably did'n function as fast as the user commanded.\r
+ // Thus do nothing.\r
+ return;\r
+ }\r
+ \r
+ device.asyncExec(new Runnable() {\r
+ \r
+ @Override\r
+ public void run() {\r
+ try {\r
+ if(sample.getWidget().isDisposed())\r
+ return;\r
+ } catch (SWTException e) {\r
+ // Widget is disposed, the GUI probably did'n function as fast as the user commanded.\r
+ // Thus do nothing.\r
+ return;\r
+ }\r
+ if(result.first != null) {\r
+ FontData fd = toSwtFontData(result.first);\r
+ sample.setFont(resourceManager.createFont(FontDescriptor.createFrom(fd)));\r
+ }\r
+ if(result.second != null) {\r
+ RGB rgb = new RGB(result.second.getRed(), result.second.getGreen(), \r
+ result.second.getBlue());\r
+ sample.setForeground(resourceManager.createColor(rgb));\r
+ }\r
+ try {\r
+ sample.getWidget().getParent().getParent().layout();\r
+ } catch (SWTException e) {\r
+\r
+ }\r
+ }\r
+ });\r
+\r
+ }\r
+\r
+ @Override\r
+ public void exception(Throwable t) {\r
+ t.printStackTrace();\r
+ }\r
+\r
+ @Override\r
+ public boolean isDisposed() {\r
+ return sample == null || sample.getWidget().isDisposed();\r
+ }\r
+\r
+ });\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Create SWT FontData based on AWT Font\r
+ * @param font AWT Font\r
+ * @return SWT FontData based on AWT Font\r
+ */\r
+ private static FontData toSwtFontData(Font font) {\r
+ FontData fontData = new FontData();\r
+ fontData.setName(font.getFamily());\r
+ fontData.setStyle(font.getStyle());\r
+ fontData.setHeight(font.getSize());\r
+ return fontData;\r
+ }\r
+\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ ISessionContext context, WidgetSupport _support) {\r
+\r
+ composite = new Composite(body, SWT.NONE);\r
+\r
+ informationGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);\r
informationGroup.setText("Information");\r
- GridDataFactory.fillDefaults().grab(false, true).applyTo(informationGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(informationGroup);\r
\r
// Textual format documentation\r
- TrackedText information = new TrackedText(informationGroup, support, SWT.MULTI | SWT.BORDER);\r
+ information = new TrackedText(informationGroup, support, SWT.MULTI | SWT.BORDER);\r
information.setTextFactory(new StringPropertyFactory(Layer0.URIs.HasDescription));\r
information.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasDescription));\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(information.getWidget());\r
\r
// Orientation information for valves\r
orientationComposite = new Composite(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().span(1, 2).applyTo(orientationComposite);\r
- GridLayoutFactory.fillDefaults().margins(3,3).applyTo(orientationComposite);\r
\r
// Range of a variable (e.g. from 0 to 10). Does not affect simulation, but the infor can be used for example in charts\r
- Group rangeGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);\r
+ rangeGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);\r
rangeGroup.setText("Range");\r
- GridDataFactory.fillDefaults().applyTo(rangeGroup);\r
- GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(6).applyTo(rangeGroup);\r
\r
- Label label = new Label(rangeGroup, SWT.NONE);\r
+ label = new Label(rangeGroup, SWT.NONE);\r
label.setText("Start");\r
\r
- TrackedText rangeStart = new TrackedText(rangeGroup, support, SWT.RIGHT | SWT.BORDER);\r
+ rangeStart = new TrackedText(rangeGroup, support, SWT.RIGHT | SWT.BORDER);\r
rangeStart.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasRangeStart));\r
rangeStart.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasRangeStart));\r
rangeStart.setInputValidator(new DoubleValidator());\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeStart.getWidget());\r
-\r
\r
label = new Label(rangeGroup, SWT.NONE);\r
label.setText("End");\r
\r
\r
- TrackedText rangeEnd = new TrackedText(rangeGroup, support, SWT.RIGHT | SWT.BORDER);\r
+ rangeEnd = new TrackedText(rangeGroup, support, SWT.RIGHT | SWT.BORDER);\r
rangeEnd.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasRangeEnd));\r
rangeEnd.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasRangeEnd));\r
rangeEnd.setInputValidator(new DoubleValidator());\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeEnd.getWidget());\r
\r
label = new Label(rangeGroup, SWT.NONE);\r
label.setText("Step");\r
\r
- TrackedText rangeStep = new TrackedText(rangeGroup, support, SWT.RIGHT | SWT.BORDER);\r
+ rangeStep = new TrackedText(rangeGroup, support, SWT.RIGHT | SWT.BORDER);\r
rangeStep.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.HasRangeStep));\r
rangeStep.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.HasRangeStep));\r
rangeStep.setInputValidator(new DoubleValidator());\r
- GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeStep.getWidget());\r
\r
\r
// Font options. FIXME: very bad appearance right now\r
\r
- final Composite fontComposite = new Composite(composite, SWT.NONE);\r
- GridDataFactory.fillDefaults().applyTo(fontComposite);\r
- GridLayoutFactory.fillDefaults().numColumns(2).applyTo(fontComposite);\r
- Button b = new Button(fontComposite, support, SWT.PUSH);\r
+ fontComposite = new Composite(composite, SWT.NONE);\r
+ b = new Button(fontComposite, support, SWT.PUSH);\r
b.setText("Choose Font");\r
\r
// Sample text with selected font\r
}\r
\r
});\r
+ }\r
\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(informationGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(informationGroup);\r
\r
- }\r
+ // Textual format documentation\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(information.getWidget());\r
\r
- private Read<Pair<Font, Color>> fontAndColorRead;\r
+ // Orientation information for valves\r
+ GridDataFactory.fillDefaults().span(1, 2).applyTo(orientationComposite);\r
+ GridLayoutFactory.fillDefaults().margins(3,3).applyTo(orientationComposite);\r
\r
- @Override\r
- public void setInput(ISessionContext context, Object input) {\r
- component = AdaptionUtils.adaptToSingle(input, Resource.class);\r
- // is the displayed variable a valve?\r
- Boolean isValve = false;\r
- try {\r
- isValve = context.getSession().syncRequest(new Read<Boolean>() {\r
+ // Range of a variable (e.g. from 0 to 10). Does not affect simulation, but the infor can be used for example in charts\r
+ GridDataFactory.fillDefaults().applyTo(rangeGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(rangeGroup);\r
\r
- @Override\r
- public Boolean perform(ReadGraph graph) throws DatabaseException {\r
- SysdynResource sr = SysdynResource.getInstance(graph);\r
- return graph.isInstanceOf(component, sr.Valve);\r
- }\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeStart.getWidget());\r
\r
- });\r
- } catch (DatabaseException e) {\r
- e.printStackTrace();\r
- }\r
- // if it is a valve, display the orientation information\r
- if(isValve) {\r
- ValveOrientationGroup vog = new ValveOrientationGroup(orientationComposite, context, support, SWT.NONE);\r
- vog.setInput(context, input);\r
- ValveTextLocationGroup vtlg = new ValveTextLocationGroup(orientationComposite, context, support, SWT.NONE);\r
- vtlg.setInput(context, input);\r
- orientationComposite.getParent().layout();\r
- }\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeEnd.getWidget());\r
\r
- // Read font and color information for sample text\r
- if(fontAndColorRead == null) {\r
- fontAndColorRead = new Read<Pair<Font, Color>>() {\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeStep.getWidget());\r
\r
- @Override\r
- public Pair<Font, Color> perform(ReadGraph graph) throws DatabaseException {\r
- Font font = null;\r
- Color color = null;\r
- if(component != null) {\r
- Resource element = graph.getPossibleObject(component, ModelingResources.getInstance(graph).ComponentToElement);\r
- if(element != null) {\r
- G2DResource g2d = G2DResource.getInstance(graph);\r
- Resource fontResource = graph.getPossibleObject(element, g2d.HasFont);\r
- if(fontResource != null)\r
- font = G2DUtils.getFont(graph, fontResource);\r
- Resource colorResource = graph.getPossibleObject(element, g2d.HasColor);\r
- if(colorResource != null)\r
- color = G2DUtils.getColor(graph, colorResource);\r
- }\r
- }\r
- return new Pair<Font, Color>(font, color);\r
- }\r
- };\r
+ GridDataFactory.fillDefaults().applyTo(fontComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(1).applyTo(fontComposite);\r
+ }\r
\r
- SimanticsUI.getSession().asyncRequest(fontAndColorRead, new Listener<Pair<Font, Color>>() {\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
\r
- @Override\r
- public void execute(final Pair<Font, Color> result) {\r
- final Display device;\r
- try {\r
- device = sample.getWidget().getDisplay();\r
- } catch (SWTException e) {\r
- // Widget is disposed, the GUI probably did'n function as fast as the user commanded.\r
- // Thus do nothing.\r
- return;\r
- }\r
- \r
- device.asyncExec(new Runnable() {\r
- \r
- @Override\r
- public void run() {\r
- try {\r
- if(sample.getWidget().isDisposed())\r
- return;\r
- } catch (SWTException e) {\r
- // Widget is disposed, the GUI probably did'n function as fast as the user commanded.\r
- // Thus do nothing.\r
- return;\r
- }\r
- if(result.first != null) {\r
- FontData fd = toSwtFontData(result.first);\r
- sample.setFont(resourceManager.createFont(FontDescriptor.createFrom(fd)));\r
- }\r
- if(result.second != null) {\r
- RGB rgb = new RGB(result.second.getRed(), result.second.getGreen(), \r
- result.second.getBlue());\r
- sample.setForeground(resourceManager.createColor(rgb));\r
- }\r
- try {\r
- sample.getWidget().getParent().getParent().layout();\r
- } catch (SWTException e) {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
\r
- }\r
- }\r
- });\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(informationGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).applyTo(informationGroup);\r
\r
- }\r
+ // Textual format documentation\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(information.getWidget());\r
\r
- @Override\r
- public void exception(Throwable t) {\r
- t.printStackTrace();\r
- }\r
+ // Orientation information for valves\r
+ GridDataFactory.fillDefaults().span(1, 2).applyTo(orientationComposite);\r
+ GridLayoutFactory.fillDefaults().margins(3,3).applyTo(orientationComposite);\r
\r
- @Override\r
- public boolean isDisposed() {\r
- return sample == null || sample.getWidget().isDisposed();\r
- }\r
+ // Range of a variable (e.g. from 0 to 10). Does not affect simulation, but the infor can be used for example in charts\r
+ GridDataFactory.fillDefaults().applyTo(rangeGroup);\r
+ GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(6).applyTo(rangeGroup);\r
\r
- });\r
- }\r
- }\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeStart.getWidget());\r
\r
- /**\r
- * Create SWT FontData based on AWT Font\r
- * @param font AWT Font\r
- * @return SWT FontData based on AWT Font\r
- */\r
- private static FontData toSwtFontData(Font font) {\r
- FontData fontData = new FontData();\r
- fontData.setName(font.getFamily());\r
- fontData.setStyle(font.getStyle());\r
- fontData.setHeight(font.getSize());\r
- return fontData;\r
- }\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeEnd.getWidget());\r
+\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rangeStep.getWidget());\r
+\r
+ GridDataFactory.fillDefaults().applyTo(fontComposite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(fontComposite);\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
/*******************************************************************************\r
- * Copyright (c) 2010 Association for Decentralized Information Management in\r
+ * Copyright (c) 2010, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
\r
import java.util.ArrayList;\r
import java.util.Collections;\r
+import java.util.Comparator;\r
\r
import org.eclipse.jface.resource.ImageDescriptor;\r
import org.eclipse.jface.resource.JFaceResources;\r
\r
private LocalResourceManager resourceManager;\r
\r
- private final char[] allowedCharacters = {\r
+ private static final char[] ALLOWED_CHARACTERS = {\r
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','å','ä','ö',\r
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','Å','Ä','Ö',\r
'1','2','3','4','5','6','7','8','9','0','.','(',')'};\r
\r
- private final String allowedConnectedCharactersRegExp = "[\\Q({[:;,<=>+-*/^\\E]";\r
+ private static final String ALLOWED_CONNECTED_CHARACTERS_REG_EXP = "[\\Q({[:;,<=>+-*/^\\E]";\r
+ \r
+ private static final ArrayList<String> ALLOW_ALL_COMPLETIONS_LIST = new ArrayList<String>();\r
+ static {\r
+ ALLOW_ALL_COMPLETIONS_LIST.add("");\r
+ }\r
\r
public CompletionProcessor(Table allowedVariables, boolean allowFunctions, ExpressionWidgetInput input) {\r
this.allowedVariables = allowedVariables;\r
}\r
\r
/**\r
- * Create CompletionProposals of the variables and add them to array.\r
+ * Create CompletionProposals of the variables and add them to array. Do not allow duplicates.\r
* @param array result array of CompletionProposals\r
* @param token current token\r
* @param offset an offset within the document for which completions should be computed\r
Image imageVariableGray = resourceManager.createImage(ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getResource("icons/variableGray.png")));\r
\r
for (String variable : variables) {\r
- if (token.length() == 0 || variable.toUpperCase().startsWith(token.toUpperCase())) {\r
- array.add(new CompletionProposal(variable, \r
+ if ((token.length() == 0 || variable.toUpperCase().startsWith(token.toUpperCase()))\r
+ && !listContainsVariable(array, variable)) {\r
+ array.add(new CompletionProposal(variable, \r
offset - token.length(),\r
token.length(), \r
variable.length(), \r
} \r
}\r
for (String variable : timeAndSelfVariables) {\r
- if (token.length() == 0 || variable.toUpperCase().startsWith(token.toUpperCase())) {\r
+ if ((token.length() == 0 || variable.toUpperCase().startsWith(token.toUpperCase()))\r
+ && !listContainsVariable(array, variable)) {\r
array.add(new CompletionProposal(variable, \r
offset - token.length(),\r
token.length(), \r
}\r
}\r
\r
+ private boolean listContainsVariable(ArrayList<ICompletionProposal> array,\r
+ String variable) {\r
+ for (ICompletionProposal proposal : array) {\r
+ if (proposal.getDisplayString().equals(variable))\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
/**\r
* Create CompletionProposals of the functions and add them to array.\r
* @param array result array of CompletionProposals\r
}\r
\r
/**\r
- * Collect all matching proposals\r
- * @param token current token\r
+ * Collect all matching proposals. Duplicates are removed; the one with the longest token stays.\r
+ * @param possibleLabelBeginnings sets of whitespace delimited tokens (as Strings)\r
* @param offset an offset within the document for which completions should be computed\r
* @return Array of matching proposals\r
*/\r
- private ICompletionProposal[] collectProposals(String token, int offset) {\r
+ private ICompletionProposal[] collectProposals(ArrayList<String> possibleLabelBeginnings, int offset) {\r
ArrayList<ICompletionProposal> resultArray = new ArrayList<ICompletionProposal>();\r
\r
// Find variables and functions and create CompletionProposals out of them.\r
findVariables();\r
- addVariables(resultArray, token, offset);\r
- addFunctions(resultArray, token, offset);\r
+ \r
+ // Sort the list based on the length of the tokens (descending) to get "" to end.\r
+ Collections.sort(possibleLabelBeginnings, new Comparator<String>(){\r
+ @Override\r
+ public int compare(String o1, String o2) {\r
+ if (o1.length() > o2.length()) {\r
+ return -1;\r
+ } else if (o1.length() < o2.length()) {\r
+ return 1;\r
+ }\r
+ return 0;\r
+ }\r
+ });\r
+ \r
+ for (String possibleLabelBeginning : possibleLabelBeginnings) {\r
+ addVariables(resultArray, possibleLabelBeginning, offset);\r
+ }\r
\r
- ICompletionProposal[] result = new ICompletionProposal[resultArray.size()];\r
+ // No support for whitespace in function names; get shortest beginning\r
+ addFunctions(resultArray, possibleLabelBeginnings.get(possibleLabelBeginnings.size() - 1), offset);\r
+\r
+ ICompletionProposal[] result = new ICompletionProposal[resultArray.size()];\r
for (int i = 0; i < result.length; ++i) {\r
result[i] = resultArray.get(i);\r
}\r
Control control = viewer.getTextWidget();\r
this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), control);\r
\r
- if (equation.length() == 0 \r
- || offset == 0\r
- || Character.isWhitespace(equation.charAt(offset - 1))) {\r
- return collectProposals("", offset);\r
+ if (equation.length() == 0 || offset == 0) {\r
+ return collectProposals(ALLOW_ALL_COMPLETIONS_LIST, offset);\r
}\r
\r
equation = equation.substring(0, offset);\r
\r
- // Split into tokens on whitespace characters\r
- String[] tokens = equation.split("[\\s]");\r
- if (tokens.length == 0) {\r
- return collectProposals("", offset);\r
+ // Split the equation on '+', '-', etc. characters\r
+ String stringsBetweenConnectedCharacters[] = equation.split(ALLOWED_CONNECTED_CHARACTERS_REG_EXP);\r
+ if (stringsBetweenConnectedCharacters.length == 0) {\r
+ return collectProposals(ALLOW_ALL_COMPLETIONS_LIST, offset);\r
}\r
- String token = tokens[tokens.length - 1];\r
+ String stringAfterLastConnectedCharacter = stringsBetweenConnectedCharacters[stringsBetweenConnectedCharacters.length - 1];\r
+ String stringAfterWhitespaceAfterLastConnectedCharacter = removeLeadingWhitespace(stringAfterLastConnectedCharacter);\r
+ \r
+ // Split into tokens on whitespace characters, include also the trailing empty strings\r
+ String[] tokens = stringAfterWhitespaceAfterLastConnectedCharacter.split("[\\s]", -42);\r
\r
- // If a '+', '-', etc. character is in the end, return all. \r
- if (allowedConnectedCharactersRegExp.indexOf(token.charAt(token.length() - 1)) != -1) {\r
- return collectProposals("", offset);\r
- }\r
- \r
- // Split the last token on '+', '-', etc. characters\r
- String tokensOfLastToken[] = token.split(allowedConnectedCharactersRegExp);\r
- if (tokensOfLastToken.length == 0) {\r
- return collectProposals("", offset);\r
+ // Only whitespace after the last connection character\r
+ if (allTokensAreEmpty(tokens))\r
+ return collectProposals(ALLOW_ALL_COMPLETIONS_LIST, offset);\r
+ \r
+ return collectProposals(getPossibleLabelBeginnings(tokens), offset);\r
+ }\r
+\r
+ /**\r
+ * Collect all possible strings (with each whitespace replaced by a space character)\r
+ * which may be a beginning of a variable. \r
+ * Create the beginnings by adding whitespace between. E.g.:\r
+ * {"multi", "part", "variab"}\r
+ * -> { "multi part variab",\r
+ * "part variab",\r
+ * "variab" }\r
+ * @param tokens list of tokens\r
+ * @return all possible label beginnings\r
+ */\r
+ private ArrayList<String> getPossibleLabelBeginnings(String[] tokens) {\r
+ ArrayList<String> possibleLabelBeginnings = new ArrayList<String>();\r
+ for (int i = 0; i < tokens.length; ++i) {\r
+ String token = new String();\r
+ for (int j = i; j < tokens.length; ++j) {\r
+ token += " " + tokens[j];\r
+ }\r
+ // Remove the excess space character from the beginning\r
+ token = token.substring(1);\r
+ \r
+ possibleLabelBeginnings.add(token);\r
}\r
- token = tokensOfLastToken[tokensOfLastToken.length - 1];\r
- //System.out.println(token + "\noffset = " + offset);\r
+ return possibleLabelBeginnings;\r
+ }\r
+\r
+ /**\r
+ * Remove leading whitespace\r
+ * @param input\r
+ * @return\r
+ */\r
+ private String removeLeadingWhitespace(String input) {\r
+ for (int i = 0; i < input.length(); ++i) {\r
+ if (!Character.isWhitespace(input.charAt(i))) {\r
+ return input.substring(i);\r
+ }\r
+ }\r
+ return "";\r
+ }\r
\r
- return collectProposals(token, offset);\r
+ private boolean allTokensAreEmpty(String[] tokens) {\r
+ for (String token : tokens)\r
+ if (!token.equals(""))\r
+ return false;\r
+ return true;\r
}\r
\r
@Override\r
\r
@Override\r
public char[] getCompletionProposalAutoActivationCharacters() {\r
- return allowedCharacters;\r
+ return ALLOWED_CHARACTERS;\r
}\r
\r
@Override\r
import org.eclipse.swt.widgets.Label;\r
import org.eclipse.swt.widgets.Listener;\r
import org.eclipse.swt.widgets.Table;\r
+import org.simantics.databoard.Bindings;\r
import org.simantics.db.ReadGraph;\r
import org.simantics.db.Resource;\r
import org.simantics.db.WriteGraph;\r
+import org.simantics.db.common.request.ReadRequest;\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.common.utils.ListUtils;\r
import org.simantics.db.exception.DatabaseException;\r
}\r
\r
@Override\r
- public void readData(final Resource expression, Map<String, Object> data) {\r
+ public void readData(final Resource expression, final Map<String, Object> data) {\r
Pair<String, String> equations = null;\r
if (expression != null && data.get("initialEquation") == null) {\r
try {\r
\r
data.put("integral", getDefaultIntegral(expression));\r
} else {\r
- data.put("integral", equations.first);\r
+ try {\r
+ final String integral = equations.first;\r
+ SimanticsUI.getSession().syncRequest(new ReadRequest() {\r
+\r
+ @Override\r
+ public void run(ReadGraph graph) throws DatabaseException {\r
+ SysdynResource sr = SysdynResource.getInstance(graph);\r
+ if (graph.hasStatement(input.expression, sr.StockExpression_useCustomIntegral)) {\r
+ data.put("integral", integral);\r
+ } else {\r
+ data.put("integral", getDefaultIntegral(graph, expression));\r
+ }\r
+ }\r
+\r
+ });\r
+ } catch (DatabaseException e) {\r
+ data.put("integral", equations.first);\r
+ e.printStackTrace();\r
+ }\r
}\r
\r
}\r
}\r
g.claimLiteral(expression, sr.StockExpression_initialEquation, currentInitial);\r
\r
- if (!currentIntegral.equals(data.get("integral"))) {\r
+ if (!currentIntegral.equals(g.getPossibleRelatedValue(expression, sr.StockExpression_integralEquation, Bindings.STRING))) {\r
// If the value is not same as default, enable the custom tag\r
g.claim(expression, sr.StockExpression_useCustomIntegral, expression);\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Copyright (c) 2013, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
/**\r
* Widget for setting percentage and color for a confidence bound\r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
public class ConfidenceBoundWidget extends Composite implements Widget {\r
\r
support.register(this);\r
\r
- GridLayoutFactory.fillDefaults().numColumns(2).applyTo(this);\r
+ GridLayoutFactory.fillDefaults().applyTo(this);\r
\r
confidenceBoundSupport = new WidgetSupportImpl();\r
+ \r
+ ColorPicker colorPicker = new ColorPicker(this, context, confidenceBoundSupport, SWT.NONE, false) {\r
+ @Override\r
+ protected Resource getColorRelation(ReadGraph graph) throws DatabaseException {\r
+ return SysdynResource.getInstance(graph).Charts_SensitivityDataset_ConfidenceBound_color;\r
+ }\r
+ };\r
+ GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(colorPicker);\r
+ \r
TrackedText variable = new TrackedText(this, confidenceBoundSupport, SWT.BORDER);\r
variable.setTextFactory(new DoublePropertyFactory(SysdynResource.URIs.Charts_SensitivityDataset_ConfidenceBound_percent));\r
variable.addModifyListener(new DoublePropertyModifier(context, SysdynResource.URIs.Charts_SensitivityDataset_ConfidenceBound_percent));\r
}\r
\r
});\r
- GridDataFactory.fillDefaults().hint(50, SWT.DEFAULT).applyTo(variable.getWidget());\r
- \r
- ColorPicker colorPicker = new ColorPicker(this, context, confidenceBoundSupport, SWT.NONE, false) {\r
- @Override\r
- protected Resource getColorRelation(ReadGraph graph) throws DatabaseException {\r
- return SysdynResource.getInstance(graph).Charts_SensitivityDataset_ConfidenceBound_color;\r
- }\r
- };\r
- GridDataFactory.fillDefaults().applyTo(colorPicker);\r
- \r
+ GridDataFactory.fillDefaults().hint(27, SWT.DEFAULT).align(SWT.CENTER, SWT.CENTER).applyTo(variable.getWidget());\r
}\r
\r
@Override\r
/*******************************************************************************\r
- * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Copyright (c) 2013, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
import org.simantics.db.exception.DatabaseException;\r
import org.simantics.db.management.ISessionContext;\r
import org.simantics.db.request.Read;\r
-import org.simantics.jfreechart.chart.properties.LabelPropertyTabContributor;\r
+import org.simantics.jfreechart.chart.properties.AdjustableTab;\r
import org.simantics.jfreechart.chart.properties.xyline.AxisAndVariablesExplorerComposite;\r
import org.simantics.jfreechart.chart.properties.xyline.AxisPropertyComposite;\r
import org.simantics.jfreechart.chart.properties.xyline.SeriesPropertyComposite;\r
import org.simantics.utils.datastructures.ArrayMap;\r
import org.simantics.utils.ui.AdaptionUtils;\r
\r
-public class SensitivityChartAxisAndVariablesTab extends LabelPropertyTabContributor {\r
+public class SensitivityChartAxisAndVariablesTab extends AdjustableTab {\r
\r
private GraphExplorerComposite explorer;\r
private ScrolledComposite propertyContainer;\r
private WidgetSupportImpl additionalSupport;\r
+ private Composite composite;\r
\r
public SensitivityChartAxisAndVariablesTab() {\r
additionalSupport = new WidgetSupportImpl();\r
}\r
\r
- @Override\r
- public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) {\r
- Composite composite = new Composite(body, SWT.NONE);\r
- GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
- GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
-\r
- // (Ontology-based) GraphExplorer displaying range axis and variables mapped to those axis\r
- explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
- "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
- explorer.setBrowseContexts(JFreeChartResource.URIs.ChartAxisAndVariablesBrowseContext);\r
- explorer.setInputSource(new SingleSelectionInputSource(\r
- Resource.class));\r
- explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
- explorer.finish();\r
-\r
- ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
- public void widgetSelected(SelectionEvent e) {\r
- updateSelection(context);\r
- }\r
- });\r
- GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
-\r
- // Scrolled composite for displaying properties of a selection in explorer\r
- propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
- GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
- GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
- propertyContainer.setExpandHorizontal(true);\r
- propertyContainer.setExpandVertical(true);\r
-\r
- }\r
-\r
/**\r
* Updates the content of propertyContainer \r
* @param context\r
}\r
\r
if(typeUri.equals(JFreeChartResource.URIs.Axis)) {\r
- AxisPropertyComposite apc = new AxisPropertyComposite(propertyContainer, context, additionalSupport, SWT.NONE);\r
+ AxisPropertyComposite apc = new AxisPropertyComposite(propertyContainer, context, additionalSupport, SWT.NONE, isVertical());\r
propertyContainer.setContent(apc);\r
Point size = apc.computeSize(SWT.DEFAULT, SWT.DEFAULT);\r
propertyContainer.setMinSize(size);\r
additionalSupport.fireInput(context, selection);\r
}\r
\r
+ @Override\r
+ protected void createAndAddControls(Composite body, IWorkbenchSite site,\r
+ final ISessionContext context, WidgetSupport support) {\r
+ composite = new Composite(body, SWT.NONE);\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ // (Ontology-based) GraphExplorer displaying range axis and variables mapped to those axis\r
+ explorer = new AxisAndVariablesExplorerComposite(ArrayMap.keys(\r
+ "displaySelectors", "displayFilter").values(false, false), site, composite, support, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE);\r
+ explorer.setBrowseContexts(JFreeChartResource.URIs.ChartAxisAndVariablesBrowseContext);\r
+ explorer.setInputSource(new SingleSelectionInputSource(\r
+ Resource.class));\r
+ explorer.getExplorer().setAutoExpandLevel(2); // Expand everything in the beginning\r
+ explorer.finish();\r
+\r
+ ((Tree)explorer.getExplorerControl()).addSelectionListener(new SelectionAdapter() {\r
+ public void widgetSelected(SelectionEvent e) {\r
+ updateSelection(context);\r
+ }\r
+ });\r
+ GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ propertyContainer = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);\r
+ GridDataFactory.fillDefaults().span(1, 2).grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+ propertyContainer.setExpandHorizontal(true);\r
+ propertyContainer.setExpandVertical(true);\r
+\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutVertical() {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(1).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().hint(220, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().span(1, 1).hint(SWT.DEFAULT, 210).grab(true, false).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+ }\r
+\r
+ @Override\r
+ protected void createControlLayoutHorizontal(boolean wideScreen) {\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(composite);\r
+\r
+ GridDataFactory.fillDefaults().hint(250, SWT.DEFAULT).grab(false, true).applyTo(explorer);\r
+\r
+ // Scrolled composite for displaying properties of a selection in explorer\r
+ GridDataFactory.fillDefaults().span(1, 2).hint(SWT.DEFAULT, SWT.DEFAULT).grab(true, true).applyTo(propertyContainer);\r
+ GridLayoutFactory.fillDefaults().applyTo(propertyContainer);\r
+ }\r
+\r
\r
}\r
/*******************************************************************************\r
- * Copyright (c) 2013 Association for Decentralized Information Management in\r
+ * Copyright (c) 2013, 2014 Association for Decentralized Information Management in\r
* Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
* UI for setting properties for sensitivity analysis series. Sensitivity analysis \r
* charts display only one variable as a "fan" chart.\r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
public class SensitivitySeriesPropertyComposite extends SeriesPropertyComposite {\r
\r
});\r
\r
- ConfidenceBoundWidget cbWidget = new ConfidenceBoundWidget(this, context, support, SWT.NONE, 0);\r
- GridDataFactory.fillDefaults().span(2, 1).applyTo(cbWidget);\r
- cbWidget = new ConfidenceBoundWidget(this, context, support, SWT.NONE, 1);\r
- GridDataFactory.fillDefaults().span(2, 1).applyTo(cbWidget);\r
- cbWidget = new ConfidenceBoundWidget(this, context, support, SWT.NONE, 2);\r
- GridDataFactory.fillDefaults().span(2, 1).applyTo(cbWidget);\r
- cbWidget = new ConfidenceBoundWidget(this, context, support, SWT.NONE, 3);\r
- GridDataFactory.fillDefaults().span(2, 1).applyTo(cbWidget);\r
- cbWidget = new ConfidenceBoundWidget(this, context, support, SWT.NONE, 4);\r
- GridDataFactory.fillDefaults().span(2, 1).applyTo(cbWidget);\r
+ Composite c = new Composite(this, SWT.NONE);\r
+ GridDataFactory.fillDefaults().span(2, 1).applyTo(c);\r
+ GridLayoutFactory.fillDefaults().numColumns(5).applyTo(c);\r
+ ConfidenceBoundWidget cbWidget = new ConfidenceBoundWidget(c, context, support, SWT.NONE, 0);\r
+ GridDataFactory.fillDefaults().applyTo(cbWidget);\r
+ cbWidget = new ConfidenceBoundWidget(c, context, support, SWT.NONE, 1);\r
+ GridDataFactory.fillDefaults().applyTo(cbWidget);\r
+ cbWidget = new ConfidenceBoundWidget(c, context, support, SWT.NONE, 2);\r
+ GridDataFactory.fillDefaults().applyTo(cbWidget);\r
+ cbWidget = new ConfidenceBoundWidget(c, context, support, SWT.NONE, 3);\r
+ GridDataFactory.fillDefaults().applyTo(cbWidget);\r
+ cbWidget = new ConfidenceBoundWidget(c, context, support, SWT.NONE, 4);\r
+ GridDataFactory.fillDefaults().applyTo(cbWidget);\r
\r
}\r
\r
*/\r
private void displayDefaultChart() {\r
if(defaultchart == null) {\r
+ NumberAxis domainAxis = new NumberAxis("time");\r
+ domainAxis.setAutoRangeIncludesZero(false);\r
XYPlot plot = new XYPlot(\r
sysdynDatasets,\r
- new NumberAxis("time"),\r
+ domainAxis,\r
new NumberAxis(""),\r
new XYLineAndShapeRenderer(true, false)\r
);\r
return Collections.emptyList();\r
\r
// Make sure unit updates are listened to\r
- String unit = graph.getPossibleRelatedValue(variable, SR.Variable_unit);\r
+ String unit = null;\r
+ if (graph.isInstanceOf(variable, SR.Shadow)) {\r
+ Resource original = graph.getPossibleObject(variable, SR.Shadow_original);\r
+ if (original == null)\r
+ return Collections.emptyList();\r
+ unit = graph.getPossibleRelatedValue(original, SR.Variable_unit);\r
+ } else {\r
+ unit = graph.getPossibleRelatedValue(variable, SR.Variable_unit);\r
+ }\r
if(unit == null || unit.trim().length() == 0)\r
return Collections.<Issue>singletonList(new StandardIssue(SR.Validations_UnitWarning, variable));\r
\r
\r
FileDialog dialog = new FileDialog(shell, SWT.SAVE);\r
\r
- String[] ext = {"*.tg"};\r
+ String[] ext = {"*.sysdynFunctions"};\r
dialog.setFilterExtensions(ext);\r
\r
dialog.setText("Export Function Library");\r
\r
FileDialog dialog = new FileDialog(shell, SWT.OPEN);\r
\r
- String[] ext = {"*.tg"};\r
+ String[] ext = {"*.sysdynFunctions; *.tg", "*.*"};\r
dialog.setFilterExtensions(ext);\r
\r
dialog.setText("Import Function Library");\r
\r
FileDialog dialog = new FileDialog(shell, SWT.SAVE);\r
\r
- String[] ext = {"*.tg"};\r
+ String[] ext = {"*.sysdyn"};\r
dialog.setFilterExtensions(ext);\r
\r
dialog.setText("Export Model");\r
\r
FileDialog dialog = new FileDialog(shell, SWT.OPEN);\r
\r
- String[] ext = {"*.tg"};\r
+ String[] ext = {"*.sysdyn; *.tg", "*.*"};\r
dialog.setFilterExtensions(ext);\r
\r
dialog.setText("Import Model");\r
\r
FileDialog dialog = new FileDialog(shell, SWT.SAVE);\r
\r
- String[] ext = {"*.tg"};\r
+ String[] ext = {"*.sysdynModule"};\r
dialog.setFilterExtensions(ext);\r
\r
dialog.setText("Export Module");\r
\r
FileDialog dialog = new FileDialog(shell, SWT.OPEN);\r
\r
- String[] ext = {"*.tg"};\r
+ String[] ext = {"*.sysdynModule; *.tg", "*.*"};\r
dialog.setFilterExtensions(ext);\r
\r
dialog.setText("Import Module");\r
<?xml version="1.0" encoding="UTF-8"?>\r
<?pde version="3.5"?>\r
\r
-<product name="Simantics System Dynamic Tool" uid="org.simantics.sysdyn.product.Sysdyn" id="org.simantics.sysdyn.ui.product" application="org.simantics.workbench.application" version="1.7" useFeatures="true" includeLaunchers="false">\r
+<product name="Simantics System Dynamic Tool" uid="org.simantics.sysdyn.product.Sysdyn" id="org.simantics.sysdyn.ui.product" application="org.simantics.workbench.application" version="1.8" useFeatures="true" includeLaunchers="false">\r
\r
<aboutInfo>\r
<text>\r
</configIni>\r
\r
<launcherArgs>\r
- <programArgs>-fixerrors\r
---launcher.XXMaxPermSize 192m\r
+ <programArgs>-fixerrors
+--launcher.XXMaxPermSize 192m
-data @noDefault</programArgs>\r
<vmArgs>-ea -Xmx768M -XX:MaxPermSize=192m -Xshare:off -Dorg.simantics.undo.enabled=false</vmArgs>\r
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac>\r
+ <vmArgsWin>-Dorg.osgi.framework.os.name=win32</vmArgsWin>\r
</launcherArgs>\r
\r
<windowImages i16="/org.simantics.sysdyn.ui/icons/sysdyn.png"/>\r
</win>\r
</launcher>\r
\r
+\r
<vm>\r
<windows include="true">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6</windows>\r
</vm>\r
</plugins>\r
\r
<features>\r
- <feature id="org.simantics.sysdyn" version="1.7.0.qualifier"/>\r
+ <feature id="org.simantics.sysdyn" version="1.8.0.qualifier"/>\r
</features>\r
\r
\r
Bundle-ManifestVersion: 2
Bundle-Name: Simantics System Dynamics
Bundle-SymbolicName: org.simantics.sysdyn;singleton:=true
-Bundle-Version: 1.7.0.qualifier
+Bundle-Version: 1.8.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.simantics.objmap;bundle-version="0.1.0",
org.simantics.db;bundle-version="0.6.2",
{ matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); }\r
| <UNSIGNED_INTEGER: (["0"-"9"])+ >\r
| <UNSIGNED_NUMBER: \r
- ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] <UNSIGNED_INTEGER>)?\r
- | "." <UNSIGNED_INTEGER> (["e","E"] <UNSIGNED_INTEGER>)?\r
- | <UNSIGNED_INTEGER> ["e","E"] <UNSIGNED_INTEGER>\r
+ ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | "." <UNSIGNED_INTEGER> (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | <UNSIGNED_INTEGER> ["e","E"] (["+","-"])? <UNSIGNED_INTEGER>\r
) >\r
}\r
\r
return 2;\r
}\r
if ((active1 & 0x20000L) != 0L)\r
- return 16;\r
+ return 17;\r
return -1;\r
case 1:\r
if ((active0 & 0x84020080400000L) != 0L)\r
jjmatchedKind = 66;\r
return jjMoveStringLiteralDfa1_0(0x0L, 0x2cc000L);\r
case 47:\r
- return jjStartNfaWithStates_0(0, 81, 16);\r
+ return jjStartNfaWithStates_0(0, 81, 17);\r
case 58:\r
jjmatchedKind = 67;\r
return jjMoveStringLiteralDfa1_0(0x0L, 0x800000L);\r
private int jjMoveNfa_0(int startState, int curPos)\r
{\r
int startsAt = 0;\r
- jjnewStateCnt = 34;\r
+ jjnewStateCnt = 37;\r
int i = 1;\r
jjstateSet[0] = startState;\r
int kind = 0x7fffffff;\r
else if (curChar == 39)\r
jjCheckNAddTwoStates(4, 5);\r
break;\r
- case 16:\r
+ case 17:\r
if (curChar == 47)\r
{\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(23);\r
+ jjCheckNAdd(24);\r
}\r
else if (curChar == 42)\r
jjCheckNAddStates(10, 12);\r
jjCheckNAddTwoStates(12, 13);\r
break;\r
case 14:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(15);\r
+ break;\r
+ case 15:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 92)\r
kind = 92;\r
- jjstateSet[jjnewStateCnt++] = 14;\r
+ jjCheckNAdd(15);\r
break;\r
- case 15:\r
+ case 16:\r
if (curChar == 47)\r
jjAddStates(5, 6);\r
break;\r
- case 17:\r
+ case 18:\r
if ((0xfffffbffffffffffL & l) != 0L)\r
jjCheckNAddStates(10, 12);\r
break;\r
- case 18:\r
+ case 19:\r
if (curChar == 42)\r
- jjstateSet[jjnewStateCnt++] = 19;\r
+ jjstateSet[jjnewStateCnt++] = 20;\r
break;\r
- case 19:\r
+ case 20:\r
if ((0xffff7fffffffffffL & l) != 0L)\r
jjCheckNAddStates(10, 12);\r
break;\r
- case 20:\r
+ case 21:\r
if (curChar == 47 && kind > 2)\r
kind = 2;\r
break;\r
- case 21:\r
+ case 22:\r
if (curChar == 42)\r
- jjstateSet[jjnewStateCnt++] = 20;\r
+ jjstateSet[jjnewStateCnt++] = 21;\r
break;\r
- case 22:\r
+ case 23:\r
if (curChar != 47)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(23);\r
+ jjCheckNAdd(24);\r
break;\r
- case 23:\r
+ case 24:\r
if ((0xfffffffffffffbffL & l) == 0L)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(23);\r
+ jjCheckNAdd(24);\r
break;\r
- case 24:\r
+ case 25:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 91)\r
kind = 91;\r
jjCheckNAddStates(0, 4);\r
break;\r
- case 25:\r
+ case 26:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 91)\r
kind = 91;\r
- jjCheckNAdd(25);\r
+ jjCheckNAdd(26);\r
break;\r
- case 26:\r
+ case 27:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(26, 27);\r
+ jjCheckNAddTwoStates(27, 28);\r
break;\r
- case 27:\r
+ case 28:\r
if (curChar != 46)\r
break;\r
if (kind > 92)\r
kind = 92;\r
- jjCheckNAddTwoStates(28, 29);\r
+ jjCheckNAddTwoStates(29, 30);\r
break;\r
- case 28:\r
+ case 29:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 92)\r
kind = 92;\r
- jjCheckNAddTwoStates(28, 29);\r
+ jjCheckNAddTwoStates(29, 30);\r
break;\r
- case 30:\r
+ case 31:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(32);\r
+ break;\r
+ case 32:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 92)\r
kind = 92;\r
- jjstateSet[jjnewStateCnt++] = 30;\r
+ jjCheckNAdd(32);\r
break;\r
- case 31:\r
+ case 33:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(31, 32);\r
+ jjCheckNAddTwoStates(33, 34);\r
break;\r
- case 33:\r
+ case 35:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(36);\r
+ break;\r
+ case 36:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 92)\r
kind = 92;\r
- jjstateSet[jjnewStateCnt++] = 33;\r
+ jjCheckNAdd(36);\r
break;\r
default : break;\r
}\r
break;\r
case 13:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 14;\r
+ jjAddStates(15, 16);\r
break;\r
- case 17:\r
- case 19:\r
+ case 18:\r
+ case 20:\r
jjCheckNAddStates(10, 12);\r
break;\r
- case 23:\r
+ case 24:\r
if (kind > 3)\r
kind = 3;\r
- jjstateSet[jjnewStateCnt++] = 23;\r
+ jjstateSet[jjnewStateCnt++] = 24;\r
break;\r
- case 29:\r
+ case 30:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 30;\r
+ jjAddStates(17, 18);\r
break;\r
- case 32:\r
+ case 34:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 33;\r
+ jjAddStates(19, 20);\r
break;\r
default : break;\r
}\r
if ((jjbitVec0[i2] & l2) != 0L)\r
jjCheckNAddStates(7, 9);\r
break;\r
- case 17:\r
- case 19:\r
+ case 18:\r
+ case 20:\r
if ((jjbitVec0[i2] & l2) != 0L)\r
jjCheckNAddStates(10, 12);\r
break;\r
- case 23:\r
+ case 24:\r
if ((jjbitVec0[i2] & l2) == 0L)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjstateSet[jjnewStateCnt++] = 23;\r
+ jjstateSet[jjnewStateCnt++] = 24;\r
break;\r
default : break;\r
}\r
kind = 0x7fffffff;\r
}\r
++curPos;\r
- if ((i = jjnewStateCnt) == (startsAt = 34 - (jjnewStateCnt = startsAt)))\r
+ if ((i = jjnewStateCnt) == (startsAt = 37 - (jjnewStateCnt = startsAt)))\r
return curPos;\r
try { curChar = input_stream.readChar(); }\r
catch(java.io.IOException e) { return curPos; }\r
}\r
}\r
static final int[] jjnextStates = {
- 25, 26, 27, 31, 32, 16, 22, 7, 8, 10, 17, 18, 21, 4, 5,
+ 26, 27, 28, 33, 34, 17, 23, 7, 8, 10, 18, 19, 22, 4, 5, 14,
+ 15, 31, 32, 35, 36,
};\r
\r
/** Token literal values. */\r
0xeL, 0x0L,
};\r
protected SimpleCharStream input_stream;\r
-private final int[] jjrounds = new int[34];\r
-private final int[] jjstateSet = new int[68];\r
+private final int[] jjrounds = new int[37];\r
+private final int[] jjstateSet = new int[74];\r
private final StringBuilder jjimage = new StringBuilder();\r
private StringBuilder image = jjimage;\r
private int jjimageLen;\r
{\r
int i;\r
jjround = 0x80000001;\r
- for (i = 34; i-- > 0;)\r
+ for (i = 37; i-- > 0;)\r
jjrounds[i] = 0x80000000;\r
}\r
\r
switch (pos)
{\r
case 0:\r
+ if ((active1 & 0x80000L) != 0L)\r
+ return 14;\r
if ((active0 & 0x3ffffffffffffff0L) != 0L || (active1 & 0xc0000000L) != 0L)\r
{\r
jjmatchedKind = 90;\r
return 2;\r
}\r
- if ((active1 & 0x80000L) != 0L)\r
- return 13;\r
if ((active1 & 0xb30010L) != 0L)\r
return 9;\r
return -1;\r
jjmatchedKind = 68;\r
return jjMoveStringLiteralDfa1_0(0x0L, 0xb30000L);\r
case 47:\r
- return jjStartNfaWithStates_0(0, 83, 13);\r
+ return jjStartNfaWithStates_0(0, 83, 14);\r
case 58:\r
jjmatchedKind = 69;\r
return jjMoveStringLiteralDfa1_0(0x0L, 0x2000000L);\r
private int jjMoveNfa_0(int startState, int curPos)\r
{\r
int startsAt = 0;\r
- jjnewStateCnt = 31;\r
+ jjnewStateCnt = 34;\r
int i = 1;\r
jjstateSet[0] = startState;\r
int kind = 0x7fffffff;\r
{\r
switch(jjstateSet[--i])\r
{\r
- case 13:\r
+ case 14:\r
if (curChar == 47)\r
{\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(20);\r
+ jjCheckNAdd(21);\r
}\r
else if (curChar == 42)\r
jjCheckNAddStates(0, 2);\r
jjCheckNAddTwoStates(9, 10);\r
break;\r
case 11:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(12);\r
+ break;\r
+ case 12:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjstateSet[jjnewStateCnt++] = 11;\r
+ jjCheckNAdd(12);\r
break;\r
- case 12:\r
+ case 13:\r
if (curChar == 47)\r
jjAddStates(8, 9);\r
break;\r
- case 14:\r
+ case 15:\r
if ((0xfffffbffffffffffL & l) != 0L)\r
jjCheckNAddStates(0, 2);\r
break;\r
- case 15:\r
+ case 16:\r
if (curChar == 42)\r
- jjstateSet[jjnewStateCnt++] = 16;\r
+ jjstateSet[jjnewStateCnt++] = 17;\r
break;\r
- case 16:\r
+ case 17:\r
if ((0xffff7fffffffffffL & l) != 0L)\r
jjCheckNAddStates(0, 2);\r
break;\r
- case 17:\r
+ case 18:\r
if (curChar == 47 && kind > 2)\r
kind = 2;\r
break;\r
- case 18:\r
+ case 19:\r
if (curChar == 42)\r
- jjstateSet[jjnewStateCnt++] = 17;\r
+ jjstateSet[jjnewStateCnt++] = 18;\r
break;\r
- case 19:\r
+ case 20:\r
if (curChar != 47)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(20);\r
+ jjCheckNAdd(21);\r
break;\r
- case 20:\r
+ case 21:\r
if ((0xfffffffffffffbffL & l) == 0L)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(20);\r
+ jjCheckNAdd(21);\r
break;\r
- case 21:\r
+ case 22:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 92)\r
kind = 92;\r
jjCheckNAddStates(3, 7);\r
break;\r
- case 22:\r
+ case 23:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 92)\r
kind = 92;\r
- jjCheckNAdd(22);\r
+ jjCheckNAdd(23);\r
break;\r
- case 23:\r
+ case 24:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(23, 24);\r
+ jjCheckNAddTwoStates(24, 25);\r
break;\r
- case 24:\r
+ case 25:\r
if (curChar != 46)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjCheckNAddTwoStates(25, 26);\r
+ jjCheckNAddTwoStates(26, 27);\r
break;\r
- case 25:\r
+ case 26:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjCheckNAddTwoStates(25, 26);\r
+ jjCheckNAddTwoStates(26, 27);\r
break;\r
- case 27:\r
+ case 28:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(29);\r
+ break;\r
+ case 29:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjstateSet[jjnewStateCnt++] = 27;\r
+ jjCheckNAdd(29);\r
break;\r
- case 28:\r
+ case 30:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(28, 29);\r
+ jjCheckNAddTwoStates(30, 31);\r
break;\r
- case 30:\r
+ case 32:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(33);\r
+ break;\r
+ case 33:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjstateSet[jjnewStateCnt++] = 30;\r
+ jjCheckNAdd(33);\r
break;\r
default : break;\r
}\r
break;\r
case 10:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 11;\r
+ jjAddStates(13, 14);\r
break;\r
- case 14:\r
- case 16:\r
+ case 15:\r
+ case 17:\r
jjCheckNAddStates(0, 2);\r
break;\r
- case 20:\r
+ case 21:\r
if (kind > 3)\r
kind = 3;\r
- jjstateSet[jjnewStateCnt++] = 20;\r
+ jjstateSet[jjnewStateCnt++] = 21;\r
break;\r
- case 26:\r
+ case 27:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 27;\r
+ jjAddStates(15, 16);\r
break;\r
- case 29:\r
+ case 31:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 30;\r
+ jjAddStates(17, 18);\r
break;\r
default : break;\r
}\r
if ((jjbitVec0[i2] & l2) != 0L)\r
jjCheckNAddStates(10, 12);\r
break;\r
- case 14:\r
- case 16:\r
+ case 15:\r
+ case 17:\r
if ((jjbitVec0[i2] & l2) != 0L)\r
jjCheckNAddStates(0, 2);\r
break;\r
- case 20:\r
+ case 21:\r
if ((jjbitVec0[i2] & l2) == 0L)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjstateSet[jjnewStateCnt++] = 20;\r
+ jjstateSet[jjnewStateCnt++] = 21;\r
break;\r
default : break;\r
}\r
kind = 0x7fffffff;\r
}\r
++curPos;\r
- if ((i = jjnewStateCnt) == (startsAt = 31 - (jjnewStateCnt = startsAt)))\r
+ if ((i = jjnewStateCnt) == (startsAt = 34 - (jjnewStateCnt = startsAt)))\r
return curPos;\r
try { curChar = input_stream.readChar(); }\r
catch(java.io.IOException e) { return curPos; }\r
}\r
}\r
static final int[] jjnextStates = {
- 14, 15, 18, 22, 23, 24, 28, 29, 13, 19, 4, 5, 7,
+ 15, 16, 19, 23, 24, 25, 30, 31, 14, 20, 4, 5, 7, 11, 12, 28,
+ 29, 32, 33,
};\r
\r
/** Token literal values. */\r
0xeL, 0x0L,
};\r
protected SimpleCharStream input_stream;\r
-private final int[] jjrounds = new int[31];\r
-private final int[] jjstateSet = new int[62];\r
+private final int[] jjrounds = new int[34];\r
+private final int[] jjstateSet = new int[68];\r
private final StringBuilder jjimage = new StringBuilder();\r
private StringBuilder image = jjimage;\r
private int jjimageLen;\r
{\r
int i;\r
jjround = 0x80000001;\r
- for (i = 31; i-- > 0;)\r
+ for (i = 34; i-- > 0;)\r
jjrounds[i] = 0x80000000;\r
}\r
\r
{ matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); }\r
| <UNSIGNED_INTEGER: (["0"-"9"])+ >\r
| <UNSIGNED_NUMBER: \r
- ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] <UNSIGNED_INTEGER>)?\r
- | "." <UNSIGNED_INTEGER> (["e","E"] <UNSIGNED_INTEGER>)?\r
- | <UNSIGNED_INTEGER> ["e","E"] <UNSIGNED_INTEGER>\r
+ ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | "." <UNSIGNED_INTEGER> (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | <UNSIGNED_INTEGER> ["e","E"] (["+","-"])? <UNSIGNED_INTEGER>\r
) >\r
}\r
\r
import org.simantics.sysdyn.representation.Configuration;\r
import org.simantics.sysdyn.representation.IElement;\r
import org.simantics.sysdyn.representation.Module;\r
+import org.simantics.sysdyn.representation.Shadow;\r
import org.simantics.sysdyn.representation.Variable;\r
import org.simantics.sysdyn.unitParser.ParseException;\r
import org.simantics.sysdyn.unitParser.UnitCheckingException;\r
\r
// Support listening, if graph and mapping exists\r
if(graph != null && model != null) {\r
+ if (var instanceof Shadow)\r
+ var = ((Shadow)var).getOriginal();\r
Resource varResource = model.getMapping().inverseGet(var);\r
if(varResource != null) {\r
try {\r
for(IElement e : configuration.getElements()) {\r
if(e instanceof Variable) {\r
Variable var = (Variable)e;\r
- if(var.getName().equals(element))\r
- return var;\r
+ try {\r
+ if (element.equals(var.getName()))\r
+ return var;\r
+ } catch (NullPointerException npe) {\r
+ npe.printStackTrace();\r
+ System.out.println("See UnitUtils");\r
+ return null;\r
+ }\r
} else if(e instanceof Module && elements.length > 1) {\r
Module mod = (Module)e;\r
if(mod.getName().equals(element)) {\r
{ matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); }\r
| <UNSIGNED_INTEGER: (["0"-"9"])+ >\r
| <UNSIGNED_NUMBER: \r
- ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] <UNSIGNED_INTEGER>)?\r
- | "." <UNSIGNED_INTEGER> (["e","E"] <UNSIGNED_INTEGER>)?\r
- | <UNSIGNED_INTEGER> ["e","E"] <UNSIGNED_INTEGER>\r
+ ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | "." <UNSIGNED_INTEGER> (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | <UNSIGNED_INTEGER> ["e","E"] (["+","-"])? <UNSIGNED_INTEGER>\r
) >\r
| <SIGNED_NUMBER : (("-")? ( <UNSIGNED_NUMBER> | <UNSIGNED_INTEGER> ))>\r
}\r
/* Generated By:JavaCC: Do not edit this line. TableParserTokenManager.java */\r
package org.simantics.sysdyn.tableParser;\r
+import java.util.ArrayList;\r
\r
/** Token Manager. */\r
public class TableParserTokenManager implements TableParserConstants\r
switch (pos)
{\r
case 0:\r
- if ((active1 & 0x80000L) != 0L)\r
- return 24;\r
if ((active0 & 0x3ffffffffffffff0L) != 0L)\r
{\r
jjmatchedKind = 90;\r
return 2;\r
}\r
- if ((active1 & 0xb30010L) != 0L)\r
- return 46;\r
if ((active1 & 0x8000L) != 0L)\r
return 9;\r
+ if ((active1 & 0xb30010L) != 0L)\r
+ return 52;\r
+ if ((active1 & 0x80000L) != 0L)\r
+ return 27;\r
return -1;\r
case 1:\r
if ((active0 & 0x108420080400000L) != 0L)\r
jjmatchedKind = 68;\r
return jjMoveStringLiteralDfa1_0(0x0L, 0xb30000L);\r
case 47:\r
- return jjStartNfaWithStates_0(0, 83, 24);\r
+ return jjStartNfaWithStates_0(0, 83, 27);\r
case 58:\r
jjmatchedKind = 69;\r
return jjMoveStringLiteralDfa1_0(0x0L, 0x2000000L);\r
private int jjMoveNfa_0(int startState, int curPos)\r
{\r
int startsAt = 0;\r
- jjnewStateCnt = 46;\r
+ jjnewStateCnt = 52;\r
int i = 1;\r
jjstateSet[0] = startState;\r
int kind = 0x7fffffff;\r
{\r
switch(jjstateSet[--i])\r
{\r
- case 24:\r
- if (curChar == 47)\r
- {\r
- if (kind > 3)\r
- kind = 3;\r
- jjCheckNAdd(31);\r
- }\r
- else if (curChar == 42)\r
- jjCheckNAddStates(0, 2);\r
- break;\r
- case 46:\r
+ case 52:\r
if ((0x3ff000000000000L & l) != 0L)\r
{\r
if (kind > 94)\r
{\r
if (kind > 93)\r
kind = 93;\r
- jjCheckNAddTwoStates(43, 44);\r
+ jjCheckNAddTwoStates(48, 49);\r
}\r
break;\r
case 9:\r
{\r
if (kind > 94)\r
kind = 94;\r
- jjCheckNAddStates(3, 7);\r
+ jjCheckNAddStates(0, 4);\r
}\r
else if (curChar == 46)\r
jjCheckNAdd(10);\r
{\r
if (kind > 92)\r
kind = 92;\r
- jjCheckNAddStates(8, 17);\r
+ jjCheckNAddStates(5, 14);\r
}\r
else if ((0x100002600L & l) != 0L)\r
{\r
kind = 1;\r
}\r
else if (curChar == 46)\r
- jjCheckNAddTwoStates(43, 10);\r
+ jjCheckNAddTwoStates(48, 10);\r
else if (curChar == 47)\r
- jjAddStates(18, 19);\r
+ jjAddStates(15, 16);\r
else if (curChar == 45)\r
- jjAddStates(20, 21);\r
+ jjAddStates(17, 18);\r
else if (curChar == 34)\r
+ jjCheckNAddStates(19, 21);\r
+ break;\r
+ case 27:\r
+ if (curChar == 47)\r
+ {\r
+ if (kind > 3)\r
+ kind = 3;\r
+ jjCheckNAdd(34);\r
+ }\r
+ else if (curChar == 42)\r
jjCheckNAddStates(22, 24);\r
break;\r
case 2:\r
break;\r
case 3:\r
if (curChar == 34)\r
- jjCheckNAddStates(22, 24);\r
+ jjCheckNAddStates(19, 21);\r
break;\r
case 4:\r
if ((0xfffffffbfffffbffL & l) != 0L)\r
- jjCheckNAddStates(22, 24);\r
+ jjCheckNAddStates(19, 21);\r
break;\r
case 6:\r
if ((0xfffffffffffffbffL & l) != 0L)\r
- jjCheckNAddStates(22, 24);\r
+ jjCheckNAddStates(19, 21);\r
break;\r
case 7:\r
if (curChar == 34 && kind > 91)\r
break;\r
case 8:\r
if (curChar == 45)\r
- jjAddStates(20, 21);\r
+ jjAddStates(17, 18);\r
break;\r
case 10:\r
if ((0x3ff000000000000L & l) == 0L)\r
jjCheckNAddTwoStates(10, 11);\r
break;\r
case 12:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(13);\r
+ break;\r
+ case 13:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 94)\r
kind = 94;\r
- jjstateSet[jjnewStateCnt++] = 12;\r
+ jjCheckNAdd(13);\r
break;\r
- case 13:\r
+ case 14:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 94)\r
kind = 94;\r
- jjCheckNAddStates(3, 7);\r
+ jjCheckNAddStates(0, 4);\r
break;\r
- case 14:\r
+ case 15:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 94)\r
kind = 94;\r
- jjCheckNAdd(14);\r
+ jjCheckNAdd(15);\r
break;\r
- case 15:\r
+ case 16:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(15, 16);\r
+ jjCheckNAddTwoStates(16, 17);\r
break;\r
- case 17:\r
+ case 18:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(19);\r
+ break;\r
+ case 19:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 94)\r
kind = 94;\r
- jjstateSet[jjnewStateCnt++] = 17;\r
+ jjCheckNAdd(19);\r
break;\r
- case 18:\r
+ case 20:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(18, 19);\r
+ jjCheckNAddTwoStates(20, 21);\r
break;\r
- case 19:\r
+ case 21:\r
if (curChar != 46)\r
break;\r
if (kind > 94)\r
kind = 94;\r
- jjCheckNAddTwoStates(20, 21);\r
+ jjCheckNAddTwoStates(22, 23);\r
break;\r
- case 20:\r
+ case 22:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 94)\r
kind = 94;\r
- jjCheckNAddTwoStates(20, 21);\r
+ jjCheckNAddTwoStates(22, 23);\r
break;\r
- case 22:\r
+ case 24:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(25);\r
+ break;\r
+ case 25:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 94)\r
kind = 94;\r
- jjstateSet[jjnewStateCnt++] = 22;\r
+ jjCheckNAdd(25);\r
break;\r
- case 23:\r
+ case 26:\r
if (curChar == 47)\r
- jjAddStates(18, 19);\r
+ jjAddStates(15, 16);\r
break;\r
- case 25:\r
+ case 28:\r
if ((0xfffffbffffffffffL & l) != 0L)\r
- jjCheckNAddStates(0, 2);\r
+ jjCheckNAddStates(22, 24);\r
break;\r
- case 26:\r
+ case 29:\r
if (curChar == 42)\r
- jjstateSet[jjnewStateCnt++] = 27;\r
+ jjstateSet[jjnewStateCnt++] = 30;\r
break;\r
- case 27:\r
+ case 30:\r
if ((0xffff7fffffffffffL & l) != 0L)\r
- jjCheckNAddStates(0, 2);\r
+ jjCheckNAddStates(22, 24);\r
break;\r
- case 28:\r
+ case 31:\r
if (curChar == 47 && kind > 2)\r
kind = 2;\r
break;\r
- case 29:\r
+ case 32:\r
if (curChar == 42)\r
- jjstateSet[jjnewStateCnt++] = 28;\r
+ jjstateSet[jjnewStateCnt++] = 31;\r
break;\r
- case 30:\r
+ case 33:\r
if (curChar != 47)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(31);\r
+ jjCheckNAdd(34);\r
break;\r
- case 31:\r
+ case 34:\r
if ((0xfffffffffffffbffL & l) == 0L)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(31);\r
+ jjCheckNAdd(34);\r
break;\r
- case 32:\r
+ case 35:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 92)\r
kind = 92;\r
- jjCheckNAddStates(8, 17);\r
+ jjCheckNAddStates(5, 14);\r
break;\r
- case 33:\r
+ case 36:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 92)\r
kind = 92;\r
- jjCheckNAdd(33);\r
+ jjCheckNAdd(36);\r
break;\r
- case 34:\r
+ case 37:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(34, 35);\r
+ jjCheckNAddTwoStates(37, 38);\r
break;\r
- case 35:\r
+ case 38:\r
if (curChar != 46)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjCheckNAddTwoStates(36, 37);\r
+ jjCheckNAddTwoStates(39, 40);\r
break;\r
- case 36:\r
+ case 39:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjCheckNAddTwoStates(36, 37);\r
+ jjCheckNAddTwoStates(39, 40);\r
break;\r
- case 38:\r
+ case 41:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(42);\r
+ break;\r
+ case 42:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjstateSet[jjnewStateCnt++] = 38;\r
+ jjCheckNAdd(42);\r
break;\r
- case 39:\r
+ case 43:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(39, 40);\r
+ jjCheckNAddTwoStates(43, 44);\r
break;\r
- case 41:\r
+ case 45:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(46);\r
+ break;\r
+ case 46:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjstateSet[jjnewStateCnt++] = 41;\r
+ jjCheckNAdd(46);\r
break;\r
- case 42:\r
+ case 47:\r
if (curChar == 46)\r
- jjCheckNAddTwoStates(43, 10);\r
+ jjCheckNAddTwoStates(48, 10);\r
break;\r
- case 43:\r
+ case 48:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjCheckNAddTwoStates(43, 44);\r
+ jjCheckNAddTwoStates(48, 49);\r
break;\r
- case 45:\r
+ case 50:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(51);\r
+ break;\r
+ case 51:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 93)\r
kind = 93;\r
- jjstateSet[jjnewStateCnt++] = 45;\r
+ jjCheckNAdd(51);\r
break;\r
default : break;\r
}\r
break;\r
case 4:\r
if ((0xffffffffefffffffL & l) != 0L)\r
- jjCheckNAddStates(22, 24);\r
+ jjCheckNAddStates(19, 21);\r
break;\r
case 5:\r
if (curChar == 92)\r
jjstateSet[jjnewStateCnt++] = 6;\r
break;\r
case 6:\r
- jjCheckNAddStates(22, 24);\r
+ jjCheckNAddStates(19, 21);\r
break;\r
case 11:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 12;\r
+ jjAddStates(25, 26);\r
break;\r
- case 16:\r
+ case 17:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 17;\r
+ jjAddStates(27, 28);\r
break;\r
- case 21:\r
+ case 23:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 22;\r
+ jjAddStates(29, 30);\r
break;\r
- case 25:\r
- case 27:\r
- jjCheckNAddStates(0, 2);\r
+ case 28:\r
+ case 30:\r
+ jjCheckNAddStates(22, 24);\r
break;\r
- case 31:\r
+ case 34:\r
if (kind > 3)\r
kind = 3;\r
- jjstateSet[jjnewStateCnt++] = 31;\r
- break;\r
- case 37:\r
- if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 38;\r
+ jjstateSet[jjnewStateCnt++] = 34;\r
break;\r
case 40:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 41;\r
+ jjAddStates(31, 32);\r
break;\r
case 44:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 45;\r
+ jjAddStates(33, 34);\r
+ break;\r
+ case 49:\r
+ if ((0x2000000020L & l) != 0L)\r
+ jjAddStates(35, 36);\r
break;\r
default : break;\r
}\r
case 4:\r
case 6:\r
if ((jjbitVec0[i2] & l2) != 0L)\r
- jjCheckNAddStates(22, 24);\r
+ jjCheckNAddStates(19, 21);\r
break;\r
- case 25:\r
- case 27:\r
+ case 28:\r
+ case 30:\r
if ((jjbitVec0[i2] & l2) != 0L)\r
- jjCheckNAddStates(0, 2);\r
+ jjCheckNAddStates(22, 24);\r
break;\r
- case 31:\r
+ case 34:\r
if ((jjbitVec0[i2] & l2) == 0L)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjstateSet[jjnewStateCnt++] = 31;\r
+ jjstateSet[jjnewStateCnt++] = 34;\r
break;\r
default : break;\r
}\r
kind = 0x7fffffff;\r
}\r
++curPos;\r
- if ((i = jjnewStateCnt) == (startsAt = 46 - (jjnewStateCnt = startsAt)))\r
+ if ((i = jjnewStateCnt) == (startsAt = 52 - (jjnewStateCnt = startsAt)))\r
return curPos;\r
try { curChar = input_stream.readChar(); }\r
catch(java.io.IOException e) { return curPos; }\r
}\r
}\r
static final int[] jjnextStates = {
- 25, 26, 29, 14, 15, 16, 18, 19, 33, 34, 35, 39, 40, 14, 15, 16,
- 18, 19, 24, 30, 9, 13, 4, 5, 7,
+ 15, 16, 17, 20, 21, 36, 37, 38, 43, 44, 15, 16, 17, 20, 21, 27,
+ 33, 9, 14, 4, 5, 7, 28, 29, 32, 12, 13, 18, 19, 24, 25, 41,
+ 42, 45, 46, 50, 51,
};\r
\r
/** Token literal values. */\r
0xeL, 0x0L,
};\r
protected SimpleCharStream input_stream;\r
-private final int[] jjrounds = new int[46];\r
-private final int[] jjstateSet = new int[92];\r
+private final int[] jjrounds = new int[52];\r
+private final int[] jjstateSet = new int[104];\r
private final StringBuilder jjimage = new StringBuilder();\r
private StringBuilder image = jjimage;\r
private int jjimageLen;\r
{\r
int i;\r
jjround = 0x80000001;\r
- for (i = 46; i-- > 0;)\r
+ for (i = 52; i-- > 0;)\r
jjrounds[i] = 0x80000000;\r
}\r
\r
{ matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); }\r
| <UNSIGNED_INTEGER: (["0"-"9"])+ >\r
| <UNSIGNED_NUMBER: \r
- ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] <UNSIGNED_INTEGER>)?\r
- | "." <UNSIGNED_INTEGER> (["e","E"] <UNSIGNED_INTEGER>)?\r
- | <UNSIGNED_INTEGER> ["e","E"] <UNSIGNED_INTEGER>\r
+ ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | "." <UNSIGNED_INTEGER> (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | <UNSIGNED_INTEGER> ["e","E"] (["+","-"])? <UNSIGNED_INTEGER>\r
) >\r
}\r
\r
{ matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); }\r
| <UNSIGNED_INTEGER: (["0"-"9"])+ >\r
| <UNSIGNED_NUMBER: \r
- ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] <UNSIGNED_INTEGER>)?\r
- | "." <UNSIGNED_INTEGER> (["e","E"] <UNSIGNED_INTEGER>)?\r
- | <UNSIGNED_INTEGER> ["e","E"] <UNSIGNED_INTEGER>\r
+ ( <UNSIGNED_INTEGER> "." (<UNSIGNED_INTEGER>)? (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | "." <UNSIGNED_INTEGER> (["e","E"] (["+","-"])? <UNSIGNED_INTEGER>)?\r
+ | <UNSIGNED_INTEGER> ["e","E"] (["+","-"])? <UNSIGNED_INTEGER>\r
) >\r
}\r
\r
return 2;\r
}\r
if ((active1 & 0x20000L) != 0L)\r
- return 13;\r
+ return 14;\r
if ((active1 & 0x2cc004L) != 0L)\r
return 9;\r
return -1;\r
jjmatchedKind = 66;\r
return jjMoveStringLiteralDfa1_0(0x0L, 0x2cc000L);\r
case 47:\r
- return jjStartNfaWithStates_0(0, 81, 13);\r
+ return jjStartNfaWithStates_0(0, 81, 14);\r
case 58:\r
jjmatchedKind = 67;\r
return jjMoveStringLiteralDfa1_0(0x0L, 0x800000L);\r
private int jjMoveNfa_0(int startState, int curPos)\r
{\r
int startsAt = 0;\r
- jjnewStateCnt = 31;\r
+ jjnewStateCnt = 34;\r
int i = 1;\r
jjstateSet[0] = startState;\r
int kind = 0x7fffffff;\r
{\r
switch(jjstateSet[--i])\r
{\r
- case 13:\r
+ case 14:\r
if (curChar == 47)\r
{\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(20);\r
+ jjCheckNAdd(21);\r
}\r
else if (curChar == 42)\r
jjCheckNAddStates(0, 2);\r
jjCheckNAddTwoStates(9, 10);\r
break;\r
case 11:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(12);\r
+ break;\r
+ case 12:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 91)\r
kind = 91;\r
- jjstateSet[jjnewStateCnt++] = 11;\r
+ jjCheckNAdd(12);\r
break;\r
- case 12:\r
+ case 13:\r
if (curChar == 47)\r
jjAddStates(8, 9);\r
break;\r
- case 14:\r
+ case 15:\r
if ((0xfffffbffffffffffL & l) != 0L)\r
jjCheckNAddStates(0, 2);\r
break;\r
- case 15:\r
+ case 16:\r
if (curChar == 42)\r
- jjstateSet[jjnewStateCnt++] = 16;\r
+ jjstateSet[jjnewStateCnt++] = 17;\r
break;\r
- case 16:\r
+ case 17:\r
if ((0xffff7fffffffffffL & l) != 0L)\r
jjCheckNAddStates(0, 2);\r
break;\r
- case 17:\r
+ case 18:\r
if (curChar == 47 && kind > 2)\r
kind = 2;\r
break;\r
- case 18:\r
+ case 19:\r
if (curChar == 42)\r
- jjstateSet[jjnewStateCnt++] = 17;\r
+ jjstateSet[jjnewStateCnt++] = 18;\r
break;\r
- case 19:\r
+ case 20:\r
if (curChar != 47)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(20);\r
+ jjCheckNAdd(21);\r
break;\r
- case 20:\r
+ case 21:\r
if ((0xfffffffffffffbffL & l) == 0L)\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjCheckNAdd(20);\r
+ jjCheckNAdd(21);\r
break;\r
- case 21:\r
+ case 22:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 90)\r
kind = 90;\r
jjCheckNAddStates(3, 7);\r
break;\r
- case 22:\r
+ case 23:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 90)\r
kind = 90;\r
- jjCheckNAdd(22);\r
+ jjCheckNAdd(23);\r
break;\r
- case 23:\r
+ case 24:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(23, 24);\r
+ jjCheckNAddTwoStates(24, 25);\r
break;\r
- case 24:\r
+ case 25:\r
if (curChar != 46)\r
break;\r
if (kind > 91)\r
kind = 91;\r
- jjCheckNAddTwoStates(25, 26);\r
+ jjCheckNAddTwoStates(26, 27);\r
break;\r
- case 25:\r
+ case 26:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 91)\r
kind = 91;\r
- jjCheckNAddTwoStates(25, 26);\r
+ jjCheckNAddTwoStates(26, 27);\r
break;\r
- case 27:\r
+ case 28:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(29);\r
+ break;\r
+ case 29:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 91)\r
kind = 91;\r
- jjstateSet[jjnewStateCnt++] = 27;\r
+ jjCheckNAdd(29);\r
break;\r
- case 28:\r
+ case 30:\r
if ((0x3ff000000000000L & l) != 0L)\r
- jjCheckNAddTwoStates(28, 29);\r
+ jjCheckNAddTwoStates(30, 31);\r
break;\r
- case 30:\r
+ case 32:\r
+ if ((0x280000000000L & l) != 0L)\r
+ jjCheckNAdd(33);\r
+ break;\r
+ case 33:\r
if ((0x3ff000000000000L & l) == 0L)\r
break;\r
if (kind > 91)\r
kind = 91;\r
- jjstateSet[jjnewStateCnt++] = 30;\r
+ jjCheckNAdd(33);\r
break;\r
default : break;\r
}\r
break;\r
case 10:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 11;\r
+ jjAddStates(13, 14);\r
break;\r
- case 14:\r
- case 16:\r
+ case 15:\r
+ case 17:\r
jjCheckNAddStates(0, 2);\r
break;\r
- case 20:\r
+ case 21:\r
if (kind > 3)\r
kind = 3;\r
- jjstateSet[jjnewStateCnt++] = 20;\r
+ jjstateSet[jjnewStateCnt++] = 21;\r
break;\r
- case 26:\r
+ case 27:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 27;\r
+ jjAddStates(15, 16);\r
break;\r
- case 29:\r
+ case 31:\r
if ((0x2000000020L & l) != 0L)\r
- jjstateSet[jjnewStateCnt++] = 30;\r
+ jjAddStates(17, 18);\r
break;\r
default : break;\r
}\r
if (jjCanMove_1(hiByte, i1, i2, l1, l2))\r
jjCheckNAddStates(10, 12);\r
break;\r
- case 14:\r
- case 16:\r
+ case 15:\r
+ case 17:\r
if (jjCanMove_2(hiByte, i1, i2, l1, l2))\r
jjCheckNAddStates(0, 2);\r
break;\r
- case 20:\r
+ case 21:\r
if (!jjCanMove_2(hiByte, i1, i2, l1, l2))\r
break;\r
if (kind > 3)\r
kind = 3;\r
- jjstateSet[jjnewStateCnt++] = 20;\r
+ jjstateSet[jjnewStateCnt++] = 21;\r
break;\r
default : break;\r
}\r
kind = 0x7fffffff;\r
}\r
++curPos;\r
- if ((i = jjnewStateCnt) == (startsAt = 31 - (jjnewStateCnt = startsAt)))\r
+ if ((i = jjnewStateCnt) == (startsAt = 34 - (jjnewStateCnt = startsAt)))\r
return curPos;\r
try { curChar = input_stream.readChar(); }\r
catch(java.io.IOException e) { return curPos; }\r
}\r
}\r
static final int[] jjnextStates = {
- 14, 15, 18, 22, 23, 24, 28, 29, 13, 19, 4, 5, 7,
+ 15, 16, 19, 23, 24, 25, 30, 31, 14, 20, 4, 5, 7, 11, 12, 28,
+ 29, 32, 33,
};\r
private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)\r
{\r
0xeL, 0x0L,
};\r
protected SimpleCharStream input_stream;\r
-private final int[] jjrounds = new int[31];\r
-private final int[] jjstateSet = new int[62];\r
+private final int[] jjrounds = new int[34];\r
+private final int[] jjstateSet = new int[68];\r
private final StringBuilder jjimage = new StringBuilder();\r
private StringBuilder image = jjimage;\r
private int jjimageLen;\r
{\r
int i;\r
jjround = 0x80000001;\r
- for (i = 31; i-- > 0;)\r
+ for (i = 34; i-- > 0;)\r
jjrounds[i] = 0x80000000;\r
}\r
\r