--- /dev/null
+package org.simantics.spreadsheet.ui.editor;\r
+\r
+import org.eclipse.jface.layout.GridDataFactory;\r
+import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.graphics.Font;\r
+import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Display;\r
+import org.eclipse.ui.IWorkbenchSite;\r
+import org.simantics.browsing.ui.swt.widgets.Label;\r
+import org.simantics.browsing.ui.swt.widgets.TrackedText;\r
+import org.simantics.browsing.ui.swt.widgets.VariableIntegerPropertyTextModifier;\r
+import org.simantics.browsing.ui.swt.widgets.VariableStringPropertyFactory;\r
+import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;\r
+import org.simantics.db.layer0.variable.Variable;\r
+import org.simantics.db.management.ISessionContext;\r
+import org.simantics.selectionview.PropertyTabContributorImpl;\r
+\r
+public class SheetTab extends PropertyTabContributorImpl {\r
+\r
+ static class NoCellInput {\r
+ \r
+ public Variable sheet;\r
+ public String location;\r
+ \r
+ public NoCellInput(Variable sheet, String location) {\r
+ this.sheet = sheet;\r
+ this.location = location;\r
+ }\r
+ \r
+ }\r
+ \r
+ public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) {\r
+\r
+ Display display = body.getDisplay();\r
+ Font font = new Font(display, "Arial", 12, SWT.NONE); \r
+\r
+ Composite composite = new Composite(body, SWT.NONE);\r
+ composite.setBackground(display.getSystemColor(SWT.COLOR_WHITE));\r
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
+ GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(2).applyTo(composite);\r
+ \r
+ Composite headerComposite = new Composite(composite, 0);\r
+ headerComposite.setBackground(display.getSystemColor(SWT.COLOR_BLACK));\r
+ GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(headerComposite);\r
+ GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(1).extendedMargins(2,2,2,2).applyTo(headerComposite);\r
+\r
+ Composite headerComposite2 = new Composite(headerComposite, 0);\r
+ headerComposite2.setBackground(display.getSystemColor(SWT.COLOR_WHITE));\r
+ GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(headerComposite2);\r
+ GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(1).extendedMargins(3,3,3,3).applyTo(headerComposite2);\r
+\r
+ Label header = new Label(headerComposite2, support, 0);\r
+ header.setText("Sheet");\r
+ header.setFont(font);\r
+ header.setBackground(display.getSystemColor(SWT.COLOR_WHITE));\r
+ GridDataFactory.fillDefaults().grab(true, false).span(2, 1).align(SWT.CENTER, SWT.CENTER).applyTo(header.getWidget());\r
+ \r
+ Label rowsLabel = new Label(composite, support, SWT.NONE);\r
+ rowsLabel.setText("Rows: ");\r
+ rowsLabel.setBackground(display.getSystemColor(SWT.COLOR_WHITE));\r
+ GridDataFactory.fillDefaults().grab(false, false).applyTo(rowsLabel.getWidget());\r
+ \r
+ TrackedText rows = new TrackedText(composite, support, SWT.BORDER);\r
+ rows.setTextFactory(new VariableStringPropertyFactory("/DimensionsCell#RowCount"));\r
+ rows.addModifyListener(new VariableIntegerPropertyTextModifier("/DimensionsCell#RowCount"));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(rows.getWidget());\r
+ \r
+ Label columnsLabel = new Label(composite, support, SWT.NONE);\r
+ columnsLabel.setText("Columns: ");\r
+ columnsLabel.setBackground(display.getSystemColor(SWT.COLOR_WHITE));\r
+ GridDataFactory.fillDefaults().grab(false, false).applyTo(columnsLabel.getWidget());\r
+ \r
+ TrackedText columns = new TrackedText(composite, support, SWT.BORDER);\r
+ columns.setTextFactory(new VariableStringPropertyFactory("/DimensionsCell#ColumnCount"));\r
+ columns.addModifyListener(new VariableIntegerPropertyTextModifier("/DimensionsCell#ColumnCount"));\r
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(columns.getWidget());\r
+ \r
+ \r
+ }\r
+ \r
+}\r