Package com.google.gwt.view.client

Examples of com.google.gwt.view.client.HasRows


   * @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);
  }
View Full Code Here


        + (exact ? " of " : " of over ") + formatter.format(dataSize);
  }

  @Override
  protected void onRangeOrRowCountChanged() {
    HasRows display = getDisplay();
    label.setText(createText());

    // Update the prev and first buttons.
    setPrevPageButtonsDisabled(!hasPreviousPage());

    // Update the next and last buttons.
    if (isRangeLimited() || !display.isRowCountExact()) {
      setNextPageButtonsDisabled(!hasNextPage());
      setFastForwardDisabled(!hasNextPages(getFastForwardPages()));
    }
  }
View Full Code Here

    // Buttons are disabled by default.
    assertTrue(pager.isPreviousButtonDisabled());
    assertTrue(pager.isNextButtonDisabled());

    // Set the display.
    HasRows display = new MockHasData<String>();
    display.setRowCount(1000);
    pager.setDisplay(display);

    // First Page.
    display.setVisibleRange(0, 20);
    assertTrue(pager.isPreviousButtonDisabled());
    assertFalse(pager.isNextButtonDisabled());

    // Middle Page.
    display.setVisibleRange(100, 20);
    assertFalse(pager.isPreviousButtonDisabled());
    assertFalse(pager.isNextButtonDisabled());

    // Last Page.
    display.setVisibleRange(980, 20);
    assertFalse(pager.isPreviousButtonDisabled());
    assertTrue(pager.isNextButtonDisabled());
  }
View Full Code Here

  public void testNextButtonsDisabledWithEmptyDisplay() {
    SimplePager pager = createPager();

    // Set the display.
    HasRows display = new MockHasData<String>();

    // Set range limited
    pager.setRangeLimited(true);
    pager.setPageSize(30);
View Full Code Here

    // you get "1-1 of 0") and "1 of 1" when there is only one record
    // (otherwise you get "1-1 of 1"). Not internationalised (but
    // neither is SimplePager)
    protected String createText() {
        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();
        if ( dataSize == 0 ) {
            return "0 of 0";
        } else if ( pageStart == endIndex ) {
            return formatter.format( pageStart )
                   + " of "
View Full Code Here

               + formatter.format( dataSize );
    }

    @Override
    protected void onRangeOrRowCountChanged() {
        HasRows display = getDisplay();
        label.setText( createText() );

        // Update the prev and first buttons.
        setPrevPageButtonsDisabled( !hasPreviousPage() );

        // Update the next and last buttons.
        if ( isRangeLimited() || !display.isRowCountExact() ) {
            setNextPageButtonsDisabled( !hasNextPage() );
            setFastForwardDisabled( !hasNextPages( getFastForwardPages() ) );
        }
    }
View Full Code Here

    //
    @Override
    public void setPageStart(int index) {

        HasRows display = getDisplay();

        if (display != null) {
            Range range = display.getVisibleRange();
            int pageSize = range.getLength();
            if (!isRangeLimited() && display.isRowCountExact()) {
                index = Math.min(index, display.getRowCount() - pageSize);
            }
            index = Math.max(0, index);
            if (index != range.getStart()) {
                display.setVisibleRange(index, pageSize);
            }
        }
    }
View Full Code Here

    // you get "1-1 of 0") and "1 of 1" when there is only one record
    // (otherwise you get "1-1 of 1"). Not internationalised (but
    // neither is SimplePager)
    protected String createText() {
        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();
        if ( dataSize == 0 ) {
            return "0 of 0";
        } else if ( pageStart == endIndex ) {
            return formatter.format( pageStart )
                   + " of "
View Full Code Here

               + formatter.format( dataSize );
    }

    @Override
    protected void onRangeOrRowCountChanged() {
        HasRows display = getDisplay();
        label.setText( createText() );

        // Update the prev and first buttons.
        setPrevPageButtonsDisabled( !hasPreviousPage() );

        // Update the next and last buttons.
        if ( isRangeLimited() || !display.isRowCountExact() ) {
            setNextPageButtonsDisabled( !hasNextPage() );
            setFastForwardDisabled( !hasNextPages( getFastForwardPages() ) );
        }
    }
View Full Code Here

                lastScrollPos = scrollable.getVerticalScrollPosition();
                if (oldScrollPos >= lastScrollPos) {
                    return;
                }

                HasRows display = getDisplay();
                if (display == null) {
                    return;
                }

                int maxScrollTop = scrollable.getWidget().getOffsetHeight()
                        - scrollable.getOffsetHeight();
                if (lastScrollPos >= maxScrollTop - 16) {
                    //We are near the end, so increase the page size.
                    int newPageSize = Math.min(display.getVisibleRange()
                            .getLength() + incrementSize, display.getRowCount());
                    display.setVisibleRange(0, newPageSize);
                }
            }
        });
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.view.client.HasRows

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.