Package org.olat.core.gui.formelements

Examples of org.olat.core.gui.formelements.FormElement


   */
  public void setAllFormElements(boolean readOnly) {
    Iterator it_formelemnames = getNameIterator();
    while (it_formelemnames.hasNext()) {
      String name = (String) it_formelemnames.next();
      FormElement fe = getFormElement(name);
      fe.setReadOnly(readOnly);
    }
  }
View Full Code Here


      Map recMap = null;
      Iterator it_formelemnames = getNameIterator();
      while (it_formelemnames.hasNext()) {
        String name = (String) it_formelemnames.next();
        String[] values = ureq.getHttpReq().getParameterValues(name);
        FormElement fe = getFormElement(name);
        fe.clearError(); // clear any previous errors
        if (!fe.isReadOnly()) {
          fe.setValues(values);
        }
      }

      // get selected submit key
      Set parameters = ureq.getParameterSet();
View Full Code Here

    renderFormHeader(f, formElementsSO, ubu, renderer.getGlobalSettings().getAjaxFlags());   
   
    Iterator it_names = f.getNameIterator();
    while (it_names.hasNext()) {
      String name = (String) it_names.next();
      FormElement fe = f.getFormElement(name);
      if (fe.isError()) {
        error = true;
      }
      renderFormElement(f, fe, formElementsSO, translator, ubu, args);
    }
View Full Code Here

   */
  public void renderBodyOnLoadJSFunctionCall(Renderer renderer, StringOutput sb, Component source, RenderingState rstate) {
    StringBuffer tmp = new StringBuffer();
    Form f = (Form) source;
    String foName = f.getComponentName();
    FormElement focusElem = null, mandatoryElem = null, firstElem = null;
    // PRE: f.isVisible() ensured by renderer
    if (!f.isValid() && !f.isDisplayOnly()) {
      // focus on first error, or on the first element if there is no error
      Iterator it_formelemnames = f.getNameIterator();
      while (it_formelemnames.hasNext()) { // guaranteed correct order since
                                            // linkedhashmap
        String name = (String) it_formelemnames.next();
        FormElement fe = f.getFormElement(name);
        if (!fe.isReadOnly()) {
          if (firstElem == null) firstElem = fe;
          if (fe.isError()) {
            focusElem = fe;
            break;
          } else if (fe.isMandatory()) {
            if (mandatoryElem == null) mandatoryElem = fe; // focus first
                                                            // mandatory element
          }
        }
      }
View Full Code Here

  private void renderElementVisibilityDependencyRules(Form f, StringOutput sb) {
    List rules = f.getVisibilityDependsOnSelectionRules();
    Iterator iter = rules.iterator();
    while (iter.hasNext()) {
      VisibilityDependsOnSelectionRule rule = (VisibilityDependsOnSelectionRule) iter.next();
      FormElement dependentElement = rule.getDependentElement();
      SelectionElement selection = rule.getSelectionElement();
      String resetValueOrig = rule.getResetValue();
      String resetValue = null;
      if (resetValueOrig != null) {
        // quote return caracters to fill into js variable
        resetValue = resetValueOrig.replaceAll("\n", "\\\\n");
        resetValue = resetValue.replaceAll("\r", "\\\\n");
      }
      sb.append("b_form_updateFormElementVisibility('")
      .append(f.getComponentName())
      .append("','")
      .append(selection.getName())
      .append("','")
      .append(dependentElement.getName())
      .append("','")
      .append(rule.getVisibilityRuleValue())
      .append("',")
      .append(String.valueOf(rule.isVisibilityRuleResult()))
      .append(",\"")
View Full Code Here

        String login = searchform.getTextElement("login").getValue();
        // build user fields search map
        Map<String, String> userPropertiesSearch = new HashMap<String, String>();       
        for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) {
          if (userPropertyHandler == null) continue;
          FormElement ui = searchform.getFormElement(userPropertyHandler.getName());
          String uiValue = userPropertyHandler.getStringValue(ui);
          if (StringHelper.containsNonWhitespace(uiValue)) {
            userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
          }
        }
View Full Code Here

    UserManager um = UserManager.getInstance();
    userPropertyHandlers = um.getUserPropertyHandlersFor(formIdentifyer, isAdmin);
    // Add all available user fields to this form
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
      if (userPropertyHandler == null) continue;
      FormElement ui = userPropertyHandler.getFormElement(getLocale(), null, formIdentifyer, false);
      addFormElement(userPropertyHandler.getName(), ui);
    }
   
    addSubmitKey("submit.search", "submit");
    if (cancelbutton) setCancelKey("submit.cancel");
View Full Code Here

    // override for admins
    if (isAdmin) return true;
   
    boolean filled = !getTextElement("login").isEmpty();
    StringBuffer  full = new StringBuffer(getTextElement("login").getValue().trim())
    FormElement lastFormElement = getFormElement("login");
   
    // DO NOT validate each user field => see OLAT-3324
    // this are custom fields in a Search Form
    // the same validation logic can not be applied
    // i.e. email must be searchable and not about getting an error like
    // "this e-mail exists already"
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
      FormElement ui = getFormElement(userPropertyHandler.getName());
        String uiValue = userPropertyHandler.getStringValue(ui);
        // add value for later non-empty search check
        if (StringHelper.containsNonWhitespace(uiValue)) {
          full.append(uiValue.trim());
          filled = true;
View Full Code Here

    // get user fields from form
    // build user fields search map
    Map<String, String> userPropertiesSearch = new HashMap<String, String>();
    for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) {
      if (userPropertyHandler == null) continue;
      FormElement ui = searchform.getFormElement(userPropertyHandler.getName());
      String uiValue = userPropertyHandler.getStringValue(ui);
      if (StringHelper.containsNonWhitespace(uiValue)) {
        userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
      }
    }
View Full Code Here

    userPropertyHandlers = um.getUserPropertyHandlersFor(formIdentifyer, true);
    String currentGroup = null;
    // Add all available user fields to this form
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
      if (userPropertyHandler == null) continue;
      FormElement ui = userPropertyHandler.getFormElement(getLocale(), null, formIdentifyer, true);
      String group = userPropertyHandler.getGroup();
      if (!group.equals(currentGroup)) {
        if (currentGroup != null) addFormElement("spacer_" + group, new SpacerElement());
        currentGroup = group;
      }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.formelements.FormElement

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.