1 package org.simantics.views.swt.client.impl;
3 import org.eclipse.swt.custom.SashForm;
4 import org.eclipse.swt.widgets.Control;
5 import org.eclipse.swt.widgets.Sash;
6 import org.simantics.views.ViewUtils.LayoutBean;
7 import org.simantics.views.swt.client.base.SWTViewUtils;
8 import org.simantics.views.swt.client.base.SingleSWTViewNode;
10 public class SWTSashForm extends SingleSWTViewNode<SashForm> {
12 private static final long serialVersionUID = 7932335224632082902L;
14 public LayoutBean layout;
16 public Integer orientation;
19 public void createControls(org.eclipse.swt.widgets.Composite parent) {
21 control = new SashForm(parent, style);
23 createChildComposites();
29 final public void synchronizeLayout(LayoutBean layout) {
30 if(layout != null) control.setLayout(SWTViewUtils.toLayout(layout));
33 final public void synchronizeWeights(int[] weights) {
36 for(Control c : control.getChildren()) {
37 if (c instanceof Sash) continue;
40 if(weights.length != childCount) throw new IllegalStateException("Got " + weights.length + " weights, but had " + childCount + " children.");
41 control.setWeights(weights);
44 final public void synchronizeOrientation(Integer orientation) {
45 if(orientation != null) control.setOrientation(orientation);