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.ButtonGroup;
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.SWTRadioButton;
12:
13: /**
14: * @author tom
15: *
16: * (C) 2001, 2003 Thomas Cataldo
17: */
18: public final class RadioButtonBuilder 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: SWTRadioButton radio = new SWTRadioButton((Composite) parent
26: .getNativeWidget(), getNodeText(elem));
27: ButtonGroup group = (ButtonGroup) loader.getCtx().get(
28: elem.getAttribute("group")).getValue();
29: group.add(radio);
30: if (elem.hasAttribute("action")) {
31: radio.setAction(elem.getAttribute("action"));
32: }
33:
34: return radio;
35: }
36:
37: }
|