01: package fr.aliacom.form.swt.maker;
02:
03: import org.eclipse.swt.widgets.Composite;
04: import org.w3c.dom.Element;
05:
06: import fr.aliacom.form.common.FormLoader;
07: import fr.aliacom.form.common.IFormComponent;
08: import fr.aliacom.form.common.TreeLoader;
09: import fr.aliacom.form.swt.BuilderFactory;
10: import fr.aliacom.form.swt.SWTBuilder;
11: import fr.aliacom.form.swt.ui.SWTTree;
12:
13: /**
14: * @author tom
15: *
16: * (C) 2001, 2002 Thomas Cataldo
17: */
18: public final class TreeBuilder extends SWTBuilder {
19:
20: /**
21: * @see fr.aliacom.form.swt.SWTBuilder#build(org.w3c.dom.Element, fr.aliacom.form.common.IFormComponent, fr.aliacom.form.common.FormLoader, fr.aliacom.form.swt.BuilderFactory)
22: */
23: public IFormComponent build(Element elem, IFormComponent parent,
24: FormLoader loader, BuilderFactory factory) {
25: SWTTree tree = new SWTTree((Composite) parent.getNativeWidget());
26: if (elem.getAttribute("rootNode").length() > 0) {
27: loader.addLoader(elem.getAttribute("rootNode"),
28: new TreeLoader(tree));
29: } else {
30: buildChildren(elem, tree, loader, factory);
31: }
32: log.debug("Tree built");
33: return tree;
34: }
35:
36: }
|