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
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add items to the view.int
getItems()
int
getRows()
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 cellsetColumns
(int cols) Sets number of columnssetRows
(int rows) Sets number of rows per pageMethods 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, 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 Details
-
GridView
- Parameters:
id
- component iddataProvider
- data provider
-
-
Method Details
-
getColumns
- Returns:
- number of columns
-
setColumns
Sets number of columns- Parameters:
cols
- number of columns- Returns:
- this for chaining
-
getRows
- Returns:
- number of rows per page
-
setRows
Sets number of rows per page- Parameters:
rows
- number of rows- Returns:
- this for chaining
-
addItems
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
- Returns:
- data provider
-
getItems
- Overrides:
getItems
in classRefreshingView<T>
- Returns:
- iterator over item instances that exist as children of this view
- See Also:
-
populateEmptyItem
Add component to an Item for which there is no model anymore and is shown in a cell- Parameters:
item
- Item object
-
newEmptyItem
Create a Item which represents an empty cell (there is no model for it in the DataProvider)- Parameters:
id
-index
-- Returns:
- created item
-
newRowItem
Create a new Item which will hold a row.- Parameters:
id
-index
-- Returns:
- created Item
-