]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Merge from trunk to branch jkauttio-dev
authorjkauttio <jkauttio@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 11 Mar 2014 13:20:51 +0000 (13:20 +0000)
committerjkauttio <jkauttio@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Tue, 11 Mar 2014 13:20:51 +0000 (13:20 +0000)
refs #2924

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/branches/dev-jkauttio@29075 ac1ea38d-2e2b-0410-8846-a27921b304fc

107 files changed:
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ChartComposite.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/FilteringCategoryDataset.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/FilteringPieDataset.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/NumberAxis.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/AdjustableTab.java [moved from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/AdjustableTab.java with 89% similarity]
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/RangeComposite.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarAxisTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarGeneralPropertiesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/bar/BarSeriesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/pie/PieGeneralPropertiesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/pie/PieSeriesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/AxisPropertyComposite.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineAxisAndVariablesTab.java
org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/xyline/XYLineGeneralPropertiesTab.java
org.simantics.sysdyn.feature/feature.xml
org.simantics.sysdyn.feature/rootfiles/molecules/Bathtub.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/molecules/Bathtub.sysdynModule [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/molecules/Decay.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/molecules/Decay.sysdynModule [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/molecules/Smooth.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/molecules/Smooth.sysdynModule [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/molecules/SmoothThirdOrder.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/molecules/SmoothThirdOrder.sysdynModule [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/molecules/Tester For Molecules.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/molecules/references.txt [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Discovery And Exploitation Of Resources.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Discovery And Exploitation Of Resources.tg [deleted file]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Global Carbon Cycle.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Global Carbon Cycle.tg [deleted file]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Predator And Limited Prey.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Predator And Limited Prey.tg [deleted file]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Resource Exploitation Use Recycling.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Resource Exploitation Use Recycling.tg [deleted file]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.sysdyn [new file with mode: 0644]
org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.tg [deleted file]
org.simantics.sysdyn.feature/rootfiles/sampleModels/references.txt [new file with mode: 0644]
org.simantics.sysdyn.ui/META-INF/MANIFEST.MF
org.simantics.sysdyn.ui/plugin.xml
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/editor/routing/DependencyRouter.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements/SysdynTextElementNoBounds.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/DisposeExperiment.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/SysdynExperimentActivator.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportFunctionLibrary.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelAsButtonHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelButtonHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModelHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/exports/ExportModuleHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportFunctionLibrary.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportModelHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/imports/ImportModuleHandler.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayDependencyTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayFlowTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ArrayIndexesTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/CommentTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ConfigurationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/DependencyTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EnumerationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/EquationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ExperimentTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ExternalFilesTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/FlowTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/FunctionLibraryTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/FunctionTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/GameExperimentTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/HistoryDataTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LabelPropertyTabContributor.java [deleted file]
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LookupTableTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LoopTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleInputTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleOutputTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleParameterTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ModuleTypeTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/PlaybackExperimentTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ReferenceDependencyTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/ResultTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/SensitivityAnalysisExperimentTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/SharedFunctionLibrariesTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/VariableInformationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/arrays/NameAndArrayRangeModifyListener.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/CompletionProcessor.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/StockExpression.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/ConfidenceBoundWidget.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/SensitivityChartAxisAndVariablesTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/SensitivitySeriesPropertyComposite.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/validation/UnitFunction.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/functions/WizardFunctionsExportPage.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/functions/WizardFunctionsImportPage.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/models/WizardModelsExportPage.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/models/WizardModelsImportPage.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/modules/WizardModulesExportPage.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/wizards/modules/WizardModulesImportPage.java
org.simantics.sysdyn.ui/sysdyn.product
org.simantics.sysdyn/META-INF/MANIFEST.MF
org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.jj
org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserTokenManager.java
org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParserTokenManager.java
org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelicaParser.jj
org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java
org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TableParser.jj
org.simantics.sysdyn/src/org/simantics/sysdyn/tableParser/TableParserTokenManager.java
org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.jj
org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.jjt
org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTokenManager.java

index dd5b069ab70bba6f07bf2ff034911b3f5b9285f6..6d571f5430b7fbb3f51ee4b43a32bf50be875c25 100644 (file)
@@ -121,6 +121,8 @@ public class ChartComposite extends Composite {
                 \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
index ec719f9561b6767a9c9d2924d1d1c71250dc84fb..fb5ec1a724d161b7c7fb78312d391d99be475e87 100644 (file)
@@ -3,6 +3,10 @@ package org.simantics.jfreechart.chart;
 /**\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
@@ -10,7 +14,6 @@ import java.util.List;
 \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
@@ -78,17 +81,18 @@ public class FilteringCategoryDataset extends AbstractDataset implements org.jfr
                                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
@@ -102,17 +106,18 @@ public class FilteringCategoryDataset extends AbstractDataset implements org.jfr
                                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
index 249c2aa68c5312c0c066c33e4c75601d08339372..dacef528a772599c7a5557af2562fb15f745c38d 100644 (file)
@@ -3,7 +3,6 @@ package org.simantics.jfreechart.chart;
 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
index 4f070631237ac500620f3909360f2c30360e04cb..a4216e104eaff9bb1bd38c02ab93c6847f8556a1 100644 (file)
@@ -36,6 +36,7 @@ public class NumberAxis extends AbstractAxis {
     @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
similarity index 89%
rename from org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/AdjustableTab.java
rename to org.simantics.jfreechart/src/org/simantics/jfreechart/chart/properties/AdjustableTab.java
index b0ad402be7819fcfbd5aa78ab2b1fae7eb657c94..da4bae8ca8eea43d1bd19b0f3f174b402608b556 100644 (file)
@@ -9,7 +9,7 @@
  * 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
@@ -78,6 +78,15 @@ public abstract class AdjustableTab extends LabelPropertyTabContributor {
                }\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
index b3d9547348f418329b2e0d2a3bce72d4b068514f..2b3ce8250aa07fc9c2b97f210612991af5a1db3f 100644 (file)
@@ -55,7 +55,7 @@ public class RangeComposite extends Composite implements Widget {
     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
@@ -109,8 +109,15 @@ public class RangeComposite extends Composite implements Widget {
                         \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
index cf11899bafa9902acbe62727ebb40be90c824d82..d82284924c92d7455584fad55aba0e4fa9bfa534 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -18,6 +18,7 @@ import org.eclipse.swt.SWT;
 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
@@ -40,11 +41,11 @@ import org.simantics.db.common.request.ReadRequest;
 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
@@ -55,9 +56,10 @@ import org.simantics.utils.ui.AdaptionUtils;
 /**\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
@@ -66,123 +68,24 @@ public class BarAxisTab extends LabelPropertyTabContributor implements Widget {
     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
@@ -279,14 +182,250 @@ public class BarAxisTab extends LabelPropertyTabContributor implements Widget {
                 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
index c2d970145682df1a502f7046021d8afa5d75e78a..9d669b6c1c692dd71e43abda75bff99777cdd7c7 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -39,13 +39,13 @@ import org.simantics.db.common.request.PossibleObjectWithType;
 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
@@ -58,9 +58,10 @@ import org.simantics.sysdyn.JFreeChartResource;
 /**\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
@@ -71,6 +72,24 @@ public class BarGeneralPropertiesTab extends LabelPropertyTabContributor {
 \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
@@ -81,171 +100,6 @@ public class BarGeneralPropertiesTab extends LabelPropertyTabContributor {
        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
@@ -383,4 +237,270 @@ public class BarGeneralPropertiesTab extends LabelPropertyTabContributor {
         }\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
index 3dd56229ea8ac815f8c97b1a0dbc1f7007ace8ba..51eefa75abcb27c2025da8e013b9a885f8fe499e 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -39,7 +39,7 @@ import org.simantics.db.exception.DatabaseException;
 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
@@ -49,9 +49,10 @@ import org.simantics.utils.ui.AdaptionUtils;
 /**\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
@@ -60,56 +61,14 @@ public class BarSeriesTab extends LabelPropertyTabContributor implements Widget
     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
@@ -209,5 +168,75 @@ public class BarSeriesTab extends LabelPropertyTabContributor implements Widget
         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
index e7dfd43097a99b10068386b8cfc7c0e24fd14716..e32a1c7ff2c29bad6a52be8d416583aa59faaea7 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -28,13 +28,13 @@ import org.simantics.browsing.ui.swt.widgets.TrackedText;
 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
@@ -45,9 +45,10 @@ import org.simantics.sysdyn.JFreeChartResource;
 /**\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
@@ -56,6 +57,21 @@ public class PieGeneralPropertiesTab extends LabelPropertyTabContributor {
     \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
@@ -66,95 +82,70 @@ public class PieGeneralPropertiesTab extends LabelPropertyTabContributor {
        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
@@ -171,21 +162,16 @@ public class PieGeneralPropertiesTab extends LabelPropertyTabContributor {
         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
@@ -193,7 +179,141 @@ public class PieGeneralPropertiesTab extends LabelPropertyTabContributor {
         }\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
index 4e4b7e8001f4e5a7bb2884e5603dba726a78a2d7..ad0ca64538c7d0474a3b0504239a7024c40d925e 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -39,7 +39,7 @@ import org.simantics.db.exception.DatabaseException;
 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
@@ -49,9 +49,10 @@ import org.simantics.utils.ui.AdaptionUtils;
 /**\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
@@ -59,57 +60,14 @@ public class PieSeriesTab extends LabelPropertyTabContributor implements Widget
     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
@@ -209,4 +167,75 @@ public class PieSeriesTab extends LabelPropertyTabContributor implements Widget
         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
index 14bdb4d4df5e083ed6c03f81eeb3df74e7b6b3e1..366c29b038f761e21dfe66f6d85584857a73baef 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -35,6 +35,7 @@ import org.simantics.sysdyn.JFreeChartResource;
  * 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
@@ -43,9 +44,17 @@ public class AxisPropertyComposite extends Composite {
     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
@@ -56,7 +65,7 @@ public class AxisPropertyComposite extends Composite {
         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
@@ -71,7 +80,8 @@ public class AxisPropertyComposite extends Composite {
         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
@@ -79,8 +89,15 @@ public class AxisPropertyComposite extends Composite {
         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
@@ -89,12 +106,17 @@ public class AxisPropertyComposite extends Composite {
         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
index 4081ce04a7b1ebec4284d566224394ada0818a03..92d4f9e05b488d8c61d394e69e74f09369e3fbbe 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -43,7 +43,7 @@ import org.simantics.db.layer0.util.RemoverUtil;
 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
@@ -54,66 +54,22 @@ import org.simantics.utils.ui.AdaptionUtils;
  * 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
@@ -153,7 +109,7 @@ public class XYLineAxisAndVariablesTab extends LabelPropertyTabContributor {
             }\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
@@ -297,4 +253,78 @@ public class XYLineAxisAndVariablesTab extends LabelPropertyTabContributor {
             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
index 51bd71361ad4d04cd19af69a34383cf387f7e181..2ab8ae98ba3348f359f69864cd72e55ee2aec7cf 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -22,6 +22,7 @@ import org.eclipse.swt.SWT;
 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
@@ -43,12 +44,12 @@ import org.simantics.db.common.request.PossibleObjectWithType;
 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
@@ -65,9 +66,10 @@ import org.simantics.utils.ui.AdaptionUtils;
  * 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
@@ -75,147 +77,19 @@ public class XYLineGeneralPropertiesTab extends LabelPropertyTabContributor impl
     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
@@ -231,9 +105,15 @@ public class XYLineGeneralPropertiesTab extends LabelPropertyTabContributor impl
                 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
@@ -315,4 +195,259 @@ public class XYLineGeneralPropertiesTab extends LabelPropertyTabContributor impl
         }\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
index e9e11f98964373e83e5ac8b4bc9fcdae0da0f0d6..3aac23110a1807c95a02e60b7a550242eec32167 100644 (file)
@@ -13,7 +13,7 @@
 <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
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/Bathtub.sysdyn b/org.simantics.sysdyn.feature/rootfiles/molecules/Bathtub.sysdyn
new file mode 100644 (file)
index 0000000..cacb360
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/molecules/Bathtub.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/Bathtub.sysdynModule b/org.simantics.sysdyn.feature/rootfiles/molecules/Bathtub.sysdynModule
new file mode 100644 (file)
index 0000000..31429c2
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/molecules/Bathtub.sysdynModule differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/Decay.sysdyn b/org.simantics.sysdyn.feature/rootfiles/molecules/Decay.sysdyn
new file mode 100644 (file)
index 0000000..334ca7e
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/molecules/Decay.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/Decay.sysdynModule b/org.simantics.sysdyn.feature/rootfiles/molecules/Decay.sysdynModule
new file mode 100644 (file)
index 0000000..78e03cc
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/molecules/Decay.sysdynModule differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/Smooth.sysdyn b/org.simantics.sysdyn.feature/rootfiles/molecules/Smooth.sysdyn
new file mode 100644 (file)
index 0000000..2abde7d
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/molecules/Smooth.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/Smooth.sysdynModule b/org.simantics.sysdyn.feature/rootfiles/molecules/Smooth.sysdynModule
new file mode 100644 (file)
index 0000000..c4cfc40
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/molecules/Smooth.sysdynModule differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/SmoothThirdOrder.sysdyn b/org.simantics.sysdyn.feature/rootfiles/molecules/SmoothThirdOrder.sysdyn
new file mode 100644 (file)
index 0000000..caa66ce
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/molecules/SmoothThirdOrder.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/SmoothThirdOrder.sysdynModule b/org.simantics.sysdyn.feature/rootfiles/molecules/SmoothThirdOrder.sysdynModule
new file mode 100644 (file)
index 0000000..1186b74
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/molecules/SmoothThirdOrder.sysdynModule differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/Tester For Molecules.sysdyn b/org.simantics.sysdyn.feature/rootfiles/molecules/Tester For Molecules.sysdyn
new file mode 100644 (file)
index 0000000..5a96a7e
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/molecules/Tester For Molecules.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/molecules/references.txt b/org.simantics.sysdyn.feature/rootfiles/molecules/references.txt
new file mode 100644 (file)
index 0000000..09ad135
--- /dev/null
@@ -0,0 +1,3 @@
+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
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Discovery And Exploitation Of Resources.sysdyn b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Discovery And Exploitation Of Resources.sysdyn
new file mode 100644 (file)
index 0000000..bcbd16c
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Discovery And Exploitation Of Resources.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Discovery And Exploitation Of Resources.tg b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Discovery And Exploitation Of Resources.tg
deleted file mode 100644 (file)
index c00a886..0000000
Binary files a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Discovery And Exploitation Of Resources.tg and /dev/null differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Global Carbon Cycle.sysdyn b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Global Carbon Cycle.sysdyn
new file mode 100644 (file)
index 0000000..60edfdf
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Global Carbon Cycle.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Global Carbon Cycle.tg b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Global Carbon Cycle.tg
deleted file mode 100644 (file)
index cedf440..0000000
Binary files a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Global Carbon Cycle.tg and /dev/null differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Predator And Limited Prey.sysdyn b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Predator And Limited Prey.sysdyn
new file mode 100644 (file)
index 0000000..2a8f549
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Predator And Limited Prey.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Predator And Limited Prey.tg b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Predator And Limited Prey.tg
deleted file mode 100644 (file)
index 3a1c507..0000000
Binary files a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Predator And Limited Prey.tg and /dev/null differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Resource Exploitation Use Recycling.sysdyn b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Resource Exploitation Use Recycling.sysdyn
new file mode 100644 (file)
index 0000000..132c2fc
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Resource Exploitation Use Recycling.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Resource Exploitation Use Recycling.tg b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Resource Exploitation Use Recycling.tg
deleted file mode 100644 (file)
index 4c49bbb..0000000
Binary files a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Resource Exploitation Use Recycling.tg and /dev/null differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.sysdyn b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.sysdyn
new file mode 100644 (file)
index 0000000..d82832a
Binary files /dev/null and b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.sysdyn differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.tg b/org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.tg
deleted file mode 100644 (file)
index 1dc2331..0000000
Binary files a/org.simantics.sysdyn.feature/rootfiles/sampleModels/Tourists Environments And Hotel Facilities.tg and /dev/null differ
diff --git a/org.simantics.sysdyn.feature/rootfiles/sampleModels/references.txt b/org.simantics.sysdyn.feature/rootfiles/sampleModels/references.txt
new file mode 100644 (file)
index 0000000..77f7b30
--- /dev/null
@@ -0,0 +1,12 @@
+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
index 119c139fcbfbc104efb4df30d8d168fbe63f2483..25abc27c00ae7e8e3f74b23f5d27daa2ccfe6c1f 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 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",
index 4d0dfc2438b0eb00fe026f95a1fa58d1e76ab434..c688debdbfce7e700f88d11b4d5b6bea51069209 100644 (file)
       <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
index eb7229b1e080914d8cd9e3a93b9a9eaca63d578c..660fe185108c48855429b56772caf8a948886266 100644 (file)
@@ -133,7 +133,7 @@ public class ModelNode extends AbstractNode<Resource> implements IDoubleClickabl
 \r
        @Override\r
        public boolean handleDoubleClick() {\r
-               return true;\r
+               return false;\r
        }\r
 \r
 }\r
index bb04e70ec18886021b94f97337dfe99691a3ce63..34f8fd71761f030702b4ccb76abc0ba4a64457c0 100644 (file)
@@ -67,6 +67,8 @@ public class DependencyRouter implements IRouter2 {
     }\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
index 76defa5bd17a76657ed84b75c4024f2dd4441ebf..3d6eda9e2463bb98c326ec522c91820af18cd89e 100644 (file)
@@ -108,6 +108,8 @@ public class SysdynTextElementNoBounds extends TextElementNoBounds {
                     @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
index 83ef73bb4d1a210e7b7a31ff10188e3273a894e5..45c3ef945dcac8b71bbd375c20ce25b3d5210daf 100644 (file)
@@ -31,7 +31,7 @@ public class DisposeExperiment extends AbstractHandler {
             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
index f4a52dfb3d501ef5a7089774b66a6a67ce394cdd..7d6906019c6bf96ea8b3fcd2cef10fcdc07898ca 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -16,6 +16,7 @@ import java.util.concurrent.Semaphore;
 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
@@ -67,7 +68,11 @@ public class SysdynExperimentActivator {
         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
@@ -95,58 +100,66 @@ public class SysdynExperimentActivator {
     }\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
index 002abbbd1716049e4e18040c244480ab46da9b57..251ab7a452c73e280c9a5c412a478b8b1c52b571 100644 (file)
@@ -85,7 +85,7 @@ public class ExportFunctionLibrary  extends AbstractHandler {
                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
index 57a6cb424d000bf87bf823e6f24455a3f262ba56..8e6318423c80cb68097be98b038a33e6b598e4cc 100644 (file)
@@ -13,7 +13,9 @@ package org.simantics.sysdyn.ui.handlers.exports;
 \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
@@ -27,15 +29,19 @@ public class ExportModelAsButtonHandler extends ExportModelButtonHandler {
        @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
index a9ee8a3255a97fd425361a7d1cb3782e64b8f6e4..9954ae65c07fc094e503e83f297a21dc6247362a 100644 (file)
@@ -30,6 +30,7 @@ import org.simantics.sysdyn.ui.utils.SysdynWorkbenchUtils;
 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
@@ -43,16 +44,20 @@ public class ExportModelButtonHandler extends ExportModelHandler {
        @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
index ee0efbb9a01a5b557bae4f87f2fd5170fbfa4560..92a5ac8e2e73be774c7a64c71ee94ca2c5b6c263 100644 (file)
@@ -18,6 +18,7 @@ import org.eclipse.core.commands.AbstractHandler;
 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
@@ -43,6 +44,7 @@ import org.simantics.sysdyn.ui.Activator;
 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
@@ -54,21 +56,55 @@ import org.simantics.ui.utils.ResourceAdaptionUtils;
  */\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
@@ -199,7 +235,7 @@ public class ExportModelHandler extends AbstractHandler {
                        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
@@ -236,4 +272,10 @@ public class ExportModelHandler extends AbstractHandler {
                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
index 7d7e7fcf62c91827dc197eae6db360ca33615958..6a0cc12f2b11998e80e25ec1673aaf2a1eda434a 100644 (file)
@@ -154,7 +154,7 @@ public class ExportModuleHandler extends AbstractHandler {
                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
index cdd40a04ca91c5fae0d3f2bd75b77d549d23780d..4e227e73830076ca1a94c1a2e2fd515f749df5b2 100644 (file)
@@ -65,7 +65,7 @@ public class ImportFunctionLibrary  extends AbstractHandler {
                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
index daba04a424de264218d46b265c2655fec7afd282..48daeb98006f14ae7dec3d17f7a308d60034625c 100644 (file)
@@ -18,7 +18,6 @@ import org.eclipse.core.commands.ExecutionEvent;
 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
@@ -45,10 +44,14 @@ public class ImportModelHandler extends AbstractHandler {
         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
index e4645106910a8684544a0a9f3eb3c3f0352b0aa7..19c4031485f3934ff1f663f09865e26528d3682c 100644 (file)
@@ -61,12 +61,12 @@ public class ImportModuleHandler extends AbstractHandler {
                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
index e7991a222a27969a5dd068d8ed962715e97166d2..a94c8a14905c4508e3e7e6847dd471b803fe0763 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -33,6 +33,7 @@ import org.simantics.db.Resource;
 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
index ef0403f608dccf39851ee0f234f6ff8463eb5c64..ad02e9ada9b3d66a38b70f4aba0f22838eef8e55 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -29,6 +29,7 @@ import org.simantics.db.Resource;
 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
index 2b622ac82270f47d5ebdfef69e64392a7d40e585..e97de85e745d48ba8d08cd6985d5289478897208 100644 (file)
@@ -37,6 +37,7 @@ import org.simantics.db.common.utils.ListUtils;
 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
index c4bf7b12bd418837717135e14d564443b08bfdbc..3d7183e610e68e448b9bae0cb86d61aa16d8690d 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -24,6 +24,7 @@ import org.simantics.browsing.ui.swt.widgets.TrackedText;
 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
index 1b6eed623626c17191b44ccfc5b3af9aa039a006..9250126c4d94070a4d9d860fb9096155b276b4de 100644 (file)
@@ -40,6 +40,7 @@ import org.simantics.db.common.utils.NameUtils;
 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
@@ -147,9 +148,14 @@ public class ConfigurationTab extends AdjustableTab {
                 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
index b2ba5ca7ccce0af32dddaecdfb27d443203b2286..6cb813fa5a42122a5c2a45f2a65093eb99ea9c7b 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -32,6 +32,7 @@ import org.simantics.db.Resource;
 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
@@ -40,85 +41,25 @@ import org.simantics.sysdyn.ui.properties.widgets.DelayMarkWidget;
 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
@@ -265,4 +206,110 @@ public class DependencyTab  extends LabelPropertyTabContributor {
         }\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
index b9f246ce9e56e51d2e99c8845dfd4425e9f28127..833a62610a814884d0dd739c622436615afdc374 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -51,6 +51,7 @@ import org.simantics.db.layer0.variable.Variable;
 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
index 901d6ecc951962deb4e3f0f542b8eb5aa49aabeb..c022808d6785296482119a0818950f0d94e8dc07 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -61,6 +61,7 @@ import org.simantics.db.management.ISessionContext;
 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
@@ -112,6 +113,7 @@ public class EquationTab extends AdjustableTab implements Widget {
                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
@@ -136,6 +138,7 @@ public class EquationTab extends AdjustableTab implements Widget {
                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
@@ -160,6 +163,7 @@ public class EquationTab extends AdjustableTab implements Widget {
                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
index 8d4aa90be5c4f530d6e4ff8ce63b1cbac8f588c8..0c291db7a828d0720b22c9ceae117cc5ec699f16 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -15,6 +15,7 @@ import org.eclipse.swt.widgets.Composite;
 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
index 47ba4e84da952509804d6d3d6de593c710ef8d10..a4a91c9f02f29639b955484568f283e5c7661f25 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -38,6 +38,7 @@ import org.simantics.db.WriteGraph;
 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
index fa86473731d169b48710ec1bb5d58b11dccffd2c..885d4ab9acba53fd4be90a538e3e922254372aeb 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -27,6 +27,7 @@ import org.simantics.db.Resource;
 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
index 5164aa97f1e4208816a0f8828c7b49769d77a20f..9704d07480cbdca5ade31ec5865eb13b37033fbc 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -21,6 +21,7 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
 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
index d7c57f34c3384ee7f23c30e318f5ab5395a001ce..de7994bebeaa94c36a69b5a7ff93279b0c9132f7 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -23,37 +23,39 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
 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
@@ -69,22 +71,57 @@ public class FunctionTab extends LabelPropertyTabContributor {
                                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
index e77b9f8680924c1c27afeb7aa9076148727518a9..8e26cc3fd28aee2b56263f536cac5a7e1e2fe66a 100644 (file)
@@ -14,6 +14,7 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
 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
@@ -43,28 +44,31 @@ public class GameExperimentTab extends LabelPropertyTabContributor {
         // 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
index fe3694de38c7d1aa212a23e5a2c282d2577bad86..ceed5ad2b8d3614dfd9c789e90e0d00db77abe87 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -48,6 +48,7 @@ import org.simantics.db.common.request.WriteRequest;
 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
index 19146ffabece0bd269e8d53fae649b0e06209f79..fd5480ee1a85067ae3217526ca70aed6f13211a1 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -32,6 +32,7 @@ import org.simantics.db.Resource;
 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
diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LabelPropertyTabContributor.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/LabelPropertyTabContributor.java
deleted file mode 100644 (file)
index d4a31f5..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************\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
index 16c92c383b92bd8388fced5d600d4859e9fc6974..25de7c92510661e9319fd70ecde046426acc52fb 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -20,6 +20,7 @@ import org.eclipse.ui.IWorkbenchSite;
 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
index b8fb2f06a36c8e4e85416a1fe3a82ca2f585f72f..cc4bd43d6328c8d35cbeff5544aa7973f0b23a72 100644 (file)
@@ -41,6 +41,7 @@ import org.simantics.db.common.request.WriteRequest;
 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
index 0b5b3d6874298ea6eda73590a88c56869ed30baa..320fb9075610b76598d337930e24734e2a2555b5 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -24,6 +24,7 @@ import org.simantics.db.Resource;
 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
index ef0e5cc4c2237b72852f31073b578753a6be0a9d..9691f7e7c6c49cf8418eee27a980d555efa031cb 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -24,6 +24,7 @@ import org.simantics.db.Resource;
 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
index 42220661f7a7e2690d3089c3c78dcb29873e2394..5e3f1246c656f6d88fd10289c510dcbf0ac2237a 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -23,6 +23,7 @@ import org.simantics.browsing.ui.swt.widgets.GraphExplorerComposite;
 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
index 030746cc1505d8b3ed21bfbe0883c8823c644a81..64a558bf07e2b83408d77a3c091c9f0be48db390 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -28,6 +28,7 @@ import org.simantics.browsing.ui.swt.widgets.impl.Widget;
 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
index 79ebe9abf08d8ed12eaeaa8e3ffc9470fee8b0b7..918dafd21d33749134b27bec6018e17eb11c0077 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -21,6 +21,7 @@ import org.simantics.browsing.ui.swt.widgets.StringPropertyModifier;
 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
index 4b7eb906ca4cb3dff248874069b555185da3f049..a1038bc5050275f6e9329736f4bdb96ec74f9a32 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -34,6 +34,7 @@ import org.simantics.db.exception.DatabaseException;
 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
index cc8f4384e04070d7ed498b5024b0792b42593aa1..55c4ce956db5632e86670bc04946af75cd70f686 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -15,6 +15,7 @@ import org.eclipse.swt.widgets.Composite;
 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
index 306cd84025d61ca6ee0c932ccd8225b33adc27d6..fee1f4c97a33e36e1b546f22bbd0b8aae3149992 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -15,6 +15,7 @@ import org.eclipse.swt.widgets.Composite;
 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
index 2001b02fac4405fc6d42da5d7f23ebf25c1e3f8b..409471cfdec6105c6aced25155f6f20bdfd6600f 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -69,6 +69,7 @@ import org.simantics.db.exception.DatabaseException;
 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
@@ -92,7 +93,7 @@ import org.simantics.utils.ui.validators.IntegerValidator;
  * @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
@@ -106,55 +107,133 @@ public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributo
     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
@@ -224,15 +303,14 @@ public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributo
             }\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
@@ -281,7 +359,7 @@ public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributo
             }\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
@@ -297,13 +375,9 @@ public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributo
         });\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
@@ -347,43 +421,32 @@ public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributo
             }\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
@@ -391,11 +454,10 @@ public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributo
 //        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
@@ -473,73 +535,110 @@ public class SensitivityAnalysisExperimentTab extends LabelPropertyTabContributo
             }\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
index 7b0301cbd20f8a4f8803144d5aa64de429d1fc23..ac3d2e74d738b9a6dde7490362c12678c2df8b81 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -38,6 +38,7 @@ import org.simantics.db.WriteGraph;
 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
index 53f7c9aa70b2d358fc5fd809e6f7581cb5147ddc..c5b1851648a7b6a122fc17fc81b9616ec9476176 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -45,6 +45,7 @@ import org.simantics.db.procedure.Listener;
 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
@@ -63,16 +64,16 @@ import org.simantics.utils.ui.validators.DoubleValidator;
 /**\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
@@ -81,69 +82,194 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
         // 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
@@ -243,133 +369,65 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
             }\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
index 90b4319cd7a8824add5d8a744b4c571cba20a0a2..6807d491a98f64d5321ee92d5e917c80feca0765 100644 (file)
@@ -87,7 +87,9 @@ public class NameAndArrayRangeModifyListener extends ComboModifyListenerImpl<Res
                }\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
index af2ea9303608a1aa7911f1a92ceb0f57775b3f1a..d2d78a52aa6588ec6088d219a8367a7c7afc15b4 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -13,6 +13,7 @@ package org.simantics.sysdyn.ui.properties.widgets.expressions;
 \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
@@ -56,12 +57,17 @@ public class CompletionProcessor implements IContentAssistProcessor {
     \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
@@ -121,7 +127,7 @@ public class CompletionProcessor implements IContentAssistProcessor {
        }\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
@@ -131,8 +137,9 @@ public class CompletionProcessor implements IContentAssistProcessor {
         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
@@ -143,7 +150,8 @@ public class CompletionProcessor implements IContentAssistProcessor {
             }   \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
@@ -156,6 +164,15 @@ public class CompletionProcessor implements IContentAssistProcessor {
         }\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
@@ -186,20 +203,38 @@ public class CompletionProcessor implements IContentAssistProcessor {
        }\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
@@ -213,35 +248,75 @@ public class CompletionProcessor implements IContentAssistProcessor {
                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
@@ -252,7 +327,7 @@ public class CompletionProcessor implements IContentAssistProcessor {
 \r
        @Override\r
        public char[] getCompletionProposalAutoActivationCharacters() {\r
-               return allowedCharacters;\r
+               return ALLOWED_CHARACTERS;\r
        }\r
 \r
        @Override\r
index 53e51b9114703d7b892d474829a5ecfd63a48b50..3aced2065dc639938113200a3aedffbd4e677a4d 100644 (file)
@@ -33,9 +33,11 @@ import org.eclipse.swt.widgets.Event;
 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
@@ -140,7 +142,7 @@ public class StockExpression implements IExpression {
     }\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
@@ -184,7 +186,25 @@ public class StockExpression implements IExpression {
                \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
@@ -240,7 +260,7 @@ public class StockExpression implements IExpression {
                     }\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
index eb89e1d7539542c3d90e23399e73e416b6519f17..b7d009b9165de12d30710c27eaf031b6262f25aa 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -41,6 +41,7 @@ import org.simantics.utils.ui.validators.DoubleValidator;
 /**\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
@@ -54,9 +55,18 @@ public class ConfidenceBoundWidget extends Composite implements Widget {
         \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
@@ -70,16 +80,7 @@ public class ConfidenceBoundWidget extends Composite implements Widget {
             }\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
index 0bfe1d6546b654fdc59d34f2abb090c191af355e..2f9571460cc3a031b86f763c1cf4d503a47038c3 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -33,7 +33,7 @@ import org.simantics.db.Resource;
 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
@@ -42,47 +42,17 @@ import org.simantics.ui.SimanticsUI;
 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
@@ -122,7 +92,7 @@ public class SensitivityChartAxisAndVariablesTab  extends LabelPropertyTabContri
             }\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
@@ -137,5 +107,61 @@ public class SensitivityChartAxisAndVariablesTab  extends LabelPropertyTabContri
         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
index c05d1ae427434a72a09b269c33bd81f0f004ed8d..4be6de7fb3c84a4bea89544775ce618f56e2d9bc 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************\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
@@ -33,6 +33,7 @@ import org.simantics.sysdyn.SysdynResource;
  * 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
@@ -85,16 +86,19 @@ public class SensitivitySeriesPropertyComposite extends SeriesPropertyComposite
             \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
index d3a336995b374bd3f7701e66b7da31c0fb4b6244..928d8377c43cc5c9ed12e5eedcd5d84a03417363 100644 (file)
@@ -267,9 +267,11 @@ public class TrendView extends ViewPart {
      */\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
index dbf2e2d0ecc730dd06e439992d2a81f9c495487c..2eeadea2cf23eeb17442dec161b9d83b180d9196 100644 (file)
@@ -62,7 +62,15 @@ public class UnitFunction {
             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
index 06b421f295d150603fef77949cdb6697c9a74538..785df451b238b71400763accd0e3e14d062179d8 100644 (file)
@@ -233,7 +233,7 @@ public class WizardFunctionsExportPage extends WizardPage {
                \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
index 3e5600aeb1f5395c20a713f7119ae23cb9383f0e..702a96cd24fd04229830a5913a79f8f32c33a747 100644 (file)
@@ -227,7 +227,7 @@ public class WizardFunctionsImportPage extends WizardPage{
 \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
index a7194de6250afccba0ec6f60fb727dcea90c4814..ae1f0e8ed81ff671c511e06052d4a2c3dac3c2f5 100644 (file)
@@ -232,7 +232,7 @@ public class WizardModelsExportPage extends WizardPage {
                \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
index 636fd688f1bee30f439de0cc0bed74f463da25d1..e91798ed70148fe5ea96baeb6c1b97b2edfce22e 100644 (file)
@@ -155,7 +155,7 @@ public class WizardModelsImportPage extends WizardPage{
                \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
index d14135a9a039f24eff5638f6fa6c555359ee6340..3625dd9d770aadcff597cd59a1266f3c45b0bff5 100644 (file)
@@ -236,7 +236,7 @@ public class WizardModulesExportPage extends WizardPage {
                \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
index 659767910c84867983b0f40aae8f2b27fb4907e6..415d02c3a17c5e5110aab85835cf1b7b227a63f0 100644 (file)
@@ -229,7 +229,7 @@ public class WizardModulesImportPage extends WizardPage{
                \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
index ebda30ea6fc3a70702e4bac9188bd93f4832911c..5c3c71bbffe3439f62702319fccf3a95504d6826 100644 (file)
@@ -1,7 +1,7 @@
 <?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
@@ -31,6 +32,7 @@
       </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
@@ -115,7 +117,7 @@ This Agreement is governed by the laws of the State of New York and the intellec
    </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
index ef26f8fb619f2f808924d4e92416d4c436940531..af0bfe79d727d02fea766b2e11d71338db37e336 100644 (file)
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 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",
index 5e8c3c2b003d0a3b3837289f76648754f54dffdf..ce3b612684e5278444e2415d1c3e0d07f1f4953f 100644 (file)
@@ -109,9 +109,9 @@ TOKEN:
     { 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
index 011bc205ad1a481537141b33546ee59ce75bd95c..85adbb7236d356b3c4ab22ce4d04c249110cbc27 100644 (file)
@@ -27,7 +27,7 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
             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
@@ -182,7 +182,7 @@ private int jjMoveStringLiteralDfa0_0()
          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
@@ -830,7 +830,7 @@ static final long[] jjbitVec0 = {
 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
@@ -866,12 +866,12 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -923,99 +923,111 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1053,24 +1065,24 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1089,17 +1101,17 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1112,14 +1124,15 @@ private int jjMoveNfa_0(int startState, int curPos)
          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
@@ -1157,8 +1170,8 @@ static final long[] jjtoSkip = {
    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
@@ -1189,7 +1202,7 @@ private void ReInitRounds()
 {\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
index 19264f965717f0ccd98c3ee31b3f7732159822d5..ab57915fd8df8ade4aa2fcbdb5108ad606d62da5 100644 (file)
@@ -15,13 +15,13 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
    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
@@ -185,7 +185,7 @@ private int jjMoveStringLiteralDfa0_0()
          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
@@ -936,7 +936,7 @@ static final long[] jjbitVec0 = {
 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
@@ -951,12 +951,12 @@ private int jjMoveNfa_0(int startState, int curPos)
          {\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
@@ -1015,99 +1015,111 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1141,24 +1153,24 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1177,17 +1189,17 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1200,14 +1212,15 @@ private int jjMoveNfa_0(int startState, int curPos)
          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
@@ -1246,8 +1259,8 @@ static final long[] jjtoSkip = {
    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
@@ -1278,7 +1291,7 @@ private void ReInitRounds()
 {\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
index 2f9f31eba9ef76ceb225a4ab174046daaf8051fa..04e39995d9fe22ca8264cc541f5cc80f242e00bc 100644 (file)
@@ -77,9 +77,9 @@ TOKEN:
     { 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
index d74b59345a4434f61b1f54c13ae814ff4b18dd77..5b63087588acfc1f1ac32b08b070f774116db821 100644 (file)
@@ -32,6 +32,7 @@ import org.simantics.sysdyn.manager.SysdynModel;
 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
@@ -139,6 +140,8 @@ public class UnitUtils {
                 \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
@@ -187,8 +190,14 @@ public class UnitUtils {
         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
index 74caa34c3de5c19a9dbf921aabca0aeeb5f8545c..c7bd0bd9129b277cdcc8d9e713a677c79728f694 100644 (file)
@@ -57,9 +57,9 @@ TOKEN:
     { 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
index 3de87d4f274380c0566e57af45e3c7309b789b24..d8eae25d9f37e106d6dc2597d278505a75515c06 100644 (file)
@@ -1,5 +1,6 @@
 /* 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
@@ -14,17 +15,17 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
    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
@@ -179,7 +180,7 @@ private int jjMoveStringLiteralDfa0_0()
          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
@@ -831,7 +832,7 @@ static final long[] jjbitVec0 = {
 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
@@ -846,17 +847,7 @@ private int jjMoveNfa_0(int startState, int curPos)
          {\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
@@ -867,7 +858,7 @@ private int jjMoveNfa_0(int startState, int curPos)
                   {\r
                      if (kind > 93)\r
                         kind = 93;\r
-                     jjCheckNAddTwoStates(43, 44);\r
+                     jjCheckNAddTwoStates(48, 49);\r
                   }\r
                   break;\r
                case 9:\r
@@ -875,7 +866,7 @@ private int jjMoveNfa_0(int startState, int curPos)
                   {\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
@@ -885,7 +876,7 @@ private int jjMoveNfa_0(int startState, int curPos)
                   {\r
                      if (kind > 92)\r
                         kind = 92;\r
-                     jjCheckNAddStates(8, 17);\r
+                     jjCheckNAddStates(5, 14);\r
                   }\r
                   else if ((0x100002600L & l) != 0L)\r
                   {\r
@@ -893,12 +884,22 @@ private int jjMoveNfa_0(int startState, int curPos)
                         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
@@ -910,15 +911,15 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -926,7 +927,7 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -936,167 +937,191 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1119,47 +1144,47 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1176,19 +1201,19 @@ private int jjMoveNfa_0(int startState, int curPos)
                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
@@ -1201,15 +1226,16 @@ private int jjMoveNfa_0(int startState, int curPos)
          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
@@ -1247,8 +1273,8 @@ static final long[] jjtoSkip = {
    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
@@ -1279,7 +1305,7 @@ private void ReInitRounds()
 {\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
index 7261f8cfa074736b8a0372cb29d3ed6688966eb9..35d321e2eafe6244f84465aa19c551f44aa4ca8f 100644 (file)
@@ -53,9 +53,9 @@ TOKEN:
     { 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
index 81d5fcb861c59cdd4480456ec35a81be8ce2c0b5..af0cd4bfe859d3d51668942b191766dcaf93c092 100644 (file)
@@ -49,9 +49,9 @@ TOKEN:
     { 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
index 17e5dd5cdda579c63ba85526576c211a18a9034b..1758bea8d2e4e2af0469b34a357c513c170a55a4 100644 (file)
@@ -20,7 +20,7 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
             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
@@ -177,7 +177,7 @@ private int jjMoveStringLiteralDfa0_0()
          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
@@ -837,7 +837,7 @@ static final long[] jjbitVec5 = {
 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
@@ -852,12 +852,12 @@ private int jjMoveNfa_0(int startState, int curPos)
          {\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
@@ -929,99 +929,111 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1055,24 +1067,24 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1102,17 +1114,17 @@ private int jjMoveNfa_0(int startState, int curPos)
                   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
@@ -1125,14 +1137,15 @@ private int jjMoveNfa_0(int startState, int curPos)
          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
@@ -1206,8 +1219,8 @@ static final long[] jjtoSkip = {
    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
@@ -1238,7 +1251,7 @@ private void ReInitRounds()
 {\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