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 <tt>setAttribute</tt>, <tt>getAttribute</tt>. We will list some useful api of implicit object and Static Classes like <tt>[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/executions.html Executions]</tt> and <tt>[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/path.html Path]</tt>. For more information, please refer to their javadoc. They are all under package org.zkoss.zk.ui.
+
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 <tt>org.zkoss.zk.ui.Component</tt>]
+
[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/Component.html <code>org.zkoss.zk.ui.Component</code>]
  
:<tt>setVisible</tt> : Sets whether this component is visible.
+
:<code>setVisible</code> : Sets whether this component is visible.
:<tt>setParent</tt> : Sets the parent component.
+
:<code>setParent</code> : Sets the parent component.
:<tt>removeChild</tt> : Removes a child.
+
:<code>removeChild</code> : Removes a child.
  
  
Because <tt>self</tt> will be cast to evaluating component, therefore its api is not limited to <tt>org.zkoss.zk.ui.Component</tt>.  
+
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>
  
<tt>linkedPanel</tt> is mapping to <tt>getLinkedPanel</tt> of Tab.java
+
<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 <tt>org.zkoss.zk.ui.IdSpace</tt>]
+
[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 <tt>window</tt>.
+
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 <tt>org.zkoss.zk.ui.Page</tt>]
+
[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 <tt>org.zkoss.zk.ui.Desktop</tt>]
+
[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/desktop.html <code>org.zkoss.zk.ui.Desktop</code>]
  
:<tt>enableServerPush</tt> : to enable server push
+
:<code>enableServerPush</code> : to enable server push
:<tt>setBookmark</tt> : Sets a bookmark to this desktop.
+
:<code>setBookmark</code> : Sets a bookmark to this desktop.
:<tt>getBookmark</tt> : Returns the current bookmark (never null).
+
:<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 <tt>org.zkoss.zk.ui.Execution</tt>]
+
[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/execution.html <code>org.zkoss.zk.ui.Execution</code>]
  
:<tt>getArg</tt> : Returns the parameters (aka., arg) if <tt>pushArg</tt> is called recently.
+
:<code>getArg</code> : Returns the parameters (aka., arg) if <code>pushArg</code> is called recently.
:<tt>getParameter</tt> : Returns the value of a request parameter as a String.[[example of execution getParameter | a example]]
+
:<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 <tt>org.zkoss.zk.ui.Session</tt>]
+
[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/session.html <code>org.zkoss.zk.ui.Session</code>]
  
:<tt>setAttribute</tt> : Sets the value of the specified custom attribute.
+
:<code>setAttribute</code> : Sets the value of the specified custom attribute.
:<tt>getAttribute</tt> : Returns the value of the specified custom attribute
+
:<code>getAttribute</code> : Returns the value of the specified custom attribute
:<tt>getNativeSession</tt> : Returns the native session.
+
:<code>getNativeSession</code> : Returns the native session.
:<tt>getRemoteAddr</tt> : Returns the Internet Protocol (IP) address of the client or last proxy that sent the first request creating this session.
+
:<code>getRemoteAddr</code> : Returns the Internet Protocol (IP) address of the client or last proxy that sent the first request creating this session.
:<tt>getDeviceType</tt> : Returns the device type that this session belongs to.
+
:<code>getDeviceType</code> : Returns the device type that this session belongs to.
  
In most cases, we use <tt>session</tt> to <tt>setAttribute</tt> and <tt>getAttribute</tt>.
+
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 <tt>org.zkoss.zk.ui.WebApp</tt>]
+
[http://www.zkoss.org/javadoc/3.5.1/zk/org/zkoss/zk/ui/webapp.html <code>org.zkoss.zk.ui.WebApp</code>]
  
:<tt>getConfiguration</tt> : Returns the configuration.
+
:<code>getConfiguration</code> : Returns the configuration.
:<tt>getInitParameter</tt> : Returns the value of the named context-wide initialization parameter.
+
:<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 <tt>org.zkoss.zk.ui.event.Event</tt>] or derived  
+
[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  
  
:<tt>stopPropagation</tt> : Stops the propagation for this event.
+
:<code>stopPropagation</code> : Stops the propagation for this event.
:<tt>getTarget</tt> : Returns the target component that receives this event.
+
:<code>getTarget</code> : Returns the target component that receives this event.
:<tt>getName</tt> : Returns the event name.
+
:<code>getName</code> : Returns the event name.
:<tt>getData</tt> : Returns the data accompanies with this event.
+
:<code>getData</code> : Returns the data accompanies with this event.
  
<tt>event</tt> may be casted to subclass like <tt>KeyEvent</tt>, <tt>InputEvent</tt>.
+
<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]
  
:<tt>createComponents</tt> : Creates components from a page file specified by an URI.
+
:<code>createComponents</code> : Creates components from a page file specified by an URI.
  
:<tt>getCurrent</tt> : Returns the current execution.
+
:<code>getCurrent</code> : Returns the current execution.
  
:<tt>getCurrent().getParameter</tt> : Returns the value of a request parameter as a String
+
:<code>getCurrent().getParameter</code> : Returns the value of a request parameter as a String
  
:<tt>forward</tt> : A shortcut of Executions.getCurrent().forward(page).
+
:<code>forward</code> : A shortcut of Executions.getCurrent().forward(page).
  
:<tt>sendRedirect</tt> : Sends a temporary redirect response to the client using the specified redirect location URL.
+
:<code>sendRedirect</code> : Sends a temporary redirect response to the client using the specified redirect location URL.
  
:<tt>wait</tt> : Suspends the current processing of an event and wait notify for the specified object.
+
:<code>wait</code> : Suspends the current processing of an event and wait notify for the specified object.
  
:<tt>notify</tt> : Wakes up a single event processing thread that is waiting on the specified object.
+
:<code>notify</code> : Wakes up a single event processing thread that is waiting on the specified object.
  
:<tt>activate</tt> : Activates a server-push thread.
+
:<code>activate</code> : Activates a server-push thread.
  
:<tt>deactivate</tt> : Deactivates 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]
  
:<tt>getComponent</tt> : Returns the component of the specified 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]
:<tt>evalJavaScript</tt>:  Asks the browser to evaluate the specified JavaScript.
+
:<code>evalJavaScript</code>:  Asks the browser to evaluate the specified JavaScript.
:<tt>scrollIntoView</tt>:  Scrolls the ancestor elements to make the specified element visible.
+
:<code>scrollIntoView</code>:  Scrolls the ancestor elements to make the specified element visible.
:<tt>showBusy</tt>:  Shows the busy message at the brower such that the user knows the system is busy.
+
:<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

Documentationost used api for Implicit Objects and Static Classes
ost used api for Implicit Objects and Static Classes


Stop.png 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

org.zkoss.zk.ui.Component

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

org.zkoss.zk.ui.IdSpace

In most case, it will be cast to window.

page

org.zkoss.zk.ui.Page

desktop

org.zkoss.zk.ui.Desktop

enableServerPush : to enable server push
setBookmark : Sets a bookmark to this desktop.
getBookmark : Returns the current bookmark (never null).

execution

org.zkoss.zk.ui.Execution

getArg : Returns the parameters (aka., arg) if pushArg is called recently.
getParameter : Returns the value of a request parameter as a String. a example

session

org.zkoss.zk.ui.Session

setAttribute : Sets the value of the specified custom attribute.
getAttribute : Returns the value of the specified custom attribute
getNativeSession : 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

org.zkoss.zk.ui.WebApp

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

org.zkoss.zk.ui.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

org.zkoss.zk.ui.Path

getComponent : Returns the component of the specified path

Clients

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.



Last Update : 2022/01/20

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.