Example #1
0
  /**
   * Refresh current view of table, fetching new data from server by asynchronous call. This is
   * expected to be called by any methods that want to refresh the view of table after edits to the
   * database.
   */
  public void refreshTableCurrentView() {
    AsyncCallback<List<HouseData>> callback =
        new AsyncCallback<List<HouseData>>() {
          @Override
          public void onFailure(Throwable caught) {
            Window.alert(caught.getMessage());
          }

          @Override
          public void onSuccess(List<HouseData> result) {
            dataProvider.updateRowData(currentStartItem, result);
          }
        };
    houseDataSvc.getHouses(currentStartItem, pageLength, callback);
  }
Example #2
0
  /**
   * Update the number of rows to the length of the current working set in in the server. Current
   * working set refers to either search results, or the entire database.
   */
  private void updateRowCount() {
    AsyncCallback<Integer> callback =
        new AsyncCallback<Integer>() {
          @Override
          public void onFailure(Throwable caught) {
            Window.alert(caught.getMessage());
          }

          @Override
          public void onSuccess(Integer result) {
            dataProvider.updateRowCount(result, true);
            databaseLength = result;
          }
        };
    houseDataSvc.getHouseDatabaseLength(callback);
  }
Example #3
0
  /**
   * Refreshes the table from the beginning. This is expected to be called by search methods to
   * update table with the search results.
   */
  public void refreshTableFromBeginning() {
    // Refresh the count of rows (Because now it's showing search results)
    updateRowCount();

    // Fetch new data from the server
    AsyncCallback<List<HouseData>> callback =
        new AsyncCallback<List<HouseData>>() {
          @Override
          public void onFailure(Throwable caught) {
            Window.alert(caught.getMessage());
          }

          @Override
          public void onSuccess(List<HouseData> result) {
            dataProvider.updateRowData(0, result);
          }
        };
    houseDataSvc.getHouses(0, pageLength, callback);
  }