Beispiel #1
0
  private void setupAutoCompletingPatternField() {
    autoCompletePatternField.getElement().setId("patternField");
    autoCompletePatternField.setStyleName("patternField");

    AutoCompletePatternFieldEventHandler handler = new AutoCompletePatternFieldEventHandler();
    autoCompletePatternField.getTextBox().addFocusHandler(handler);
    autoCompletePatternField.getTextBox().addBlurHandler(handler);
    autoCompletePatternField.addKeyPressHandler(handler);
  }
Beispiel #2
0
  private void turnNameFieldIntoLabel() {
    String name = patternNameField.getText();

    if (name.equalsIgnoreCase(DEFAULT_PATTERN_NAME)) {
      name = "";
    }

    arrowImage.setVisible(true);
    patternNameField.setVisible(false);

    if (name.equals("")) {
      GWTServiceLookup.getSearchService().deleteSavedSearch(currentSearchId, blackHoleCallback);
      currentSearchId = 0;
      starImage.setUrl(STAR_OFF_URL);
    } else {
      // NOTE: currently do not support updated a saved search pattern
      if (currentSearchId == 0) {
        String pattern = autoCompletePatternField.getText();
        createSavedSearch(name, pattern);
      } else {
        updateSavedSearchName(currentSearchId, name);
      }
      patternNameLabel.setText(elipse(name));
      patternNameLabel.setVisible(true);
      starImage.setUrl(STAR_ON_URL);
    }
  }
Beispiel #3
0
 public void activateSavedSearch(SavedSearch savedSearch) {
   currentSearchId = savedSearch.getId();
   autoCompletePatternField.setValue(savedSearch.getPattern(), true);
   patternNameField.setValue(savedSearch.getName(), true);
   Log.debug(
       "search results change: [" + savedSearch.getName() + "," + savedSearch.getPattern() + "]");
   turnNameFieldIntoLabel();
   savedSearchesPanel.hide();
   click(searchButton);
 }