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

        // 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).  There's also a special case if the
        // final page is empty: we get "> 10 of 10" instead of "11 of 10".
        NumberFormat formatter = NumberFormat.getFormat("#,###");
        HasRows display = getDisplay();
        Range range = display.getVisibleRange();
        int pageStart = range.getStart() + 1;
        int size = range.getLength();
        int dataSize = display.getRowCount();
        int endIndex = Math.min(dataSize, pageStart + size - 1);
        endIndex = Math.max(pageStart, endIndex);
        boolean exact = display.isRowCountExact();
        if (dataSize == 0) {
            return "0 of 0";
        } else if (pageStart == endIndex) {
            if (pageStart > dataSize) {
                // This is better than "11 of 10" if the final page is empty
View Full Code Here

      }
    }

    /** True if we know for certain there is a last page beyond the one currently displayed. */
    protected boolean hasLastPage() {
        HasRows display = getDisplay();
        Range range = display.getVisibleRange();
        int pageStart = range.getStart() + 1;
        int size = range.getLength();
        int dataSize = display.getRowCount();
        int endIndex = Math.min(dataSize, pageStart + size - 1);
        endIndex = Math.max(pageStart, endIndex);
        boolean exact = display.isRowCountExact();
        if (dataSize == 0) {
            return false;
        } else if (pageStart == endIndex) {
            return false;
        } else {
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

   }

   @Override
   protected String createText()
   {
      final HasRows display = getDisplay();
      if (display.getVisibleRange().getStart() == display.getRowCount())
         return "";

      String text = super.createText();

      if (display.isRowCountExact())
         return "Commits " + text;
      else
      {
         int pos = text.indexOf(" of ");
         return "Commits " + (pos >= 0 ? text.substring(0, pos) : text);
View Full Code Here

      }
   }

   @Override
   public void setPageStart(int index) {
      HasRows display = getDisplay();
      if (display != null) {
         Range range = display.getVisibleRange();
         int pageSize = range.getLength();
         index = Math.max(0, index);
         if (index != range.getStart()) {
            display.setVisibleRange(index, pageSize);
         }
      }
   }
View Full Code Here

        initWidget(label);
    }

    @Override
    protected void onRangeOrRowCountChanged() {
        HasRows display = getDisplay();
        Range range = display.getVisibleRange();
        int start = range.getStart();
        int end = start + range.getLength();
        label.setText(start + " - " + end + " : " + display.getRowCount(),
                HasDirection.Direction.LTR);
    }
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.