コード例 #1
0
  /** {@inheritDoc} */
  protected void setupFormValues(
      RequestContext ctx, DynaActionForm form, BaseKickstartCommand cmdIn) {
    KickstartLocaleCommand cmd = (KickstartLocaleCommand) cmdIn;

    ArrayList timezones = cmd.getValidTimezones();
    ctx.getRequest().setAttribute(TIMEZONE_OPTIONS, timezones);

    form.set(TIMEZONE, cmd.getTimezone());
    form.set(USE_UTC, cmd.getKickstartData().isUsingUtc());
  }
コード例 #2
0
  /** {@inheritDoc} */
  protected ValidatorError processFormValues(
      HttpServletRequest request, DynaActionForm form, BaseKickstartCommand cmd) {

    ValidatorError retval = null;

    KickstartLocaleCommand localeCmd = (KickstartLocaleCommand) cmd;
    cmd = null;

    ArrayList validTimezones = localeCmd.getValidTimezones();
    if (isTimezoneValid(validTimezones, form.getString(TIMEZONE)) == Boolean.TRUE) {
      localeCmd.setTimezone(form.getString(TIMEZONE));
    } else {
      retval = new ValidatorError("kickstart.locale." + "validation.timezone.invalid");
    }

    Boolean useUtc = (Boolean) form.get(USE_UTC);

    if (useUtc == null) {
      useUtc = Boolean.FALSE;
    }

    if (localeCmd.getKickstartData().isUsingUtc().booleanValue() && !useUtc.booleanValue()) {
      localeCmd.doNotUseUtc();
    } else if (!localeCmd.getKickstartData().isUsingUtc().booleanValue() && useUtc.booleanValue()) {
      localeCmd.useUtc();
    }

    return retval;
  }