Class RepeatingView
- 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
-
- All Implemented Interfaces:
Serializable
,Iterable<Component>
,IEventSink
,IEventSource
,IFeedbackContributor
,IConverterLocator
,IMetadataContext<Serializable,Component>
,IHeaderContributor
,IRequestableComponent
,IHierarchical<Component>
,IClusterable
- Direct Known Subclasses:
RefreshingView
,SelectOptions
public class RepeatingView extends AbstractRepeater
A repeater view that renders all of its children, using its body markup, in the order they were added.
Example:Java:
RepeatingView view = new RepeatingView("repeater"); view.add(new Label(view.newChildId(), "hello")); view.add(new Label(view.newChildId(), "goodbye")); view.add(new Label(view.newChildId(), "good morning")); add(view);
Markup:
<ul><li wicket:id="repeater"></li></ul>
Yields:
<ul><li>hello</li><li>goodbye</li><li>good morning</li></ul>
To expand a bit: the repeater itself produces no markup, instead every direct child inherits the entire markup of the repeater. In the example above repeaters's markup is:<li wicket:id="repeater"></li>
and so this is the markup that is available to the direct children - the Label components. So as each label renders it produces a line of the output that has theli
tag.- 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 RepeatingView(String id)
RepeatingView(String id, IModel<?> model)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
newChildId()
Generates a unique id string.protected void
onPopulate()
Callback to let the repeater know it should populate itself with its items.protected Iterator<? extends Component>
renderIterator()
Returns an iterator for the collection of child components to be rendered.-
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, 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
-
RepeatingView
public RepeatingView(String id)
- See Also:
Component(String)
-
RepeatingView
public RepeatingView(String id, IModel<?> model)
- See Also:
Component(String, IModel)
-
-
Method Detail
-
newChildId
public String newChildId()
Generates a unique id string. This makes it easy to add items to be rendered w/out having to worry about generating unique id strings in your code.- Returns:
- unique child id
-
renderIterator
protected Iterator<? extends Component> renderIterator()
Description copied from class:AbstractRepeater
Returns an iterator for the collection of child components to be rendered. Users can override this to change order of rendered children.- Specified by:
renderIterator
in classAbstractRepeater
- Returns:
- iterator over child components to be rendered
- See Also:
AbstractRepeater.renderIterator()
-
onPopulate
protected void onPopulate()
Description copied from class:AbstractRepeater
Callback to let the repeater know it should populate itself with its items.- Specified by:
onPopulate
in classAbstractRepeater
- See Also:
AbstractRepeater.onPopulate()
-
-