public abstract class VelocityPanel extends Panel implements IMarkupResourceStreamProvider, IMarkupCacheKeyProvider
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
.
ENABLE, FLAG_AFTER_RENDERING, FLAG_INITIALIZED, FLAG_PREPARED_FOR_RENDER, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RENDERING, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING
Constructor and Description |
---|
VelocityPanel(String id,
IModel<? extends Map> model)
Construct.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
escapeHtml()
Gets whether to escape HTML characters.
|
static VelocityPanel |
forTemplateResource(String id,
IModel<? extends Map> model,
IResourceStream templateResource)
Convenience factory method to create a
VelocityPanel instance with a given
template resource . |
String |
getCacheKey(MarkupContainer container,
Class<?> containerClass)
Provide the markup cache key for the associated Markup resource stream.
|
IResourceStream |
getMarkupResourceStream(MarkupContainer container,
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).
|
getRegionMarkup, newMarkupSourcingStrategy
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onAfterRenderChildren, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterfaceAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, visitParents, warn, wrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
dequeue, newDequeueContext
public static VelocityPanel forTemplateResource(String id, IModel<? extends Map> model, IResourceStream templateResource)
VelocityPanel
instance with a given
template resource
.id
- Component idmodel
- optional model for variable substitution.templateResource
- The template resourceVelocityPanel
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, 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 withpublic final String getCacheKey(MarkupContainer container, Class<?> containerClass)
getCacheKey
in interface IMarkupCacheKeyProvider
container
- The MarkupContainer object requesting the markup cache keycontainerClass
- The container the markup should be associated withIMarkupResourceStreamProvider
protected void onDetach()
onDetach
in class MarkupContainer
Copyright © 2006–2021 Apache Software Foundation. All rights reserved.