|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object echopoint.ui.layout.LayoutManagerPeer echopoint.ui.layout.JspTemplateLayoutManagerUI
JspTemplateLayoutManagerUI is the backend layout peer class for the component JspTemplateLayoutManager. This class uses the following rendering strategy because of characteritics of the Echo rendering scheme and also the Servlet output mechanism. * When the standard Echo render(rc,parentElement) method is called, the JSP is included using a NoOp servlet response. This is done because at this stage output is not meant to be sent to the actual servlet stream but rather an Element hierarchy is to be built. * Any required ComponentStyle values and Service includes must be generated at the Element render time and cannot be displayed until actual output render time. * If during a this Element render, StyleSheet information is applied, then the render is repeated to ensure that the updated style information makes its way into the HtmlDocument. * The UI peer implements Renderable and adds itself as the content in the Element hierarchy. This allows it to be called back later when the actual servlet output stream is being written to. This callback is the render(PrintWriter) method. * Later in the Renderable render method, the JSP content is written to the actual serlvet output stream including any included components. * A one time flag is used to control whether component properties have been previously been set. This is needed because a JSP render will occcur each time the template is displayed, however you only want the properties to be applied only once.
Field Summary |
Fields inherited from interface echopoint.ui.jsp.JspRenderingContext |
JSPRENDERINGCONTEXT |
Fields inherited from interface nextapp.echoservlet.html.Renderable |
INDENT_STRING |
Constructor Summary | |
JspTemplateLayoutManagerUI()
|
Method Summary | |
CompilationContext |
getCompilationContext()
Returns the CompilationContext needed to render Echo output. |
nextapp.echo.Component |
getComponent(java.lang.String name)
Returns a Component based on the name given. |
nextapp.echoservlet.ComponentPeer |
getComponentPeer(nextapp.echo.Component component)
Returns a ComponentPeer based on the Component given. |
nextapp.echoservlet.html.Element |
getOutputElement()
Returns the top level output Element in play |
nextapp.echoservlet.RenderingContext |
getRenderingContext()
Returns the RenderingContext needed to render Echo output. |
boolean |
getStylesApplied()
Returns true of Styles have been applied during execution the JSP render. |
boolean |
isFinalOutputOccurring()
Returns true if final output to the underlying JSP stream is occurring. |
void |
render(java.io.PrintWriter pw,
int depth,
boolean parentWhitespaceRelevant)
Renders the renderable object to the given PrintWriter. |
void |
render(nextapp.echoservlet.RenderingContext rc,
nextapp.echoservlet.html.Element parent,
nextapp.echoservlet.ComponentPeer parentPeer,
nextapp.echoservlet.ComponentPeer[] children)
We render the Component as a Renderable which defers the rendering until the actual Servlet output stream is being written to! |
void |
setCompilationContext(CompilationContext context)
Sets the compilation context in play |
void |
setComponentPeers(nextapp.echoservlet.ComponentPeer[] peers)
Sets the list of child component peers |
void |
setFinalOutputOccurring(boolean b)
|
void |
setOutputElement(nextapp.echoservlet.html.Element element)
Sets the output element in play |
void |
setRenderingContext(nextapp.echoservlet.RenderingContext rc)
Sets the RenderingContext to be used to render Echo output. |
void |
setStylesApplied(boolean stylesApplied)
Sets whether styles have been applied during a JSP render |
Methods inherited from class echopoint.ui.layout.LayoutManagerPeer |
getLayoutManager, registered, setLayoutManager |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JspTemplateLayoutManagerUI()
Method Detail |
public void render(nextapp.echoservlet.RenderingContext rc, nextapp.echoservlet.html.Element parent, nextapp.echoservlet.ComponentPeer parentPeer, nextapp.echoservlet.ComponentPeer[] children)
We also have to perform the rendering during the standard
render(rc,parent)
call otherwise
ComponentStyle
information is not added
to the HtmlDocument nor are any required Service URIs.
This is because the Renderable render methods is called AFTER the HEAD section of the document has already been written and hence we cant add any more during our actual render.
This does introduce some problems. If a child component peer writes to the body or head tag during its render() method then it will end up with 2 lots of Element objects in the tag. This can cause problems with a ConcurrentModificationException because at actual Echo servlet stream output time, the Echo code is iterating the body or head tag at the same time that the 2nd pass is adding content to it.
But with Echo 1.0.4, the RenderingContext contructor has been opened up and we can crate a "fake" context to fool the output into going to the bit bucket.
render
in class LayoutManagerPeer
for more information on rendering
public void render(java.io.PrintWriter pw, int depth, boolean parentWhitespaceRelevant)
This allows the JSP to be "included inline" during the actual output to the browser client. It can then "write" the JspWriter output inline as it is executed.
render
in interface nextapp.echoservlet.html.Renderable
pw
- The PrintWriter to render to.depth
- The indentation depth that should be applied to the element
being rendered.parentWhitespaceRelevant
- A flag that indicates whether the
containing element is sensitive to white space.public nextapp.echo.Component getComponent(java.lang.String name)
ComponentMapper
getComponent
in interface ComponentMapper
ComponentMapper.getComponent(java.lang.String)
public nextapp.echoservlet.ComponentPeer getComponentPeer(nextapp.echo.Component component)
ComponentPeerMapper
getComponentPeer
in interface ComponentPeerMapper
ComponentPeerMapper.getComponentPeer(nextapp.echo.Component)
public nextapp.echoservlet.html.Element getOutputElement()
public nextapp.echoservlet.RenderingContext getRenderingContext()
JspRenderingContext
getRenderingContext
in interface JspRenderingContext
JspRenderingContext.getRenderingContext()
public CompilationContext getCompilationContext()
JspRenderingContext
getCompilationContext
in interface JspRenderingContext
JspRenderingContext.getCompilationContext()
public void setRenderingContext(nextapp.echoservlet.RenderingContext rc)
rc
- the RenderingContextpublic void setCompilationContext(CompilationContext context)
context
- public void setComponentPeers(nextapp.echoservlet.ComponentPeer[] peers)
peers
- public void setOutputElement(nextapp.echoservlet.html.Element element)
element
- public boolean isFinalOutputOccurring()
JspRenderingContext
isFinalOutputOccurring
in interface JspRenderingContext
JspRenderingContext.isFinalOutputOccurring()
public void setFinalOutputOccurring(boolean b)
public boolean getStylesApplied()
JspRenderingContext
getStylesApplied
in interface JspRenderingContext
JspRenderingContext.getStylesApplied()
public void setStylesApplied(boolean stylesApplied)
JspRenderingContext
setStylesApplied
in interface JspRenderingContext
stylesApplied
- true if they have been appliedJspRenderingContext.setStylesApplied(boolean)
|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |