01: package fr.aliacom.form.swt.maker;
02:
03: import org.eclipse.swt.SWT;
04: import org.eclipse.swt.layout.GridData;
05: import org.eclipse.swt.layout.GridLayout;
06: import org.eclipse.swt.widgets.Composite;
07: import org.eclipse.swt.widgets.Label;
08: import org.w3c.dom.Element;
09:
10: import fr.aliacom.form.common.FormLoader;
11: import fr.aliacom.form.common.IFormComponent;
12: import fr.aliacom.form.swt.BuilderFactory;
13: import fr.aliacom.form.swt.SWTBuilder;
14:
15: /**
16: * Create an horizontal separator in a grid panel
17: * The separator fills all the columns
18: *
19: * @author tom
20: *
21: * (C) 2001, 2002 Thomas Cataldo
22: */
23: public class GridSeparatorBuilder extends SWTBuilder {
24:
25: /**
26: * @see fr.aliacom.form.swt.SWTBuilder#build(Element, IFormComponent, FormLoader, BuilderFactory)
27: */
28: public IFormComponent build(Element elem, IFormComponent parent,
29: FormLoader loader, BuilderFactory factory) {
30: final Composite comp = (Composite) parent.getNativeWidget();
31: final Label sep = new Label(comp, SWT.SEPARATOR
32: | SWT.HORIZONTAL);
33: GridData data = new GridData(GridData.FILL_HORIZONTAL
34: | GridData.VERTICAL_ALIGN_CENTER);
35: data.horizontalSpan = ((GridLayout) comp.getLayout()).numColumns;
36: sep.setLayoutData(data);
37:
38: return null;
39: }
40:
41: }
|