Difference between revisions of "Most used api for Implicit Objects and Static Classes"
From Documentation
(Created page with '{{ZKDevelopersGuidePageHeader}} ==Overview== Besides <tt>setAttribute</tt>, <tt>getAttribute</tt>. We will list some useful api of implicit object and Static Classes like <tt>[h…') |
m (correct highlight (via JWB)) |
||
Line 2: | Line 2: | ||
==Overview== | ==Overview== | ||
− | Besides < | + | Besides <code>setAttribute</code>, <code>getAttribute</code>. We will list some useful api of implicit object and Static Classes like <code>[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/executions.html Executions]</code> and <code>[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/path.html Path]</code>. For more information, please refer to their javadoc. They are all under package org.zkoss.zk.ui. |
==self== | ==self== | ||
− | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/Component.html < | + | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/Component.html <code>org.zkoss.zk.ui.Component</code>] |
− | :< | + | :<code>setVisible</code> : Sets whether this component is visible. |
− | :< | + | :<code>setParent</code> : Sets the parent component. |
− | :< | + | :<code>removeChild</code> : Removes a child. |
− | Because < | + | Because <code>self</code> will be cast to evaluating component, therefore its api is not limited to <code>org.zkoss.zk.ui.Component</code>. |
For example | For example | ||
Line 19: | Line 19: | ||
</source> | </source> | ||
− | < | + | <code>linkedPanel</code> is mapping to <code>getLinkedPanel</code> of Tab.java |
==spaceOwner== | ==spaceOwner== | ||
− | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/idspace.html < | + | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/idspace.html <code>org.zkoss.zk.ui.IdSpace</code>] |
− | In most case, it will be cast to < | + | In most case, it will be cast to <code>window</code>. |
==page== | ==page== | ||
− | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/page.html < | + | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/page.html <code>org.zkoss.zk.ui.Page</code>] |
==desktop== | ==desktop== | ||
− | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/desktop.html < | + | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/desktop.html <code>org.zkoss.zk.ui.Desktop</code>] |
− | :< | + | :<code>enableServerPush</code> : to enable server push |
− | :< | + | :<code>setBookmark</code> : Sets a bookmark to this desktop. |
− | :< | + | :<code>getBookmark</code> : Returns the current bookmark (never null). |
==execution== | ==execution== | ||
− | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/execution.html < | + | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/execution.html <code>org.zkoss.zk.ui.Execution</code>] |
− | :< | + | :<code>getArg</code> : Returns the parameters (aka., arg) if <code>pushArg</code> is called recently. |
− | :< | + | :<code>getParameter</code> : Returns the value of a request parameter as a String.[[example of execution getParameter | a example]] |
==session== | ==session== | ||
− | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/session.html < | + | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/session.html <code>org.zkoss.zk.ui.Session</code>] |
− | :< | + | :<code>setAttribute</code> : Sets the value of the specified custom attribute. |
− | :< | + | :<code>getAttribute</code> : Returns the value of the specified custom attribute |
− | :< | + | :<code>getNativeSession</code> : Returns the native session. |
− | :< | + | :<code>getRemoteAddr</code> : Returns the Internet Protocol (IP) address of the client or last proxy that sent the first request creating this session. |
− | :< | + | :<code>getDeviceType</code> : Returns the device type that this session belongs to. |
− | In most cases, we use < | + | In most cases, we use <code>session</code> to <code>setAttribute</code> and <code>getAttribute</code>. |
==application== | ==application== | ||
− | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/webapp.html < | + | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/webapp.html <code>org.zkoss.zk.ui.WebApp</code>] |
− | :< | + | :<code>getConfiguration</code> : Returns the configuration. |
− | :< | + | :<code>getInitParameter</code> : Returns the value of the named context-wide initialization parameter. |
==event== | ==event== | ||
− | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/event/event.html < | + | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/event/event.html <code>org.zkoss.zk.ui.event.Event</code>] or derived |
− | :< | + | :<code>stopPropagation</code> : Stops the propagation for this event. |
− | :< | + | :<code>getTarget</code> : Returns the target component that receives this event. |
− | :< | + | :<code>getName</code> : Returns the event name. |
− | :< | + | :<code>getData</code> : Returns the data accompanies with this event. |
− | < | + | <code>event</code> may be casted to subclass like <code>KeyEvent</code>, <code>InputEvent</code>. |
==Executions== | ==Executions== | ||
[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/executions.html org.zkoss.zk.ui.Executions] | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/executions.html org.zkoss.zk.ui.Executions] | ||
− | :< | + | :<code>createComponents</code> : Creates components from a page file specified by an URI. |
− | :< | + | :<code>getCurrent</code> : Returns the current execution. |
− | :< | + | :<code>getCurrent().getParameter</code> : Returns the value of a request parameter as a String |
− | :< | + | :<code>forward</code> : A shortcut of Executions.getCurrent().forward(page). |
− | :< | + | :<code>sendRedirect</code> : Sends a temporary redirect response to the client using the specified redirect location URL. |
− | :< | + | :<code>wait</code> : Suspends the current processing of an event and wait notify for the specified object. |
− | :< | + | :<code>notify</code> : Wakes up a single event processing thread that is waiting on the specified object. |
− | :< | + | :<code>activate</code> : Activates a server-push thread. |
− | :< | + | :<code>deactivate</code> : Deactivates a server-push thread. |
==Path== | ==Path== | ||
[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/path.html org.zkoss.zk.ui.Path] | [http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/path.html org.zkoss.zk.ui.Path] | ||
− | :< | + | :<code>getComponent</code> : Returns the component of the specified path |
== Clients == | == Clients == | ||
[http://www.zkoss.org/javadoc/5.0/zk/org/zkoss/zk/ui/util/Clients.html Clients] | [http://www.zkoss.org/javadoc/5.0/zk/org/zkoss/zk/ui/util/Clients.html Clients] | ||
− | :< | + | :<code>evalJavaScript</code>: Asks the browser to evaluate the specified JavaScript. |
− | :< | + | :<code>scrollIntoView</code>: Scrolls the ancestor elements to make the specified element visible. |
− | :< | + | :<code>showBusy</code>: Shows the busy message at the brower such that the user knows the system is busy. |
{{ ZKDevelopersGuidePageFooter}} | {{ ZKDevelopersGuidePageFooter}} |
Latest revision as of 02:58, 20 January 2022
This documentation is for an older version of ZK. For the latest one, please click here.
Overview
Besides setAttribute
, getAttribute
. We will list some useful api of implicit object and Static Classes like Executions
and Path
. For more information, please refer to their javadoc. They are all under package org.zkoss.zk.ui.
self
setVisible
: Sets whether this component is visible.setParent
: Sets the parent component.removeChild
: Removes a child.
Because self
will be cast to evaluating component, therefore its api is not limited to org.zkoss.zk.ui.Component
.
For example
<tab label="OnDemand" onSelect="load(self.linkedPanel)"/>
linkedPanel
is mapping to getLinkedPanel
of Tab.java
spaceOwner
In most case, it will be cast to window
.
page
desktop
enableServerPush
: to enable server pushsetBookmark
: Sets a bookmark to this desktop.getBookmark
: Returns the current bookmark (never null).
execution
getArg
: Returns the parameters (aka., arg) ifpushArg
is called recently.getParameter
: Returns the value of a request parameter as a String. a example
session
setAttribute
: Sets the value of the specified custom attribute.getAttribute
: Returns the value of the specified custom attributegetNativeSession
: Returns the native session.getRemoteAddr
: Returns the Internet Protocol (IP) address of the client or last proxy that sent the first request creating this session.getDeviceType
: Returns the device type that this session belongs to.
In most cases, we use session
to setAttribute
and getAttribute
.
application
getConfiguration
: Returns the configuration.getInitParameter
: Returns the value of the named context-wide initialization parameter.
event
org.zkoss.zk.ui.event.Event
or derived
stopPropagation
: Stops the propagation for this event.getTarget
: Returns the target component that receives this event.getName
: Returns the event name.getData
: Returns the data accompanies with this event.
event
may be casted to subclass like KeyEvent
, InputEvent
.
Executions
createComponents
: Creates components from a page file specified by an URI.
getCurrent
: Returns the current execution.
getCurrent().getParameter
: Returns the value of a request parameter as a String
forward
: A shortcut of Executions.getCurrent().forward(page).
sendRedirect
: Sends a temporary redirect response to the client using the specified redirect location URL.
wait
: Suspends the current processing of an event and wait notify for the specified object.
notify
: Wakes up a single event processing thread that is waiting on the specified object.
activate
: Activates a server-push thread.
deactivate
: Deactivates a server-push thread.
Path
getComponent
: Returns the component of the specified path
Clients
evalJavaScript
: Asks the browser to evaluate the specified JavaScript.scrollIntoView
: Scrolls the ancestor elements to make the specified element visible.showBusy
: Shows the busy message at the brower such that the user knows the system is busy.