T
- type of elements contained in the model's listpublic abstract class RefreshingView<T> extends RepeatingView
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.
RepeatingView
,
ModelIteratorAdapter
,
Serialized FormENABLE, 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 and Description |
---|
RefreshingView(String id)
Constructor
|
RefreshingView(String id,
IModel<?> model)
Constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addItems(Iterator<Item<T>> items)
Add items to the view.
|
protected abstract Iterator<IModel<T>> |
getItemModels()
Returns an iterator over models for items that will be added to this view
|
IItemReuseStrategy |
getItemReuseStrategy() |
Iterator<Item<T>> |
getItems() |
protected Item<T> |
newItem(String id,
int index,
IModel<T> model)
Factory method for Item container.
|
protected IItemFactory<T> |
newItemFactory()
Create a new IItemFactory based upon the RefreshingView
|
protected void |
onPopulate()
Refresh the items in the view.
|
protected abstract void |
populateItem(Item<T> item)
Populate the given Item container.
|
RefreshingView<T> |
setItemReuseStrategy(IItemReuseStrategy strategy)
Sets the item reuse strategy.
|
newChildId, renderIterator
dequeue, getMarkup, onBeforeRender, onRender, renderChild
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
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
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, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public RefreshingView(String id)
id
- component idprotected final void onPopulate()
onPopulate
in class RepeatingView
AbstractRepeater.onPopulate()
protected IItemFactory<T> newItemFactory()
protected abstract Iterator<IModel<T>> getItemModels()
protected abstract void populateItem(Item<T> item)
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"));
item
- The item to populateprotected Item<T> newItem(String id, int index, IModel<T> model)
id
- component id for the new data itemindex
- the index of the new data itemmodel
- the model for the new data itemItem
public Iterator<Item<T>> getItems()
protected void addItems(Iterator<Item<T>> items)
items
- item instances to be added to this viewpublic IItemReuseStrategy getItemReuseStrategy()
DefaultItemReuseStrategy
if none was set.DefaultItemReuseStrategy
public RefreshingView<T> setItemReuseStrategy(IItemReuseStrategy strategy)
Item
s.strategy
- item reuse strategyIItemReuseStrategy
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.