|
||||||||||
| 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 |
| 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 |
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 |
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 available| Method Detail |
|---|
protected void init()
public final FunctionMapper getFunctionMapper()
Page
getFunctionMapper in interface Pagepublic boolean addFunctionMapper(FunctionMapper mapper)
PageThe new added function mapper has the higher priority.
Page.getFunctionMapper() will return the new
addFunctionMapper in interface Pagemapper - the new function mapper (null to ignore).public boolean removeFunctionMapper(FunctionMapper mapper)
PagePage.addFunctionMapper(org.zkoss.xel.FunctionMapper).
removeFunctionMapper in interface Pagepublic boolean hasFunctionMapper(FunctionMapper mapper)
Page
hasFunctionMapper in interface PagePage.addFunctionMapper(org.zkoss.xel.FunctionMapper)public java.lang.String getRequestPath()
PageIt 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 PageExecution.getContextPath(),
Desktop.getRequestPath()public final java.lang.String getId()
PageNote: it returns null when
Initiator.doInit(org.zkoss.zk.ui.Page, java.util.Map is called.
getId in interface Pagepublic final java.lang.String getUuid()
PageIt is mainly used for communication between client and server and you rarely need to access it.
getUuid in interface Pagepublic void setId(java.lang.String id)
PageNote: 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 Pagepublic java.lang.String getTitle()
PageDefault: "".
getTitle in interface Pagepublic void setTitle(java.lang.String title)
Page
setTitle in interface Pagepublic java.lang.String getStyle()
Page
getStyle in interface Pagepublic void setStyle(java.lang.String style)
PageNote: Unlike Page.setTitle(java.lang.String), you can change the style only in
the lifecycle of the loading page.
setStyle in interface Pagepublic java.util.Map<java.lang.String,java.lang.Object> getAttributes(int scope)
PageIf 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 Pagescope - 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)
PageIf 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 Pagescope - 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)
PageNotice 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)
PageIf 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 Pagescope - 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)
PageIf 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 Pagescope - 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 ScopegetAttributes in interface Pagepublic java.lang.Object getAttribute(java.lang.String name)
Page
getAttribute in interface ScopegetAttribute in interface Pagepublic boolean hasAttribute(java.lang.String name)
PageNotice that null is a valid value, so you need this
method to really know if an atribute is defined.
hasAttribute in interface ScopehasAttribute in interface Page
public java.lang.Object setAttribute(java.lang.String name,
java.lang.Object value)
Page
setAttribute in interface ScopesetAttribute in interface Pagevalue - the value.
public java.lang.Object removeAttribute(java.lang.String name)
Page
removeAttribute in interface ScoperemoveAttribute in interface Page
public java.lang.Object getAttribute(java.lang.String name,
boolean recurse)
Scope
getAttribute in interface Scoperecurse - 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)
ScopeNotice 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 Scoperecurse - 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 Scoperecurse - 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 Scoperecurse - 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)
PageNotice 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 Pagerecurse - whether to look up the desktop/session for the
existence of the attribute.
public boolean hasAttributeOrFellow(java.lang.String name,
boolean recurse)
PageNotice 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 Pagerecurse - whether to look up the desktop/session for the
existence of the attribute.public boolean addScopeListener(ScopeListener listener)
Scope
addScopeListener in interface Scopepublic boolean removeScopeListener(ScopeListener listener)
Scope
removeScopeListener in interface Scopepublic void invalidate()
Page
invalidate in interface Pagepublic boolean addClassResolver(ClassResolver resolver)
Page
addClassResolver in interface Pageresolver - 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
PageClassResolver (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 ClassResolverresolveClass in interface Pageclsnm - 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)
PagePage.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 Pageclsnm - 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 PagePage.getLoadedInterpreters()
public Function getZScriptFunction(Component comp,
java.lang.String name,
java.lang.Class[] argTypes)
Page
getZScriptFunction in interface Pagecomp - 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 PagePage.getLoadedInterpreters()
public java.lang.Object getZScriptVariable(Component comp,
java.lang.String name)
Page
getZScriptVariable in interface Pagecomp - 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)
PagegetXelVariable(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 PagePage.getXelVariable(XelContext, Object, Object, boolean)
public java.lang.Object getXelVariable(XelContext ctx,
java.lang.Object base,
java.lang.Object name,
boolean ignoreExec)
PageUnlike Page.getXelVariable(String), this method
can utilitize VariableResolverX if you'd like
to retrieve a property of another object.
getXelVariable in interface Pagectx - 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)
PagePage.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 Pagepublic boolean removeVariableResolver(VariableResolver resolver)
PagePage.addVariableResolver(org.zkoss.xel.VariableResolver).
removeVariableResolver in interface Pagepublic boolean hasVariableResolver(VariableResolver resolver)
Page
hasVariableResolver in interface PagePage.addVariableResolver(org.zkoss.xel.VariableResolver)
public boolean addEventListener(java.lang.String evtnm,
EventListener<? extends Event> listener)
PageDue 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 Pageevtnm - 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 Pagepublic boolean isComplete()
PageIt 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 Pagepublic void setComplete(boolean complete)
PageDefault: false. It means a page is complete if and only if it is not included by other page.
setComplete in interface Pagecomplete - 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()
PageCtrlPage.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 PageCtrlpublic void init(PageConfig config)
PageCtrlPageConfig, 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 PageCtrlconfig - the info about how to initialize this pagepublic void destroy()
PageCtrl
destroy in interface PageCtrldestroy in class AbstractPagepublic boolean isAlive()
Page
isAlive in interface PagePageCtrl.destroy()public java.lang.String getBeforeHeadTags()
PageCtrlSince it is generated before ZK's default tags (such as CSS and JS), it cannot override ZK's default behaviors.
getBeforeHeadTags in interface PageCtrlPageCtrl.getAfterHeadTags()public java.lang.String getAfterHeadTags()
PageCtrlSince it is generated after ZK's default tags (such as CSS and JS), it could override ZK's default behaviors.
getAfterHeadTags in interface PageCtrlPageCtrl.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 PageCtrlpublic 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 PageCtrlpublic java.util.Collection<java.lang.Object[]> getResponseHeaders()
PageCtrlDate 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 PageCtrlpublic java.lang.String getRootAttributes()
PageCtrlFor HTML, the root element is the HTML element.
getRootAttributes in interface PageCtrlpublic void setRootAttributes(java.lang.String rootAttrs)
PageCtrlDefault: "".
setRootAttributes in interface PageCtrlpublic java.lang.String getContentType()
PageCtrl
getContentType in interface PageCtrlpublic void setContentType(java.lang.String contentType)
PageCtrl
setContentType in interface PageCtrlpublic java.lang.String getWidgetClass()
PageCtrl
getWidgetClass in interface PageCtrlpublic void setWidgetClass(java.lang.String wgtcls)
PageCtrl
setWidgetClass in interface PageCtrlwgtcls - the widget class. The device default is assumed if wgtcls
is null or empty.public java.lang.String getDocType()
PageCtrl
getDocType in interface PageCtrlpublic void setDocType(java.lang.String docType)
PageCtrlDefault: null (i.e., the device default)
setDocType in interface PageCtrlpublic java.lang.String getFirstLine()
PageCtrlFor 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)
PageCtrlDefault: null (i.e., nothing generated)
setFirstLine in interface PageCtrlpublic java.lang.Boolean getCacheable()
PageCtrl
getCacheable in interface PageCtrlpublic void setCacheable(java.lang.Boolean cacheable)
PageCtrlDefault: null (use the device default).
setCacheable in interface PageCtrlpublic java.lang.Boolean getAutomaticTimeout()
PageCtrl
getAutomaticTimeout in interface PageCtrlPageCtrl.setAutomaticTimeout(java.lang.Boolean)public void setAutomaticTimeout(java.lang.Boolean autoTimeout)
PageCtrlDefault: 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 PageCtrlpublic final Desktop getDesktop()
PageNote: 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
PageCtrlYou could use Attributes.PAGE_REDRAW_CONTROL
and/or Attributes.PAGE_RENDERER
to control how to render manually.
redraw in interface PageCtrljava.io.IOException
public void interpret(java.lang.String zslang,
java.lang.String script,
Scope scope)
Page
interpret in interface Pagezslang - 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)
PageThe interpreter will be loaded and initialized, if it is not loaded yet.
getInterpreter in interface Pagezslang - the scripting language. If null, Page.getZScriptLanguage()
is assumed.public java.util.Collection<Interpreter> getLoadedInterpreters()
Page
getLoadedInterpreters in interface Pagepublic java.lang.String getZScriptLanguage()
Page
getZScriptLanguage in interface Page
public void setZScriptLanguage(java.lang.String zslang)
throws InterpreterNotFoundException
Page
setZScriptLanguage in interface PageInterpreterNotFoundException - if no such language
public void addDeferredZScript(Component parent,
ZScript zscript)
PageCtrl
addDeferredZScript in interface PageCtrlparent - 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 Pagepublic java.util.Iterator<EventListener<? extends Event>> getListenerIterator(java.lang.String evtnm)
getEventListeners(java.lang.String).
getListenerIterator in interface Pagepublic java.lang.Iterable<EventListener<? extends Event>> getEventListeners(java.lang.String evtnm)
PageNote: 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 Pagepublic final Component getOwner()
PageCtrlNote: the owner, if not null, must implement Includer.
getOwner in interface PageCtrlpublic final void setOwner(Component comp)
PageCtrlCalled only internally
Since 5.0.6, the owner must implement Includer.
setOwner in interface PageCtrlpublic void sessionWillPassivate(Desktop desktop)
PageCtrl
sessionWillPassivate in interface PageCtrlpublic void sessionDidActivate(Desktop desktop)
PageCtrl
sessionDidActivate in interface PageCtrlpublic LanguageDefinition getLanguageDefinition()
Page
getLanguageDefinition in interface Pagepublic ComponentDefinitionMap getComponentDefinitionMap()
PageNote: 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)
PageNote: unlike LanguageDefinition.getComponentDefinition(java.lang.String),
this method doesn't throw ComponentNotFoundException if not found.
It just returns null.
getComponentDefinition in interface Pagerecurse - whether to look up the component from Page.getLanguageDefinition()
public ComponentDefinition getComponentDefinition(java.lang.Class<? extends Component> cls,
boolean recurse)
PageNote: unlike LanguageDefinition.getComponentDefinition(java.lang.String),
this method doesn't throw ComponentNotFoundException if not found.
It just returns null.
getComponentDefinition in interface Pagerecurse - whether to look up the component from Page.getLanguageDefinition()public java.lang.Class<? extends ExpressionFactory> getExpressionFactoryClass()
PageConfiguration.getExpressionFactoryClass()
is used.
Default: null.
getExpressionFactoryClass in interface PagePage.setExpressionFactoryClass(java.lang.Class extends org.zkoss.xel.ExpressionFactory>)public void setExpressionFactoryClass(java.lang.Class<? extends ExpressionFactory> expfcls)
Page
setExpressionFactoryClass in interface Pageexpfcls - 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 | |||||||||