wicket.extensions.markup.html.repeater
Class RepeatingView

java.lang.Object
  extended by wicket.Component
      extended by wicket.MarkupContainer
          extended by wicket.markup.html.WebMarkupContainer
              extended by wicket.extensions.markup.html.repeater.RepeatingView
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
OrderedRepeatingView, RefreshingView, SelectOptions

public class RepeatingView
extends wicket.markup.html.WebMarkupContainer

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("1", "hello"));
 view.add(new Label("2", "goodbye"));
 view.add(new Label("3", "good morning"));
 

Markup:

  <ul><li wicket:id="repeater"></li></ul>
 

Yields:

  <ul><li>goodbye</li><li>hello</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 litag.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class wicket.Component
wicket.Component.ComponentModelChange, wicket.Component.EnabledChange, wicket.Component.IVisitor, wicket.Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.Component
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER
 
Constructor Summary
RepeatingView(java.lang.String id)
           
RepeatingView(java.lang.String id, wicket.model.IModel model)
           
 
Method Summary
 java.lang.String newChildId()
          Generates a unique id string.
protected  void onRender(wicket.markup.MarkupStream markupStream)
          Renders all child items in no specified order
protected  void renderChild(wicket.Component child)
          Render a single child.
protected  java.util.Iterator renderIterator()
          Returns an iterator for the collection of child components to be rendered.
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalAttach, internalDetach, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onComponentTagBody, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isEnabled, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onComponentTag, onDetach, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, renderHead, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMetaData, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RepeatingView

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

RepeatingView

public RepeatingView(java.lang.String id,
                     wicket.model.IModel model)
See Also:
Component.Component(String, IModel)
Method Detail

newChildId

public java.lang.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

onRender

protected void onRender(wicket.markup.MarkupStream markupStream)
Renders all child items in no specified order

Overrides:
onRender in class wicket.MarkupContainer
Parameters:
markupStream - The markup stream

renderIterator

protected java.util.Iterator renderIterator()
Returns an iterator for the collection of child components to be rendered. Child component are rendered in the order they are in the iterator. Since we use the iterator returned by wicket's MarkupContainer#iterator() method and that method does not guarantee any kind of ordering neither do we. This method can be overridden by subclasses to create an ordering scheme, see OrderedRepeatingView#renderIterator().

Returns:
iterator over child components to be rendered

renderChild

protected void renderChild(wicket.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


Copyright © 2004-2008 Wicket developers. All Rights Reserved.