|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwicket.ajax.AjaxRequestTarget
public class AjaxRequestTarget
A request target that produces ajax response envelopes used on the client side to update component markup as well as evaluate arbitrary javascript.
A component whose markup needs to be updated should be added to this target via AjaxRequestTarget#addComponent(Component) method. Its body will be rendered and added to the envelope when the target is processed, and refreshed on the client side when the ajax response is received.
It is important that the component whose markup needs to be updated contains an id attribute in the generated markup that is equal to the value retrieved from Component#getMarkupId(). This can be accomplished by either setting the id attribute in the html template, or using an attribute modifier that will add the attribute with value Component#getMarkupId() to the tag ( such as MarkupIdSetter )
Any javascript that needs to be evaluater on the client side can be added using AjaxRequestTarget#addJavascript(String). For example, this feature can be useful when it is desirable to link component update with some javascript effects.
| Constructor Summary | |
|---|---|
AjaxRequestTarget()
Constructor |
|
| Method Summary | |
|---|---|
void |
addComponent(Component component)
Adds a component to the list of components to be rendered |
void |
addComponent(Component component,
java.lang.String markupId)
Adds a component to the list of components to be rendered |
void |
addJavascript(java.lang.String javascript)
Deprecated. use appendJavascript(String javascript) instead |
void |
appendJavascript(java.lang.String javascript)
Adds javascript that will be evaluated on the client side after components are replaced |
void |
detach(RequestCycle requestCycle)
This method is alled on the end of a request cycle to indicate that processing is done and that cleaning up of the subject(s) of this target may be done. |
protected java.lang.String |
encode(java.lang.String str)
Encodes a string so it is safe to use inside CDATA blocks |
boolean |
equals(java.lang.Object obj)
|
protected java.lang.String |
getEncodingName()
|
java.lang.Object |
getLock(RequestCycle requestCycle)
Gets the lock to be used for synchronization. |
int |
hashCode()
|
protected boolean |
needsEncoding(java.lang.String str)
|
void |
prependJavascript(java.lang.String javascript)
Adds javascript that will be evaluated on the client side before components are replaced |
void |
respond(RequestCycle requestCycle)
Generates a response. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AjaxRequestTarget()
| Method Detail |
|---|
public final void addComponent(Component component)
component - component to be rendered
public final void addComponent(Component component,
java.lang.String markupId)
markupId - id of client-side dom element that will be updatedcomponent - component to be renderedpublic final void addJavascript(java.lang.String javascript)
javascript - public final void appendJavascript(java.lang.String javascript)
javascript - public void detach(RequestCycle requestCycle)
IRequestTarget
detach in interface IRequestTargetrequestCycle - the current request cycleIRequestTarget.detach(wicket.RequestCycle)public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public java.lang.Object getLock(RequestCycle requestCycle)
IRequestTarget
getLock in interface IRequestTargetrequestCycle - the current request cycle
IRequestTarget.getLock(RequestCycle)public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public final void prependJavascript(java.lang.String javascript)
javascript - public final void respond(RequestCycle requestCycle)
IRequestTarget
respond in interface IRequestTargetrequestCycle - the current request cycleIRequestTarget.respond(wicket.RequestCycle)public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()protected java.lang.String encode(java.lang.String str)
str -
protected java.lang.String getEncodingName()
protected boolean needsEncoding(java.lang.String str)
str -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||