コード例 #1
0
 public static ScheduleType stringToScheduleType(String strSchedule) throws EnumException {
   for (ScheduleType v : EnumSet.range(ScheduleType.RUN_ONCE, ScheduleType.CRON)) {
     if (v.toString().equals(strSchedule)) {
       return v;
     }
   }
   throw new EnumException(MSGS.invalidTemporalValue(scheduleValue.toString()));
 }
コード例 #2
0
  public enum ScheduleType {
    RUN_ONCE(0, MSGS.runOnce()),
    SECONDS(1, MSGS.seconds()),
    MINUTES(2, MSGS.minutes()),
    HOURS(3, MSGS.hours()),
    DAILY(4, MSGS.daily()),
    WEEKLY(5, MSGS.weekly()),
    MONTHLY(6, MSGS.monthly()),
    YEARLY(7, MSGS.yearly()),
    CRON(8, MSGS.cron());

    private ScheduleType(int value, String name) {
      this.value = value;
      this.name = name;
    }

    private final int value;

    private final String name;

    private static ScheduleType[] scheduleValue = {
      RUN_ONCE, SECONDS, MINUTES, HOURS, DAILY, WEEKLY, MONTHLY, YEARLY, CRON
    };

    public int value() {
      return value;
    }

    public String toString() {
      return name;
    }

    public static ScheduleType get(int idx) {
      return scheduleValue[idx];
    }

    public static int length() {
      return scheduleValue.length;
    }

    public static ScheduleType stringToScheduleType(String strSchedule) throws EnumException {
      for (ScheduleType v : EnumSet.range(ScheduleType.RUN_ONCE, ScheduleType.CRON)) {
        if (v.toString().equals(strSchedule)) {
          return v;
        }
      }
      throw new EnumException(MSGS.invalidTemporalValue(scheduleValue.toString()));
    }
  } /* end enum */
コード例 #3
0
    public EndDatePanel(Date date) {
      final EndDatePanel localThis = this;

      noEndDateRb =
          new RadioButton(END_DATE_RB_GROUP + uniqueInstanceNumber, MSGS.noEndDateLabel());
      noEndDateRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      noEndDateRb.setValue(true);
      add(noEndDateRb);
      HorizontalPanel hp = new HorizontalPanel();
      add(hp);

      HorizontalPanel endByPanel = new HorizontalPanel();
      endByRb = new RadioButton(END_DATE_RB_GROUP + uniqueInstanceNumber, MSGS.endByLabel());
      endByRb.setStyleName("recurrenceRadioButton"); // $NON-NLS-1$
      endByPanel.add(endByRb);
      DefaultFormat format = new DefaultFormat(DateTimeFormat.getShortDateFormat());
      endDatePicker = new DatePickerEx(format);
      endDatePicker.getDatePicker().setStyleName(END_DATE_PICKER);
      endDatePicker.getDatePicker().setEnabled(false);
      endByPanel.add(endDatePicker.getDatePicker());
      endByLabel = new ErrorLabel(endByPanel);
      hp.add(endByLabel);

      noEndDateRb.addClickListener(
          new ClickListener() {
            public void onClick(Widget sender) {
              localThis.endDatePicker.getDatePicker().setEnabled(false);
            }
          });

      endByRb.addClickListener(
          new ClickListener() {
            public void onClick(Widget sender) {
              localThis.endDatePicker.getDatePicker().setEnabled(true);
            }
          });
      reset(date);
      configureOnChangeHandler();
    }