1 package org.simantics.spreadsheet.ui.editor;
\r
3 import org.eclipse.jface.layout.GridDataFactory;
\r
4 import org.eclipse.jface.layout.GridLayoutFactory;
\r
5 import org.eclipse.swt.SWT;
\r
6 import org.eclipse.swt.graphics.Font;
\r
7 import org.eclipse.swt.widgets.Composite;
\r
8 import org.eclipse.swt.widgets.Display;
\r
9 import org.eclipse.ui.IWorkbenchSite;
\r
10 import org.simantics.browsing.ui.swt.widgets.Label;
\r
11 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
\r
12 import org.simantics.db.management.ISessionContext;
\r
13 import org.simantics.selectionview.PropertyTabContributorImpl;
\r
15 public class MatrixCellTab extends PropertyTabContributorImpl {
\r
17 public void createControls(Composite body, IWorkbenchSite site, final ISessionContext context, WidgetSupport support) {
\r
19 Display display = body.getDisplay();
\r
20 Font font = new Font(display, "Arial", 12, SWT.NONE);
\r
22 Composite composite = new Composite(body, SWT.NONE);
\r
23 composite.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
\r
24 GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
\r
25 GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(2).applyTo(composite);
\r
27 Composite headerComposite = new Composite(composite, 0);
\r
28 headerComposite.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
\r
29 GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(headerComposite);
\r
30 GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(1).extendedMargins(2,2,2,2).applyTo(headerComposite);
\r
32 Composite headerComposite2 = new Composite(headerComposite, 0);
\r
33 headerComposite2.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
\r
34 GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(headerComposite2);
\r
35 GridLayoutFactory.fillDefaults().equalWidth(false).numColumns(1).extendedMargins(3,3,3,3).applyTo(headerComposite2);
\r
37 Label header = new Label(headerComposite2, support, 0);
\r
38 //header.setTextFactory(new VariableStringPropertyFactory(" Variable - %1", "#URI"));
\r
39 header.setText("Matrix");
\r
40 header.setFont(font);
\r
41 header.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
\r
42 GridDataFactory.fillDefaults().grab(true, false).span(2, 1).align(SWT.CENTER, SWT.CENTER).applyTo(header.getWidget());
\r
44 // Label label = new Label(composite, support, SWT.NONE);
\r
45 // label.setText("Expression: ");
\r
46 // label.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
\r
47 // GridDataFactory.fillDefaults().grab(false, false).applyTo(label.getWidget());
\r
49 // TrackedText name = new TrackedText(composite, support, SWT.BORDER);
\r
50 // name.setTextFactory(new VariableStringPropertyFactory("#Expression"));
\r
51 // name.addModifyListener(new VariableStringPropertyTextModifier("Expression"));
\r
52 // GridDataFactory.fillDefaults().grab(true, false).applyTo(name.getWidget());
\r