org.zkoss.zk.ui.sys
Interface PageCtrl

All Known Implementing Classes:
AbstractPage, PageImpl

public interface PageCtrl

Addition interface to Page for implementation purpose.

Application developers shall never access any of this methods.

Author:
tomyeh

Field Summary
static java.lang.String ATTR_REDRAW_BY_INCLUDE
          The execution attribute used to control redraw(java.util.Collection, java.io.Writer) to use include instead of forward to redraw the page
 
Method Summary
 void addDeferredZScript(Component parent, ZScript zscript)
          Adds a deferred zscript.
 void addFellow(Component comp)
          Adds a fellow.
 void addRoot(Component comp)
          Adds a root component to a page.
 void destroy()
          Called when this page is about to be detroyed.
 java.lang.Boolean getCacheable()
          Returns if the client can cache the rendered result, or null to use the device default.
 java.lang.String getContentType()
          Returns the content type, or null to use the device default.
 Component getDefaultParent()
          Returns the default parent, or null if no such parent.
 java.lang.String getDocType()
          Returns the doc type (<!
 java.lang.String getFirstLine()
          Returns the first line to be generated to the output, or null if nothing to generate.
 java.lang.String getHeaders()
          Returns all content that will be generated inside the header element (never null).
 java.lang.String getHeaders(boolean before)
          Returns the content of the specified condition that shall be generated inside the header element (never null).
 Component getOwner()
          Returns the owner of this page, or null if it is not owned by any component.
 java.lang.String getRootAttributes()
          Returns the attributes of the root element declared in this page (never null).
 boolean hasFellow(java.lang.String compId)
          Returns whether a fellow exists with the specified component ID.
 void init(PageConfig config)
          Initializes this page by assigning the info provided by the specified PageConfig, and then adds it to a desktop (by use of Execution.getDesktop()).
 void moveRoot(Component comp, Component refRoot)
          Moves a root component before the reference component.
 void preInit()
          Pre-initializes this page.
 void redraw(java.util.Collection responses, java.io.Writer out)
          Redraws the whole page into the specified output.
 void removeFellow(Component comp)
          Removes a fellow.
 void removeRoot(Component comp)
          Detaches a root component from this page.
 void sessionDidActivate(Desktop desktop)
          Notification that the session, which owns this page, has just been activated (aka., deserialized).
 void sessionWillPassivate(Desktop desktop)
          Notification that the session, which owns this page, is about to be passivated (aka., serialized).
 void setCacheable(java.lang.Boolean cacheable)
          Sets if the client can cache the rendered result.
 void setContentType(java.lang.String contentType)
          Sets the content type.
 void setDefaultParent(Component comp)
          Sets the default parent.
 void setDocType(java.lang.String docType)
          Sets the doc type (<!
 void setFirstLine(java.lang.String firstLine)
          Sets the first line to be generated to the output.
 void setOwner(Component comp)
          Sets the owner of this page.
 void setRootAttributes(java.lang.String rootAttributes)
          Set the attributes of the root element declared in this page Default: "".
 

Field Detail

ATTR_REDRAW_BY_INCLUDE

static final java.lang.String ATTR_REDRAW_BY_INCLUDE
The execution attribute used to control redraw(java.util.Collection, java.io.Writer) to use include instead of forward to redraw the page

See Also:
Constant Field Values
Method Detail

preInit

void preInit()
Pre-initializes this page. It initializes Page.getDesktop(), but it doesn't add this page to the desktop yet (which is done by init(org.zkoss.zk.ui.sys.PageConfig)).

Note: it is called before Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map) and init(org.zkoss.zk.ui.sys.PageConfig). Since Page.getDesktop() is initialized in this method, it is OK to create components in Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map).

Since:
3.5.2

init

void init(PageConfig config)
Initializes this page by assigning the info provided by the specified PageConfig, and then adds it to a desktop (by use of Execution.getDesktop()).

Note: this method is called after preInit() and Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map).

This method shall be called only after the current execution is activated.

Parameters:
config - the info about how to initialize this page
Since:
3.0.0

destroy

void destroy()
Called when this page is about to be detroyed. It is called by desktop, after removing it from the desktop.


getHeaders

java.lang.String getHeaders(boolean before)
Returns the content of the specified condition that shall be generated inside the header element (never null).

For HTML, the header element is the HEAD element.

Parameters:
before - whether to return the headers that shall be shown before ZK's CSS/JS headers. If true, only the headers that shall be shown before (such as meta) are returned. If true, only the headers that shall be shown after (such as link) are returned.
Since:
3.6.1
See Also:
getHeaders()

getHeaders

java.lang.String getHeaders()
Returns all content that will be generated inside the header element (never null).

For HTML, the header element is the HEAD element.

It returns all header no matter it shall be shown before or after ZK's CSS/JS headers. To have more control, use getHeaders(boolean) instead.

See Also:
getHeaders(boolean)

getRootAttributes

java.lang.String getRootAttributes()
Returns the attributes of the root element declared in this page (never null). An empty string is returned if no special attribute is declared.

For HTML, the root element is the HTML element.

Since:
3.0.0

setRootAttributes

void setRootAttributes(java.lang.String rootAttributes)
Set the attributes of the root element declared in this page

Default: "".


getDocType

java.lang.String getDocType()
Returns the doc type (<!DOCTYPE>), or null to use the device default.

Since:
3.0.0

setDocType

void setDocType(java.lang.String docType)
Sets the doc type (<!DOCTYPE>).

Default: null (i.e., the device default)

Since:
3.0.0

getFirstLine

java.lang.String getFirstLine()
Returns the first line to be generated to the output, or null if nothing to generate.

For XML devices, it is usually the xml processing instruction:
<?xml version="1.0" encoding="UTF-8"?>

Since:
3.0.0

setFirstLine

void setFirstLine(java.lang.String firstLine)
Sets the first line to be generated to the output.

Default: null (i.e., nothing generated)

Since:
3.0.0

getContentType

java.lang.String getContentType()
Returns the content type, or null to use the device default.

Since:
3.0.0

setContentType

void setContentType(java.lang.String contentType)
Sets the content type.

Since:
3.0.0

getCacheable

java.lang.Boolean getCacheable()
Returns if the client can cache the rendered result, or null to use the device default.

Since:
3.0.0

setCacheable

void setCacheable(java.lang.Boolean cacheable)
Sets if the client can cache the rendered result.

Default: null (use the device default).

Since:
3.0.0

getOwner

Component getOwner()
Returns the owner of this page, or null if it is not owned by any component. A page is included by a component. We say it is owned by the component.


setOwner

void setOwner(Component comp)
Sets the owner of this page.

Used only internally.


redraw

void redraw(java.util.Collection responses,
            java.io.Writer out)
            throws java.io.IOException
Redraws the whole page into the specified output.

You could use ATTR_REDRAW_BY_INCLUDE to control whether to include, instead of forward, the page content. By default, Execution.forward(java.io.Writer, java.lang.String, java.util.Map, int) is used if possible.

Parameters:
responses - a list of responses that the page has to generate corresponding javascript to process them; or null if no such responses. The responses is not null, if and only if the page is creating
Throws:
java.io.IOException

addRoot

void addRoot(Component comp)
Adds a root component to a page.

It is used internally and developers shall not invoke it explicityly.

See Also:
Component.setPage(org.zkoss.zk.ui.Page)

removeRoot

void removeRoot(Component comp)
Detaches a root component from this page.

It is used internally and developers shall not invoke it explicitly

See Also:
Component.setPage(org.zkoss.zk.ui.Page)

moveRoot

void moveRoot(Component comp,
              Component refRoot)
Moves a root component before the reference component.

Note: it assumes removeRoot was called before for comp. Otherwise, nothing happens.

It is used internally and developers shall not invoke it explicitly

Since:
3.0.0
See Also:
Component.setPageBefore(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Component)

addFellow

void addFellow(Component comp)
Adds a fellow.


removeFellow

void removeFellow(Component comp)
Removes a fellow.


hasFellow

boolean hasFellow(java.lang.String compId)
Returns whether a fellow exists with the specified component ID.


addDeferredZScript

void addDeferredZScript(Component parent,
                        ZScript zscript)
Adds a deferred zscript.

Parameters:
parent - the component that is the parent of zscript (in the ZUML page), or null if it belongs to the page.
zscript - the zscript that shall be evaluated as late as when the interpreter of the same language is being loaded.

getDefaultParent

Component getDefaultParent()
Returns the default parent, or null if no such parent. If a default parent is defined (by use of setDefaultParent(org.zkoss.zk.ui.Component)), Executions.createComponents(String, Component, java.util.Map) will use it as the default parent, if developers didn't specify one.


setDefaultParent

void setDefaultParent(Component comp)
Sets the default parent.

It is rarely used by application developers. Rather, it is used by ZHTML's body to make sure new created compnents are placed correctly.

Caller has to ensure the comp is part of the page. Otherwise, the result is unpreditable.

See Also:
getDefaultParent()

sessionWillPassivate

void sessionWillPassivate(Desktop desktop)
Notification that the session, which owns this page, is about to be passivated (aka., serialized).


sessionDidActivate

void sessionDidActivate(Desktop desktop)
Notification that the session, which owns this page, has just been activated (aka., deserialized).



Copyright &copy; 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo