01: package fr.aliacom.form.swt.maker;
02:
03: import org.eclipse.swt.custom.CTabFolder;
04: import org.eclipse.swt.widgets.Composite;
05: import org.w3c.dom.Element;
06:
07: import fr.aliacom.form.common.FormLoader;
08: import fr.aliacom.form.common.IFormComponent;
09: import fr.aliacom.form.swt.BuilderFactory;
10: import fr.aliacom.form.swt.SWTBuilder;
11: import fr.aliacom.form.swt.ui.SWTTabbedPane;
12:
13: /**
14: * @author tom
15: *
16: * (C) 2001, 2002 Thomas Cataldo
17: */
18: public final class TabbedPaneBuilder extends SWTBuilder {
19:
20: /**
21: * @see fr.aliacom.form.swt.SWTBuilder#build(Element, IFormComponent, FormLoader, BuilderFactory)
22: */
23: public IFormComponent build(Element elem, IFormComponent parent,
24: FormLoader loader, BuilderFactory factory) {
25: boolean canClose = false;
26: if (elem.hasAttribute("canClose")) {
27: canClose = elem.getAttribute("canClose").equals("true");
28: }
29: SWTTabbedPane tabs = new SWTTabbedPane((Composite) parent
30: .getNativeWidget(), canClose);
31:
32: buildChildren(elem, tabs, loader, factory);
33: CTabFolder natTabs = (CTabFolder) tabs.getNativeWidget();
34: if (natTabs.getItemCount() > 0) {
35: natTabs.setSelection(0);
36: }
37: return tabs;
38: }
39:
40: }
|