Search in sources :

Example 1 with AbstractHasData

use of com.google.gwt.user.cellview.client.AbstractHasData in project rstudio by rstudio.

the class HistoryAsyncDataProvider method onRangeChanged.

@Override
public void onRangeChanged(final HasData<CommitInfo> display) {
    final Range rng = display.getVisibleRange();
    final int start = rng.getStart();
    final int length = rng.getLength();
    if (length == 0)
        return;
    getHistory(rev_, fileFilter_.getValue(), start, length, searchText_.getValue(), new SimpleRequestCallback<RpcObjectList<CommitInfo>>("Error Fetching History") {

        @Override
        public void onResponseReceived(RpcObjectList<CommitInfo> response) {
            super.onResponseReceived(response);
            if (response.length() < length)
                updateRowCount(start + response.length(), true);
            updateRowData(start, response.toArrayList());
        }

        @Override
        public void onError(ServerError error) {
            if (display instanceof AbstractHasData) {
                display.setVisibleRangeAndClearData(new Range(start, 0), true);
            }
            if (strategy_.getShowHistoryErrors())
                super.onError(error);
            else
                Debug.logError(error);
        }
    });
}
Also used : RpcObjectList(org.rstudio.core.client.jsonrpc.RpcObjectList) ServerError(org.rstudio.studio.client.server.ServerError) Range(com.google.gwt.view.client.Range) AbstractHasData(com.google.gwt.user.cellview.client.AbstractHasData)

Aggregations

AbstractHasData (com.google.gwt.user.cellview.client.AbstractHasData)1 Range (com.google.gwt.view.client.Range)1 RpcObjectList (org.rstudio.core.client.jsonrpc.RpcObjectList)1 ServerError (org.rstudio.studio.client.server.ServerError)1