/** * <p>Process the <code>Form</code> objects. This clones the <code>Field</code>s * that don't exist in a <code>FormSet</code> compared to its parent * <code>FormSet</code>.</p> */ private void processForms() { if (defaultFormSet == null) {// it isn't mandatory to have a // default formset defaultFormSet = new FormSet(); } defaultFormSet.process(getConstants()); // Loop through FormSets and merge if necessary for (Iterator<String> i = getFormSets().keySet().iterator(); i.hasNext();) { String key = i.next(); FormSet fs = getFormSets().get(key); fs.merge(getParent(fs)); } // Process Fully Constructed FormSets for (Iterator<FormSet> i = getFormSets().values().iterator(); i.hasNext();) { FormSet fs = i.next(); if (!fs.isProcessed()) { fs.process(getConstants()); } } }
formSet = new FormSet(); formSet.setLanguage(language); formSet.setCountry(country);
va.setMethodParams("java.lang.Object,org.apache.commons.validator.Field,java.util.List"); FormSet fs = new FormSet(); Form form = new Form(); form.setName("testForm");
private ValidatorResources setupDateResources(String property, String action) { ValidatorResources resources = new ValidatorResources(); ValidatorAction va = new ValidatorAction(); va.setName(action); va.setClassname("org.apache.commons.validator.ValidatorTest"); va.setMethod("formatDate"); va.setMethodParams("java.lang.Object,org.apache.commons.validator.Field"); FormSet fs = new FormSet(); Form form = new Form(); form.setName("testForm"); Field field = new Field(); field.setProperty(property); field.setDepends(action); form.addField(field); fs.addForm(form); resources.addValidatorAction(va); resources.addFormSet(fs); resources.process(); return resources; }
protected synchronized FormSet getFormSet(String schema, String name) { String key = schema + "." + name; FormSet formSet = formSetCache.get(key); if (formSet == null) { formSet = new FormSet(); formSetCache.put(key, formSet); } return formSet; }
/** * <p>Process the <code>Form</code> objects. This clones the <code>Field</code>s * that don't exist in a <code>FormSet</code> compared to its parent * <code>FormSet</code>.</p> */ private void processForms() { if (defaultFormSet == null) {// it isn't mandatory to have a // default formset defaultFormSet = new FormSet(); } defaultFormSet.process(getConstants()); // Loop through FormSets and merge if necessary for (Iterator<String> i = getFormSets().keySet().iterator(); i.hasNext();) { String key = i.next(); FormSet fs = getFormSets().get(key); fs.merge(getParent(fs)); } // Process Fully Constructed FormSets for (Iterator<FormSet> i = getFormSets().values().iterator(); i.hasNext();) { FormSet fs = i.next(); if (!fs.isProcessed()) { fs.process(getConstants()); } } }
/** * <p>Process the <code>Form</code> objects. This clones the <code>Field</code>s * that don't exist in a <code>FormSet</code> compared to its parent * <code>FormSet</code>.</p> */ private void processForms() { if (defaultFormSet == null) {// it isn't mandatory to have a // default formset defaultFormSet = new FormSet(); } defaultFormSet.process(hConstants); // Loop through FormSets and merge if necessary for (Iterator i = hFormSets.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); FormSet fs = (FormSet) hFormSets.get(key); fs.merge(getParent(fs)); } // Process Fully Constructed FormSets for (Iterator i = hFormSets.values().iterator(); i.hasNext();) { FormSet fs = (FormSet) i.next(); if (!fs.isProcessed()) { fs.process(hConstants); } } }
public Object invoke(MethodInvocation invocation) throws Throwable { String formKey; if (invocation.getArguments().length == 2) { formKey = (String) invocation.getArguments()[1]; } else { formKey = (String) invocation.getArguments()[3]; } if (formKey == null) { return invocation.proceed(); } ModuleConfig config = ModuleUtils.getInstance().getModuleConfig(S2StrutsContextUtil.getRequest()); Form form = this.validationCreator.createForm(config, formKey); if (form != null) { if (log.isDebugEnabled()) { log.debug("auto create " + form); } // initialize form... ValidatorResources resources = new ValidatorResources(); FormSet formSet = new FormSet(); formSet.addForm(form); resources.addFormSet(formSet); resources.process(); // ...initialized form return form; } return invocation.proceed(); }
formSet = new FormSet(); formSet.setLanguage(language); formSet.setCountry(country);
formSet = new FormSet(); formSet.setLanguage(language); formSet.setCountry(country);
private void registerValidations(ModuleConfig config) { // Create Forms. ValidatorResources currentResources = getValidatorResources(config); FormSet formSet = new FormSet(); FormBeanConfig[] formConfigs = config.findFormBeanConfigs(); for (int i = 0; i < formConfigs.length; i++) { if (!registeredValidation(currentResources, formConfigs[i])) { Class clazz = ClassUtil.forName(formConfigs[i].getType()); String name = formConfigs[i].getName(); Form form = this.validationCreator.createForm(config, clazz, name); if (form != null) { formSet.addForm(form); if (log.isDebugEnabled()) { log.debug("auto register " + form); } } } } // Initialize ValidatorResources if (formSet.getForms().size() != 0) { ValidatorResources resources = new ValidatorResources(); resources.addFormSet(formSet); resources.process(); addValidatorResources(config, resources); } }