Class AbstractRenderService<T>
- 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.hippoecm.frontend.service.render.AbstractRenderService<T>
-
- All Implemented Interfaces:
Serializable
,Iterable<org.apache.wicket.Component>
,EventListener
,org.apache.wicket.event.IEventSink
,org.apache.wicket.event.IEventSource
,org.apache.wicket.feedback.IFeedbackContributor
,org.apache.wicket.IConverterLocator
,org.apache.wicket.IMetadataContext<Serializable,org.apache.wicket.Component>
,org.apache.wicket.IQueueRegion
,org.apache.wicket.markup.html.IHeaderContributor
,org.apache.wicket.request.component.IRequestableComponent
,org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>
,org.apache.wicket.util.io.IClusterable
,IObserver
,IRenderService
- Direct Known Subclasses:
ListRenderService
,RenderService
public abstract class AbstractRenderService<T> extends org.apache.wicket.markup.html.panel.Panel implements IObserver, IRenderService
Utility class that bundles a lot of the functionality needed for visual plugins. It registers anIRenderService
, with itself as theComponent
.The configuration parameters are as follows, with the class of the expected service between brackets:
- wicket.model (IModelReference)
The
IModel
that is available with the getModel() method, is the model that is provided by aIModelReference
service. The name for this service can be found in the configuration with thewicket.model
key. When the model is changed with setModel(), this change is propagated to the IModelReference service. When another plugin changes the model or the model object changes, the Component#onModelChanged() method is invoked. It is recommended to override this method to respond to changes. - wicket.id (IRenderService)
The primary task of the RenderPlugin is to provide an
IRenderService
implementation. - wicket.extensions (IRenderService) A list of service names for child render services. These child services will be added to the plugin directly.
- wicket.behavior
A list of service names for
IBehaviorService
s. The behaviors that are exposed by these services are added to the Component. - wicket.variant (Layout) The layout variantion to use. In contrast with Wickets default, the variation is not inherited from the parent.
- wicket.skin (CSS stylesheet) An array of stylesheets that will be added to the HTML head.
- wicket.css (CSS)
An array of CSS class names that will be added to the
Component
that is provided by this render service. - wicket.feedback (Feedback) The feedback service id. When specified, a IFeedbackMessageFilter that accepts messages generated by the component is registered with this id.
- wicket.feedback.scope (FeedbackScope) The feedback reporting scope. Only messages with the configured scope will be reported by the registered message filter.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractRenderService.ExtensionPoint
Base class for extension points.
-
Field Summary
Fields Modifier and Type Field Description static String
BEHAVIOR
protected LinkedHashMap<String,AbstractRenderService.ExtensionPoint>
children
static String
CSS_ID
static String
DEFAULT_LOCALE
static String
EXTENSIONS_ID
static String
FEEDBACK
static String
FEEDBACK_SCOPE
static String
MODEL_ID
static String
SKIN_ID
static String
VARIANT_ID
static String
VISIBLE
static String
WICKET_ID
-
Constructor Summary
Constructors Constructor Description AbstractRenderService(IPluginContext context, IPluginConfig properties)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addExtensionPoint(String extension)
void
bind(IRenderService parent, String wicketId)
Bind the component to the specified id.protected abstract AbstractRenderService.ExtensionPoint
createExtensionPoint(String extension)
Create an extension point with the specified name.void
focus(IRenderService child)
Set focus on the specified child.protected String
getBundleName()
org.apache.wicket.Component
getComponent()
The WicketComponent
that is added to the parent.protected IDialogService
getDialogService()
Utility method to retrieve theIDialogService
} from the plugin framework.String
getId()
String
getMarkupId(boolean createIfDoesNotExist)
org.apache.wicket.model.IModel<T>
getModel()
T
getModelObject()
IObservable
getObservable()
The observable that the observer is interested in.IRenderService
getParentService()
The parent service for this render service.protected IPluginConfig
getPluginConfig()
TheIPluginConfig
that was used to create the service.protected IPluginContext
getPluginContext()
TheIPluginContext
that was used to create the service.protected ResourceBundleModel
getResourceBundleModel(String key, Locale locale)
UserSession
getSession()
String
getVariation()
boolean
isActive()
protected void
onAfterRender()
protected void
onBeforeRender()
void
onComponentTag(org.apache.wicket.markup.ComponentTag tag)
void
onComponentTagBody(org.apache.wicket.markup.MarkupStream markupStream, org.apache.wicket.markup.ComponentTag openTag)
void
onEvent(Iterator event)
Callback that is invoked when the observable sends events.protected void
redraw()
Utility method for subclasses to redraw the completePanel
.protected void
removeExtensionPoint(String name)
void
render(PluginRequestTarget target)
Called after user events and JCR events have been handled, but before the rendering has started.org.apache.wicket.MarkupContainer
setDefaultModel(org.apache.wicket.model.IModel<?> model)
void
setModel(org.apache.wicket.model.IModel<T> model)
void
setModelObject(T object)
void
unbind()
Releases the component.void
updateModel(org.apache.wicket.model.IModel model)
-
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
getRegionMarkup, newMarkupSourcingStrategy
-
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSession
-
Methods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onDetach, onInitialize, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderAssociatedMarkup, renderNext, replace, size, stream, streamChildren, toString, toString, visitChildren, visitChildren
-
Methods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, 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, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMarkupTag, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
WICKET_ID
public static final String WICKET_ID
- See Also:
- Constant Field Values
-
MODEL_ID
public static final String MODEL_ID
- See Also:
- Constant Field Values
-
VARIANT_ID
public static final String VARIANT_ID
- See Also:
- Constant Field Values
-
SKIN_ID
public static final String SKIN_ID
- See Also:
- Constant Field Values
-
CSS_ID
public static final String CSS_ID
- See Also:
- Constant Field Values
-
EXTENSIONS_ID
public static final String EXTENSIONS_ID
- See Also:
- Constant Field Values
-
FEEDBACK
public static final String FEEDBACK
- See Also:
- Constant Field Values
-
FEEDBACK_SCOPE
public static final String FEEDBACK_SCOPE
- See Also:
- Constant Field Values
-
BEHAVIOR
public static final String BEHAVIOR
- See Also:
- Constant Field Values
-
VISIBLE
public static final String VISIBLE
- See Also:
- Constant Field Values
-
DEFAULT_LOCALE
public static final String DEFAULT_LOCALE
- See Also:
- Constant Field Values
-
children
protected final LinkedHashMap<String,AbstractRenderService.ExtensionPoint> children
-
-
Constructor Detail
-
AbstractRenderService
public AbstractRenderService(IPluginContext context, IPluginConfig properties)
-
-
Method Detail
-
getModel
public org.apache.wicket.model.IModel<T> getModel()
-
getModelObject
public T getModelObject()
-
setModel
public final void setModel(org.apache.wicket.model.IModel<T> model)
-
setModelObject
public final void setModelObject(T object)
-
isActive
public boolean isActive()
-
setDefaultModel
public org.apache.wicket.MarkupContainer setDefaultModel(org.apache.wicket.model.IModel<?> model)
- Overrides:
setDefaultModel
in classorg.apache.wicket.MarkupContainer
-
updateModel
public final void updateModel(org.apache.wicket.model.IModel model)
-
getObservable
public IObservable getObservable()
Description copied from interface:IObserver
The observable that the observer is interested in. This observable may not change, w.r.t. theIObservable.equals(java.lang.Object)
method, while the observer is registered.- Specified by:
getObservable
in interfaceIObserver<T>
-
onEvent
public void onEvent(Iterator event)
Description copied from interface:IObserver
Callback that is invoked when the observable sends events. The iterator is guaranteed to be non-empty.
-
getVariation
public String getVariation()
- Overrides:
getVariation
in classorg.apache.wicket.Component
-
getPluginContext
protected IPluginContext getPluginContext()
TheIPluginContext
that was used to create the service.
-
getPluginConfig
protected IPluginConfig getPluginConfig()
TheIPluginConfig
that was used to create the service.
-
redraw
protected void redraw()
Utility method for subclasses to redraw the completePanel
. When invoked during request processing or event handling, the service will be rendered during the rendering phase.For more fine-grained redrawing, subclasses should override the
render(PluginRequestTarget)
method.
-
addExtensionPoint
protected void addExtensionPoint(String extension)
-
createExtensionPoint
protected abstract AbstractRenderService.ExtensionPoint createExtensionPoint(String extension)
Create an extension point with the specified name.
-
removeExtensionPoint
protected void removeExtensionPoint(String name)
-
getDialogService
protected IDialogService getDialogService()
Utility method to retrieve theIDialogService
} from the plugin framework. The dialog service is guaranteed to be available.
-
onComponentTag
public void onComponentTag(org.apache.wicket.markup.ComponentTag tag)
- Overrides:
onComponentTag
in classorg.apache.wicket.Component
-
getComponent
public org.apache.wicket.Component getComponent()
The WicketComponent
that is added to the parent. The component must have the id that was set with theIRenderService.bind(IRenderService, String)
method.- Specified by:
getComponent
in interfaceIRenderService
-
render
public void render(PluginRequestTarget target)
Called after user events and JCR events have been handled, but before the rendering has started. Plugins can registerComponent
s with the request target to enlist in the rendering phase.Implementations that use extensions must call the same method on those.
- Specified by:
render
in interfaceIRenderService
-
focus
public void focus(IRenderService child)
Set focus on the specified child. Implementations should make the child visible when they themselves are visible, or become visible later.- Specified by:
focus
in interfaceIRenderService
- Parameters:
child
- The extension that requests focus. This parameter can be null, in which case the Component should set focus to itself.
-
getId
public String getId()
- Specified by:
getId
in interfaceorg.apache.wicket.request.component.IRequestableComponent
- Overrides:
getId
in classorg.apache.wicket.Component
-
getMarkupId
public String getMarkupId(boolean createIfDoesNotExist)
- Overrides:
getMarkupId
in classorg.apache.wicket.Component
-
getSession
public UserSession getSession()
- Overrides:
getSession
in classorg.apache.wicket.Component
-
bind
public void bind(IRenderService parent, String wicketId)
Description copied from interface:IRenderService
Bind the component to the specified id. Provides the render service with a reference to the parent render service.- Specified by:
bind
in interfaceIRenderService
-
unbind
public void unbind()
Description copied from interface:IRenderService
Releases the component. Implementations cannot use the parent reference after this method has been invoked.- Specified by:
unbind
in interfaceIRenderService
-
getParentService
public IRenderService getParentService()
The parent service for this render service.- Specified by:
getParentService
in interfaceIRenderService
-
getResourceBundleModel
protected final ResourceBundleModel getResourceBundleModel(String key, Locale locale)
-
getBundleName
protected String getBundleName()
-
onBeforeRender
protected void onBeforeRender()
- Overrides:
onBeforeRender
in classorg.apache.wicket.Component
-
onAfterRender
protected void onAfterRender()
- Overrides:
onAfterRender
in classorg.apache.wicket.Component
-
onComponentTagBody
public void onComponentTagBody(org.apache.wicket.markup.MarkupStream markupStream, org.apache.wicket.markup.ComponentTag openTag)
- Overrides:
onComponentTagBody
in classorg.apache.wicket.MarkupContainer
-
-