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.common.ui.wizard.IWizardModel;
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.SWTWizard;
12:
13: /**
14: * @author tom
15: *
16: * (C) 2001, 2003 Thomas Cataldo
17: */
18: public final class WizardBuilder 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: IWizardModel model = createModel(elem.getAttribute("model"));
26: SWTWizard wizard = new SWTWizard((Composite) parent
27: .getNativeWidget(), model);
28: buildChildren(elem, wizard, loader, factory);
29: wizard.createUI();
30: wizard.setForm(loader.getForm());
31: return wizard;
32: }
33:
34: /**
35: * Method createModel.
36: * @param string
37: * @return IWizardModel
38: */
39: private IWizardModel createModel(String string) {
40: IWizardModel ret = null;
41: try {
42: ret = (IWizardModel) Class.forName(string).newInstance();
43: } catch (InstantiationException e) {
44: } catch (IllegalAccessException e) {
45: } catch (ClassNotFoundException e) {
46: }
47: return ret;
48: }
49:
50: }
|