Search in sources :

Example 1 with Range

use of com.google.gwt.view.client.Range 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)

Example 2 with Range

use of com.google.gwt.view.client.Range in project blogwt by billy1380.

the class SimplePager method createText.

/**
 * Get the text to display in the pager that reflects the state of the pager.
 *
 * @return the text
 */
protected String createText() {
    // Default text is 1 based.
    NumberFormat formatter = NumberFormat.getFormat("#,###");
    HasRows display = getDisplay();
    Range range = display.getVisibleRange();
    int pageStart = range.getStart() + 1;
    int pageSize = range.getLength();
    int dataSize = display.getRowCount();
    int endIndex = Math.min(dataSize, pageStart + pageSize - 1);
    endIndex = Math.max(pageStart, endIndex);
    boolean exact = display.isRowCountExact();
    return formatter.format(pageStart) + "-" + formatter.format(endIndex) + (exact ? " of " : " of over ") + formatter.format(dataSize);
}
Also used : HasRows(com.google.gwt.view.client.HasRows) Range(com.google.gwt.view.client.Range) NumberFormat(com.google.gwt.i18n.client.NumberFormat)

Example 3 with Range

use of com.google.gwt.view.client.Range in project blogwt by billy1380.

the class GeneratedDownloadController method onRangeChanged.

/* (non-Javadoc)
	 * 
	 * @see
	 * com.google.gwt.view.client.AbstractDataProvider#onRangeChanged(com.google
	 * .gwt.view.client.HasData) */
@Override
protected void onRangeChanged(HasData<GeneratedDownload> display) {
    Range range = display.getVisibleRange();
    pager.start(Integer.valueOf(range.getStart())).count(Integer.valueOf(range.getLength()));
    fetchGeneratedDownloads();
}
Also used : Range(com.google.gwt.view.client.Range)

Example 4 with Range

use of com.google.gwt.view.client.Range in project blogwt by billy1380.

the class PageController method onRangeChanged.

/* (non-Javadoc)
	 * 
	 * @see
	 * com.google.gwt.view.client.AbstractDataProvider#onRangeChanged(com.google
	 * .gwt.view.client.HasData) */
@Override
protected void onRangeChanged(HasData<Page> display) {
    Range range = display.getVisibleRange();
    pager.start(Integer.valueOf(range.getStart())).count(Integer.valueOf(range.getLength()));
    fetchPages();
}
Also used : Range(com.google.gwt.view.client.Range)

Example 5 with Range

use of com.google.gwt.view.client.Range in project blogwt by billy1380.

the class PermissionController method onRangeChanged.

/* (non-Javadoc)
	 * 
	 * @see
	 * com.google.gwt.view.client.AbstractDataProvider#onRangeChanged(com.google
	 * .gwt.view.client.HasData) */
@Override
protected void onRangeChanged(HasData<Permission> display) {
    Range range = display.getVisibleRange();
    pager.start(Integer.valueOf(range.getStart())).count(Integer.valueOf(range.getLength()));
    fetchPermissions();
}
Also used : Range(com.google.gwt.view.client.Range)

Aggregations

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