Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
0
    public void handleSelection(
        final int rowIndex, final int columnIndex, final SavedSearch savedSearch) {
      Log.debug(
          "SavedSearchesEventHandler.handleSelection("
              + rowIndex
              + ","
              + columnIndex
              + ","
              + savedSearch
              + ")");
      if (columnIndex == 1) {
        GWTServiceLookup.getSearchService()
            .deleteSavedSearch(
                savedSearch.getId(),
                new AsyncCallback<Void>() {
                  @Override
                  public void onFailure(Throwable caught) {}

                  @Override
                  public void onSuccess(Void result) {
                    if (currentSearchId == savedSearch.getId()) {
                      currentSearchId = 0;
                      patternNameField.setValue("", true);
                      patternNameField.setVisible(false);
                      patternNameLabel.setText("");
                      patternNameLabel.setVisible(false);
                      autoCompletePatternField.setFocus(true);
                      starImage.setUrl(STAR_OFF_URL);
                      savedSearchesPanel.hide();
                    }

                    // is user deleting the one and only element in the list?
                    if (savedSearchesGrid.size() == 1) {
                      savedSearchesPanel.hide();
                    }
                    savedSearchesGrid.removeRow(rowIndex);
                  }
                });
      } else {
        activateSavedSearch(savedSearch); // activating the saved search also clicks the button
      }
    }