X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.spreadsheet.ui%2Fsrc%2Forg%2Fsimantics%2Fspreadsheet%2Fui%2Feditor%2FSheetTab.java;h=05eb94177600fd42e2f2af72015d61fa0b139501;hb=459ca221e046b0ed539e4eab4486a0a3178a4eba;hp=0abf3db99b6498ab0b34a24ab6e31686dbe16682;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/editor/SheetTab.java b/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/editor/SheetTab.java index 0abf3db99..05eb94177 100644 --- a/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/editor/SheetTab.java +++ b/bundles/org.simantics.spreadsheet.ui/src/org/simantics/spreadsheet/ui/editor/SheetTab.java @@ -1,82 +1,82 @@ -package org.simantics.spreadsheet.ui.editor; - -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.layout.GridLayoutFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IWorkbenchSite; -import org.simantics.browsing.ui.swt.widgets.Label; -import org.simantics.browsing.ui.swt.widgets.TrackedText; -import org.simantics.browsing.ui.swt.widgets.VariableIntegerPropertyTextModifier; -import org.simantics.browsing.ui.swt.widgets.VariableStringPropertyFactory; -import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; -import org.simantics.db.layer0.variable.Variable; -import org.simantics.db.management.ISessionContext; -import org.simantics.selectionview.PropertyTabContributorImpl; - -public class SheetTab extends PropertyTabContributorImpl { - - static class NoCellInput { - - public Variable sheet; - public String location; - - public NoCellInput(Variable sheet, String location) { - this.sheet = sheet; - this.location = location; - } - - } - - public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) { - - Display display = body.getDisplay(); - Font font = new Font(display, "Arial", 12, SWT.NONE); - - Composite composite = new Composite(body, SWT.NONE); - composite.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); - GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(2).applyTo(composite); - - Composite headerComposite = new Composite(composite, 0); - headerComposite.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); - GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(headerComposite); - GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(1).extendedMargins(2,2,2,2).applyTo(headerComposite); - - Composite headerComposite2 = new Composite(headerComposite, 0); - headerComposite2.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(headerComposite2); - GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(1).extendedMargins(3,3,3,3).applyTo(headerComposite2); - - Label header = new Label(headerComposite2, support, 0); - header.setText("Sheet"); - header.setFont(font); - header.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - GridDataFactory.fillDefaults().grab(true, false).span(2, 1).align(SWT.CENTER, SWT.CENTER).applyTo(header.getWidget()); - - Label rowsLabel = new Label(composite, support, SWT.NONE); - rowsLabel.setText("Rows: "); - rowsLabel.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - GridDataFactory.fillDefaults().grab(false, false).applyTo(rowsLabel.getWidget()); - - TrackedText rows = new TrackedText(composite, support, SWT.BORDER); - rows.setTextFactory(new VariableStringPropertyFactory("/DimensionsCell#RowCount")); - rows.addModifyListener(new VariableIntegerPropertyTextModifier("/DimensionsCell#RowCount")); - GridDataFactory.fillDefaults().grab(true, false).applyTo(rows.getWidget()); - - Label columnsLabel = new Label(composite, support, SWT.NONE); - columnsLabel.setText("Columns: "); - columnsLabel.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); - GridDataFactory.fillDefaults().grab(false, false).applyTo(columnsLabel.getWidget()); - - TrackedText columns = new TrackedText(composite, support, SWT.BORDER); - columns.setTextFactory(new VariableStringPropertyFactory("/DimensionsCell#ColumnCount")); - columns.addModifyListener(new VariableIntegerPropertyTextModifier("/DimensionsCell#ColumnCount")); - GridDataFactory.fillDefaults().grab(true, false).applyTo(columns.getWidget()); - - - } - -} +package org.simantics.spreadsheet.ui.editor; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchSite; +import org.simantics.browsing.ui.swt.widgets.Label; +import org.simantics.browsing.ui.swt.widgets.TrackedText; +import org.simantics.browsing.ui.swt.widgets.VariableIntegerPropertyTextModifier; +import org.simantics.browsing.ui.swt.widgets.VariableStringPropertyFactory; +import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.db.management.ISessionContext; +import org.simantics.selectionview.PropertyTabContributorImpl; + +public class SheetTab extends PropertyTabContributorImpl { + + static class NoCellInput { + + public Variable sheet; + public String location; + + public NoCellInput(Variable sheet, String location) { + this.sheet = sheet; + this.location = location; + } + + } + + public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) { + + Display display = body.getDisplay(); + Font font = new Font(display, "Arial", 12, SWT.NONE); + + Composite composite = new Composite(body, SWT.NONE); + composite.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); + GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); + GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(2).applyTo(composite); + + Composite headerComposite = new Composite(composite, 0); + headerComposite.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); + GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(headerComposite); + GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(1).extendedMargins(2,2,2,2).applyTo(headerComposite); + + Composite headerComposite2 = new Composite(headerComposite, 0); + headerComposite2.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); + GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(headerComposite2); + GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(1).extendedMargins(3,3,3,3).applyTo(headerComposite2); + + Label header = new Label(headerComposite2, support, 0); + header.setText("Sheet"); + header.setFont(font); + header.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); + GridDataFactory.fillDefaults().grab(true, false).span(2, 1).align(SWT.CENTER, SWT.CENTER).applyTo(header.getWidget()); + + Label rowsLabel = new Label(composite, support, SWT.NONE); + rowsLabel.setText("Rows: "); + rowsLabel.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); + GridDataFactory.fillDefaults().grab(false, false).applyTo(rowsLabel.getWidget()); + + TrackedText rows = new TrackedText(composite, support, SWT.BORDER); + rows.setTextFactory(new VariableStringPropertyFactory("/DimensionsCell#RowCount")); + rows.addModifyListener(new VariableIntegerPropertyTextModifier("/DimensionsCell#RowCount")); + GridDataFactory.fillDefaults().grab(true, false).applyTo(rows.getWidget()); + + Label columnsLabel = new Label(composite, support, SWT.NONE); + columnsLabel.setText("Columns: "); + columnsLabel.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); + GridDataFactory.fillDefaults().grab(false, false).applyTo(columnsLabel.getWidget()); + + TrackedText columns = new TrackedText(composite, support, SWT.BORDER); + columns.setTextFactory(new VariableStringPropertyFactory("/DimensionsCell#ColumnCount")); + columns.addModifyListener(new VariableIntegerPropertyTextModifier("/DimensionsCell#ColumnCount")); + GridDataFactory.fillDefaults().grab(true, false).applyTo(columns.getWidget()); + + + } + +}