org.apache.wicket.velocity.markup.html
Class VelocityPanel
java.lang.Object
org.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
org.apache.wicket.markup.html.panel.Panel
org.apache.wicket.velocity.markup.html.VelocityPanel
- All Implemented Interfaces:
- Serializable, Iterable<Component>, IEventSink, IEventSource, IClusterable, IConverterLocator, IHeaderContributor, IMarkupCacheKeyProvider, IMarkupResourceStreamProvider, IRequestableComponent, IHierarchical<Component>
public abstract class VelocityPanel
- extends Panel
- implements IMarkupResourceStreamProvider, IMarkupCacheKeyProvider
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.
- See Also:
- Serialized Form
| Fields inherited from class org.apache.wicket.markup.html.panel.Panel |
PANEL |
| Fields inherited from class org.apache.wicket.Component |
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
| Methods inherited from class org.apache.wicket.MarkupContainer |
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkupStream, getMarkupType, hasAssociatedMarkup, internalAdd, iterator, iterator, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren |
| Methods inherited from class org.apache.wicket.Component |
add, addStateChange, afterRender, beforeRender, callOnBeforeRenderIfNotVisible, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachBehaviors, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onConfigure, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponent, renderComponentTag, rendered, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap |
VelocityPanel
public VelocityPanel(String id,
IModel<? extends Map> model)
- Construct.
- Parameters:
id - Component idtemplateResource - The velocity template as a string resourcemodel - Model with variables that can be substituted by Velocity.
forTemplateResource
public static VelocityPanel forTemplateResource(String id,
IModel<? extends Map> model,
IStringResourceStream templateResource)
- Convenience factory method to create a
VelocityPanel instance with a given
template resource.
- Parameters:
id - Component idmodel - optional model for variable substitution.templateResource - The template resource
- Returns:
- an instance of
VelocityPanel
onComponentTagBody
protected void onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
- Overrides:
onComponentTagBody in class Panel
- See Also:
org.apache.wicket.markup.html.panel.Panel#onComponentTagBody(org.apache.wicket.markup.
MarkupStream, org.apache.wicket.markup.ComponentTag)
escapeHtml
protected boolean escapeHtml()
- Gets whether to escape HTML characters.
- Returns:
- whether to escape HTML characters. The default value is false.
getTemplateResource
protected abstract IStringResourceStream getTemplateResource()
- Returns the template resource passed to the constructor.
- Returns:
- The template resource
parseGeneratedMarkup
protected boolean parseGeneratedMarkup()
- Gets whether to parse the resulting Wicket markup.
- Returns:
- whether to parse the resulting Wicket markup. The default is false.
throwVelocityExceptions
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). The default is false, which
traps and displays any exception without having consequences for the other components on the
page.
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.
- Returns:
- Whether any velocity exceptions should be thrown or trapped. The default is false.
getMarkupResourceStream
public final IResourceStream getMarkupResourceStream(MarkupContainer container,
Class<?> containerClass)
- Specified by:
getMarkupResourceStream in interface IMarkupResourceStreamProvider
- See Also:
org.apache.wicket.markup.IMarkupResourceStreamProvider#getMarkupResourceStream(org.apache
.wicket.MarkupContainer, java.lang.Class)
getCacheKey
public final String getCacheKey(MarkupContainer container,
Class<?> containerClass)
- Specified by:
getCacheKey in interface IMarkupCacheKeyProvider
- See Also:
org.apache.wicket.markup.IMarkupCacheKeyProvider#getCacheKey(org.apache.wicket.
MarkupContainer, java.lang.Class)
onDetach
protected void onDetach()
- Overrides:
onDetach in class Component
- See Also:
Component.onDetach()
Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.