예제 #1
0
 public Date getBeforeDate() {
   if (beforeCheckBox.getValue()) {
     return beforeDateBox.getDate();
   }
   return null;
 }
예제 #2
0
 public Date getAfterDate() {
   if (afterCheckBox.getValue()) {
     return afterDateBox.getDate();
   }
   return null;
 }
예제 #3
0
  /** @param jobs */
  public void initUI(JsArray<JsJob> jobs) {
    if (jobs != null) {
      for (int i = 0; i < jobs.length(); i++) {
        resourceOracle.add(jobs.get(i).getShortResourceName());
      }
    }

    resourceSuggestBox.setWidth("240px");
    userListBox.setWidth("200px");
    userListBox.getElement().getStyle().setTextTransform(Style.TextTransform.CAPITALIZE);
    scheduleStateListBox.setWidth("200px");
    scheduleTypeListBox.setWidth("200px");

    // next execution filter
    CaptionPanel executionFilterCaptionPanel =
        new CaptionPanel(Messages.getString("executionTime"));
    FlexTable executionFilterPanel = new FlexTable();
    executionFilterPanel.setWidget(0, 0, beforeCheckBox);
    executionFilterPanel.setWidget(0, 1, beforeDateBox);
    executionFilterPanel.setWidget(1, 0, afterCheckBox);
    executionFilterPanel.setWidget(1, 1, afterDateBox);
    executionFilterCaptionPanel.add(executionFilterPanel);

    afterCheckBox.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            afterDateBox.setEnabled(event.getValue());
          }
        });

    beforeCheckBox.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            beforeDateBox.setEnabled(event.getValue());
          }
        });
    beforeDateBox.setEnabled(beforeCheckBox.getValue());
    afterDateBox.setEnabled(afterCheckBox.getValue());

    final String showAll = Messages.getString("showAll");
    // user filter
    int selectedIndex = getSelectedIndex(userListBox);
    userListBox.clear();
    userListBox.addItem(showAll);
    HashSet<String> uniqueUsers = new HashSet<String>();
    if (jobs != null) {
      for (int i = 0; i < jobs.length(); i++) {
        uniqueUsers.add(jobs.get(i).getUserName());
      }
    }
    for (String user : uniqueUsers) {
      userListBox.addItem(user);
    }
    userListBox.setSelectedIndex(selectedIndex);

    // state filter
    scheduleStateListBox.setVisibleItemCount(1);
    selectedIndex = getSelectedIndex(scheduleStateListBox);
    scheduleStateListBox.clear();
    // NORMAL, PAUSED, COMPLETE, ERROR, BLOCKED, UNKNOWN
    scheduleStateListBox.addItem(showAll, ScheduleStateEnum.SHOWALL.getValue());
    scheduleStateListBox.addItem(Messages.getString("normal"), ScheduleStateEnum.NORMAL.getValue());
    scheduleStateListBox.addItem(Messages.getString("paused"), ScheduleStateEnum.PAUSED.getValue());
    scheduleStateListBox.addItem(
        Messages.getString("complete"), ScheduleStateEnum.COMPLETE.getValue());
    scheduleStateListBox.addItem(Messages.getString("error"), ScheduleStateEnum.ERROR.getValue());
    scheduleStateListBox.addItem(
        Messages.getString("blocked"), ScheduleStateEnum.BLOCKED.getValue());
    scheduleStateListBox.addItem(
        Messages.getString("unknown"), ScheduleStateEnum.UNKNOWN.getValue());
    scheduleStateListBox.setSelectedIndex(selectedIndex);

    // state filter
    scheduleTypeListBox.setVisibleItemCount(1);
    selectedIndex = getSelectedIndex(scheduleTypeListBox);
    scheduleTypeListBox.clear();
    // DAILY, WEEKLY, MONTHLY, YEARLY
    scheduleTypeListBox.addItem(showAll, ScheduleStateEnum.SHOWALL.getValue());
    scheduleTypeListBox.addItem(
        Messages.getString("schedule.daily"), ScheduleTypeEnum.DAILY.getValue());
    scheduleTypeListBox.addItem(
        Messages.getString("schedule.weekly"), ScheduleTypeEnum.WEEKLY.getValue());
    scheduleTypeListBox.addItem(
        Messages.getString("schedule.monthly"), ScheduleTypeEnum.MONTHLY.getValue());
    scheduleTypeListBox.addItem(
        Messages.getString("schedule.yearly"), ScheduleTypeEnum.YEARLY.getValue());
    scheduleTypeListBox.setSelectedIndex(selectedIndex);

    FlexTable filterPanel = new FlexTable();
    filterPanel.setWidget(0, 0, new Label(Messages.getString("scheduledResource")));
    filterPanel.setWidget(1, 0, resourceSuggestBox);

    filterPanel.setWidget(2, 0, new Label(Messages.getString("_user")));
    filterPanel.setWidget(3, 0, userListBox);

    filterPanel.setWidget(4, 0, new Label(Messages.getString("scheduleState")));
    filterPanel.setWidget(5, 0, scheduleStateListBox);

    filterPanel.setWidget(6, 0, new Label(Messages.getString("scheduleType")));
    filterPanel.setWidget(7, 0, scheduleTypeListBox);

    filterPanel.setWidget(8, 0, executionFilterCaptionPanel);

    setContent(filterPanel);
  }