|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zkoss.zk.ui.AbstractPage
org.zkoss.zk.ui.impl.PageImpl
public class PageImpl
An implmentation of Page
and PageCtrl
.
Refer to them for more details.
Note: though PageImpl
is serializable, it is designed
to work with Web container to enable the serialization of sessions.
It is not suggested to serialize and desrialize it directly since
many fields might be lost.
On the other hand, it is OK to serialize and deserialize
Component
.
Implementation Notes:
It is not thread-safe because it is protected by the spec:
at most one thread can access a page and all its components at the same time.
Field Summary |
---|
Fields inherited from interface org.zkoss.zk.ui.Page |
---|
APPLICATION_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE |
Fields inherited from interface org.zkoss.zk.ui.sys.PageCtrl |
---|
ATTR_REDRAW_BY_INCLUDE |
Constructor Summary | |
---|---|
PageImpl(LanguageDefinition langdef,
ComponentDefinitionMap compdefs,
java.lang.String path,
java.lang.String zslang)
Constructs a page without page definition and richlet. |
|
PageImpl(PageDefinition pgdef)
Constructs a page by giving the page definition. |
|
PageImpl(Richlet richlet,
java.lang.String path)
Constructs a page by specifying a richlet. |
Method Summary | |
---|---|
void |
addDeferredZScript(Component parent,
ZScript zscript)
Adds a deferred zscript. |
boolean |
addEventListener(java.lang.String evtnm,
EventListener listener)
Adds an event listener to specified event for all components in this page. |
void |
addFunctionMapper(FunctionMapper mapper)
Adds the function mapper in addition to the current one. |
boolean |
addScopeListener(ScopeListener listener)
Adds a listener to listen whether this scope is changed. |
boolean |
addVariableResolver(VariableResolver resolver)
Adds a name resolver that will be used to resolve a variable by Page.getVariable(java.lang.String) . |
boolean |
containsVariable(java.lang.String name)
Deprecated. As of release 5.0.0, replaced with hasAttribute(java.lang.String, int) . |
void |
destroy()
Called when this page is about to be detroyed. |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the specified attribute associated with this page. |
java.lang.Object |
getAttribute(java.lang.String name,
boolean recurse)
Returns the custom attribute associated with this object. |
java.lang.Object |
getAttribute(java.lang.String name,
int scope)
Returns the value of the specified custom attribute in the specified scope. |
java.lang.Object |
getAttributeOrFellow(java.lang.String name,
boolean recurse)
Returns the custom attribute associated with this page, or the fellow of this page; or null if no found. |
java.util.Map |
getAttributes()
Returns all custom attributes associated with this page. |
java.util.Map |
getAttributes(int scope)
Returns all custom attributes of the specified scope. |
java.lang.Boolean |
getAutomaticTimeout()
Returns whether to automatically redirect to the timeout URI. |
java.lang.Boolean |
getCacheable()
Returns if the client can cache the rendered result, or null to use the device default. |
ComponentDefinition |
getComponentDefinition(java.lang.Class cls,
boolean recurse)
Returns the component definition of the specified class, or null if not found. |
ComponentDefinition |
getComponentDefinition(java.lang.String name,
boolean recurse)
Returns the component definition of the specified name, or null if not found. |
ComponentDefinitionMap |
getComponentDefinitionMap()
Returns the map of component definitions (never null). |
java.lang.String |
getContentType()
Returns the content type, or null to use the device default. |
Component |
getDefaultParent()
Deprecated. As of release 5.0.0, the default parent is no longe meaningful. |
Desktop |
getDesktop()
Returns the desktop that this page belongs to. |
java.lang.String |
getDocType()
Returns the doc type (<! |
java.lang.Class |
getExpressionFactoryClass()
Returns the implementation of the expression factory that is used by this page, or null if Configuration.getExpressionFactoryClass()
is used. |
java.lang.String |
getFirstLine()
Returns the first line to be generated to the output, or null if nothing to generate. |
FunctionMapper |
getFunctionMapper()
Returns the function mapper for resolving XEL functions, or null if not available. |
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). |
java.lang.String |
getId()
Returns ID which is unique in the request (never null). |
Interpreter |
getInterpreter(java.lang.String zslang)
Returns the interpreter of the specified scripting language. |
LanguageDefinition |
getLanguageDefinition()
Returns the language definition that this page belongs to (never null). |
java.util.Iterator |
getListenerIterator(java.lang.String evtnm)
Returns an iterator for iterating listener for the specified event. |
java.util.Collection |
getLoadedInterpreters()
Returns all loaded interpreters. |
Namespace |
getNamespace()
Deprecated. As of release 5.0.0, the concept of namespace is deprecated and replaced with the attributes of a scope (such as a page and a component). |
Component |
getOwner()
Returns the owner of this page, or null if it is not owned by any component. |
java.lang.String |
getRequestPath()
Returns the request path of this page, or "" if not available. |
java.lang.String |
getRootAttributes()
Returns the attributes of the root element declared in this page (never null). |
java.lang.String |
getStyle()
Returns the CSS style of this page, or empty if not specified. |
java.lang.String |
getTitle()
Returns the title of the desktop this page belongs to (and evaluate it if it contains an expression). |
java.lang.String |
getUuid()
Returns UUID (universal unique ID) which is unquie in the whole session. |
java.lang.Object |
getVariable(java.lang.String name)
Deprecated. As of release 5.0.0, replaced with getAttribute(java.lang.String, int) . |
java.lang.Object |
getXelVariable(java.lang.String name)
Returns a variable that is visible to XEL expressions. |
java.lang.Object |
getXelVariable(XelContext ctx,
java.lang.Object base,
java.lang.Object name,
boolean ignoreExec)
Returns a vairable that is visible to XEL expressions. |
java.lang.Class |
getZScriptClass(java.lang.String clsnm)
Returns the class of the specified name by searching the thread class loader and the classes defined in the loaded interpreters. |
Function |
getZScriptFunction(Component comp,
java.lang.String name,
java.lang.Class[] argTypes)
Returns the function of the specified name by searching the logical scope of the specified component in all the loaded interpreters. |
Function |
getZScriptFunction(Namespace ns,
java.lang.String name,
java.lang.Class[] argTypes)
Deprecated. As of release 5.0.0, replaced with getZScriptFunction(Component,String,Class[]) . |
Function |
getZScriptFunction(java.lang.String name,
java.lang.Class[] argTypes)
Returns the function of the specified name by searching the loaded interpreters. |
java.lang.String |
getZScriptLanguage()
Returns the default scripting language which is assumed when a zscript element doesn't specify any language. |
java.lang.Object |
getZScriptVariable(Component comp,
java.lang.String name)
Returns the value of the variable of the specified name by searching the logical scope of the specified component in all the loaded interpreters, if any. |
java.lang.Object |
getZScriptVariable(Namespace ns,
java.lang.String name)
Deprecated. As of release 5.0.0, replaced with getZScriptVariable(Component,String) . |
java.lang.Object |
getZScriptVariable(java.lang.String name)
Returns the value of the variable of the specified name by searching the loaded interpreters, if any. |
boolean |
hasAttribute(java.lang.String name)
Returns if an attribute exists. |
boolean |
hasAttribute(java.lang.String name,
boolean recurse)
Returns if a custom attribute is associated with this object. |
boolean |
hasAttribute(java.lang.String name,
int scope)
Returns if an attribute exists. |
boolean |
hasAttributeOrFellow(java.lang.String name,
boolean recurse)
Returns if a custom attribute is associated with this page, or a fellow of this page. |
protected void |
init()
Initialized the page when contructed or deserialized. |
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 |
interpret(java.lang.String zslang,
java.lang.String script,
Namespace ns)
Deprecated. As of release 5.0.0, replaced with interpret(String,String,Scope) . |
void |
interpret(java.lang.String zslang,
java.lang.String script,
Scope scope)
Interprets a script in the sepcified scripting language in the context of the specified scope. |
void |
invalidate()
Invalidates this page to cause all components to redraw. |
boolean |
isComplete()
Returns if this page is a complete page. |
boolean |
isListenerAvailable(java.lang.String evtnm)
Returns whether the event listener is available. |
void |
preInit()
Pre-initializes this page. |
void |
redraw(java.io.Writer out)
Redraws the whole page into the specified output. |
java.lang.Object |
removeAttribute(java.lang.String name)
Removes the specified attribute custom associated with the page. |
java.lang.Object |
removeAttribute(java.lang.String name,
boolean recurse)
Removes the custom attribute associated with this scope. |
java.lang.Object |
removeAttribute(java.lang.String name,
int scope)
Removes the specified custom attribute in the specified scope. |
boolean |
removeEventListener(java.lang.String evtnm,
EventListener listener)
Removes an event listener. |
boolean |
removeScopeListener(ScopeListener listener)
Removes a change listener from this scope. |
boolean |
removeVariableResolver(VariableResolver resolver)
Removes a name resolve that was added by Page.addVariableResolver(org.zkoss.xel.VariableResolver) . |
java.lang.Class |
resolveClass(java.lang.String clsnm)
Resolves the class of the specified name. |
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). |
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the value of the specified custom attribute associated with this page. |
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value,
boolean recurse)
Sets the custom attribute associated with this scope, or the parent scope. |
java.lang.Object |
setAttribute(java.lang.String name,
java.lang.Object value,
int scope)
Sets the value of the specified custom attribute in the specified scope. |
void |
setAutomaticTimeout(java.lang.Boolean autoTimeout)
Sets whether to automatically redirect to the timeout URI. |
void |
setCacheable(java.lang.Boolean cacheable)
Sets if the client can cache the rendered result. |
void |
setComplete(boolean complete)
Sets if the page is a complete page. |
void |
setContentType(java.lang.String contentType)
Sets the content type. |
void |
setDefaultParent(Component comp)
Deprecated. As of release 5.0.0, the default parent is no longe meaningful. |
void |
setDocType(java.lang.String docType)
Sets the doc type (<! |
void |
setExpressionFactoryClass(java.lang.Class expfcls)
Sets the implementation of the expression factory that is used by this page. |
void |
setFirstLine(java.lang.String firstLine)
Sets the first line to be generated to the output. |
void |
setId(java.lang.String id)
Sets the identifier of this page. |
void |
setOwner(Component comp)
Sets the owner of this page. |
void |
setRootAttributes(java.lang.String rootAttrs)
Set the attributes of the root element declared in this page Default: "". |
void |
setStyle(java.lang.String style)
Sets the CSS style of this page. |
void |
setTitle(java.lang.String title)
Sets the title of the desktop this page belongs to (it might contain an expression). |
void |
setVariable(java.lang.String name,
java.lang.Object val)
Deprecated. As of release 5.0.0, replaced with setAttribute(java.lang.String, java.lang.Object, int) . |
void |
setZScriptLanguage(java.lang.String zslang)
Sets the defafult scripting language which will be assumed if a zscript element doesn't specify any language. |
java.lang.String |
toString()
|
void |
unsetVariable(java.lang.String name)
Deprecated. As of release 5.0.0, replaced with removeAttribute(java.lang.String, int) . |
Methods inherited from class org.zkoss.zk.ui.AbstractPage |
---|
getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstRoot, getLastRoot, getRoots, hasFellow, hasFellow, removeComponents |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PageImpl(PageDefinition pgdef)
Note: when a page is constructed, it doesn't belong to a desktop
yet. Caller has to invoke init()
to complete
the creation of a page.
Why two phase? Contructor could be called before execution
is activated, but init()
must be called in an execution.
Also note that getId()
and getTitle()
are not ready until init()
is called.
pgdef
- the page definition (never null).public PageImpl(LanguageDefinition langdef, ComponentDefinitionMap compdefs, java.lang.String path, java.lang.String zslang)
langdef
- the language definition (never null)compdefs
- the component definition map.
If null, an empty map is assumed.path
- the request path. If null, empty is assumed.zslang
- the zscript language. If null, "Java" is assumed.public PageImpl(Richlet richlet, java.lang.String path)
Note: when a page is constructed, it doesn't belong to a desktop
yet. Caller has to invoke init()
to complete
the creation of a page.
Also note that getId()
and getTitle()
are not ready until init()
is called.
richlet
- the richlet to serve this page.path
- the request path, or null if not availableMethod Detail |
---|
protected void init()
public final FunctionMapper getFunctionMapper()
Page
getFunctionMapper
in interface Page
public void addFunctionMapper(FunctionMapper mapper)
Page
The new added function mapper has the higher priority.
Page.getFunctionMapper()
will return the new
addFunctionMapper
in interface Page
mapper
- the new function mapper (null to ignore).public java.lang.String getRequestPath()
Page
It is the same as the servlet path (javax.servlet.http.HttpServletRequest's getServletPath), if ZK is running at a servlet container.
Note: Desktop.getRequestPath()
returns the request path
that causes the desktop to create. And, there might be multiple
pages in the same desktop.
getRequestPath
in interface Page
Execution.getContextPath()
,
Desktop.getRequestPath()
public final java.lang.String getId()
Page
Note: it returns null when
Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map)
is called.
getId
in interface Page
public final java.lang.String getUuid()
Page
It is mainly used for communication between client and server and you rarely need to access it.
getUuid
in interface Page
public void setId(java.lang.String id)
Page
Note: you can change the page's ID only in
Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map)
or ExecutionInit.init(org.zkoss.zk.ui.Execution, org.zkoss.zk.ui.Execution)
.
Once the page is initialized (by PageCtrl.init(org.zkoss.zk.ui.sys.PageConfig)
),
calling this
method will cause an exception.
setId
in interface Page
public java.lang.String getTitle()
Page
Default: "".
getTitle
in interface Page
public void setTitle(java.lang.String title)
Page
setTitle
in interface Page
public java.lang.String getStyle()
Page
getStyle
in interface Page
public void setStyle(java.lang.String style)
Page
Note: Unlike Page.setTitle(java.lang.String)
, you can change the style only in
the lifecycle of the loading page.
setStyle
in interface Page
public java.util.Map getAttributes(int scope)
Page
If scope is Page.PAGE_SCOPE
, it means custom attributes shared
by components from the same page as this one's.
If scope is Page.DESKTOP_SCOPE
, it means custom attributes shared
by components from the same desktopas this one's.
getAttributes
in interface Page
scope
- Page.APPLICATION_SCOPE
, Page.SESSION_SCOPE
,
Page.PAGE_SCOPE
, Page.REQUEST_SCOPE
or Page.DESKTOP_SCOPE
.public java.lang.Object getAttribute(java.lang.String name, int scope)
Page
If scope is Page.PAGE_SCOPE
, it means custom attributes shared
by components from the same page as this one's.
If scope is Page.DESKTOP_SCOPE
, it means custom attributes shared
by components from the same desktopas this one's.
getAttribute
in interface Page
scope
- Page.APPLICATION_SCOPE
, Page.SESSION_SCOPE
,
Page.PAGE_SCOPE
, Page.REQUEST_SCOPE
or Page.DESKTOP_SCOPE
.public boolean hasAttribute(java.lang.String name, int scope)
Page
Notice that null
is a valid value, so you need this
method to really know if an atribute is defined.
hasAttribute
in interface Page
public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value, int scope)
Page
If scope is Page.PAGE_SCOPE
, it means custom attributes shared
by components from the same page as this one's.
If scope is Page.DESKTOP_SCOPE
, it means custom attributes shared
by components from the same desktopas this one's.
setAttribute
in interface Page
scope
- Page.APPLICATION_SCOPE
, Page.SESSION_SCOPE
,
Page.PAGE_SCOPE
, Page.REQUEST_SCOPE
or Page.DESKTOP_SCOPE
.public java.lang.Object removeAttribute(java.lang.String name, int scope)
Page
If scope is Page.PAGE_SCOPE
, it means custom attributes shared
by components from the same page as this one's.
If scope is Page.DESKTOP_SCOPE
, it means custom attributes shared
by components from the same desktopas this one's.
removeAttribute
in interface Page
scope
- Page.APPLICATION_SCOPE
, Page.SESSION_SCOPE
,
Page.PAGE_SCOPE
, Page.REQUEST_SCOPE
or Page.DESKTOP_SCOPE
.public java.util.Map getAttributes()
Page
getAttributes
in interface Scope
getAttributes
in interface Page
public java.lang.Object getAttribute(java.lang.String name)
Page
getAttribute
in interface Scope
getAttribute
in interface Page
public boolean hasAttribute(java.lang.String name)
Page
Notice that null
is a valid value, so you need this
method to really know if an atribute is defined.
hasAttribute
in interface Scope
hasAttribute
in interface Page
public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value)
Page
setAttribute
in interface Scope
setAttribute
in interface Page
value
- the value.
public java.lang.Object removeAttribute(java.lang.String name)
Page
removeAttribute
in interface Scope
removeAttribute
in interface Page
public java.lang.Object getAttribute(java.lang.String name, boolean recurse)
Scope
getAttribute
in interface Scope
recurse
- whether to search its ancestor scope.
If true and the current scope doen't define the attribute,
it searches up its ancestor to see
any of them has defined the specified attribute.public boolean hasAttribute(java.lang.String name, boolean recurse)
Scope
Notice that null
is a valid value, so you can
tell if an attribute is assoicated by examining the return value
of Scope.getAttribute(java.lang.String)
.
hasAttribute
in interface Scope
recurse
- whether to search its ancestor scope.
If true and the current scope doen't define the attribute,
it searches up its ancestor to see
any of them has defined the specified attribute.public java.lang.Object setAttribute(java.lang.String name, java.lang.Object value, boolean recurse)
Scope
setAttribute
in interface Scope
recurse
- whether to look up the parent scope for the
existence of the attribute.Scope.setAttribute(String,Object)
.public java.lang.Object removeAttribute(java.lang.String name, boolean recurse)
Scope
removeAttribute
in interface Scope
recurse
- whether to look up the parent scope for the
existence of the attribute.Scope.removeAttribute(String)
.public java.lang.Object getAttributeOrFellow(java.lang.String name, boolean recurse)
Page
Notice that this method will NOT check for any variable defined in
the variable resolver (Page.addVariableResolver(org.zkoss.xel.VariableResolver)
).
You have to invoke Page.getXelVariable(XelContext,Object,Object,boolean)
or Page.getXelVariable(String)
manually.
getAttributeOrFellow
in interface Page
recurse
- whether to look up the desktop/session for the
existence of the attribute.public boolean hasAttributeOrFellow(java.lang.String name, boolean recurse)
Page
Notice that this method will NOT check for any variable defined in
the variable resolver (Page.addVariableResolver(org.zkoss.xel.VariableResolver)
).
You have to invoke Page.getXelVariable(XelContext,Object,Object,boolean)
or Page.getXelVariable(String)
manually.
hasAttributeOrFellow
in interface Page
recurse
- whether to look up the desktop/session for the
existence of the attribute.public boolean addScopeListener(ScopeListener listener)
Scope
addScopeListener
in interface Scope
public boolean removeScopeListener(ScopeListener listener)
Scope
removeScopeListener
in interface Scope
public void invalidate()
Page
invalidate
in interface Page
public java.lang.Class resolveClass(java.lang.String clsnm) throws java.lang.ClassNotFoundException
Page
Page.getLoadedInterpreters()
.
It is similar to Page.getZScriptClass(java.lang.String)
, except
resolveClass
in interface Page
java.lang.ClassNotFoundException
Page.getZScriptClass(java.lang.String)
public void setVariable(java.lang.String name, java.lang.Object val)
setAttribute(java.lang.String, java.lang.Object, int)
.
setVariable
in interface Page
public boolean containsVariable(java.lang.String name)
hasAttribute(java.lang.String, int)
.
containsVariable
in interface Page
public java.lang.Object getVariable(java.lang.String name)
getAttribute(java.lang.String, int)
.
getVariable
in interface Page
public void unsetVariable(java.lang.String name)
removeAttribute(java.lang.String, int)
.
unsetVariable
in interface Page
public java.lang.Class getZScriptClass(java.lang.String clsnm)
Page
Note: if not defined in the interpeter, it will also look for
the class by use of the current thread's class loader.
See Page.resolveClass(java.lang.String)
.
getZScriptClass
in interface Page
Page.getLoadedInterpreters()
public Function getZScriptFunction(java.lang.String name, java.lang.Class[] argTypes)
Page
getZScriptFunction
in interface Page
Page.getLoadedInterpreters()
public Function getZScriptFunction(Component comp, java.lang.String name, java.lang.Class[] argTypes)
Page
getZScriptFunction
in interface Page
comp
- the component to start the search. If null, this
method searches only the page's attributes.
In other words, if comp is null, this method is the same as
Page.getZScriptFunction(String, Class[])
.public Function getZScriptFunction(Namespace ns, java.lang.String name, java.lang.Class[] argTypes)
getZScriptFunction(Component,String,Class[])
.
getZScriptFunction
in interface Page
ns
- the namespace used as a reference to identify the
correct scope for searching the variable.
It is ignored if the interpreter doesn't support hierachical scopes.
Note: this method doesn't look for any variable stored in ns.
Page.getLoadedInterpreters()
public java.lang.Object getZScriptVariable(java.lang.String name)
Page
getZScriptVariable
in interface Page
Page.getLoadedInterpreters()
public java.lang.Object getZScriptVariable(Component comp, java.lang.String name)
Page
getZScriptVariable
in interface Page
comp
- the component as the context to look for the variable
defined in an interpreter. If null, the context is assumed to
be this page.public java.lang.Object getZScriptVariable(Namespace ns, java.lang.String name)
getZScriptVariable(Component,String)
.
getZScriptVariable
in interface Page
ns
- the namespace used as a reference to identify the
correct scope for searching the variable.
It is ignored if the interpreter doesn't support hierachical scopes.
Note: this method doesn't look for any variable stored in ns.public java.lang.Object getXelVariable(java.lang.String name)
Page
getXelVariable(null, null, name, false)
.
This method is mainly used to access special variable, such as request parameters (if this page is requested by HTTP).
getXelVariable
in interface Page
Page.getXelVariable(XelContext, Object, Object, boolean)
public java.lang.Object getXelVariable(XelContext ctx, java.lang.Object base, java.lang.Object name, boolean ignoreExec)
Page
Unlike Page.getXelVariable(String)
, this method
can utilitize VariableResolverX
introduced in ZK 5.0.
getXelVariable
in interface Page
ctx
- the XEL contextbase
- the base object. If null, it looks for a top-level variable.
If not null, it looks for a member of the base object (such as getter).name
- the property to retrieve.ignoreExec
- whether to ignore the current execution
(Execution.getVariableResolver()
.
If true, it invokes only the variable resolvers define in this page
(Page.addVariableResolver(org.zkoss.xel.VariableResolver)
).
If false, it will first check the execution, so the implicit objects
such as page
and desktop
will be resolved.Page.getXelVariable(String)
public boolean addVariableResolver(VariableResolver resolver)
Page
Page.getVariable(java.lang.String)
.
Note: the variables resolved by the specified resolver are accessible to both zscript and EL expressions.
addVariableResolver
in interface Page
public boolean removeVariableResolver(VariableResolver resolver)
Page
Page.addVariableResolver(org.zkoss.xel.VariableResolver)
.
removeVariableResolver
in interface Page
public boolean addEventListener(java.lang.String evtnm, EventListener listener)
Page
Due to performance consideration, unlike Component.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener)
,
all event listeners for the page are deferrable, no matter
Deferrable
is implemented or not.
addEventListener
in interface Page
evtnm
- what event to listen (never null)
Component.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener)
public boolean removeEventListener(java.lang.String evtnm, EventListener listener)
Page
removeEventListener
in interface Page
public boolean isComplete()
Page
It is meaningful only if it is the top-level page (i.e.,
not included by the include
component).
Default: false. It means ZK loader will enclose the page content with HTML/HEAD/BODY if necessary (such as not included by other Servlet).
If you have a page that has a complete HTML page and it is included by other page, you have to specify the complete flag to be true.
isComplete
in interface Page
public void setComplete(boolean complete)
Page
Default: false. It means a page is complete if and only if it is not included by other page.
setComplete
in interface Page
complete
- whether the page is complete.
If true, this page is assumed to be complete no matter it is included
or not. If false, this page is assumed to be complete if it is
not included by other page.Page.isComplete()
public void preInit()
PageCtrl
Page.getDesktop()
,
but it doesn't add this page to the desktop yet
(which is done by PageCtrl.init(org.zkoss.zk.ui.sys.PageConfig)
).
Note: it is called before
Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map)
and PageCtrl.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)
.
preInit
in interface PageCtrl
public void init(PageConfig config)
PageCtrl
PageConfig
, and then adds it
to a desktop (by use of Execution.getDesktop()
).
Note: this method is called after PageCtrl.preInit()
and
Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map)
.
This method shall be called only after the current execution is activated.
init
in interface PageCtrl
config
- the info about how to initialize this pagepublic void destroy()
PageCtrl
destroy
in interface PageCtrl
destroy
in class AbstractPage
public java.lang.String getHeaders(boolean before)
PageCtrl
For HTML, the header element is the HEAD element.
getHeaders
in interface PageCtrl
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.PageCtrl.getHeaders()
public java.lang.String getHeaders()
PageCtrl
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
PageCtrl.getHeaders(boolean)
instead.
getHeaders
in interface PageCtrl
PageCtrl.getHeaders(boolean)
public java.lang.String getRootAttributes()
PageCtrl
For HTML, the root element is the HTML element.
getRootAttributes
in interface PageCtrl
public void setRootAttributes(java.lang.String rootAttrs)
PageCtrl
Default: "".
setRootAttributes
in interface PageCtrl
public java.lang.String getContentType()
PageCtrl
getContentType
in interface PageCtrl
public void setContentType(java.lang.String contentType)
PageCtrl
setContentType
in interface PageCtrl
public java.lang.String getDocType()
PageCtrl
getDocType
in interface PageCtrl
public void setDocType(java.lang.String docType)
PageCtrl
Default: null (i.e., the device default)
setDocType
in interface PageCtrl
public java.lang.String getFirstLine()
PageCtrl
For XML devices, it is usually the xml processing instruction:
<?xml version="1.0" encoding="UTF-8"?>
getFirstLine
in interface PageCtrl
public void setFirstLine(java.lang.String firstLine)
PageCtrl
Default: null (i.e., nothing generated)
setFirstLine
in interface PageCtrl
public java.lang.Boolean getCacheable()
PageCtrl
getCacheable
in interface PageCtrl
public void setCacheable(java.lang.Boolean cacheable)
PageCtrl
Default: null (use the device default).
setCacheable
in interface PageCtrl
public java.lang.Boolean getAutomaticTimeout()
PageCtrl
getAutomaticTimeout
in interface PageCtrl
PageCtrl.setAutomaticTimeout(java.lang.Boolean)
public void setAutomaticTimeout(java.lang.Boolean autoTimeout)
PageCtrl
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).
setAutomaticTimeout
in interface PageCtrl
public final Desktop getDesktop()
Page
Note: it returns null when
Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map)
is called.
getDesktop
in interface Page
public void redraw(java.io.Writer out) throws java.io.IOException
PageCtrl
You could use Attributes.PAGE_REDRAW_CONTROL
and/or Attributes.PAGE_RENDERER
to control how to render manually.
redraw
in interface PageCtrl
java.io.IOException
public final Namespace getNamespace()
getNamespace
in interface Page
Page.interpret(java.lang.String, java.lang.String, org.zkoss.zk.scripting.Namespace)
public void interpret(java.lang.String zslang, java.lang.String script, Scope scope)
Page
interpret
in interface Page
zslang
- the scripting language. If null, Page.getZScriptLanguage()
is assumed.scope
- the scope used as the context.
Since a component is a scope, you can pass a component as the context.
By context we mean the attribute of the scope, its space owner,
spacer owner's space owner, page and desktop will be searched.
If null, this page is assumed.public void interpret(java.lang.String zslang, java.lang.String script, Namespace ns)
interpret(String,String,Scope)
.
interpret
in interface Page
zslang
- the scripting language. If null, Page.getZScriptLanguage()
is assumed.ns
- the namspace. If null, the current namespace is assumed.
The current namespace is the event target's namespace
(Event.getTarget()
),
if the thread is processing an event.
Otherwise, the current namespace is this page's namespacepublic Interpreter getInterpreter(java.lang.String zslang)
Page
The interpreter will be loaded and initialized, if it is not loaded yet.
getInterpreter
in interface Page
zslang
- the scripting language. If null, Page.getZScriptLanguage()
is assumed.public java.util.Collection getLoadedInterpreters()
Page
getLoadedInterpreters
in interface Page
public java.lang.String getZScriptLanguage()
Page
getZScriptLanguage
in interface Page
public void setZScriptLanguage(java.lang.String zslang) throws InterpreterNotFoundException
Page
setZScriptLanguage
in interface Page
InterpreterNotFoundException
- if no such languagepublic void addDeferredZScript(Component parent, ZScript zscript)
PageCtrl
addDeferredZScript
in interface PageCtrl
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.public boolean isListenerAvailable(java.lang.String evtnm)
Page
isListenerAvailable
in interface Page
public java.util.Iterator getListenerIterator(java.lang.String evtnm)
Page
getListenerIterator
in interface Page
public final Component getOwner()
PageCtrl
getOwner
in interface PageCtrl
public final void setOwner(Component comp)
PageCtrl
Used only internally.
setOwner
in interface PageCtrl
public Component getDefaultParent()
getDefaultParent
in interface PageCtrl
public void setDefaultParent(Component comp)
setDefaultParent
in interface PageCtrl
public void sessionWillPassivate(Desktop desktop)
PageCtrl
sessionWillPassivate
in interface PageCtrl
public void sessionDidActivate(Desktop desktop)
PageCtrl
sessionDidActivate
in interface PageCtrl
public LanguageDefinition getLanguageDefinition()
Page
getLanguageDefinition
in interface Page
public ComponentDefinitionMap getComponentDefinitionMap()
Page
Note: the map is shared among all instance of the same page definition.
Any component definition added (by ComponentDefinitionMap.add(org.zkoss.zk.ui.metainfo.ComponentDefinition)
)
are visible to all other instances of the same page definition.
Thus, it is NOT a good idea to change its content.
getComponentDefinitionMap
in interface Page
public ComponentDefinition getComponentDefinition(java.lang.String name, boolean recurse)
Page
Note: unlike LanguageDefinition.getComponentDefinition(java.lang.String)
,
this method doesn't throw ComponentNotFoundException if not found.
It just returns null.
getComponentDefinition
in interface Page
recurse
- whether to look up the component from Page.getLanguageDefinition()
public ComponentDefinition getComponentDefinition(java.lang.Class cls, boolean recurse)
Page
Note: unlike LanguageDefinition.getComponentDefinition(java.lang.String)
,
this method doesn't throw ComponentNotFoundException if not found.
It just returns null.
getComponentDefinition
in interface Page
recurse
- whether to look up the component from Page.getLanguageDefinition()
public java.lang.Class getExpressionFactoryClass()
Page
Configuration.getExpressionFactoryClass()
is used.
Default: null.
getExpressionFactoryClass
in interface Page
Page.setExpressionFactoryClass(java.lang.Class)
public void setExpressionFactoryClass(java.lang.Class expfcls)
Page
setExpressionFactoryClass
in interface Page
expfcls
- the class that implements
ExpressionFactory
,
If null, Configuration.getExpressionFactoryClass()
is used.Page.getExpressionFactoryClass()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |