org.apache.wicket.markup.repeater
Class RepeatingView

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.repeater.AbstractRepeater
                  extended by org.apache.wicket.markup.repeater.RepeatingView
All Implemented Interfaces:
Serializable, IClusterable, IConverterLocator
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 reeaters'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 the li tag.

Author:
Igor Vaynberg ( ivaynberg )
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor<T extends Component>, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
RepeatingView(String id)
           
RepeatingView(String id, IModel<?> model)
           
 
Method Summary
 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
onBeforeRender, onRender, renderChild
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onAfterRenderChildren, onComponentTagBody, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, callOnBeforeRenderIfNotVisible, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachBehaviors, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviors, getBehaviors, getBehaviorsRawList, getClassRelativePath, getComponentBorder, getConverter, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdImpl, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalAttach, internalDetach, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isAttached, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markAttached, markRendering, modelChanged, modelChanging, onAfterRender, onAttach, onBeginRequest, onComponentTag, onConfigure, onDetach, onEndRequest, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, prepareForRender, redirectToInterceptPage, remove, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, setAuto, setComponentBorder, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RepeatingView

public RepeatingView(String id)
See Also:
Component.Component(String)

RepeatingView

public RepeatingView(String id,
                     IModel<?> model)
See Also:
Component.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 class AbstractRepeater
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 class AbstractRepeater
See Also:
AbstractRepeater.onPopulate()


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.