Class 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 using renderIterator() 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 to renderChild(Component). A typical implementation simply does child.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 of FormComponents in stateless pages because the form components will not be available during the action phase (i.e. at Form.onSubmit()). Use RepeatingView in these cases.
Author:
Igor Vaynberg (ivaynberg)
See Also:
  • Constructor Details

  • Method Details

    • 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 class MarkupContainer
    • 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 Component.onBeforeRender() call to its children it is strongly recommended that super call is made at the end of the override.

      Changes to the component tree can be made only before calling super.onBeforeRender().
      Overrides:
      onBeforeRender in class Component
      See Also:
    • getMarkup

      Description copied from class: MarkupContainer
      Get the markup of the child.
      Overrides:
      getMarkup in class MarkupContainer
      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:
    • 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 to MarkupContainer.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 class MarkupContainer
      Parameters:
      dequeue - the dequeue context to use