info.magnolia.rendering.model
Interface RenderingModel<RD extends RenderableDefinition>

Type Parameters:
RD - - an instance of RenderableDefinition
All Known Subinterfaces:
EarlyExecutionAware<RD>
All Known Implementing Classes:
RenderingModelImpl

public interface RenderingModel<RD extends RenderableDefinition>

A RenderingModel is used during rendering, it is analogous to the model part of the MVC pattern. It is associated with a renderable and is executed before a content node using the renderable is rendered. The renderer instantiates the RenderingModel and calls its execute method. While rendering the model is available to the template script under the name model and the value returned by the execute method is available under the name actionResult. It is commonly used to add backing logic to a component.

Instantiation

It is created using reflection for each renderable and used only once, its constructor can declare as arguments any components that can be provided by the current ComponentProvider and in addition it can declare any of the following constructor arguments: After instantiation all request parameters are then mapped to the model's properties.

It can also abort the rendering by returning SKIP_RENDERING from its execute method.

Version:
$Id$

Field Summary
static String SKIP_RENDERING
          A constant used in some special cases where rendering must be skipped, i.e.
 
Method Summary
 String execute()
          Called after all properties were set.
 info.magnolia.jcr.util.ContentMap getContent()
          Map representation of the content node tied to this model.
 RD getDefinition()
          The renderable (template, area or component) tied to this model.
 javax.jcr.Node getNode()
          The content node tied to this model.
 RenderingModel<?> getParent()
          The model of the parent component or template.
 RenderingModel<?> getRoot()
          The top root model of the rendering process.
 

Field Detail

SKIP_RENDERING

static final String SKIP_RENDERING
A constant used in some special cases where rendering must be skipped, i.e. a redirect template. It can be used by template models as a return value for the execute() method to inform AbstractRenderer that it should not render anything in that particular case.

See Also:
Constant Field Values
Method Detail

getParent

RenderingModel<?> getParent()
The model of the parent component or template.


getNode

javax.jcr.Node getNode()
The content node tied to this model.


getContent

info.magnolia.jcr.util.ContentMap getContent()
Map representation of the content node tied to this model.


getDefinition

RD getDefinition()
The renderable (template, area or component) tied to this model.


execute

String execute()
Called after all properties were set. Can return a string which is passed to the method. RenderableDefinition#determineTemplatePath(String, RenderingModel)


getRoot

RenderingModel<?> getRoot()
The top root model of the rendering process. In for example the scope of rendering a page this would be the pages model.



Copyright © 2003-2012 Magnolia International Ltd.. All Rights Reserved.