@Override
  protected void onRangeChanged(HasData<FunctionInfo> display) {
    getData();

    int start = display.getVisibleRange().getStart();
    int end = start + display.getVisibleRange().getLength();
    end = end >= funcList.size() ? funcList.size() : end;
    List<FunctionInfo> sub = funcList.subList(start, end);
    updateRowData(start, sub);
  }
  public void insertRefreshedData(final HasData<Dto> display, final ListQueryResult result) {
    lastRefresh = System.currentTimeMillis();

    final List<Dto> list = new ArrayList<Dto>();

    if (null != result && null != result.getResults()) {
      for (final Dto dto : result.getResults()) {
        list.add(dto);
      }
    }

    display.setRowCount(result == null ? 0 : result.getItemCount(), true);
    display.setRowData(display.getVisibleRange().getStart(), list);
  }
  public void refresh(final HasData<Dto> display) {
    if (lastRefreshTooYoung()) return;

    lastRefresh = System.currentTimeMillis();

    final Range range = display.getVisibleRange();
    final int start = range.getStart();
    final int end = start + range.getLength();

    readService.getAll(
        module,
        start,
        end,
        new AsyncCallback<ListQueryResult>() {
          @Override
          public void onSuccess(ListQueryResult result) {
            insertRefreshedData(display, result);
          }

          @Override
          public void onFailure(Throwable caught) {
            Window.alert("Could not load");
          }
        });
  }
Ejemplo n.º 4
0
 public void refreshList() {
   HasData<DataMockSummary> next = dataProvider.getDataDisplays().iterator().next();
   next.setVisibleRangeAndClearData(next.getVisibleRange(), true);
 }