Package org.olat.core.util.component

Examples of org.olat.core.util.component.FormComponentTraverser


    //
    // step 1: call evalFormRequest(ureq) on each FormComponent this gives
    // ....... for each element the possibility to intermediate save a value.
    // ....... As a sideeffect the formcomponent to be dispatched is found.
    EvaluatingFormComponentVisitor efcv = new EvaluatingFormComponentVisitor(dispatchUri);
    FormComponentTraverser ct = new FormComponentTraverser(efcv, formLayout, false);
    ct.visitAll(ureq);
    // step 2: dispatch to the form component
    // ......... only one component to be dispatched can be found, e.g. clicked
    // ......... element....................................................
    // ......... dispatch changes server model -> rerendered
    // ......... dispatch may also request a form validation by
    // ......... calling the submit
    FormItem dispatchFormItem = efcv.getDispatchToComponent();
    //.......... doDispatchFormRequest is called on the found item
    //.......... which in turn may call submit(UserRequest ureq).
    //.......... After submitting, which fires a ok/nok event
    //.......... the code goes further with step 3.........................
    if (implicitFormSubmit) {
      //implicit Submit (Press Enter without on a Field without submit item.)
      // see also OLAT-3141
      submit(ureq);
    }else{
      if (dispatchFormItem == null) {
        // source not found. This "never happens". Try to produce some hints.
        String fbc = new String();
        for (FormBasicController i: formListeners) {
          if (fbc.length()>0) {
            fbc += ",";
          }
          fbc+=(i.getClass().getName());
        }
        logWarn("OLAT-5061: Could not determine request source in FlexiForm >"+formName+"<. Check >"+fbc+"<", null);
       
        // TODO: what now?
        // Assuming the same as "implicitFormSubmit" for now.
        submit(ureq);
       
      } else {
        // ****************************************
        // explicit Submit or valid form dispatch *
        // ****************************************
        dispatchFormItem.doDispatchFormRequest(ureq);
        // step 3: find parent container of dispatched component
        // .......... check dependency rules
        // .......... apply dependency rules
        FindParentFormComponentVisitor fpfcv = new FindParentFormComponentVisitor(
            dispatchFormItem);
        ct = new FormComponentTraverser(fpfcv, formLayout, false);
        ct.visitAll(ureq);
        fpfcv.getParent().evalDependencyRuleSetFor(ureq, dispatchFormItem);
      }
    }
    //
    action = -1;
View Full Code Here


  /**
   * @param ureq
   */
  public void submit(UserRequest ureq) {
    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;
    // let the businesslogic validate this is implemented by the outside listener
View Full Code Here

  /**
   * @param ureq
   */
  public void reset(UserRequest ureq) {
    ResettingFormComponentVisitor rfcv = new ResettingFormComponentVisitor();
    FormComponentTraverser ct = new FormComponentTraverser(rfcv, formLayout, false);
    ct.visitAll(ureq);//calls reset on all elements!
    //
    evalAllFormDependencyRules(ureq);
    //
    formWrapperComponent.fireFormEvent(ureq, FormEvent.RESET);
    hasAlreadyFired = true;
View Full Code Here

  /**
   * @param ureq
   */
  void evalAllFormDependencyRules(UserRequest ureq) {
    FormDependencyRulesInitComponentVisitor fdrocv = new FormDependencyRulesInitComponentVisitor();
    FormComponentTraverser ct = new FormComponentTraverser(fdrocv, formLayout, false);
    ct.visitAll(ureq);//visit all container and eval container with its elements!
  }
View Full Code Here

TOP

Related Classes of org.olat.core.util.component.FormComponentTraverser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.