|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Observable com.creamtec.ajaxswing.rendering.AbstractDocument com.creamtec.ajaxswing.rendering.html.HTMLPage
public class HTMLPage
Represents HTML page that will be sent to the browser. The page stores the HTML code in a buffer
and provides methods to access and modify it. Each page is associated with a client agent for which
the rendering is performed, and a rendering context which stores the rendering attributes and can
be used to set flags during rendering. HTMLPage is different from StringBuffer in that it maintains
an indent making reading HTML easier. Notice that to decrease the size of rendered HTML page you
can opt not to maintain indents.
The page has a current output stream which can be either the header or the body. By default it is
body when renderers are invoked. Page uses Observable pattern to support listeners on page rendering
state. When the page is cleared either right before the processing of a new HTTP request or when the
client agent is being shutdown, it notifies all registered listeners allowing them to do resource
cleanup and other tasks. The parameter to Observer's update method is the page itself.
Constructor Summary | |
---|---|
HTMLPage()
Creates an empty page with the given buffer size and associates it with the client agent |
|
HTMLPage(HTMLPage page)
Creates a page that has the same indents as the given page and is associated with the same client agent |
Method Summary | |
---|---|
void |
afterRender()
Callback function called after a document is rendered |
void |
appendHeaderScript(java.lang.String script)
Use to append JavaScript to the HTML page header together with other AjaxSwing's JavaScripts. |
void |
appendOnLoadScriptBody(java.lang.String onLoadFunctionBody)
Appends JavaScript statements to the body of onLoad function. |
void |
appendWindowFooter()
Appends footer to the current component's body |
void |
beforeRender()
Callback function called before a document is rendered |
java.lang.String |
cleanupImageUrl(java.lang.String url)
Helper function used by getImageUrl to clean up the image URL in case it originated from a jar or from a file |
void |
clearWindowFooter()
|
static java.lang.String |
generateName(java.lang.Object obj)
Delegates the generation of component name to WindowUpdater |
java.lang.StringBuilder |
getBody()
Returns the buffer representing the page body (HTML between <body> and </body> tags) |
java.lang.String |
getComponentName(java.awt.Component comp)
|
static java.lang.String |
getComponentName(java.awt.MenuBar comp)
If a component has a name, it is returned. |
java.lang.String |
getCssClass()
|
java.lang.String |
getDocsStampURL(java.lang.String name)
|
java.lang.StringBuilder |
getHeader()
Returns the buffer representing the page header (HTML between <header> and </header> tags) |
java.lang.StringBuilder |
getHeaderScript()
Returns the buffer representing the page header (HTML between <header> and </header> tags) |
java.lang.String |
getImageUrl(javax.swing.Icon icon,
java.awt.Component component)
Helper function that can be used to obtain a URL that should be used on a page for a given Icon. |
java.lang.String |
getImageUrl(java.awt.Image image)
Helper function that can be used to obtain a URL that should be used on a page for a given Image. |
int |
getNextComponentNameIndex(java.lang.Object obj)
|
java.lang.String |
getOnLoadScriptBody()
|
HTMLPageRenderer |
getPageRenderer()
Returns the page renderer associated with the page. |
int |
getSnapshotImageIndex()
Returns an index for generating the snapshot name |
java.lang.String |
getSubmitURL()
Returns the URL |
java.lang.String |
getTempFileURL(java.lang.String fileName)
Appends a full URL to a file located in AjaxSwing temp directory |
java.lang.String |
getThemeDocsStampURL(java.lang.String name)
|
java.awt.Component |
getV4RootComponent()
|
java.lang.StringBuilder |
getWindowFooter()
Returns the buffer representing the end of the page body. |
void |
incSnapshotIndex()
Increments an index for generating the snapshot name by one |
void |
reset(boolean complete)
Clears the page and its buffers. |
void |
setRenderContext(RenderContext context)
Sets rendering context |
void |
setUseOnLoad(boolean useOnLoad)
Sets weather or not the page should have onLoad function specified for the tag |
void |
setV4RootComponent(java.awt.Component v4RootComponent)
|
java.lang.String |
toString()
Renders page as string using the specified template |
Methods inherited from class com.creamtec.ajaxswing.rendering.AbstractDocument |
---|
getClientAgent, getDocsURL, getDocumentRenderer, getProps, getRedirectURL, getRenderContext, getThemeDocsURL, getThemeName, getTitle, isPartialUpdateAllowed, setClientAgent, setComponentDirty, setDocumentRenderer, setPartialUpdateAllowed, setRedirectURL, setTitle |
Methods inherited from class java.util.Observable |
---|
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HTMLPage()
public HTMLPage(HTMLPage page)
Method Detail |
---|
public HTMLPageRenderer getPageRenderer()
public void setRenderContext(RenderContext context)
public java.lang.StringBuilder getBody()
public java.lang.StringBuilder getWindowFooter()
public void clearWindowFooter()
public java.lang.StringBuilder getHeader()
public java.lang.StringBuilder getHeaderScript()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getCssClass()
public java.lang.String getSubmitURL()
public static java.lang.String generateName(java.lang.Object obj)
obj
- UI element
public void reset(boolean complete)
reset
in class AbstractDocument
public static java.lang.String getComponentName(java.awt.MenuBar comp)
public java.lang.String getComponentName(java.awt.Component comp)
public java.lang.String getImageUrl(javax.swing.Icon icon, java.awt.Component component)
public java.lang.String getImageUrl(java.awt.Image image)
public java.lang.String cleanupImageUrl(java.lang.String url)
public java.lang.String getTempFileURL(java.lang.String fileName)
fileName
- public void appendOnLoadScriptBody(java.lang.String onLoadFunctionBody)
onLoadFunctionBody
- statements to appear inside the body of function onLoad()public java.lang.String getOnLoadScriptBody()
public void setUseOnLoad(boolean useOnLoad)
public void beforeRender()
Document
beforeRender
in interface Document
beforeRender
in class AbstractDocument
public void afterRender()
Document
afterRender
in interface Document
afterRender
in class AbstractDocument
public void appendWindowFooter()
public java.lang.String getThemeDocsStampURL(java.lang.String name)
public java.lang.String getDocsStampURL(java.lang.String name)
public void appendHeaderScript(java.lang.String script)
public int getSnapshotImageIndex()
public void incSnapshotIndex()
public int getNextComponentNameIndex(java.lang.Object obj)
getNextComponentNameIndex
in class AbstractDocument
public void setV4RootComponent(java.awt.Component v4RootComponent)
public java.awt.Component getV4RootComponent()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |