1 package org.simantics.document.swt.core.base;
\r
4 import java.util.TreeMap;
\r
6 import org.eclipse.swt.widgets.Composite;
\r
7 import org.eclipse.swt.widgets.Control;
\r
8 import org.simantics.document.server.JSONObject;
\r
9 import org.simantics.document.server.client.WidgetData;
\r
10 import org.simantics.document.swt.core.SWTDocument;
\r
12 public abstract class LeafWidgetManager<W extends Control> extends PropertyWidgetManager<WidgetContainer<W>> {
\r
14 class Container extends WidgetContainer<W> {
\r
16 @SuppressWarnings("unchecked")
\r
18 protected void doUpdateProperties(SWTDocument document, Control control, JSONObject object) {
\r
19 LeafWidgetManager.this.doUpdateProperties(document, (W)control, object);
\r
23 protected Control doCreateControl(SWTDocument document, Composite parent, JSONObject object) {
\r
24 return LeafWidgetManager.this.doCreateControl(document, parent, object);
\r
30 public WidgetContainer<W> createWidget(JSONObject object) {
\r
31 return new Container();
\r
35 public void updateChildren(SWTDocument document, JSONObject object, WidgetContainer<W> widget, TreeMap<String,WidgetData> childMap) {
\r
36 throw new UnsupportedOperationException("Widget type " + object.getType() + " does not support children");
\r
40 public void updateProperties(SWTDocument document, JSONObject object, WidgetContainer<W> widget) {
\r
41 widget.updateProperties(document, object);
\r
44 abstract protected void doUpdateProperties(SWTDocument document, W control, JSONObject object);
\r
45 abstract protected W doCreateControl(SWTDocument document, Composite parent, JSONObject object);
\r