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>
- Type Parameters:
T
- type of elements contained in the model's list
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IMetadataContext<Serializable,
,Component> IHeaderContributor
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
- Direct Known Subclasses:
AbstractPageableView
An abstract repeater view that provides refreshing functionality to its subclasses. The view is
refreshed every request, making it well suited for displaying dynamic data.
The view is populated by implementing getItemModels()
and
populateItem(Item)
methods. RefreshingView builds the items that will be
rendered by looping over the models retrieved from getItemModels()
and
calling the newItem(String, int, IModel)
to generate the child item
container followed by a call to populateItem(Item)
to let the user
populate the newly created item container with custom components.
The provided ModelIteratorAdapter
can make implementing
getItemModels()
easier if you have an iterator over item objects.
- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
-
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
ConstructorDescriptionRefreshingView
(String id) ConstructorRefreshingView
(String id, IModel<?> model) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add items to the view.Returns an iterator over models for items that will be added to this viewgetItems()
Factory method for Item container.protected IItemFactory<T>
Create a new IItemFactory based upon the RefreshingViewprotected final void
Refresh the items in the view.protected abstract void
populateItem
(Item<T> item) Populate the given Item container.setItemReuseStrategy
(IItemReuseStrategy strategy) Sets the item reuse strategy.Methods inherited from class org.apache.wicket.markup.repeater.RepeatingView
newChildId, renderIterator
Methods inherited from class org.apache.wicket.markup.repeater.AbstractRepeater
dequeue, getMarkup, onBeforeRender, 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, onDetach, 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
-
RefreshingView
Constructor- Parameters:
id
- component id
-
RefreshingView
Constructor- Parameters:
id
- component idmodel
- model
-
-
Method Details
-
onPopulate
Refresh the items in the view. Delegates the creation of items to the selected item reuse strategy- Overrides:
onPopulate
in classRepeatingView
- See Also:
-
newItemFactory
Create a new IItemFactory based upon the RefreshingView- Returns:
- An Item factory that delegates to the RefreshingView
-
getItemModels
Returns an iterator over models for items that will be added to this view- Returns:
- an iterator over models for items that will be added to this view
-
populateItem
Populate the given Item container.be careful to add any components to the item and not the view itself. So, don't do:
add(new Label("foo", "bar"));
but:item.add(new Label("foo", "bar"));
- Parameters:
item
- The item to populate
-
newItem
Factory method for Item container. Item containers are simple MarkupContainer used to aggregate the user added components for a row inside the view.- Parameters:
id
- component id for the new data itemindex
- the index of the new data itemmodel
- the model for the new data item- Returns:
- DataItem created DataItem
- See Also:
-
getItems
- Returns:
- iterator over item instances that exist as children of this view
-
addItems
Add items to the view. Prior to this all items were removed so every request this function starts from a clean slate.- Parameters:
items
- item instances to be added to this view
-
getItemReuseStrategy
- Returns:
- currently set item reuse strategy. Defaults to
DefaultItemReuseStrategy
if none was set. - See Also:
-
setItemReuseStrategy
Sets the item reuse strategy. This strategy controls the creation ofItem
s.- Parameters:
strategy
- item reuse strategy- Returns:
- this for chaining
- See Also:
-