com.inmethod.grid.common
Class AbstractPageableView<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.repeater.RepeatingView
                      extended by org.apache.wicket.markup.repeater.RefreshingView<T>
                          extended by com.inmethod.grid.common.AbstractPageableView<T>
Type Parameters:
T - row/item model object type
All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IClusterable, IConverterLocator, IHeaderContributor, IPageable, IRequestableComponent, IHierarchical<Component>

public abstract class AbstractPageableView<T>
extends RefreshingView<T>
implements IPageable

Wicket AbstractPageableView alternative that uses IDataSource as data source. Compared to Wicket AbstractPageableView this component allows paging without knowing the total number of rows.

Author:
Matej Knopp
See Also:
Serialized Form

Field Summary
static int UNKOWN_COUNT
          Constant for unknown count of rows.
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
AbstractPageableView(String id)
          Constructor.
AbstractPageableView(String id, IModel<T> model)
          Constructor,
 
Method Summary
 void clearCache()
          clears the queryResult cache so the next use will be forced to re-initialize
 int getCurrentPage()
           
 int getCurrentPageItemCount()
          Returns the count of items on current page.
protected abstract  IDataSource<T> getDataSource()
           
protected  Iterator<IModel<T>> getItemModels()
           
 int getPageCount()
          Gets the total number of pages this pageable object has.
protected abstract  int getRowsPerPage()
           
protected abstract  IGridSortState getSortState()
           
 int getTotalRowCount()
          Returns the total count of items (sum of count of items on all pages) or UNKOWN_COUNT in case the count can't be determined.
protected  void onBeforeRender()
           
protected  void onDetach()
          Cleanup
 void setCurrentPage(int page)
          Sets the a page that should be rendered.
protected  IDataSource.IQuery wrapQuery(IDataSource.IQuery original)
          Allows to wrap created query.
 
Methods inherited from class org.apache.wicket.markup.repeater.RefreshingView
addItems, getItemReuseStrategy, getItems, newItem, newItemFactory, onPopulate, populateItem, setItemReuseStrategy
 
Methods inherited from class org.apache.wicket.markup.repeater.RepeatingView
newChildId, renderIterator
 
Methods inherited from class org.apache.wicket.markup.repeater.AbstractRepeater
getMarkup, onRender, renderChild
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onComponentTag, onConfigure, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, 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
 

Field Detail

UNKOWN_COUNT

public static final int UNKOWN_COUNT
Constant for unknown count of rows.

See Also:
Constant Field Values
Constructor Detail

AbstractPageableView

public AbstractPageableView(String id,
                            IModel<T> model)
Constructor,

Parameters:
id -
model -

AbstractPageableView

public AbstractPageableView(String id)
Constructor.

Parameters:
id -
Method Detail

getTotalRowCount

public int getTotalRowCount()
Returns the total count of items (sum of count of items on all pages) or UNKOWN_COUNT in case the count can't be determined.

Returns:
total count of items or -1

getCurrentPageItemCount

public int getCurrentPageItemCount()
Returns the count of items on current page.

Returns:
count of items on current page

getCurrentPage

public int getCurrentPage()
Specified by:
getCurrentPage in interface IPageable
Returns:
The current page that is or will be rendered.

onBeforeRender

protected void onBeforeRender()
Overrides:
onBeforeRender in class AbstractRepeater

getPageCount

public int getPageCount()
Gets the total number of pages this pageable object has.

Specified by:
getPageCount in interface IPageable
Returns:
The total number of pages this pageable object has

setCurrentPage

public void setCurrentPage(int page)
Sets the a page that should be rendered.

Specified by:
setCurrentPage in interface IPageable
Parameters:
page - The page that should be rendered.

clearCache

public void clearCache()
clears the queryResult cache so the next use will be forced to re-initialize


wrapQuery

protected IDataSource.IQuery wrapQuery(IDataSource.IQuery original)
Allows to wrap created query.

Parameters:
original -
Returns:

onDetach

protected void onDetach()
Cleanup

Overrides:
onDetach in class Component

getSortState

protected abstract IGridSortState getSortState()

getDataSource

protected abstract IDataSource<T> getDataSource()

getRowsPerPage

protected abstract int getRowsPerPage()

getItemModels

protected Iterator<IModel<T>> getItemModels()
Specified by:
getItemModels in class RefreshingView<T>
See Also:
RefreshingView.getItemModels()


Copyright © 2007-2012 inMethod s.r.o.. All Rights Reserved.