Class AbstractRepeater
- java.lang.Object
-
- org.apache.wicket.Component
-
- org.apache.wicket.MarkupContainer
-
- org.apache.wicket.markup.html.WebMarkupContainer
-
- org.apache.wicket.markup.repeater.AbstractRepeater
-
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IMetadataContext<Serializable,Component>
,IHeaderContributor
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
- Direct Known Subclasses:
ListView
,Loop
,RepeatingView
public abstract class AbstractRepeater extends WebMarkupContainer
Base class for repeaters. This container renders each of its children using its own markup. The children are collected usingrenderIterator()
method. This class will take care of properly positioning and rewinding its markup stream so before each child renders it points to the beginning of this component. Each child is rendered by a call torenderChild(Component)
. A typical implementation simply doeschild.render();
. Note: the children are added during the render phase (in Component.beforeRender() so most of the specializations of this class should not be used as parents ofFormComponent
s in stateless pages because the form components will not be available during the action phase (i.e. atForm.onSubmit()
). UseRepeatingView
in these cases.- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
- Serialized Form
-
-
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 AbstractRepeater(String id)
ConstructorAbstractRepeater(String id, IModel<?> model)
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
dequeue(DequeueContext dequeue)
Dequeues components.IMarkupFragment
getMarkup(Component child)
Get the markup of the child.protected void
onBeforeRender()
Called on all visible components before any component is rendered.protected abstract void
onPopulate()
Callback to let the repeater know it should populate itself with its items.protected void
onRender()
Renders all child items in no specified orderprotected void
renderChild(Component child)
Render a single child.protected abstract Iterator<? extends Component>
renderIterator()
Returns an iterator for the collection of child components to be rendered.-
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, 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
-
AbstractRepeater
public AbstractRepeater(String id)
Constructor- Parameters:
id
-
-
AbstractRepeater
public AbstractRepeater(String id, IModel<?> model)
Constructor- Parameters:
id
-model
-
-
-
Method Detail
-
renderIterator
protected abstract Iterator<? extends Component> renderIterator()
Returns an iterator for the collection of child components to be rendered. Users can override this to change order of rendered children.- Returns:
- iterator over child components to be rendered
-
onRender
protected final void onRender()
Renders all child items in no specified order- Overrides:
onRender
in classMarkupContainer
-
renderChild
protected void renderChild(Component child)
Render a single child. This method can be overridden to modify how a single child component is rendered.- Parameters:
child
- Child component to be rendered
-
onBeforeRender
protected void onBeforeRender()
Description copied from class:Component
Called on all visible components before any component is rendered.NOTE: If you override this, you *must* call super.onBeforeRender() within your implementation. Because this method is responsible for cascading
Changes to the component tree can be made only before calling super.onBeforeRender().Component.onBeforeRender()
call to its children it is strongly recommended that super call is made at the end of the override.- Overrides:
onBeforeRender
in classComponent
- See Also:
Component.onBeforeRender()
-
getMarkup
public IMarkupFragment getMarkup(Component child)
Description copied from class:MarkupContainer
Get the markup of the child.- Overrides:
getMarkup
in classMarkupContainer
- Parameters:
child
- The child component. If null, the container's markup will be returned. See Border, Panel or Enclosure where getMarkup(null) != getMarkup().- Returns:
- The child's markup
- See Also:
MarkupContainer.getMarkup(org.apache.wicket.Component)
-
onPopulate
protected abstract void onPopulate()
Callback to let the repeater know it should populate itself with its items.
-
dequeue
public void dequeue(DequeueContext dequeue)
Description copied from class:MarkupContainer
Dequeues components. The default implementation iterates direct children of this container found in its markup and tries to find matching components in queues filled by a call toMarkupContainer.queue(Component...)
. It then delegates the dequeueing to these children. Certain components that implement custom markup behaviors (such as repeaters and borders) override this method to bring dequeueing in line with their custom markup handling.- Overrides:
dequeue
in classMarkupContainer
- Parameters:
dequeue
- the dequeue context to use
-
-