Example #1
0
  @Override
  public void addHandler(final PTInstruction addHandler, final UIService uiService) {

    if (HANDLER.KEY_.DATE_VALUE_CHANGE_HANDLER.equals(addHandler.getString(HANDLER.KEY))) {
      final DateBox dateBox = cast();
      final TextBox textBox = dateBox.getTextBox();
      dateBox.addValueChangeHandler(
          new ValueChangeHandler<Date>() {

            @Override
            public void onValueChange(final ValueChangeEvent<Date> event) {
              triggerEvent(addHandler, uiService, dateBox);
            }
          });
      textBox.addValueChangeHandler(
          new ValueChangeHandler<String>() {

            @Override
            public void onValueChange(final ValueChangeEvent<String> event) {
              triggerEvent(addHandler, uiService, dateBox);
            }
          });
    } else {
      super.addHandler(addHandler, uiService);
    }
  }
 public MethodCallSearch() {
   initWidget(uiBinder.createAndBindUi(this));
   Window.setTitle("Method call search");
   flowBeginDate.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat("dd/MM/yy")));
   flowBeginDate.getTextBox().setVisibleLength(8);
   flowBeginDate.getTextBox().setMaxLength(8);
   flowBeginDate
       .getTextBox()
       .addKeyPressHandler(
           new KeyPressHandler() {
             public void onKeyPress(KeyPressEvent pEvent) {
               presenter.filterData(MethodCallSearch.this, pEvent);
             }
           });
   tableModel = new MetodCallSearchTableModel(service);
   table = tableModel.getTable();
   searchResult.add(table);
 }
Example #3
0
 public FlowSearch() {
   initWidget(sUiBinder.createAndBindUi(this));
   // TODO Replace this hack with a changeTitleEvent
   Window.setTitle("Flow search");
   beginDate.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat("dd/MM/yy")));
   beginDate.getTextBox().setVisibleLength(8);
   beginDate.getTextBox().setMaxLength(8);
   beginDate
       .getTextBox()
       .addKeyPressHandler(
           new KeyPressHandler() {
             public void onKeyPress(KeyPressEvent pEvent) {
               presenter.filterData(FlowSearch.this, pEvent);
             }
           });
   table = new FlowSearchTableModel(service).getTable();
   searchResult.add(table);
 }
Example #4
0
  protected void triggerEvent(
      final PTInstruction addHandler, final UIService uiService, final DateBox dateBox) {
    final PTInstruction instruction = new PTInstruction();
    instruction.setObjectID(addHandler.getObjectID());
    instruction.put(TYPE.KEY, TYPE.KEY_.EVENT);
    instruction.put(HANDLER.KEY, HANDLER.KEY_.DATE_VALUE_CHANGE_HANDLER);
    instruction.put(PROPERTY.VALUE, dateBox.getTextBox().getText());

    uiService.sendDataToServer(dateBox, instruction);
  }
Example #5
0
  private void setupSessionsDateRange() {
    DateTimeFormat format =
        DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.YEAR_MONTH_NUM_DAY);

    sessionsFrom.setFormat(new DateBox.DefaultFormat(format));
    sessionsTo.setFormat(new DateBox.DefaultFormat(format));

    sessionsFrom
        .getTextBox()
        .addValueChangeHandler(new EmptyDateBoxValueChangePropagator(sessionsFrom));
    sessionsTo
        .getTextBox()
        .addValueChangeHandler(new EmptyDateBoxValueChangePropagator(sessionsTo));

    final ValueChangeHandler<Date> valueChangeHandler =
        new ValueChangeHandler<Date>() {

          @Override
          public void onValueChange(ValueChangeEvent<Date> dateValueChangeEvent) {
            sessionIdsTextBox.setValue(null);
            Date fromDate = sessionsFrom.getValue();
            Date toDate = sessionsTo.getValue();

            if (fromDate == null || toDate == null) {
              sessionDataProvider.addDataDisplayIfNotExists(sessionsDataGrid);
              sessionDataForDatePeriodAsyncProvider.removeDataDisplayIfNotExists(sessionsDataGrid);

              return;
            }

            sessionDataForDatePeriodAsyncProvider.setDateRange(fromDate, toDate);

            sessionDataProvider.removeDataDisplayIfNotExists(sessionsDataGrid);
            sessionDataForSessionIdsAsyncProvider.removeDataDisplayIfNotExists(sessionsDataGrid);
            sessionDataForDatePeriodAsyncProvider.addDataDisplayIfNotExists(sessionsDataGrid);
          }
        };

    sessionsTo.addValueChangeHandler(valueChangeHandler);
    sessionsFrom.addValueChangeHandler(valueChangeHandler);
  }
Example #6
0
  @SuppressWarnings("unused")
  private HorizontalPanel getDatePanel() {
    HorizontalPanel panel = new HorizontalPanel();

    startDate.setFormat((new DateBox.DefaultFormat(DateTimeFormat.getFormat("dd/MM/yyyy"))));
    startDate.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          public void onValueChange(ValueChangeEvent<Date> event) {
            exp.setStartDate("" + ((DateBox) (event.getSource())).getTextBox().getValue());
          }
        });
    startDate
        .getTextBox()
        .addValueChangeHandler(
            new ValueChangeHandler<String>() {
              public void onValueChange(ValueChangeEvent<String> event) {
                String value = ((TextBox) (event.getSource())).getValue();
                exp.setStartDate(value.equals("") ? null : value);
              }
            });

    endDate.setFormat((new DateBox.DefaultFormat(DateTimeFormat.getFormat("dd/MM/yyyy"))));
    endDate.addValueChangeHandler(
        new ValueChangeHandler<Date>() {
          public void onValueChange(ValueChangeEvent<Date> event) {
            exp.setEndDate(((DateBox) (event.getSource())).getTextBox().getValue());
          }
        });
    endDate
        .getTextBox()
        .addValueChangeHandler(
            new ValueChangeHandler<String>() {
              public void onValueChange(ValueChangeEvent<String> event) {
                String value = ((TextBox) (event.getSource())).getValue();
                exp.setEndDate(value.equals("") ? null : value);
              }
            });

    final ListBox type = new ListBox();
    type.addItem(constants.exportCreate(), "create");
    type.addItem(constants.exportUpdate(), "update");
    type.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            if (type.getValue(type.getSelectedIndex()).length() > 0) {
              exp.setDateType(type.getValue(type.getSelectedIndex()));
            } else {
              exp.setDateType(null);
            }
          }
        });

    Grid table = new Grid(1, 5);
    table.setWidget(0, 0, type);
    table.setWidget(0, 1, new HTML(constants.exportFrom()));
    table.setWidget(0, 2, startDate);
    table.setWidget(0, 3, new HTML(constants.exportTo()));
    table.setWidget(0, 4, endDate);

    panel.add(table);

    return panel;
  }
Example #7
0
 public TextBox getTextBox() {
   return dateBox.getTextBox();
 }
Example #8
0
 /**
  * Gets the text of the box
  *
  * @return
  */
 public String getText() {
   return dateBox.getTextBox().getText();
 }