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