protected CheckboxItem createActivateCheckboxItem(final ListGridRecord ruleRecord) {
   CheckboxItem checkBox = new CheckboxItem(ACTIVATED_FIELD, " ");
   checkBox.setValue(ruleRecord.getAttributeAsBoolean(SUBSCRIBED));
   checkBox.addChangedHandler(createActivateChangedHandler(ruleRecord));
   return checkBox;
 }
  private void initComponents() {
    HLayout formsHLayout = new HLayout();
    formsHLayout.setWidth100();
    formsHLayout.setHeight("*");
    formsHLayout.setMembersMargin(5);

    DynamicForm jobNamesForm = new DynamicForm();
    jobNamesForm.setWidth100();
    jobNamesForm.setHeight100();
    jobNamesForm.setGroupTitle("Filter Jobs");
    jobNamesForm.setIsGroup(true);
    jobNamesForm.setTitleOrientation(TitleOrientation.TOP);
    jobNamesForm.setNumCols(2);
    jobNamesForm.setValuesManager(valuesManager);

    jobNamesForm.setDataFetchMode(FetchMode.BASIC);

    CheckboxItem selectAllJobNamesChkItem = new CheckboxItem();
    selectAllJobNamesChkItem.setValue(true);
    selectAllJobNamesChkItem.setTitle("Select All Jobs");
    selectAllJobNamesChkItem.setWidth("*");
    selectAllJobNamesChkItem.setName("selectAllJobNames");
    selectAllJobNamesChkItem.addChangedHandler(
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {
            if ((Boolean) event.getValue()) {
              selectJobNameGrid.setDisabled(true);
              selectJobNameGrid.setCriterion(null);
            } else {
              selectJobNameGrid.setDisabled(false);
              // selectJobNameGrid.setCriterion(new Criterion().seta);
            }
          }
        });

    selectJobNameGrid.setTitle("Select Jobs");
    selectJobNameGrid.setWidth(280);
    selectJobNameGrid.setMultiple(true);
    selectJobNameGrid.setMultipleAppearance(MultipleAppearance.GRID);
    selectJobNameGrid.setValueMap("job", "job1", "job2", "Goat", "Marmoset", "Mouse");
    selectJobNameGrid.setName("selectedJobNames");
    selectJobNameGrid.setCriteriaField("selectedJobNames");
    /*selectJobNameGrid.addClickHandler(new ClickHandler() {
    	@Override
    	public void onClick(ClickEvent event) {
    		if(event.getSource().equals(selectJobNameGrid)){
    			String[] values = selectJobNameGrid.getValues();
    			valuesManager.setAttribute("selectedJobNames", values, true);
    		}
    	}
    });*/

    executionStartDate.setName("executionStartDate");
    executionStartDate.setTitle("Exceution Start Date");
    executionStartDate.setRequired(true);

    executionEndDate.setName("executionEndDate");
    executionEndDate.setTitle("Exceution End Date");
    executionEndDate.setRequired(true);

    executionStartTime.setName("executionStartTime");
    executionStartTime.setTitle("Exceution Start Time");
    executionStartTime.setRequired(true);

    executionEndTime.setName("executionEndTime");
    executionEndTime.setTitle("Exceution End Time");
    executionEndTime.setRequired(true);

    FormItem[] formItems =
        new FormItem[] {
          selectAllJobNamesChkItem,
          selectJobNameGrid,
          executionStartDate,
          executionStartTime,
          executionEndDate,
          executionEndTime
        };
    jobNamesForm.setDataSource(HistoricalJobMonitorDataSource.getInstance(), formItems);
    jobNamesForm.setFields(formItems);
    formsHLayout.addMember(jobNamesForm);

    addMember(formsHLayout);

    addMember(searchButton);
  }
Ejemplo n.º 3
0
  private void refresh() {
    form.clearValues();
    form.clearErrors(false);

    if (form != null) form.destroy();

    if (formsContainer.contains(form)) formsContainer.removeChild(form);

    form = new DynamicForm();
    form.setNumCols(2);
    form.setTitleOrientation(TitleOrientation.TOP);

    TextItem include = ItemFactory.newTextItem("include", "include", account.getIncludes());
    include.addChangedHandler(changedHandler);

    TextItem exclude = ItemFactory.newTextItem("exclude", "exclude", account.getExcludes());
    exclude.addChangedHandler(changedHandler);

    TextItem folder = ItemFactory.newTextItem("mailfolder", "mailfolder", account.getMailFolder());
    folder.addChangedHandler(changedHandler);

    SelectItem format = ItemFactory.newSelectItem("format", "format");
    LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
    map.put("0", I18N.message("multiplefiles"));
    map.put("1", I18N.message("singleeml"));
    format.setValueMap(map);
    format.addChangedHandler(changedHandler);
    format.setValue(Integer.toString(account.getFormat()));

    CheckboxItem deleteFomMailbox = new CheckboxItem();
    deleteFomMailbox.setName("delete");
    deleteFomMailbox.setTitle(I18N.message("deletefrommailbox"));
    deleteFomMailbox.setRedrawOnChange(true);
    deleteFomMailbox.setWidth(50);
    deleteFomMailbox.addChangedHandler(changedHandler);
    deleteFomMailbox.setValue(account.isDeleteFromMailbox());

    final DateItem startDate = ItemFactory.newDateItem("startdate", "earliestdate");
    startDate.addChangedHandler(changedHandler);
    startDate.setValue(account.getStartDate());
    startDate.setUseMask(false);
    startDate.setShowPickerIcon(true);
    startDate.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
    startDate.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if ("backspace".equals(event.getKeyName().toLowerCase())
                || "delete".equals(event.getKeyName().toLowerCase())) {
              startDate.clearValue();
              startDate.setValue((Date) null);
              changedHandler.onChanged(null);
            } else {
              changedHandler.onChanged(null);
            }
          }
        });

    form.setItems(folder, format, include, exclude, startDate, deleteFomMailbox);

    formsContainer.addMember(form);
  }