org.apache.wicket.ajax
public interface AjaxRequestTarget extends IPageRequestHandler, ILoggableRequestHandler
Modifier and Type | Interface and Description |
---|---|
static class |
AjaxRequestTarget.AbstractListener
Empty implementation of an
AjaxRequestTarget.IListener useful as a starting point for your own
custom listener. |
static interface |
AjaxRequestTarget.IJavaScriptResponse
An ajax javascript response that allows users to add javascript to be executed on the client
side
|
static interface |
AjaxRequestTarget.IListener
An
AjaxRequestTarget listener that can be used to respond to various target-related
events |
static interface |
AjaxRequestTarget.ITargetRespondListener
Components can implement this interface to get a notification when AjaxRequestTarget begins
to respond.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Component... components)
Adds components to the list of components to be rendered.
|
void |
add(Component component,
String markupId)
Adds a component to the list of components to be rendered
|
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 as
childCriteria |
void |
addListener(AjaxRequestTarget.IListener listener)
Adds a listener to this target
|
void |
appendJavaScript(CharSequence javascript)
Adds javascript that will be evaluated on the client side after components are replaced
|
void |
focusComponent(Component component)
Sets the focus in the browser to the given component.
|
Collection<? extends Component> |
getComponents()
Returns an unmodifiable collection of all components added to this target
|
IHeaderResponse |
getHeaderResponse()
Returns the header response associated with current AjaxRequestTarget.
|
String |
getLastFocusedElementId()
Returns the HTML id of the last focused element.
|
Page |
getPage()
Returns the page.
|
void |
prependJavaScript(CharSequence javascript)
Adds javascript that will be evaluated on the client side before components are replaced.
|
void |
registerRespondListener(AjaxRequestTarget.ITargetRespondListener listener)
Register the given respond listener.
|
getPageId, getRenderCount, isPageInstanceCreated
getPageClass, getPageParameters
detach, respond
getLogData
void add(Component component, String markupId)
markupId
- id of client-side dom element that will be updatedcomponent
- component to be renderedIllegalArgumentException
- if the component is a Page
or an AbstractRepeater
IllegalStateException
- if the components are currently being rendered, or have already been renderedvoid add(Component... components)
components
- components to be renderedvoid addChildren(MarkupContainer parent, Class<?> childCriteria)
childCriteria
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.void addListener(AjaxRequestTarget.IListener listener)
listener
- IllegalStateException
- if AjaxRequestTarget.IListener
's events are currently being fired or have both been fired
alreadyvoid appendJavaScript(CharSequence javascript)
If the javascript needs to do something asynchronously (i.e. needs to use window.setTimeout(), for example
to do animations) then the following special syntax may be used: someFunctionName|myJsLogic(someFunctionName);
.
Wicket will transform it to: function(someFunctionName){myJsLogic(someFunctionName);}
and your code
is responsible to execute someFunctionName() when the asynchronous task is finished. Once someFunctionName
is executed the next appended script will be executed. Important: it is highly recommended to
execute your code in try/finally to make sure someFunctionName is executed even an error happens in
your code, otherwise all following scripts wont be executed.
javascript
- void prependJavaScript(CharSequence javascript)
If the javascript needs to do something asynchronously (i.e. needs to use window.setTimeout(), for example
to do animations) then the following special syntax may be used: someFunctionName|myJsLogic(someFunctionName);
.
Wicket will transform it to: function(someFunctionName){myJsLogic(someFunctionName);}
and your code
is responsible to execute someFunctionName() when the asynchronous task is finished. Once someFunctionName
is executed the next prepended script will be executed. Important: it is highly recommended to
execute your code in try/finally to make sure someFunctionName is executed even an error happens in
your code, otherwise all following scripts and component replacements wont be made.
javascript
- void registerRespondListener(AjaxRequestTarget.ITargetRespondListener listener)
AjaxRequestTarget.ITargetRespondListener.onTargetRespond(org.apache.wicket.ajax.AjaxRequestTarget)
method will be invoked when
the AjaxRequestTarget
starts to respond.listener
- Collection<? extends Component> getComponents()
void focusComponent(Component component)
component
- The component to get the focus or null.IHeaderResponse getHeaderResponse()
String getLastFocusedElementId()
null
if nonePage getPage()
getPage
in interface IPageRequestHandler
Copyright © 2006–2017 Apache Software Foundation. All rights reserved.