|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.tacos.ajax.contrib.PrototypeResponseBuilder
public class PrototypeResponseBuilder
Response renderer implementation of the prototype library. Prototype doesn't currently handle the notion of multiple partial responses, so this instance effectively dumps the entirety of its contents into one node in the response.
http://prototype.conio.net/
Field Summary | |
---|---|
protected AjaxWebRequest |
ajaxRequest
Ajax request |
static String |
CONTENT_TYPE
Content type |
protected org.apache.tapestry.IMarkupWriter |
writer
XML Markup writer to write to |
protected Map |
writers
Map of component id's to their nested markup writer instances, which we have to use or else the writer will conflic with our xml nodes |
Fields inherited from interface net.sf.tacos.ajax.ResponseBuilder |
---|
SCRIPT_BLOCK |
Constructor Summary | |
---|---|
PrototypeResponseBuilder()
Default constructor |
Method Summary | |
---|---|
void |
addExceptionResponse(org.apache.tapestry.IPage exceptionPage,
org.apache.tapestry.IRequestCycle cycle)
Adds the specified Exception page to Ajax response. |
void |
addPostProcessScript(String script)
Script that will be executed just after any content replacements in the response, but before anything in the normal script blocks. |
void |
addPreProcessScript(String script)
Adds the specified script string to the preprocessing section of the client response. |
void |
addResponseBlock(String id,
String data)
Adds an arbitrary block of markup to this responses response. |
void |
addStatusResponse(String status)
Adds an xml response block of type "statustext". |
protected org.apache.tapestry.IComponent |
checkComponentContainers(org.apache.tapestry.IComponent comp)
Certain components that a requested component refresh are contained by might prevent the successfull render of a component directly, such as a Foreach component. |
void |
cleanupAfterRender()
Invoked by AjaxDirectService after a request cycle
so invokers can cleanup resources. |
boolean |
componentWriterExists(String id)
Checks for the existance of a previously created component IMarkupWriter , this is currently
only used in manual block writing semantics, specifically
in the Tree components rendering logic. |
AjaxWebRequest |
getAjaxRequest()
The ajax request |
protected String |
getComponentId(org.apache.tapestry.IComponent comp)
Gets the id of the specified component, choosing the "id" element binding over any other id. |
org.apache.tapestry.IMarkupWriter |
getComponentWriter(String id)
Gets a NestedMarkupWriter for the specified
component to write to and caches the buffer for later
write to the stream via the cleanupAfterRender() . |
String |
getContentType()
Should return the content type response that this builder generates. |
org.apache.tapestry.IMarkupWriter |
getScriptWriter()
Return a valid writer instance that is setup to write to the ResponseBuilder.SCRIPT_BLOCK portion of
the response. |
org.apache.tapestry.IMarkupWriter |
getWriter()
The writer |
org.apache.tapestry.IMarkupWriter |
getWriter(org.apache.tapestry.IComponent component,
org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.IMarkupWriter cwriter)
Invoked by enhanced IRender.render(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
methods before rendering to replace their incoming IMarkupWriter instance with the one
provided by this class, which may return the same writer or a special writer
depending on the circumstances. |
void |
prepareForRender()
Called before invoking either ResponseBuilder.updateComponentsDirect(IRequestCycle, IPage, IPage, IComponent) ,
or if in full render mode invoking renderRequest( |
void |
removeComponentWriter(String id)
Removes the specified IMarkupWriter from this reponse,
if it exists. |
void |
renderResponse(org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.IPage activePage,
org.apache.tapestry.IPage componentPage,
org.apache.tapestry.IComponent component)
Called to render a complete response to the client, in the case of of direct component updates being set to false. |
void |
setAjaxRequest(AjaxWebRequest ajaxRequest)
Sets the associated ajax request. |
void |
setWriter(org.apache.tapestry.IMarkupWriter writer)
Sets the text/xml response writer. |
void |
updateComponentsDirect(org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.IPage activePage,
org.apache.tapestry.IPage componentPage,
org.apache.tapestry.IComponent component)
Called to update all components in cycle directly, without causing any other component to render output. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CONTENT_TYPE
protected AjaxWebRequest ajaxRequest
protected org.apache.tapestry.IMarkupWriter writer
protected Map writers
Constructor Detail |
---|
public PrototypeResponseBuilder()
Method Detail |
---|
public org.apache.tapestry.IMarkupWriter getWriter(org.apache.tapestry.IComponent component, org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.IMarkupWriter cwriter)
IRender.render(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle)
methods before rendering to replace their incoming IMarkupWriter instance with the one
provided by this class, which may return the same writer or a special writer
depending on the circumstances.
getWriter
in interface ResponseBuilder
cwriter
- Current writer rendering response
NullWriter
, an ajax
xml response stream, or a normal html response stream.public void updateComponentsDirect(org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.IPage activePage, org.apache.tapestry.IPage componentPage, org.apache.tapestry.IComponent component)
updateComponentsDirect
in interface ResponseBuilder
protected org.apache.tapestry.IComponent checkComponentContainers(org.apache.tapestry.IComponent comp)
Foreach
component. This method checks
all of the components in a page to see if the specified component
has a container of one of these types.
comp
- The IComponent
to check containers of
IComponent
that should
be rendered before this component may be rendered.
//TODO: this is currently unusedprotected String getComponentId(org.apache.tapestry.IComponent comp)
comp
-
public void prepareForRender()
ResponseBuilder.updateComponentsDirect(IRequestCycle, IPage, IPage, IComponent)
,
or if in full render mode invoking renderRequest(
prepareForRender
in interface ResponseBuilder
public void addStatusResponse(String status)
addStatusResponse
in interface ResponseBuilder
AjaxWebRequest.addStatusResponse(String)
public void addPreProcessScript(String script)
addPreProcessScript
in interface ResponseBuilder
public void addPostProcessScript(String script)
addPostProcessScript
in interface ResponseBuilder
public void renderResponse(org.apache.tapestry.IRequestCycle cycle, org.apache.tapestry.IPage activePage, org.apache.tapestry.IPage componentPage, org.apache.tapestry.IComponent component)
renderResponse
in interface ResponseBuilder
public void cleanupAfterRender()
AjaxDirectService
after a request cycle
so invokers can cleanup resources.
In the case of full page/non direct component invocations
this causes all the buffered component IMarkupWriter
instances
to have their contents written to the response stream.
cleanupAfterRender
in interface ResponseBuilder
public org.apache.tapestry.IMarkupWriter getComponentWriter(String id)
NestedMarkupWriter
for the specified
component to write to and caches the buffer for later
write to the stream via the cleanupAfterRender()
.
getComponentWriter
in interface ResponseBuilder
id
-
public void removeComponentWriter(String id)
IMarkupWriter
from this reponse,
if it exists.
removeComponentWriter
in interface ResponseBuilder
public boolean componentWriterExists(String id)
IMarkupWriter
, this is currently
only used in manual block writing semantics, specifically
in the Tree components rendering logic.
componentWriterExists
in interface ResponseBuilder
public void addResponseBlock(String id, String data)
addResponseBlock
in interface ResponseBuilder
id
- The component/block id to associate with response.data
- The content to writepublic org.apache.tapestry.IMarkupWriter getScriptWriter()
ResponseBuilder.SCRIPT_BLOCK
portion of
the response.
getScriptWriter
in interface ResponseBuilder
public AjaxWebRequest getAjaxRequest()
getAjaxRequest
in interface ResponseBuilder
public void setAjaxRequest(AjaxWebRequest ajaxRequest)
setAjaxRequest
in interface ResponseBuilder
public org.apache.tapestry.IMarkupWriter getWriter()
getWriter
in interface ResponseBuilder
public void setWriter(org.apache.tapestry.IMarkupWriter writer)
setWriter
in interface ResponseBuilder
public String getContentType()
getContentType
in interface ResponseBuilder
public void addExceptionResponse(org.apache.tapestry.IPage exceptionPage, org.apache.tapestry.IRequestCycle cycle)
addExceptionResponse
in interface ResponseBuilder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |