01: package com.xoetrope.swing.forms;
02:
03: import net.xoetrope.builder.XuiBuilder;
04: import com.xoetrope.validation.XFormValidationFactory;
05: import net.xoetrope.xui.XPage;
06: import net.xoetrope.xui.XProject;
07: import net.xoetrope.xui.validation.XValidationFactory;
08:
09: /**
10: * A builder of forms from an XML description. Extends XuiBuilder by adding
11: * support for repeated elements.
12: *
13: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
14: * the GNU Public License (GPL), please see license.txt for more details. If
15: * you make commercial use of this software you must purchase a commercial
16: * license from Xoetrope.</p>
17: * <p> $Revision: 1.5 $</p>
18: */
19: public class XFormBuilder extends XuiBuilder {
20: public XFormBuilder(XProject project) {
21: super (project);
22: }
23:
24: protected void init(String packageName) {
25: super .init(XPage.XUI_SWING_PACKAGE);
26: }
27:
28: /**
29: * Construct a validation factory appropriate to this builder
30: * @param validationFileName the validations file to read
31: * @return the validation factory
32: */
33: protected XValidationFactory getValidationFactory(
34: String validationFileName) {
35: try {
36: XValidationFactory vf = (XValidationFactory) validationFactories
37: .get(validationFileName);
38: if (vf == null) {
39: vf = new XFormValidationFactory(currentProject);
40: vf.addConfigFile("Project", validationFileName, true);
41: validationFactories.put(validationFileName, vf);
42: }
43: return vf;
44: } catch (Exception ex) {
45: return null;
46: }
47: }
48: }
|