org.drools.guvnor.client.widgets.tables
Class GuvnorSimplePager

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.google.gwt.user.cellview.client.AbstractPager
                  extended by org.drools.guvnor.client.widgets.tables.GuvnorSimplePager
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget

public class GuvnorSimplePager
extends com.google.gwt.user.cellview.client.AbstractPager

Essentially a fork of GWT's SimplePager that maintains a set page size and displays page numbers and total pages more elegantly. SimplePager will ensure pageSize rows are always rendered even if the "last" page has less than pageSize rows remain. Forked not sub-classed as GWTs code is largely private and not open to extension :(


Nested Class Summary
static interface GuvnorSimplePager.Resources
          A ClientBundle that provides images for this widget.
static interface GuvnorSimplePager.Style
          Styles used by this widget.
static class GuvnorSimplePager.TextLocation
          The location of the text relative to the paging buttons.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
GuvnorSimplePager()
          Construct a SimplePager with the default text location.
GuvnorSimplePager(GuvnorSimplePager.TextLocation location)
          Construct a SimplePager with the specified text location.
GuvnorSimplePager(GuvnorSimplePager.TextLocation location, GuvnorSimplePager.Resources resources, boolean showFastForwardButton, int fastForwardRows, boolean showLastPageButton)
          Construct a SimplePager with the specified resources.
 
Method Summary
protected  String createText()
           
 int getPageSize()
           
 void nextPage()
           
protected  void onRangeOrRowCountChanged()
           
 void previousPage()
           
 void setDisplay(com.google.gwt.view.client.HasRows display)
           
 void setPage(int index)
           
 void setPageSize(int pageSize)
           
 void setPageStart(int index)
           
 void startLoading()
          Let the page know that the table is loading.
 
Methods inherited from class com.google.gwt.user.cellview.client.AbstractPager
firstPage, getDisplay, getPage, getPageCount, getPageStart, hasNextPage, hasNextPages, hasPage, hasPreviousPage, hasPreviousPages, isRangeLimited, lastPage, lastPageStart, setRangeLimited
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GuvnorSimplePager

public GuvnorSimplePager()
Construct a SimplePager with the default text location.


GuvnorSimplePager

public GuvnorSimplePager(GuvnorSimplePager.TextLocation location)
Construct a SimplePager with the specified text location.

Parameters:
location - the location of the text relative to the buttons

GuvnorSimplePager

public GuvnorSimplePager(GuvnorSimplePager.TextLocation location,
                         GuvnorSimplePager.Resources resources,
                         boolean showFastForwardButton,
                         int fastForwardRows,
                         boolean showLastPageButton)
Construct a SimplePager with the specified resources.

Parameters:
location - the location of the text relative to the buttons
resources - the GuvnorSimplePager.Resources to use
showFastForwardButton - if true, show a fast-forward button that advances by a larger increment than a single page
fastForwardRows - the number of rows to jump when fast forwarding
showLastPageButton - if true, show a button to go the the last page
Method Detail

getPageSize

public int getPageSize()
Overrides:
getPageSize in class com.google.gwt.user.cellview.client.AbstractPager

nextPage

public void nextPage()
Overrides:
nextPage in class com.google.gwt.user.cellview.client.AbstractPager

previousPage

public void previousPage()
Overrides:
previousPage in class com.google.gwt.user.cellview.client.AbstractPager

setDisplay

public void setDisplay(com.google.gwt.view.client.HasRows display)
Overrides:
setDisplay in class com.google.gwt.user.cellview.client.AbstractPager

setPage

public void setPage(int index)
Overrides:
setPage in class com.google.gwt.user.cellview.client.AbstractPager

setPageSize

public void setPageSize(int pageSize)
Overrides:
setPageSize in class com.google.gwt.user.cellview.client.AbstractPager

setPageStart

public void setPageStart(int index)
Overrides:
setPageStart in class com.google.gwt.user.cellview.client.AbstractPager

startLoading

public void startLoading()
Let the page know that the table is loading. Call this method to clear all data from the table and hide the current range when new data is being loaded into the table.


createText

protected String createText()

onRangeOrRowCountChanged

protected void onRangeOrRowCountChanged()
Specified by:
onRangeOrRowCountChanged in class com.google.gwt.user.cellview.client.AbstractPager


Copyright © 2001-2011 JBoss Inc.. All Rights Reserved.