Class AbstractPaginationWidget<W extends org.eclipse.swt.widgets.Widget>
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.nebula.widgets.pagination.AbstractPageControllerComposite
org.eclipse.nebula.widgets.pagination.AbstractPaginationWidget<W>
- Type Parameters:
W
- the widget linked to the pagination controller.T
- the pagination controller to observe to refresh paginated data in the widget and update it with total elements.
- All Implemented Interfaces:
IPageChangedListener
,org.eclipse.swt.graphics.Drawable
- Direct Known Subclasses:
PageableTable
,PageableTree
public abstract class AbstractPaginationWidget<W extends org.eclipse.swt.widgets.Widget> extends AbstractPageControllerComposite
Abstract class SWT
Composite
which host a SWT Widget
linked
to a pagination controller to display data with pagination. The
refreshPage()
must be implemented to load
paginated data and update the total element of the controller.
This composite is able to to add another Composite
on the top and on
the bottom of the widget. For instance you can display navigation page links
on the top of the widget.-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description AbstractPaginationWidget(org.eclipse.swt.widgets.Composite parent, int style, int pageSize, IPageContentProvider pageContentProvider, ICompositeRendererFactory pageRendererTopFactory, ICompositeRendererFactory pageRendererBottomFactory)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.protected
AbstractPaginationWidget(org.eclipse.swt.widgets.Composite parent, int style, int pageSize, IPageContentProvider pageContentProvider, ICompositeRendererFactory pageRendererTopFactory, ICompositeRendererFactory pageRendererBottomFactory, boolean createUI)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.AbstractPaginationWidget(org.eclipse.swt.widgets.Composite parent, int style, IPageContentProvider pageContentProvider, ICompositeRendererFactory pageRendererTopFactory, ICompositeRendererFactory pageRendererBottomFactory)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. -
Method Summary
Modifier and Type Method Description protected org.eclipse.swt.widgets.Composite
createCompositeBottom(org.eclipse.swt.widgets.Composite parent)
Create bottom composite if needed.protected org.eclipse.swt.widgets.Composite
createCompositeTop(org.eclipse.swt.widgets.Composite parent)
Create top composite if needed.protected void
createUI(org.eclipse.swt.widgets.Composite parent)
Create the UI content.protected abstract W
createWidget(org.eclipse.swt.widgets.Composite parent)
Create the widget linked to the pagination controller.org.eclipse.swt.widgets.Composite
getCompositeBottom()
Returns the composite created by the pageRendererTopFactory on the bottom of the widget (null if none Composite must be added)org.eclipse.swt.widgets.Composite
getCompositeTop()
Returns the composite created by the pageRendererTopFactory on the top of the widget (null if none Composite must be added)IPageLoader
getPageLoader()
Returns the page loader to use to load paginated list.IPageLoaderHandler
getPageLoaderHandler()
Returns the page loader handler to observe before/after page loading process.ICompositeRendererFactory
getPageRendererBottomFactory()
Returns the page renderer factory to use to create a Composite on the bottom of the widget.ICompositeRendererFactory
getPageRendererTopFactory()
Returns the page renderer factory to use to create a Composite on the top of the widget.W
getWidget()
Returns the widget.void
pageIndexChanged(int oldPageNumber, int newPageNumber, PageableController controller)
Sent when page changed in the page controllerPageableController
.void
pageSizeChanged(int oldPageSize, int newPageSize, PageableController paginationController)
Sent when page size changed in the page controllerPageableController
.abstract void
refreshPage()
Refresh the page.void
refreshPage(boolean reset)
Refresh the page.void
setLocale(java.util.Locale locale)
Set the locale to use for resources.void
setPageLoader(IPageLoader pageLoader)
Set the page loader to use to load paginated list.void
setPageLoaderHandler(IPageLoaderHandler pageLoaderHandler)
Set the page loader handler to observe before/after page loading process.void
sortChanged(java.lang.String oldPopertyName, java.lang.String propertyName, int oldSortDirection, int sortDirection, PageableController paginationController)
Sent when sort changed in the page controllerPageableController
.void
totalElementsChanged(long oldTotalElements, long newTotalElements, PageableController controller)
Sent when total elements changed in the page controllerPageableController
.Methods inherited from class org.eclipse.nebula.widgets.pagination.AbstractPageControllerComposite
createController, dispose, getController, getLocale, getPageContentProvider, localeChanged, setCurrentPage
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
-
Constructor Details
-
AbstractPaginationWidget
public AbstractPaginationWidget(org.eclipse.swt.widgets.Composite parent, int style, IPageContentProvider pageContentProvider, ICompositeRendererFactory pageRendererTopFactory, ICompositeRendererFactory pageRendererBottomFactory)Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. Default page size is used here.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructpageRendererTopFactory
- the page renderer factory used to create a SWT Composite on the top of the widget. Null if none Composite must be created.pageRendererBottomFactory
- the page renderer factory used to create a SWT Composite on the bottom of the widget. Null if none Composite must be created.
-
AbstractPaginationWidget
public AbstractPaginationWidget(org.eclipse.swt.widgets.Composite parent, int style, int pageSize, IPageContentProvider pageContentProvider, ICompositeRendererFactory pageRendererTopFactory, ICompositeRendererFactory pageRendererBottomFactory)Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructpageSize
- size of the page (number items displayed per page).pageRendererTopFactory
- the page renderer factory used to create a SWT Composite on the top of the widget. Null if none Composite must be created.pageRendererBottomFactory
- the page renderer factory used to create a SWT Composite on the bottom of the widget. Null if none Composite must be created.
-
AbstractPaginationWidget
protected AbstractPaginationWidget(org.eclipse.swt.widgets.Composite parent, int style, int pageSize, IPageContentProvider pageContentProvider, ICompositeRendererFactory pageRendererTopFactory, ICompositeRendererFactory pageRendererBottomFactory, boolean createUI)Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructpageSize
- size of the page (number items displayed per page).pageRendererTopFactory
- the page renderer factory used to create a SWT Composite on the top of the widget. Null if none Composite must be created.pageRendererBottomFactory
- the page renderer factory used to create a SWT Composite on the bottom of the widget. Null if none Composite must be created.createUI
- true if the UI must be created and false otherwise.
-
-
Method Details
-
createUI
protected void createUI(org.eclipse.swt.widgets.Composite parent)Description copied from class:AbstractPageControllerComposite
Create the UI content.- Specified by:
createUI
in classAbstractPageControllerComposite
-
createCompositeTop
protected org.eclipse.swt.widgets.Composite createCompositeTop(org.eclipse.swt.widgets.Composite parent)Create top composite if needed.- Parameters:
parent
-
-
createCompositeBottom
protected org.eclipse.swt.widgets.Composite createCompositeBottom(org.eclipse.swt.widgets.Composite parent)Create bottom composite if needed.- Parameters:
parent
-
-
getPageRendererTopFactory
Returns the page renderer factory to use to create a Composite on the top of the widget.- Returns:
-
getPageRendererBottomFactory
Returns the page renderer factory to use to create a Composite on the bottom of the widget.- Returns:
-
getCompositeTop
public org.eclipse.swt.widgets.Composite getCompositeTop()Returns the composite created by the pageRendererTopFactory on the top of the widget (null if none Composite must be added)- Returns:
-
getCompositeBottom
public org.eclipse.swt.widgets.Composite getCompositeBottom()Returns the composite created by the pageRendererTopFactory on the bottom of the widget (null if none Composite must be added)- Returns:
-
pageIndexChanged
Description copied from interface:IPageChangedListener
Sent when page changed in the page controllerPageableController
.- Parameters:
oldPageNumber
- old page index.newPageNumber
- new page index.controller
- the page controller which have sent this event.- See Also:
(int, int, org.eclipse.nebula.widgets.pagination.PaginationController)
-
totalElementsChanged
public void totalElementsChanged(long oldTotalElements, long newTotalElements, PageableController controller)Description copied from interface:IPageChangedListener
Sent when total elements changed in the page controllerPageableController
.- Parameters:
oldTotalElements
- old total elements.newTotalElements
- new total elements.controller
- the page controller which have sent this event.
-
sortChanged
public void sortChanged(java.lang.String oldPopertyName, java.lang.String propertyName, int oldSortDirection, int sortDirection, PageableController paginationController)Description copied from interface:IPageChangedListener
Sent when sort changed in the page controllerPageableController
.- Parameters:
oldPopertyName
- old property name.propertyName
- new property name.oldSortDirection
- old sort direction :SWT.UP
,SWT.DOWN
.sortDirection
- new sort direction :SWT.UP
,SWT.DOWN
.- See Also:
(java.lang.String, java.lang.String, int, int, org.eclipse.nebula.widgets.pagination.PaginationController)
-
pageSizeChanged
public void pageSizeChanged(int oldPageSize, int newPageSize, PageableController paginationController)Description copied from interface:IPageChangedListener
Sent when page size changed in the page controllerPageableController
.- Parameters:
oldPageSize
- old page size.newPageSize
- new page size.paginationController
- the page controller which have sent this event.- See Also:
(int, int, org.eclipse.nebula.widgets.pagination.PaginationController)
-
refreshPage
public void refreshPage(boolean reset)Refresh the page.- Parameters:
reset
- true if page index must be reseted to the first page index before refresh page and false otherwise.
-
setLocale
public void setLocale(java.util.Locale locale)Description copied from class:AbstractPageControllerComposite
Set the locale to use for resources.- Overrides:
setLocale
in classAbstractPageControllerComposite
- See Also:
AbstractPageControllerComposite.setLocale(java.util.Locale)
-
setPageLoaderHandler
Set the page loader handler to observe before/after page loading process.- Parameters:
pageLoaderHandler
-
-
getPageLoaderHandler
Returns the page loader handler to observe before/after page loading process.- Returns:
-
setPageLoader
Set the page loader to use to load paginated list.- Parameters:
pageLoader
-
-
getPageLoader
Returns the page loader to use to load paginated list.- Returns:
-
getWidget
Returns the widget.- Returns:
-
createWidget
Create the widget linked to the pagination controller.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)- Returns:
-
refreshPage
public abstract void refreshPage()Refresh the page. This method should load paginated list data, update the viewer and update the pagination controller with total elements.
-