Module org.apache.wicket.core
Interface IPartialPageRequestHandler
- All Superinterfaces:
IPageClassRequestHandler
,IPageRequestHandler
,IRequestHandler
- All Known Subinterfaces:
AjaxRequestTarget
,IWebSocketRequestHandler
- All Known Implementing Classes:
AbstractPartialPageRequestHandler
,AjaxRequestHandler
,WebSocketRequestHandler
Request handler that allows partial updates of the current page instance.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds components to the list of components to be rendered.void
Adds a component to the list of components to be renderedvoid
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
void
appendJavaScript
(CharSequence javascript) Add JavasSript that will be evaluated on the client side after components are replacedvoid
focusComponent
(Component component) Sets the focus in the browser to the given component.Collection<? extends Component>
Returns an unmodifiable collection of all components added to this targetReturns the header response associated with current handler.void
prependJavaScript
(CharSequence javascript) Add JavaScript that will be evaluated on the client side before components are replaced.Methods inherited from interface org.apache.wicket.core.request.handler.IPageClassRequestHandler
getPageClass, getPageParameters
Methods inherited from interface org.apache.wicket.core.request.handler.IPageRequestHandler
getPage, getPageId, getRenderCount, isPageInstanceCreated
Methods inherited from interface org.apache.wicket.request.IRequestHandler
detach, respond
-
Method Details
-
add
Adds a component to the list of components to be rendered- Parameters:
markupId
- id of client-side dom element that will be updatedcomponent
- component to be rendered- Throws:
IllegalArgumentException
- if the component is aPage
or anAbstractRepeater
IllegalStateException
- if the components are currently being rendered, or have already been rendered
-
add
Adds components to the list of components to be rendered.- Parameters:
components
- components to be rendered
-
addChildren
Visits all children of the specified parent container and adds them to the target if they are of same type aschildCriteria
- 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.
-
appendJavaScript
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.- Parameters:
javascript
-
-
prependJavaScript
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.- Parameters:
javascript
-
-
focusComponent
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.- Parameters:
component
- The component to get the focus or null.
-
getComponents
Collection<? extends Component> getComponents()Returns an unmodifiable collection of all components added to this target- Returns:
- unmodifiable collection of all components added to this target
-
getHeaderResponse
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.- Returns:
- header response
-