|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Component org.apache.wicket.MarkupContainer org.apache.wicket.markup.html.WebMarkupContainer org.apache.wicket.markup.html.panel.Panel org.apache.wicket.velocity.markup.html.VelocityPanel
public abstract class VelocityPanel
Panel that displays the result of rendering a Velocity template. The template itself can be any
StringResourceStream
implementation, of which there are a number of convenient
implementations in the org.apache.wicket.util
package. The model can be any normal
Map
, which will be used to create the VelocityContext
.
Note: Be sure to properly initialize the Velocity engine before using
VelocityPanel
.
Field Summary |
---|
Fields inherited from class org.apache.wicket.markup.html.panel.Panel |
---|
PANEL |
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
VelocityPanel(java.lang.String id,
IModel<? extends java.util.Map> model)
Construct. |
Method Summary | |
---|---|
protected boolean |
escapeHtml()
Gets whether to escape HTML characters. |
static VelocityPanel |
forTemplateResource(java.lang.String id,
IModel<? extends java.util.Map> model,
IResourceStream templateResource)
Convenience factory method to create a VelocityPanel instance with a given
template resource . |
java.lang.String |
getCacheKey(MarkupContainer container,
java.lang.Class<?> containerClass)
Provide the markup cache key for the associated Markup resource stream. |
IResourceStream |
getMarkupResourceStream(MarkupContainer container,
java.lang.Class<?> containerClass)
Create a new markup resource stream for the container. |
protected abstract IResourceStream |
getTemplateResource()
Returns the template resource passed to the constructor. |
void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Handle the container's body. |
protected void |
onDetach()
Called to allow a component to detach resources after use. |
protected boolean |
parseGeneratedMarkup()
Gets whether to parse the resulting Wicket markup. |
protected boolean |
throwVelocityExceptions()
Whether any velocity exception should be trapped and displayed on the panel (false) or thrown up to be handled by the exception mechanism of Wicket (true). |
Methods inherited from class org.apache.wicket.markup.html.panel.Panel |
---|
newMarkupSourcingStrategy |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VelocityPanel(java.lang.String id, IModel<? extends java.util.Map> model)
id
- Component idtemplateResource
- The velocity template as a string resourcemodel
- Model with variables that can be substituted by Velocity.Method Detail |
---|
public static VelocityPanel forTemplateResource(java.lang.String id, IModel<? extends java.util.Map> model, IResourceStream templateResource)
VelocityPanel
instance with a given
template resource
.
id
- Component idmodel
- optional model for variable substitution.templateResource
- The template resource
VelocityPanel
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
onComponentTagBody
in class MarkupContainer
markupStream
- The markup streamopenTag
- The open tag for the bodyprotected boolean escapeHtml()
protected abstract IResourceStream getTemplateResource()
protected boolean parseGeneratedMarkup()
protected boolean throwVelocityExceptions()
Trapping these exceptions without disturbing the other components is especially useful in CMS like applications, where 'normal' users are allowed to do basic scripting. On errors, you want them to be able to have them correct them while the rest of the application keeps on working.
public final IResourceStream getMarkupResourceStream(MarkupContainer container, java.lang.Class<?> containerClass)
Note: usually it will only called once, as the IResourceStream will be cached by MarkupCache.
getMarkupResourceStream
in interface IMarkupResourceStreamProvider
container
- The MarkupContainer which requests to load the Markup resource streamcontainerClass
- The container the markup should be associated with
public final java.lang.String getCacheKey(MarkupContainer container, java.lang.Class<?> containerClass)
getCacheKey
in interface IMarkupCacheKeyProvider
container
- The MarkupContainer object requesting the markup cache keycontainerClass
- The container the markup should be associated with
IMarkupResourceStreamProvider
protected void onDetach()
onDetach
in class Component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |