]> gerrit.simantics Code Review - simantics/platform.git/blob
998be35727487003ea3ca1036557d0aa4b64a1f5
[simantics/platform.git] /
1 package org.simantics.document.swt.core.widget;
2
3 import java.util.TreeMap;
4
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;
16
17 public class FillComposite extends HasWidgetsWidgetManager<Composite> {
18
19         @Override
20         protected void doUpdateProperties(SWTDocument document, Composite control, JSONObject object) {
21         }
22
23         @Override
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));
30                 return result;
31         }
32         
33         @SuppressWarnings("unchecked")
34         @Override
35         public void updateChildren(SWTDocument document, JSONObject object, WidgetContainer widget, TreeMap<String, WidgetData> childMap) {
36                 
37                 super.updateChildren(document, object, widget, childMap);
38
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());
43                 
44         }
45         
46         @Override
47         public IEventCommand eventCommand(SWTDocument document, JSONObject object, WidgetContainer widget, String command) {
48             return null;
49         }
50         
51 }