Search in sources :

Example 6 with FormComponentTraverser

use of org.olat.core.util.component.FormComponentTraverser in project openolat by klemens.

the class Form method reset.

/**
 * @param ureq
 */
public void reset(UserRequest ureq) {
    ResettingFormComponentVisitor rfcv = new ResettingFormComponentVisitor();
    FormComponentTraverser ct = new FormComponentTraverser(rfcv, formLayout, false);
    // calls reset on all elements!
    ct.visitAll(ureq);
    // 
    evalAllFormDependencyRules(ureq);
    // 
    formWrapperComponent.fireFormEvent(ureq, FormEvent.RESET);
    hasAlreadyFired = true;
}
Also used : FormComponentTraverser(org.olat.core.util.component.FormComponentTraverser)

Example 7 with FormComponentTraverser

use of org.olat.core.util.component.FormComponentTraverser in project openolat by klemens.

the class Form method submit.

private final void submit(UserRequest ureq, Event validationOkEvent) {
    ValidatingFormComponentVisitor vfcv = new ValidatingFormComponentVisitor();
    FormComponentTraverser ct = new FormComponentTraverser(vfcv, formLayout, false);
    ct.visitAll(ureq);
    // validate all form elements and gather validation status
    ValidationStatus[] status = vfcv.getStatus();
    // 
    boolean isValid = status == null || status.length == 0;
    for (Iterator<FormBasicController> iterator = formListeners.iterator(); iterator.hasNext(); ) {
        FormBasicController fbc = iterator.next();
        // let all listeners validate and calc the total isValid
        // let further validate even if one fails.
        isValid = fbc.validateFormLogic(ureq) && isValid;
    }
    formWrapperComponent.fireValidation(ureq, isValid, validationOkEvent);
    isValidAndSubmitted = isValid;
    hasAlreadyFired = true;
}
Also used : ValidationStatus(org.olat.core.util.ValidationStatus) FormComponentTraverser(org.olat.core.util.component.FormComponentTraverser)

Example 8 with FormComponentTraverser

use of org.olat.core.util.component.FormComponentTraverser in project openolat by klemens.

the class Form method evalAllFormDependencyRules.

/**
 * @param ureq
 */
void evalAllFormDependencyRules(UserRequest ureq) {
    FormDependencyRulesInitComponentVisitor fdrocv = new FormDependencyRulesInitComponentVisitor();
    FormComponentTraverser ct = new FormComponentTraverser(fdrocv, formLayout, false);
    // visit all container and eval container with its elements!
    ct.visitAll(ureq);
}
Also used : FormComponentTraverser(org.olat.core.util.component.FormComponentTraverser)

Aggregations

FormComponentTraverser (org.olat.core.util.component.FormComponentTraverser)8 IOException (java.io.IOException)2 ServletException (javax.servlet.ServletException)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2 Submit (org.olat.core.gui.components.form.flexible.elements.Submit)2 AssertException (org.olat.core.logging.AssertException)2 ValidationStatus (org.olat.core.util.ValidationStatus)2