Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Some inline code formatting

...

1. Determine component visibility. If the component is not visible,
the RequestCycle's Response is changed to NullResponse.getInstance(),
which is a Response implementation that simply discards its output.

2. Component.onRender() is called to allow the Component's rendering
implementation to actually render the Component.

3. Any Component models are detached to reduce the size of the
Component hierarchy in case it is replicated across a cluster.

The implementation of onRender() can really be anything that writes to
the Response, but it typically is not overridden. The default
implementation of onRender() in MarkupContainer simply calls:

Code Block
	protected void onRender()
	{
		renderAll(findMarkupStream());
	}

which renders the markup in the container. The implementation of
onRender() in WebComponent and WebMarkupContainer calls a different
method that is tuned to rendering reusable components rather than
containers full of arbitrary markup:

Code Block
	protected void onRender()
	{
		renderComponent(findMarkupStream());
	}

The renderComponent() method gets a mutable copy of the next Tag in the
markup stream for the component and calls onComponentTag(Tag) to allow
the subclass to modify the tag. Once the subclass has changed the
tag, it is written out to the Response with renderComponentTag(Tag)
and the markup stream is advanced to the next tag. Next
onComponentTagBody() is called, passing in the MarkupStream and the
ComponentTag that was written out as the opening tag. This allows the
component to do whatever it needs to do to produce a body for the
component tag. One operation the subclass can call in
onComponentTagBody() is Component.replaceComponentTagBody(), which
replaces the markup inside the component's body with an arbtiraryarbitrary
String. Finally, the framework writes out any appropriate closing tag
for the component's open tag.

...