Example #1
0
 @UiHandler("clearSessionFiltersButton")
 void handleClearSessionFiltersButtonClick(ClickEvent e) {
   sessionsTo.setValue(null, true);
   sessionsFrom.setValue(null, true);
   sessionIdsTextBox.setText(null);
   stopTypingSessionIdsTimer.schedule(10);
 }
Example #2
0
  private void filterSessions(Set<SessionDataDto> sessionDataDtoSet) {
    if (sessionDataDtoSet == null || sessionDataDtoSet.isEmpty()) {
      sessionIdsTextBox.setText(null);
      stopTypingSessionIdsTimer.schedule(10);

      return;
    }

    final StringBuilder builder = new StringBuilder();
    boolean first = true;
    for (SessionDataDto sessionDataDto : sessionDataDtoSet) {
      if (!first) {
        builder.append("/");
      }
      builder.append(sessionDataDto.getSessionId());
      first = false;
    }
    sessionIdsTextBox.setText(builder.toString());
    stopTypingSessionIdsTimer.schedule(10);
  }
Example #3
0
  private void setupSessionNumberTextBox() {
    stopTypingSessionIdsTimer =
        new Timer() {

          @Override
          public void run() {
            final String currentContent = sessionIdsTextBox.getText().trim();

            // If session ID text box is empty then load all sessions
            if (currentContent == null || currentContent.isEmpty()) {
              sessionDataProvider.addDataDisplayIfNotExists(sessionsDataGrid);
              sessionDataForSessionIdsAsyncProvider.removeDataDisplayIfNotExists(sessionsDataGrid);

              return;
            }

            Set<String> sessionIds = new HashSet<String>();
            if (currentContent.contains(",")
                || currentContent.contains(";")
                || currentContent.contains("/")) {
              sessionIds.addAll(Arrays.asList(currentContent.split("\\s*[,;/]\\s*")));
            } else {
              sessionIds.add(currentContent);
            }

            sessionDataForSessionIdsAsyncProvider.setSessionIds(sessionIds);

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

    sessionIdsTextBox.addKeyUpHandler(
        new KeyUpHandler() {
          @Override
          public void onKeyUp(KeyUpEvent event) {
            sessionsFrom.setValue(null);
            sessionsTo.setValue(null);
            stopTypingSessionIdsTimer.schedule(500);
          }
        });
  }