Interface PageCtrl
- All Known Implementing Classes:
AbstractPage,PageImpl,VolatilePage
Page for implementation purpose.
Application developers shall never access any of this methods.
- Author:
- tomyeh
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAfterHeadTags(String tags) Adds the tags that will be generated inside the head element and after ZK's default tags.voidaddBeforeHeadTags(String tags) Adds the tags that will be generated inside the head element and before ZK's default tags.voidaddDeferredZScript(Component parent, ZScript zscript) Adds a deferred zscript.voiddestroy()Called when this page is about to be destroyed.Returns the tags that shall be generated inside the head element and after ZK's default tags (never null).Returns whether to automatically redirect to the timeout URI.Returns the tags that shall be generated inside the head element and before ZK's default tags (never null).Returns if the client can cache the rendered result, or null to use the device default.Returns the content type, or null to use the device default.Returns the doc type (<!Returns the first line to be generated to the output, or null if nothing to generate.getOwner()Returns the owner of this page, or null if it is not owned by any component.Collection<Object[]>Returns a readonly collection of response headers (never null).Returns the attributes of the root element declared in this page (never null).Returns the widget class of this page, or null to use the device default.voidinit(PageConfig config) Initializes this page by assigning the info provided by the specifiedPageConfig, and then adds it to a desktop (by use ofExecution.getDesktop()).voidpreInit()Pre-initializes this page.voidRedraws the whole page into the specified output.voidsessionDidActivate(Desktop desktop) Notification that the session, which owns this page, has just been activated (a.k.a., deserialized).voidsessionWillPassivate(Desktop desktop) Notification that the session, which owns this page, is about to be passivated (a.k.a., serialized).voidsetAutomaticTimeout(Boolean autoTimeout) Sets whether to automatically redirect to the timeout URI.voidsetCacheable(Boolean cacheable) Sets if the client can cache the rendered result.voidsetContentType(String contentType) Sets the content type.voidsetDocType(String docType) Sets the doc type (<!voidsetFirstLine(String firstLine) Sets the first line to be generated to the output.voidSets the owner of this page.voidsetRootAttributes(String rootAttributes) Set the attributes of the root element declared in this pagevoidsetWidgetClass(String wgtcls) Sets the widget class of this page.
-
Method Details
-
preInit
void preInit()Pre-initializes this page. It initializesPage.getDesktop(), but it doesn't add this page to the desktop yet (which is done byinit(org.zkoss.zk.ui.sys.PageConfig)).Note: it is called before
Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map<java.lang.String, java.lang.Object>)andinit(org.zkoss.zk.ui.sys.PageConfig). SincePage.getDesktop()is initialized in this method, it is OK to create components inInitiator.doInit(org.zkoss.zk.ui.Page, java.util.Map<java.lang.String, java.lang.Object>).- Since:
- 3.5.2
-
init
Initializes this page by assigning the info provided by the specifiedPageConfig, and then adds it to a desktop (by use ofExecution.getDesktop()).Note: this method is called after
preInit()andInitiator.doInit(org.zkoss.zk.ui.Page, java.util.Map<java.lang.String, java.lang.Object>).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 destroyed. It is called by desktop, after removing it from the desktop. -
getBeforeHeadTags
String getBeforeHeadTags()Returns the tags that shall be generated inside the head element and before ZK's default tags (never null). For example, it might consist of <meta> and <link>.Since it is generated before ZK's default tags (such as CSS and JS), it cannot override ZK's default behaviors.
- Since:
- 5.0.5
- See Also:
-
getAfterHeadTags
String getAfterHeadTags()Returns the tags that shall be generated inside the head element and after ZK's default tags (never null). For example, it might consist of <meta> and <link>.Since it is generated after ZK's default tags (such as CSS and JS), it could override ZK's default behaviors.
- Since:
- 5.0.5
- See Also:
-
addBeforeHeadTags
Adds the tags that will be generated inside the head element and before ZK's default tags. For example,((PageCtrl)page).addBeforeHeadTags("<meta name=\"robots\" content=\"index,follow\"/>");You could specify the link, meta and script directive to have the similar result.
- Since:
- 5.0.5
-
addAfterHeadTags
Adds the tags that will be generated inside the head element and after ZK's default tags. For example,((PageCtrl)page).addBeforeHeadTags("<meta name=\"robots\" content=\"index,follow\"/>");You could specify the link, meta and script directive to have the similar result.
- Since:
- 5.0.5
-
getResponseHeaders
Collection<Object[]> getResponseHeaders()Returns a readonly collection of response headers (never null). The entry is a three-element object array. The first element is the header name. The second element of the array is the value which is an instance ofDateorString(and never null). The third element indicates whether to add (rather than set) theader. It is an instance of Boolean (and never null).- Since:
- 5.0.2
-
getRootAttributes
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
Set the attributes of the root element declared in this pageDefault: "".
-
getDocType
String getDocType()Returns the doc type (<!DOCTYPE>), or null to use the device default.- Since:
- 3.0.0
-
setDocType
Sets the doc type (<!DOCTYPE>).Default: null (i.e., the device default)
- Since:
- 3.0.0
-
getFirstLine
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
Sets the first line to be generated to the output.Default: null (i.e., nothing generated)
- Since:
- 3.0.0
-
getContentType
String getContentType()Returns the content type, or null to use the device default.- Since:
- 3.0.0
-
setContentType
Sets the content type.- Since:
- 3.0.0
-
getWidgetClass
String getWidgetClass()Returns the widget class of this page, or null to use the device default.- Since:
- 5.0.5
-
setWidgetClass
Sets the widget class of this page.- Parameters:
wgtcls- the widget class. The device default is assumed if wgtcls is null or empty.- Since:
- 5.0.5
-
getCacheable
Boolean getCacheable()Returns if the client can cache the rendered result, or null to use the device default.- Since:
- 3.0.0
-
setCacheable
Sets if the client can cache the rendered result.Default: null (use the device default).
- Since:
- 3.0.0
-
getAutomaticTimeout
Boolean getAutomaticTimeout()Returns whether to automatically redirect to the timeout URI.- Since:
- 3.6.3
- See Also:
-
setAutomaticTimeout
Sets whether to automatically redirect to the timeout URI.Default: null (use the device default).
If it is set to false, it means this page is redirected to the timeout URI when the use takes some action after timeout. In other words, nothing happens if the user does nothing. If it is set to true, it is redirected as soon as timeout, no matter the user takes any action.
Refer to
Configuration.setAutomaticTimeout(java.lang.String, boolean)for how to configure the device default (default: false).- Since:
- 3.6.3
-
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.Note: the owner, if not null, must implement
Includer. -
setOwner
Sets the owner of this page.Called only internally
Since 5.0.6, the owner must implement
Includer. -
redraw
Redraws the whole page into the specified output.You could use
Attributes.PAGE_REDRAW_CONTROLand/orAttributes.PAGE_RENDERERto control how to render manually.- Throws:
IOException- Since:
- 5.0.0
-
addDeferredZScript
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.
-
sessionWillPassivate
Notification that the session, which owns this page, is about to be passivated (a.k.a., serialized). -
sessionDidActivate
Notification that the session, which owns this page, has just been activated (a.k.a., deserialized).
-