|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 |
Constructor Summary | |
---|---|
PageImpl(LanguageDefinition langdef,
ComponentDefinitionMap compdefs,
java.lang.String path,
java.lang.String zslang)
Constructs a page without page definition and richlet. |
|
PageImpl(Page ref)
Constructs a page with another page as instance |
|
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 |
addAfterHeadTags(java.lang.String tags)
Adds the tags that will be generated inside the head element and after ZK's default tags. |
void |
addBeforeHeadTags(java.lang.String tags)
Adds the tags that will be generated inside the head element and before ZK's default tags. |
boolean |
addClassResolver(ClassResolver resolver)
Adds a class resolver to this page. |
void |
addDeferredZScript(Component parent,
ZScript zscript)
Adds a deferred zscript. |
boolean |
addEventListener(java.lang.String evtnm,
EventListener<? extends Event> listener)
Adds an event listener to specified event for all components in this page. |
boolean |
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 variable resolver that will be used to resolve a variable by Page.getXelVariable(java.lang.String) . |
void |
destroy()
Called when this page is about to be detroyed. |
java.lang.String |
getAfterHeadTags()
Returns the tags that shall be generated inside the head element and after ZK's default tags (never null). |
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<java.lang.String,java.lang.Object> |
getAttributes()
Returns all custom attributes associated with this page. |
java.util.Map<java.lang.String,java.lang.Object> |
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.String |
getBeforeHeadTags()
Returns the tags that shall be generated inside the head element and before ZK's default tags (never null). |
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<? extends Component> 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. |
Desktop |
getDesktop()
Returns the desktop that this page belongs to. |
java.lang.String |
getDocType()
Returns the doc type (<! |
java.lang.Iterable<EventListener<? extends Event>> |
getEventListeners(java.lang.String evtnm)
Returns an iterable collection of the event listeners for the given event. |
java.lang.Class<? extends ExpressionFactory> |
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 |
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<EventListener<? extends Event>> |
getListenerIterator(java.lang.String evtnm)
Deprecated. As of release 6.0, replaced with getEventListeners(java.lang.String) . |
java.util.Collection<Interpreter> |
getLoadedInterpreters()
Returns all loaded interpreters. |
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.util.Collection<java.lang.Object[]> |
getResponseHeaders()
Returns a readonly collection of response headers (never null). |
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.String |
getViewport()
Return the meta viewport of this page, or "auto" if not specified. |
java.lang.String |
getWidgetClass()
Returns the widget class of this page, or null to use the device default. |
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 classes defined in the loaded interpreters ( Page.getLoadedInterpreters() ). |
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(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(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. |
boolean |
hasFunctionMapper(FunctionMapper mapper)
Returns if the specified function mapper has been registered |
boolean |
hasVariableResolver(VariableResolver resolver)
Returns if the specified variable resolver has been registered |
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,
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 |
isAlive()
Returns whether the desktop is still alive. |
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<? extends Event> listener)
Removes an event listener. |
boolean |
removeFunctionMapper(FunctionMapper mapper)
Removes a function mapper that was added by Page.addFunctionMapper(org.zkoss.xel.FunctionMapper) . |
boolean |
removeScopeListener(ScopeListener listener)
Removes a change listener from this scope. |
boolean |
removeVariableResolver(VariableResolver resolver)
Removes a variable resolver 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 |
setDocType(java.lang.String docType)
Sets the doc type (<! |
void |
setExpressionFactoryClass(java.lang.Class<? extends ExpressionFactory> 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 |
setViewport(java.lang.String viewport)
Sets the viewport of this page. |
void |
setWidgetClass(java.lang.String wgtcls)
Sets the widget class of this page. |
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()
|
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(Page ref)
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 boolean 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 boolean removeFunctionMapper(FunctionMapper mapper)
Page
Page.addFunctionMapper(org.zkoss.xel.FunctionMapper)
.
removeFunctionMapper
in interface Page
public boolean hasFunctionMapper(FunctionMapper mapper)
Page
hasFunctionMapper
in interface Page
Page.addFunctionMapper(org.zkoss.xel.FunctionMapper)
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.lang.String getViewport()
Page
Default: "auto".
getViewport
in interface Page
public void setViewport(java.lang.String viewport)
Page
setViewport
in interface Page
public java.util.Map<java.lang.String,java.lang.Object> 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
- one of 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
- one of 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
- one of 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
- one of Page.APPLICATION_SCOPE
, Page.SESSION_SCOPE
,
Page.PAGE_SCOPE
, Page.REQUEST_SCOPE
or Page.DESKTOP_SCOPE
.public java.util.Map<java.lang.String,java.lang.Object> 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 boolean addClassResolver(ClassResolver resolver)
Page
addClassResolver
in interface Page
resolver
- the class resolver to be added.
Currently it supports only ImportedClassResolver
.Page.resolveClass(java.lang.String)
public java.lang.Class<?> resolveClass(java.lang.String clsnm) throws java.lang.ClassNotFoundException
Page
ClassResolver
(registered with
Page.addClassResolver(org.zkoss.lang.ClassResolver)
). If not found, it looks at the current
thread's class loader. And then, it looks for classes defined
in any loaded interpreters (Page.getLoadedInterpreters()
).
resolveClass
in interface ClassResolver
resolveClass
in interface Page
clsnm
- the class name. It does not have to be a fully qualified name
(i.e., it could have no package name), if the class is imported by
use of the import directive (such as <?import class="com.foo.*"?>).
java.lang.ClassNotFoundException
- if the class is not found.public java.lang.Class<?> getZScriptClass(java.lang.String clsnm)
Page
Page.getLoadedInterpreters()
).
Note that: since ZK 6, this method will not search
the current thread's class loader.
In other words, you'd like to look for a class from a given page, use Page.resolveClass(java.lang.String)
instead.
Also notice that it won't throw an exception if not found. Rather, it returns null.
getZScriptClass
in interface Page
clsnm
- the fully qualified class name. Unlike Page.resolveClass(java.lang.String)
,
this method does not support the imported class (by Page.addClassResolver(org.zkoss.lang.ClassResolver)
).
Page.resolveClass(java.lang.String)
,
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 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 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
if you'd like
to retrieve a property of another object.
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.getXelVariable(java.lang.String)
.
The new added variable resolver has the higher priority.
Note: the variables resolver 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 hasVariableResolver(VariableResolver resolver)
Page
hasVariableResolver
in interface Page
Page.addVariableResolver(org.zkoss.xel.VariableResolver)
public boolean addEventListener(java.lang.String evtnm, EventListener<? extends Event> listener)
Page
Due to performance consideration, unlike Component.addEventListener(int, java.lang.String, org.zkoss.zk.ui.event.EventListener extends org.zkoss.zk.ui.event.Event>)
,
all event listeners for the page are deferrable, no matter
Deferrable
is implemented or not.
ZK 5.0 and earlier, the second registration is ignored if an event listener has been registered twice. However, since 6.0.0 and later, it won't be ignored. If a listener has been registered multiple times, it will be invoked multiple times.
If you prefer to ignore the second registration, you could specify a library property called "org.zkoss.zk.ui.EventListener.duplicateIgnored" to true.
addEventListener
in interface Page
evtnm
- what event to listen (never null)
Component.addEventListener(int, java.lang.String, org.zkoss.zk.ui.event.EventListener extends org.zkoss.zk.ui.event.Event>)
public boolean removeEventListener(java.lang.String evtnm, EventListener<? extends Event> 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 boolean isAlive()
Page
isAlive
in interface Page
PageCtrl.destroy()
public java.lang.String getBeforeHeadTags()
PageCtrl
Since it is generated before ZK's default tags (such as CSS and JS), it cannot override ZK's default behaviors.
getBeforeHeadTags
in interface PageCtrl
PageCtrl.getAfterHeadTags()
public java.lang.String getAfterHeadTags()
PageCtrl
Since it is generated after ZK's default tags (such as CSS and JS), it could override ZK's default behaviors.
getAfterHeadTags
in interface PageCtrl
PageCtrl.getBeforeHeadTags()
public void addBeforeHeadTags(java.lang.String tags)
PageCtrl
((PageCtrl)page).addBeforeHeadTags("");
You could specify the link, meta and script directive to have the similar result.
addBeforeHeadTags
in interface PageCtrl
public void addAfterHeadTags(java.lang.String tags)
PageCtrl
((PageCtrl)page).addBeforeHeadTags("");
You could specify the link, meta and script directive to have the similar result.
addAfterHeadTags
in interface PageCtrl
public java.util.Collection<java.lang.Object[]> getResponseHeaders()
PageCtrl
Date
or String
(and never null).
The third element indicates whether to add (rather than set)
theader. It is an instance of Boolean (and never null).
getResponseHeaders
in interface PageCtrl
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 getWidgetClass()
PageCtrl
getWidgetClass
in interface PageCtrl
public void setWidgetClass(java.lang.String wgtcls)
PageCtrl
setWidgetClass
in interface PageCtrl
wgtcls
- the widget class. The device default is assumed if wgtcls
is null or empty.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 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 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<Interpreter> 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<EventListener<? extends Event>> getListenerIterator(java.lang.String evtnm)
getEventListeners(java.lang.String)
.
getListenerIterator
in interface Page
public java.lang.Iterable<EventListener<? extends Event>> getEventListeners(java.lang.String evtnm)
Page
Note: it is OK to invoke Page.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener extends org.zkoss.zk.ui.event.Event>)
or Page.removeEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener extends org.zkoss.zk.ui.event.Event>)
when iterating through the event listeners with the returned collection.
To remove an event listener from the returned iterable collection,
you could invoke Iterable.iterator()
's Iterator.remove()
.
getEventListeners
in interface Page
public final Component getOwner()
PageCtrl
Note: the owner, if not null, must implement Includer
.
getOwner
in interface PageCtrl
public final void setOwner(Component comp)
PageCtrl
Called only internally
Since 5.0.6, the owner must implement Includer
.
setOwner
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<? extends Component> 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<? extends ExpressionFactory> getExpressionFactoryClass()
Page
Configuration.getExpressionFactoryClass()
is used.
Default: null.
getExpressionFactoryClass
in interface Page
Page.setExpressionFactoryClass(java.lang.Class extends org.zkoss.xel.ExpressionFactory>)
public void setExpressionFactoryClass(java.lang.Class<? extends ExpressionFactory> 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 |