Component-based UI"

From Documentation
Line 3: Line 3:
 
=Overview=
 
=Overview=
  
Each UI object is represented with a component (<javadoc type="interface">org.zkoss.zk.ui.Component</javadoc>). Thus, composing UI is all about assembling components.
+
Each UI object is represented with a component (<javadoc type="interface">org.zkoss.zk.ui.Component</javadoc>). Thus, composing UI is all about assembling components. To alert UI is all about modifying the states and relationship of components.
  
For example, here we declared a <javadoc>org.zkoss.zul.Window</javadoc> component, enabled the border (border="normal"), and set its width to a definite 250 pixels. Enclosed in the <javadoc>org.zkoss.zul.Window</javadoc> are two <javadoc>org.zkoss.zul.Button</javadoc> components.
+
For example, as shown below, we declared a <javadoc>org.zkoss.zul.Window</javadoc> component, enabled the border (border="normal"), and set its width to a definite 250 pixels. Enclosed in the <javadoc>org.zkoss.zul.Window</javadoc> are two <javadoc>org.zkoss.zul.Button</javadoc> components.
  
 
[[Image:ZKEssentials_Intro_Hello.png]]
 
[[Image:ZKEssentials_Intro_Hello.png]]
  
 +
As shown, there are two ways to declare UI: XML-based approach and pure-Java approach. Furthermore, you could mix them if you like.
 +
 +
=Desktop, Page and Component=
 +
 +
A page is a collections of components. Only components attached to a page are available at the client. They are removed when they are detached from a page. A page represents a portion of the browser window. A page is created automatically when ZK Loader loads a ZUML page or calls a richlet (<javadoc type="interface" method="service(org.zkoss.zk.ui.Page)">org.zkoss.zk.ui.Richlet</javadoc>).
 +
 +
A desktop (<javadoc type="interface">org.zkoss.zk.ui.Desktop</javadoc>) represents a browser window (or a tab or a frame of the browser)<ref>Under portal environment, there might be multiple desktops in one browser window. However, it is really important in the developer's viewpoint.</ref>.
 +
 +
A desktop is also the logic scope that an application can access in a request. In other words, the application can not access components in multiple
 +
 +
<blockquote>
 +
----
 +
<references/>
 +
</blockquote>
  
 
=Version History=
 
=Version History=

Revision as of 08:14, 3 November 2010


Component-based UI


Overview

Each UI object is represented with a component (Component). Thus, composing UI is all about assembling components. To alert UI is all about modifying the states and relationship of components.

For example, as shown below, we declared a Window component, enabled the border (border="normal"), and set its width to a definite 250 pixels. Enclosed in the Window are two Button components.

ZKEssentials Intro Hello.png

As shown, there are two ways to declare UI: XML-based approach and pure-Java approach. Furthermore, you could mix them if you like.

Desktop, Page and Component

A page is a collections of components. Only components attached to a page are available at the client. They are removed when they are detached from a page. A page represents a portion of the browser window. A page is created automatically when ZK Loader loads a ZUML page or calls a richlet (Richlet.service(Page)).

A desktop (Desktop) represents a browser window (or a tab or a frame of the browser)[1].

A desktop is also the logic scope that an application can access in a request. In other words, the application can not access components in multiple


  1. Under portal environment, there might be multiple desktops in one browser window. However, it is really important in the developer's viewpoint.

Version History

Last Update : 2010/11/3

Version Date Content
     



Last Update : 2010/11/03

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