Ejemplo n.º 1
0
  public boolean perform(
      Translator_Base translator,
      HttpServlet servlet,
      HttpServletRequest request,
      HttpServletResponse response,
      String userId,
      ValidProp prop)
      throws java.io.IOException, javax.servlet.ServletException {
    logger.info("UIControl_FixedHeader:perform - entering");
    // dumpRequest(request);

    if (parseString(request, Translator_UserPreferences.SAVE_OPTION).length() > 0) {
      try {
        if (hasValue(parseString(request, UIControl_FixedHeader.CONTROL_NAME))) {
          UserDisplayPrefs.setUserPropValue(translator, userId, prop, "on");
        } else {
          UserDisplayPrefs.setUserPropValue(translator, userId, prop, "off");
        }
      } catch (Exception e) {
        e.printStackTrace();
        throw new javax.servlet.ServletException(e);
      }
    }

    return true;
  }
Ejemplo n.º 2
0
  public String getUiDisplay(
      Translator_Base translator, HttpServletRequest request, String userId, ValidProp prop) {
    // dumpRequest(request);
    // dumpSession(request);

    try {
      // -----------------------------------------------------------------------
      // GET VALUE

      String value = parseString(request, UIControl_FixedHeader.CONTROL_NAME);
      String dataChange = parseString(request, Translator_UserPreferences.DATA_CHANGE);
      if (hasValue(dataChange) && dataChange.equalsIgnoreCase("true") && hasValue(value) == false) {
        value = "off";
      }
      if (hasValue(parseString(request, Translator_UserPreferences.RESTORE_OPTION))) {
        value = UIControl_FixedHeader.SYSTEM_VALUE;
      }
      if (hasValue(value) == false
          || hasValue(parseString(request, Translator_UserPreferences.CANCEL_OPTION))) {
        value =
            UserDisplayPrefs.getUserPropValue(translator, userId, UIControl_FixedHeader.SHORT_NAME);
      }

      // -----------------------------------------------------------------------
      // BUILD CONTROL

      Input control = new Input(Input.CHECKBOX, UIControl_FixedHeader.CONTROL_NAME);
      control.setOnChange("submitForm()");
      if (value.equalsIgnoreCase("on")) {
        control.setChecked(true);
      }

      // logger.debug(control);
      return control.toString();
    } catch (Exception e) {
      e.printStackTrace();
    }

    return new String();
  }