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.commands.Command;
07: import fr.aliacom.commands.CommandPool;
08: import fr.aliacom.form.common.FormComponentLoader;
09: import fr.aliacom.form.common.FormLoader;
10: import fr.aliacom.form.common.IFormComponent;
11: import fr.aliacom.form.swt.BuilderFactory;
12: import fr.aliacom.form.swt.SWTBuilder;
13: import fr.aliacom.form.swt.ui.SWTComboBox;
14:
15: /**
16: * @author tom
17: *
18: * (C) 2001, 2003 Thomas Cataldo
19: */
20: public final class ComboBoxBuilder extends SWTBuilder {
21:
22: /**
23: * @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)
24: */
25: public IFormComponent build(Element elem, IFormComponent parent,
26: FormLoader loader, BuilderFactory factory) {
27: SWTComboBox combo = new SWTComboBox((Composite) parent
28: .getNativeWidget(), elem.getAttribute("valueProperty"),
29: elem.getAttribute("displayProperty"));
30: if (elem.hasAttribute("onSelect")) {
31: Command c = CommandPool.getInstance().getCommand(
32: loader.getForm(), loader.getCtx(),
33: elem.getAttribute("onSelect"));
34: combo.setOnSelectAction(c);
35: }
36: loader.addLoader(elem.getAttribute("rows"),
37: new FormComponentLoader(combo));
38: return combo;
39: }
40:
41: }
|