Class GridView<T>
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- org.apache.wicket.markup.repeater.AbstractRepeater
-
- org.apache.wicket.markup.repeater.RepeatingView
-
- org.apache.wicket.markup.repeater.RefreshingView<T>
-
- org.apache.wicket.markup.repeater.AbstractPageableView<T>
-
- org.apache.wicket.markup.repeater.data.DataViewBase<T>
-
- org.apache.wicket.markup.repeater.data.GridView<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IMetadataContext<Serializable,Component>
,IHeaderContributor
,IPageable
,IPageableItems
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
public abstract class GridView<T> extends DataViewBase<T>
A pageable DataView which breaks the data in the IDataProvider into a number of data-rows, depending on the column size. A typical use case is to show items in a table with ie 3 columns where the table is filled left to right top-down so that for each third item a new row is created.Example
<tbody> <tr wicket:id="rows" class"even"> <td wicket:id="cols"> <span wicket:id="id">Test ID</span> </td> </tr> </tbody>
and in java:add(new GridView("rows", dataProvider).setColumns(3));
- Author:
- Igor Vaynberg, Christian Essl
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GridView.ItemsIterator<T>
Iterator that iterates over all items in the cells
-
Field Summary
-
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING, RFLAG_CONTAINER_HAS_REMOVALS
-
-
Constructor Summary
Constructors Constructor Description GridView(String id, IDataProvider<T> dataProvider)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addItems(Iterator<Item<T>> items)
Add items to the view.int
getColumns()
IDataProvider<T>
getDataProvider()
Iterator<Item<T>>
getItems()
int
getRows()
protected Item<T>
newEmptyItem(String id, int index)
Create a Item which represents an empty cell (there is no model for it in the DataProvider)protected Item<?>
newRowItem(String id, int index)
Create a new Item which will hold a row.protected abstract void
populateEmptyItem(Item<T> item)
Add component to an Item for which there is no model anymore and is shown in a cellGridView<T>
setColumns(int cols)
Sets number of columnsGridView<T>
setRows(int rows)
Sets number of rows per page-
Methods inherited from class org.apache.wicket.markup.repeater.data.DataViewBase
getItemModels, internalGetDataProvider, internalGetItemCount, onDetach
-
Methods inherited from class org.apache.wicket.markup.repeater.AbstractPageableView
getCurrentPage, getFirstItemOffset, getItemCount, getItemModels, getItemsPerPage, getPageCount, getRowCount, getViewSize, onBeforeRender, setCurrentPage, setItemsPerPage
-
Methods inherited from class org.apache.wicket.markup.repeater.RefreshingView
getItemReuseStrategy, 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
dequeue, getMarkup, onRender, renderChild
-
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
-
Methods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onComponentTagBody, onInitialize, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
-
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, 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, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMarkupTag, 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, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onComponentTag, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
GridView
public GridView(String id, IDataProvider<T> dataProvider)
- Parameters:
id
- component iddataProvider
- data provider
-
-
Method Detail
-
getColumns
public int getColumns()
- Returns:
- number of columns
-
setColumns
public GridView<T> setColumns(int cols)
Sets number of columns- Parameters:
cols
- number of columns- Returns:
- this for chaining
-
getRows
public int getRows()
- Returns:
- number of rows per page
-
setRows
public GridView<T> setRows(int rows)
Sets number of rows per page- Parameters:
rows
- number of rows- Returns:
- this for chaining
-
addItems
protected void addItems(Iterator<Item<T>> items)
Description copied from class:RefreshingView
Add items to the view. Prior to this all items were removed so every request this function starts from a clean slate.- Overrides:
addItems
in classRefreshingView<T>
- Parameters:
items
- item instances to be added to this view
-
getDataProvider
public IDataProvider<T> getDataProvider()
- Returns:
- data provider
-
getItems
public Iterator<Item<T>> getItems()
- Overrides:
getItems
in classRefreshingView<T>
- Returns:
- iterator over item instances that exist as children of this view
- See Also:
RefreshingView.getItems()
-
populateEmptyItem
protected abstract void populateEmptyItem(Item<T> item)
Add component to an Item for which there is no model anymore and is shown in a cell- Parameters:
item
- Item object
-
newEmptyItem
protected Item<T> newEmptyItem(String id, int index)
Create a Item which represents an empty cell (there is no model for it in the DataProvider)- Parameters:
id
-index
-- Returns:
- created item
-
newRowItem
protected Item<?> newRowItem(String id, int index)
Create a new Item which will hold a row.- Parameters:
id
-index
-- Returns:
- created Item
-
-