|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.tacos.ajax.contrib.RicoResponseBuilder
Handles logic of directly invoking and rendering component responses to ajax request.
As per the rico documentation, will try to write a response xml document back to the suppliedIMarkupWriter
looking somewhat like:
Project page: http://openrico.org Mr. Pat Barnes1743 1st Avenue Boston, Boston 71204-2345Executive Vice PresidentPhone #: (972) 555-0293Mobile #: (972) 555-0295Notes: Spouse playes tennis at the country club with John.
Field Summary | |
protected AjaxWebRequest |
ajaxRequest
Ajax request |
static String |
CONTENT_TYPE
Content type |
protected 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 |
Constructor Summary | |
RicoResponseBuilder()
Default constructor |
Method Summary | |
protected IComponent |
checkComponentContainers(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.
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. |
AjaxWebRequest |
getAjaxRequest()
The ajax request |
protected 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. Ie "text/plain" or "text/xml". These content types must also exist in the hivemodule.xml contribution tapestry.markup.MarkupFilters. |
IMarkupWriter |
getWriter()
The writer |
IMarkupWriter |
getWriter(IComponent component,
IRequestCycle cycle,
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 |
renderResponse(IRequestCycle cycle,
IPage activePage,
IPage componentPage,
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(IMarkupWriter writer)
Sets the text/xml response writer. |
void |
updateComponentsDirect(IRequestCycle cycle,
IPage activePage,
IPage componentPage,
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 IMarkupWriter writer
protected Map writers
Constructor Detail |
public RicoResponseBuilder()
Method Detail |
public IMarkupWriter getWriter(IComponent component, IRequestCycle cycle, 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
component
- cycle
- cwriter
- Current writer rendering response
NullMarkupWriter
, an ajax
xml response stream, or a normal html response stream.public void updateComponentsDirect(IRequestCycle cycle, IPage activePage, IPage componentPage, IComponent component)
updateComponentsDirect
in interface ResponseBuilder
cycle
- activePage
- componentPage
- component
- protected IComponent checkComponentContainers(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.public void prepareForRender()
ResponseBuilder.updateComponentsDirect(IRequestCycle, IPage, IPage, IComponent)
,
or if in full render mode invoking renderRequest(
prepareForRender
in interface ResponseBuilder
public void renderResponse(IRequestCycle cycle, IPage activePage, IPage componentPage, IComponent component)
renderResponse
in interface ResponseBuilder
cycle
- activePage
- componentPage
- component
- 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
protected 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()
.
id
-
public AjaxWebRequest getAjaxRequest()
getAjaxRequest
in interface ResponseBuilder
public void setAjaxRequest(AjaxWebRequest ajaxRequest)
setAjaxRequest
in interface ResponseBuilder
ajaxRequest
- public IMarkupWriter getWriter()
getWriter
in interface ResponseBuilder
public void setWriter(IMarkupWriter writer)
setWriter
in interface ResponseBuilder
writer
- public String getContentType()
getContentType
in interface ResponseBuilder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |