Example #1
0
  public void evaluateParams() {
    super.evaluateParams();

    // override Select's default
    if (StringUtils.isBlank(size)) {
      addParameter("size", "5");
    }
    if (StringUtils.isBlank(multiple)) {
      addParameter("multiple", Boolean.TRUE);
    }

    if (allowMoveUp != null) {
      addParameter("allowMoveUp", findValue(allowMoveUp, Boolean.class));
    }
    if (allowMoveDown != null) {
      addParameter("allowMoveDown", findValue(allowMoveDown, Boolean.class));
    }
    if (allowSelectAll != null) {
      addParameter("allowSelectAll", findValue(allowSelectAll, Boolean.class));
    }

    if (moveUpLabel != null) {
      addParameter("moveUpLabel", findString(moveUpLabel));
    }
    if (moveDownLabel != null) {
      addParameter("moveDownLabel", findString(moveDownLabel));
    }
    if (selectAllLabel != null) {
      addParameter("selectAllLabel", findString(selectAllLabel));
    }

    // inform our form ancestor about this UpDownSelect so the form knows how to
    // auto select all options upon it submission
    Form ancestorForm = (Form) findAncestor(Form.class);
    if (ancestorForm != null) {

      // inform form ancestor that we are using a custom onSubmit
      enableAncestorFormCustomOnsubmit();

      Map m = (Map) ancestorForm.getParameters().get("updownselectIds");
      if (m == null) {
        // map with key -> id ,  value -> headerKey
        m = new LinkedHashMap();
      }
      m.put(getParameters().get("id"), getParameters().get("headerKey"));
      ancestorForm.getParameters().put("updownselectIds", m);
    } else {
      if (LOG.isWarnEnabled()) {
        LOG.warn(
            "no ancestor form found for updownselect "
                + this
                + ", therefore autoselect of all elements upon form submission will not work ");
      }
    }
  }