Package org.olat.core.gui.components.form.flexible

Examples of org.olat.core.gui.components.form.flexible.FormItem


   * @param formItemName
   * @return
   */
  private FormItem getFormItem(String formItemName) {
    Map<String, FormItem> comps = container.getFormComponents();
    FormItem foco = comps.get(formItemName);
    return foco;
  }
View Full Code Here


    // ......... 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);
View Full Code Here

          return;
        }       
        /*
         * evaluate normal inner form events
         */
        FormItem fiSrc = fe.getFormItemSource();
        // check for InlineElments
        if(fiSrc instanceof InlineElement){
          this.flc.setDirty(true);
        }
        //
View Full Code Here

     */
    if (actiontype == FormItemDependencyRuleImpl.CUSTOM) {
      applayable.apply(triggerElement, triggerVal, targets);
    } else {
      for (Iterator iter = targets.iterator(); iter.hasNext();) {
        FormItem element = (FormItem) iter.next();
        switch (actiontype) {
          case FormItemDependencyRuleImpl.MAKE_INVISIBLE:
            element.setVisible(false);
            break;
          case FormItemDependencyRuleImpl.MAKE_VISIBLE:
            element.setVisible(true);
            break;
          case FormItemDependencyRuleImpl.MAKE_READONLY:
            element.setEnabled(false);
            break;
          case FormItemDependencyRuleImpl.MAKE_WRITABLE:
            element.setEnabled(true);
            break;
          case FormItemDependencyRuleImpl.HIDE_ERROR:
            element.showError(false);
            break;
          case FormItemDependencyRuleImpl.RESET:
            element.reset();
            break;
          default:
            throw new AssertException("unsupported action in dependency rule");
        }
      }
View Full Code Here

    formLayout.add(closeLink);
    // add all step titles, but disabled.
    Step tmp = startStep;
    maxSteps = 0;
    do {
      FormItem title = tmp.getStepTitle();
      title.setEnabled(false);
      stepTitleLinks.add(title);
      maxSteps++;
      tmp = tmp.nextStep();
    } while (tmp != Step.NOSTEP);
    // init buttons and the like
View Full Code Here

      } else if (event instanceof FormEvent) {
        /*
         * evaluate inner form events
         */
        FormEvent fe = (FormEvent) event;
        FormItem fiSrc = fe.getFormItemSource();
        //
        formInnerEvent(ureq, fiSrc, fe);
        // no need to set container dirty, up to controller code if something is dirty
      }
    }
View Full Code Here

    createOrUpdateSynonymLayout(formLayout, glossItemSynonyms);
  }

  private void createOrUpdateSynonymLayout(FormItemContainer formLayout, ArrayList<String> glossItemSynonymsToUse){
    FormUIFactory formUIf = FormUIFactory.getInstance();
    FormItem synLay = formLayout.getFormComponent("synonymLayout");
    if (synLay != null) {
      formLayout.remove("synonymLayout");
    }
    FormLayoutContainer tmpLayout = FormLayoutContainer.createCustomFormLayout("synonymLayout", getTranslator(), velocity_root
        + "/editSynonym.html");
View Full Code Here

      } else {
        uifactory.addSpacerElement("spacer_" + userPropertyHandler.getName(), formLayout, true);
      }
     
      // add input field to container
      FormItem formItem = userPropertyHandler.addFormItem(getLocale(), this.identity.getUser(), this.usageIdentifier, this.isAdministrativeUser, formLayout);
      String propertyName = userPropertyHandler.getName();
      this.formItems.put(propertyName, formItem);
     
      if (formItem instanceof TextElement) {
        // it's a text field, so get the value of this property into the text field
        TextElement textElement = (TextElement)formItem;
        textElement.setValue(this.identity.getUser().getProperty(propertyName, getLocale()));
      } else if (formItem instanceof MultipleSelectionElement) {
        // it's a checkbox, so set the box to checked if the corresponding property is set to "true"
        MultipleSelectionElement checkbox = (MultipleSelectionElement)formItem;
        String value = this.identity.getUser().getProperty(propertyName, getLocale());
        if (value != null) {
          checkbox.select(propertyName, value.equals("true"));
        } else {
          // assume "false" if the property is not present
          checkbox.select(propertyName, false);
        }
      }
     
      // special case for email field
      if (userPropertyHandler.getName().equals("email")) {
        RegistrationManager rm = RegistrationManager.getInstance();
        String key = this.identity.getUser().getProperty("emchangeKey", null);
        TemporaryKeyImpl tempKey = rm.loadTemporaryKeyByRegistrationKey(key);
        if (tempKey != null) {
          XStream xml = new XStream();
          HashMap<String, String> mails = (HashMap<String, String>) xml.fromXML(tempKey.getEmailAddress());
          formItem.setExampleKey("email.change.form.info", new String[] {mails.get("changedEMail")});
        }
      }
    }
   
    // add the "about me" text field.
View Full Code Here

    // For each user property...
    for (UserPropertyHandler userPropertyHandler : this.userPropertyHandlers) {

      // ...get the value from the form field and store it into the user
      // property...
      FormItem formItem = this.formItems.get(userPropertyHandler.getName());

      userPropertyHandler.updateUserFromFormItem(user, formItem);

      // ...and store the "publish" flag for each property.
      MultipleSelectionElement checkbox = this.publishCheckboxes.get("checkbox_" + userPropertyHandler.getName());
View Full Code Here

   */
  public Identity updateIdentityFromFormData(Identity id) {
    User user = id.getUser();
    // update each user field
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
      FormItem formItem = this.formItems.get(userPropertyHandler.getName());

      userPropertyHandler.updateUserFromFormItem(user, formItem);
    }
    return id;
  }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.form.flexible.FormItem

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.