wicket.extensions.markup.html.repeater.pageable
Class AbstractPageableView

java.lang.Object
  extended by wicket.Component
      extended by wicket.MarkupContainer
          extended by wicket.markup.html.WebMarkupContainer
              extended by wicket.extensions.markup.html.repeater.RepeatingView
                  extended by wicket.extensions.markup.html.repeater.refreshing.RefreshingView
                      extended by wicket.extensions.markup.html.repeater.pageable.AbstractPageableView
All Implemented Interfaces:
java.io.Serializable, wicket.markup.html.navigation.paging.IPageable
Direct Known Subclasses:
DataViewBase

public abstract class AbstractPageableView
extends RefreshingView
implements wicket.markup.html.navigation.paging.IPageable

An abstract repeater view that provides paging functionality to its subclasses.

The view is populated by overriding the getItemModels(int offset, int count) method and providing an iterator that returns models for items in the current page. The AbstractPageableView builds the items that will be rendered by looping over the models and calling the newItem(String id, int index, IModel model) to generate the child item container followed by populateItem(Component item) to let the user populate the newly created item container with with custom components.

Author:
Igor Vaynberg (ivaynberg)
See Also:
RefreshingView, IPageable, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class wicket.Component
wicket.Component.ComponentModelChange, wicket.Component.EnabledChange, wicket.Component.IVisitor, wicket.Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.Component
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER
 
Constructor Summary
AbstractPageableView(java.lang.String id)
           
AbstractPageableView(java.lang.String id, wicket.model.IModel model)
           
 
Method Summary
 int getCurrentPage()
           
protected  java.util.Iterator getItemModels()
          This method retrieves the subset of models for items in the current page and allows RefreshingView to generate items.
protected abstract  java.util.Iterator getItemModels(int offset, int size)
          Returns an iterator over models for items in the current page
 int getPageCount()
           
 int getRowCount()
           
protected  int getViewOffset()
           
protected  int getViewSize()
           
protected abstract  int internalGetItemCount()
           
protected  int internalGetRowsPerPage()
           
protected  void internalOnDetach()
           
protected  void internalSetRowsPerPage(int items)
          Sets the maximum number of items to show per page.
 void setCurrentPage(int page)
           
 
Methods inherited from class wicket.extensions.markup.html.repeater.refreshing.RefreshingView
addItems, getItemReuseStrategy, getItems, internalOnAttach, newItem, populateItem, setItemReuseStrategy
 
Methods inherited from class wicket.extensions.markup.html.repeater.RepeatingView
newChildId, onRender, renderChild, renderIterator
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalAttach, internalDetach, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onComponentTagBody, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isEnabled, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onComponentTag, onDetach, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, renderHead, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMetaData, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPageableView

public AbstractPageableView(java.lang.String id,
                            wicket.model.IModel model)
See Also:
Component.Component(String, IModel)

AbstractPageableView

public AbstractPageableView(java.lang.String id)
See Also:
Component.Component(String)
Method Detail

getItemModels

protected java.util.Iterator getItemModels()
This method retrieves the subset of models for items in the current page and allows RefreshingView to generate items.

Specified by:
getItemModels in class RefreshingView
Returns:
iterator over models for items in the current page

internalOnDetach

protected void internalOnDetach()
Overrides:
internalOnDetach in class wicket.Component

getItemModels

protected abstract java.util.Iterator getItemModels(int offset,
                                                    int size)
Returns an iterator over models for items in the current page

Parameters:
offset - index of first item in this page
size - number of items that will be showin in the current page
Returns:
an iterator over models for items in the current page

internalGetRowsPerPage

protected final int internalGetRowsPerPage()
Returns:
maximum number of items that will be shown per page

internalSetRowsPerPage

protected final void internalSetRowsPerPage(int items)
Sets the maximum number of items to show per page. The current page will also be set to zero

Parameters:
items -

internalGetItemCount

protected abstract int internalGetItemCount()
Returns:
total item count

getRowCount

public final int getRowCount()
Returns:
total item count

getCurrentPage

public final int getCurrentPage()
Specified by:
getCurrentPage in interface wicket.markup.html.navigation.paging.IPageable
See Also:
IPageable.getCurrentPage()

setCurrentPage

public final void setCurrentPage(int page)
Specified by:
setCurrentPage in interface wicket.markup.html.navigation.paging.IPageable
See Also:
IPageable.setCurrentPage(int)

getPageCount

public final int getPageCount()
Specified by:
getPageCount in interface wicket.markup.html.navigation.paging.IPageable
See Also:
IPageable.getPageCount()

getViewOffset

protected int getViewOffset()
Returns:
the index of the first visible item

getViewSize

protected int getViewSize()
Returns:
the number of items visible


Copyright © 2004-2008 Wicket developers. All Rights Reserved.