01: package fr.aliacom.form.swt.maker;
02:
03: import org.w3c.dom.Element;
04:
05: import fr.aliacom.commands.Command;
06: import fr.aliacom.commands.CommandPool;
07: import fr.aliacom.common.ui.tree.ITreeNode;
08: import fr.aliacom.form.common.FormLoader;
09: import fr.aliacom.form.common.IFormComponent;
10: import fr.aliacom.form.swt.BuilderFactory;
11: import fr.aliacom.form.swt.SWTBuilder;
12: import fr.aliacom.form.swt.ui.tree.CommandTreeNode;
13:
14: /**
15: * @author tom
16: *
17: * (C) 2001, 2002 Thomas Cataldo
18: */
19: public class TreeNodeBuilder extends SWTBuilder {
20:
21: /**
22: * @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)
23: */
24: public IFormComponent build(Element elem, IFormComponent parent,
25: FormLoader loader, BuilderFactory factory) {
26: String text = getNodeText(elem);
27: Command com = null;
28: if (elem.hasAttribute("pythonAction")) {
29: com = CommandPool.getInstance().getCommand(
30: loader.getForm(), loader.getCtx(),
31: elem.getAttribute("pythonAction"));
32: }
33:
34: CommandTreeNode node = new CommandTreeNode((ITreeNode) parent,
35: com, text, (elem.hasAttribute("icon") ? elem
36: .getAttribute("icon") : null));
37: buildChildren(elem, node, loader, factory);
38: return null;
39: }
40:
41: }
|