01: package fr.aliacom.form.swt.maker;
02:
03: import org.w3c.dom.Element;
04:
05: import fr.aliacom.form.common.FormComponentLoader;
06: import fr.aliacom.form.common.FormLoader;
07: import fr.aliacom.form.common.IFormComponent;
08: import fr.aliacom.form.swt.BuilderFactory;
09: import fr.aliacom.form.swt.SWTBuilder;
10: import fr.aliacom.form.swt.ui.SWTPassword;
11:
12: /**
13: * @author tom
14: *
15: * (C) 2001, 2003 Thomas Cataldo
16: */
17: public class PasswordBuilder extends SWTBuilder {
18:
19: /**
20: * @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)
21: */
22: public IFormComponent build(Element elem, IFormComponent parent,
23: FormLoader loader, BuilderFactory factory) {
24: int length = (elem.hasAttribute("length") ? Integer
25: .parseInt(elem.getAttribute("length")) : 10);
26: SWTPassword text = new SWTPassword(parent, elem
27: .getAttribute("property"), length);
28:
29: if (elem.hasAttribute("editable")) {
30: text.setEditable(elem.getAttribute("editable").equals(
31: "true") ? true : false);
32: }
33: if (elem.hasAttribute("enabled")) {
34: text
35: .setEnabled(elem.getAttribute("enabled").equals(
36: "true") ? true : false);
37: }
38:
39: loader.addLoader(elem.getAttribute("bean"),
40: new FormComponentLoader(text));
41: return text;
42: }
43:
44: }
|