01: package fr.aliacom.form.swt.maker;
02:
03: import org.eclipse.swt.SWT;
04: import org.eclipse.swt.widgets.Menu;
05: import org.eclipse.swt.widgets.MenuItem;
06: import org.w3c.dom.Element;
07:
08: import fr.aliacom.form.common.IFormComponent;
09: import fr.aliacom.form.common.FormLoader;
10: import fr.aliacom.form.swt.BuilderFactory;
11: import fr.aliacom.form.swt.SWTBuilder;
12: import fr.aliacom.form.swt.ui.SWTMenu;
13:
14: /**
15: * @author tom
16: *
17: * (C) 2001, 2002 Thomas Cataldo
18: */
19: public class MenuBuilder extends SWTBuilder {
20:
21: /**
22: * @see fr.aliacom.form.swt.SWTBuilder#build(Element, IFormComponent, FormLoader, BuilderFactory)
23: */
24: public IFormComponent build(Element elem, IFormComponent parent,
25: FormLoader loader, BuilderFactory factory) {
26: Menu bar = (Menu) parent.getNativeWidget();
27: Menu menu = new Menu(bar);
28: SWTMenu ret = new SWTMenu(menu);
29: MenuItem item = new MenuItem(bar, SWT.CASCADE);
30: item.setText(getNodeText(elem));
31: item.setMenu(menu);
32: buildChildren(elem, ret, loader, factory);
33: return ret;
34: }
35:
36: }
|