org.apache.wicket.markup.html.list
Class PageableListView<T>

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.repeater.AbstractRepeater
                  extended by org.apache.wicket.markup.html.list.ListView<T>
                      extended by org.apache.wicket.markup.html.list.PageableListView<T>
Type Parameters:
T - Model object type
All Implemented Interfaces:
Serializable, IClusterable, IConverterLocator, IPageable

public abstract class PageableListView<T>
extends ListView<T>
implements IPageable

PageableListView is similar to ListView but provides in addition pageable views. A PageableListView holds pageable rows of information. The rows can be re-ordered and deleted, either one at a time or many at a time.

Author:
Jonathan Locke
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor<T extends Component>, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
PageableListView(String id, IModel<? extends List<? extends T>> model, int rowsPerPage)
          Constructor
PageableListView(String id, List<? extends T> list, int rowsPerPage)
          Creates a pageable list view having the given number of rows per page that uses the provided object as a simple model.
 
Method Summary
 int getCurrentPage()
          Gets the index of the current page being displayed by this list view.
 int getPageCount()
          Gets the number of pages in this list view.
 int getRowsPerPage()
          Gets the maximum number of rows on each page.
 int getViewSize()
          Based on the model object's list size, firstIndex and view size, determine what the view size really will be.
 void setCurrentPage(int currentPage)
          Sets the current page that this list view should show.
 void setRowsPerPage(int rowsPerPage)
          Sets the maximum number of rows on each page.
 ListView<T> setStartIndex(int startIndex)
          Prevent users from accidentally using it.
 ListView<T> setViewSize(int size)
          Prevent users from accidentally using it.
 
Methods inherited from class org.apache.wicket.markup.html.list.ListView
getList, getListItemModel, getModel, getModelObject, getReuseItems, getStartIndex, iterator, moveDownLink, moveUpLink, newItem, onBeginPopulateItem, onPopulate, populateItem, removeLink, renderChild, renderItem, renderIterator, setList, setModel, setModelObject, setReuseItems
 
Methods inherited from class org.apache.wicket.markup.repeater.AbstractRepeater
onBeforeRender, onRender
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, newMarkupResourceStream, onAfterRenderChildren, onComponentTagBody, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, callOnBeforeRenderIfNotVisible, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachBehaviors, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviors, getBehaviors, getBehaviorsRawList, getClassRelativePath, getComponentBorder, getConverter, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdImpl, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalAttach, internalDetach, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isAttached, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markAttached, markRendering, modelChanged, modelChanging, onAfterRender, onAttach, onBeginRequest, onComponentTag, onConfigure, onDetach, onEndRequest, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, prepareForRender, redirectToInterceptPage, remove, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, setAuto, setComponentBorder, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PageableListView

public PageableListView(String id,
                        IModel<? extends List<? extends T>> model,
                        int rowsPerPage)
Constructor

Parameters:
id - See Component
model - See Component
rowsPerPage - Number of rows to show on a page

PageableListView

public PageableListView(String id,
                        List<? extends T> list,
                        int rowsPerPage)
Creates a pageable list view having the given number of rows per page that uses the provided object as a simple model.

Parameters:
id - See Component
list - See Component
rowsPerPage - Number of rows to show on a page
See Also:
ListView.ListView(String, List)
Method Detail

getCurrentPage

public final int getCurrentPage()
Gets the index of the current page being displayed by this list view.

Specified by:
getCurrentPage in interface IPageable
Returns:
Returns the currentPage.

getPageCount

public final int getPageCount()
Gets the number of pages in this list view.

Specified by:
getPageCount in interface IPageable
Returns:
The number of pages in this list view

getRowsPerPage

public final int getRowsPerPage()
Gets the maximum number of rows on each page.

Returns:
the maximum number of rows on each page.

setRowsPerPage

public final void setRowsPerPage(int rowsPerPage)
Sets the maximum number of rows on each page.

Parameters:
rowsPerPage - the maximum number of rows on each page.

getViewSize

public int getViewSize()
Description copied from class: ListView
Based on the model object's list size, firstIndex and view size, determine what the view size really will be. E.g. default for viewSize is Integer.MAX_VALUE, if not set via setViewSize(). If the underlying list has 10 elements, the value returned by getViewSize() will be 10 if startIndex = 0.

Overrides:
getViewSize in class ListView<T>
Returns:
The number of items to be populated and rendered.
See Also:
ListView.getViewSize()

setCurrentPage

public final void setCurrentPage(int currentPage)
Sets the current page that this list view should show.

Specified by:
setCurrentPage in interface IPageable
Parameters:
currentPage - The currentPage to set.

setStartIndex

public ListView<T> setStartIndex(int startIndex)
                          throws UnsupportedOperationException
Prevent users from accidentally using it.

Overrides:
setStartIndex in class ListView<T>
Parameters:
startIndex - First index of model object's list to display
Returns:
This
Throws:
UnsupportedOperationException - always
See Also:
ListView.setStartIndex(int)

setViewSize

public ListView<T> setViewSize(int size)
                        throws UnsupportedOperationException
Prevent users from accidentally using it.

Overrides:
setViewSize in class ListView<T>
Parameters:
size - the view size
Returns:
This
Throws:
UnsupportedOperationException - always
See Also:
ListView.setStartIndex(int)


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.