public abstract class PartialPageUpdate extends Object
The elements of such response are:
Modifier and Type | Class and Description |
---|---|
protected static class |
PartialPageUpdate.ResponseBuffer
Wrapper of a response that buffers its contents.
|
Modifier and Type | Field and Description |
---|---|
protected List<CharSequence> |
appendJavaScripts
A list of scripts (JavaScript) which should be executed on the client side after the
components' replacement
|
protected PartialPageUpdate.ResponseBuffer |
bodyBuffer
Buffer of response body.
|
protected boolean |
componentsFrozen
A flag that indicates that components cannot be added anymore.
|
protected List<CharSequence> |
domReadyJavaScripts
A list of scripts (JavaScript) which should be executed on the client side after the
components' replacement.
|
protected HtmlHeaderContainer |
header |
protected PartialPageUpdate.ResponseBuffer |
headerBuffer
Buffer of response header.
|
protected Map<String,Component> |
markupIdToComponent
The component instances that will be rendered/replaced.
|
protected List<CharSequence> |
prependJavaScripts
A list of scripts (JavaScript) which should be executed on the client side before the
components' replacement
|
Constructor and Description |
---|
PartialPageUpdate(Page page)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Component component,
String markupId)
Adds a component to be updated at the client side with its current markup
|
void |
appendJavaScript(CharSequence javascript)
Adds script to the ones which are executed after the component replacement.
|
protected boolean |
containsAncestorFor(Component component)
Checks if the target contains an ancestor for the given component
|
boolean |
containsPage() |
void |
detach(IRequestCycle requestCycle)
Detaches the page if at least one of its components was updated.
|
boolean |
equals(Object o) |
Collection<? extends Component> |
getComponents() |
IHeaderResponse |
getHeaderResponse()
Gets or creates an IHeaderResponse instance to use for the header contributions.
|
int |
hashCode() |
protected void |
onAfterRespond(Response response)
Hook-method called after components are written.
|
protected void |
onBeforeRespond(Response response)
Hook-method called before components are written.
|
void |
prependJavaScript(CharSequence javascript)
Adds script to the ones which are executed before the component replacement.
|
abstract void |
setContentType(WebResponse response,
String encoding)
Sets the Content-Type header to indicate the type of the response.
|
protected abstract void |
writeComponent(Response response,
String markupId,
Component component,
String encoding)
Writes a single component
|
protected abstract void |
writeFooter(Response response,
String encoding) |
protected abstract void |
writeHeader(Response response,
String encoding)
Writes the head part of the response.
|
protected abstract void |
writeHeaderContribution(Response response)
Writes header contribution (<link/> or <script/>) to the response.
|
protected void |
writeHeaderContribution(Response response,
Component component) |
protected abstract void |
writeNormalEvaluations(Response response,
Collection<CharSequence> js) |
protected abstract void |
writePriorityEvaluations(Response response,
Collection<CharSequence> js) |
void |
writeTo(Response response,
String encoding)
Serializes this object to the response.
|
protected final List<CharSequence> prependJavaScripts
protected final List<CharSequence> appendJavaScripts
protected final List<CharSequence> domReadyJavaScripts
protected final Map<String,Component> markupIdToComponent
protected transient boolean componentsFrozen
add(Component, String)
protected final PartialPageUpdate.ResponseBuffer bodyBuffer
protected final PartialPageUpdate.ResponseBuffer headerBuffer
protected HtmlHeaderContainer header
public PartialPageUpdate(Page page)
page
- the page which components are being updated.public void writeTo(Response response, String encoding)
response
- the response to write toencoding
- the encoding for the responseprotected void onBeforeRespond(Response response)
response
- protected void onAfterRespond(Response response)
response
- protected abstract void writeFooter(Response response, String encoding)
response
- the response to write toencoding
- the encoding for the responseprotected abstract void writePriorityEvaluations(Response response, Collection<CharSequence> js)
response
- the response to write tojs
- the JavaScript to evaluateprotected abstract void writeNormalEvaluations(Response response, Collection<CharSequence> js)
response
- the response to write tojs
- the JavaScript to evaluateprotected abstract void writeComponent(Response response, String markupId, Component component, String encoding)
response
- the response to write tomarkupId
- the markup id to use for the component replacementcomponent
- the component which markup will be used as replacementencoding
- the encoding for the responseprotected abstract void writeHeader(Response response, String encoding)
response
- the response to write toencoding
- the encoding for the responseprotected abstract void writeHeaderContribution(Response response)
response
- the response to write topublic final void appendJavaScript(CharSequence javascript)
javascript
- the javascript to executepublic final void prependJavaScript(CharSequence javascript)
javascript
- the javascript to executepublic final void add(Component component, String markupId) throws IllegalArgumentException, IllegalStateException
component
- the component to updatemarkupId
- the markup id to use to find the component in the page's markupIllegalArgumentException
- thrown when a Page or an AbstractRepeater is addedIllegalStateException
- thrown when components no more can be added for replacement.public final Collection<? extends Component> getComponents()
public void detach(IRequestCycle requestCycle)
requestCycle
- the current request cycleprotected boolean containsAncestorFor(Component component)
component
- the component which ancestors should be checked.true
if target contains an ancestor for the given componentpublic boolean containsPage()
true
if the page has been added for replacementpublic IHeaderResponse getHeaderResponse()
protected void writeHeaderContribution(Response response, Component component)
response
- the response to write tocomponent
- to component which will contribute to the headerpublic abstract void setContentType(WebResponse response, String encoding)
response
- the current we responseencoding
- the encoding to useCopyright © 2006–2020 Apache Software Foundation. All rights reserved.