1 package org.simantics.document.swt.core.widget;
3 import java.util.TreeMap;
5 import org.eclipse.jface.layout.GridDataFactory;
6 import org.eclipse.jface.layout.GridLayoutFactory;
7 import org.eclipse.swt.SWT;
8 import org.eclipse.swt.widgets.Composite;
9 import org.eclipse.swt.widgets.Control;
10 import org.simantics.document.server.IEventCommand;
11 import org.simantics.document.server.JSONObject;
12 import org.simantics.document.server.client.WidgetData;
13 import org.simantics.document.swt.core.SWTDocument;
14 import org.simantics.document.swt.core.base.HasWidgetsWidgetManager;
15 import org.simantics.document.swt.core.base.WidgetContainer;
17 public class FillComposite extends HasWidgetsWidgetManager<Composite> {
20 protected void doUpdateProperties(SWTDocument document, Composite control, JSONObject object) {
24 protected Composite doCreateControl(SWTDocument document, Composite parent, JSONObject object) {
25 Composite result = new Composite(parent, SWT.NONE);
26 // result.setLayout(new FillLayout(SWT.VERTICAL));
27 //GridDataFactory.fillDefaults().grab(true, true).minSize(1, 1).applyTo(result);
28 GridLayoutFactory.fillDefaults().applyTo(result);
29 // result.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED));
33 @SuppressWarnings("unchecked")
35 public void updateChildren(SWTDocument document, JSONObject object, WidgetContainer widget, TreeMap<String, WidgetData> childMap) {
37 super.updateChildren(document, object, widget, childMap);
39 WidgetData child = childMap.values().iterator().next();
40 WidgetContainer container = (WidgetContainer)child.widget;
41 if(container.getControl() == null) return;
42 GridDataFactory.fillDefaults().grab(true, true).minSize(1, 1).applyTo((Control)container.getControl());
47 public IEventCommand eventCommand(SWTDocument document, JSONObject object, WidgetContainer widget, String command) {