Module org.apache.wicket.core
Class AbstractPartialPageRequestHandler
java.lang.Object
org.apache.wicket.core.request.handler.AbstractPartialPageRequestHandler
- All Implemented Interfaces:
IPageClassRequestHandler
,IPageRequestHandler
,IPartialPageRequestHandler
,IRequestHandler
- Direct Known Subclasses:
AjaxRequestHandler
,WebSocketRequestHandler
public abstract class AbstractPartialPageRequestHandler
extends Object
implements IPartialPageRequestHandler
Abstract
IPartialPageRequestHandler
that implements common methods for Ajax and Web-sockets
specializations of IPartialPageRequestHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds components to the list of components to be rendered.final void
Adds a component to the list of components to be renderedfinal void
addChildren
(MarkupContainer parent, Class<?> childCriteria) Visits all children of the specified parent container and adds them to the target if they are of same type aschildCriteria
final void
appendJavaScript
(CharSequence javascript) Add JavasSript that will be evaluated on the client side after components are replacedfinal void
focusComponent
(Component component) Sets the focus in the browser to the given component.final IHeaderResponse
Returns the header response associated with current handler.final Page
getPage()
Returns the page.final Class<? extends IRequestablePage>
Returns the page classfinal Integer
Returns the page id.final PageParameters
final Integer
Returns the number of times this page has been rendered.protected abstract PartialPageUpdate
final boolean
Checks if the page instance is already created or if it will be created whenIPageRequestHandler.getPage()
is calledfinal void
prependJavaScript
(CharSequence javascript) Add JavaScript that will be evaluated on the client side before components are replaced.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.wicket.core.request.handler.IPartialPageRequestHandler
getComponents
Methods inherited from interface org.apache.wicket.request.IRequestHandler
detach, respond
-
Constructor Details
-
AbstractPartialPageRequestHandler
-
-
Method Details
-
addChildren
Description copied from interface:IPartialPageRequestHandler
Visits all children of the specified parent container and adds them to the target if they are of same type aschildCriteria
- Specified by:
addChildren
in interfaceIPartialPageRequestHandler
- Parameters:
parent
- Must not be null.childCriteria
- Must not be null. If you want to traverse all components use ` Component.class as the value for this argument.
-
add
Description copied from interface:IPartialPageRequestHandler
Adds components to the list of components to be rendered.- Specified by:
add
in interfaceIPartialPageRequestHandler
- Parameters:
components
- components to be rendered
-
getPageId
Description copied from interface:IPageRequestHandler
Returns the page id.- Specified by:
getPageId
in interfaceIPageRequestHandler
- Returns:
- page id
-
getRenderCount
Description copied from interface:IPageRequestHandler
Returns the number of times this page has been rendered.- Specified by:
getRenderCount
in interfaceIPageRequestHandler
- Returns:
- the number of times this page has been rendered.
- See Also:
-
getPageParameters
- Specified by:
getPageParameters
in interfaceIPageClassRequestHandler
- Returns:
- page parameters
-
add
Description copied from interface:IPartialPageRequestHandler
Adds a component to the list of components to be rendered- Specified by:
add
in interfaceIPartialPageRequestHandler
- Parameters:
component
- component to be renderedmarkupId
- id of client-side dom element that will be updated
-
prependJavaScript
Description copied from interface:IPartialPageRequestHandler
Add JavaScript that will be evaluated on the client side before components are replaced.If the JavaScript needs to do something asynchronously (i.e. uses window.setTimeout(), for example to do animations), it may call
Wicket.Ajax.suspendCall()
to suspend the evaluation of the current Ajax call. The returned function has to be called when the asynchronous task is finished, after which the evaluation of the Ajax call is continued, e.g.target.prependJavaScript("var continueCall = Wicket.Ajax.suspendCall(); try { ... } finally { continueCall(); }");
Important: it is recommended to execute your code in try/finally to make sure the function is executed even if an error happens in your code, otherwise all following scripts and component replacements wont be made.- Specified by:
prependJavaScript
in interfaceIPartialPageRequestHandler
-
appendJavaScript
Description copied from interface:IPartialPageRequestHandler
Add JavasSript that will be evaluated on the client side after components are replacedIf the JavaScript needs to do something asynchronously (i.e. uses window.setTimeout(), for example to do animations), it may call
Wicket.Ajax.suspendCall()
to suspend the evaluation of the current Ajax call. The returned function has to be called when the asynchronous task is finished, after which the evaluation of the Ajax call is continued, e.g.target.appendJavaScript("var continueCall = Wicket.Ajax.suspendCall(); try { ... } finally { continueCall(); }");
Important: it is recommended to execute your code in try/finally to make sure the function is executed even if an error happens in your code, otherwise all following scripts and component replacements wont be made.- Specified by:
appendJavaScript
in interfaceIPartialPageRequestHandler
-
focusComponent
Description copied from interface:IPartialPageRequestHandler
Sets the focus in the browser to the given component. The markup id must be set. If the component is null the focus will not be set to any component.- Specified by:
focusComponent
in interfaceIPartialPageRequestHandler
- Parameters:
component
- The component to get the focus or null.
-
isPageInstanceCreated
Description copied from interface:IPageRequestHandler
Checks if the page instance is already created or if it will be created whenIPageRequestHandler.getPage()
is called- Specified by:
isPageInstanceCreated
in interfaceIPageRequestHandler
- Returns:
true
iff page instance is already created
-
getHeaderResponse
Description copied from interface:IPartialPageRequestHandler
Returns the header response associated with current handler. Beware that only renderOnDomReadyJavaScript and renderOnLoadJavaScript can be called outside the renderHeader(IHeaderResponse response) method. Calls to other render** methods will result in the call failing with a debug-level log statement to help you see why it failed.- Specified by:
getHeaderResponse
in interfaceIPartialPageRequestHandler
- Returns:
- header response
-
getUpdate
-
getPage
Description copied from interface:IPageRequestHandler
Returns the page. Be aware that the page can be instantiated if this wasn't the case already.- Specified by:
getPage
in interfaceIPageRequestHandler
- Returns:
- page instance
- See Also:
-
getPageClass
Description copied from interface:IPageClassRequestHandler
Returns the page class- Specified by:
getPageClass
in interfaceIPageClassRequestHandler
- Returns:
- page class
-