org.zkoss.zul

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » zk » org.zkoss.zul 
org.zkoss.zul
ZUL Component Set in HTML

ZUL component set that are used for HTML-based clients.

Table of Contents

Components of XUL in HTML

Introduction

The implementation of XUL components for ZK.

Directive Elements

page

<?page [id="..."] [title="..."] [language="xul/html"]?>
  • The language must be xul/html.
  • The title is used as the HTML page title. Used only if it is rendered as a standalone page (rather than included).
  • The id, if specified, must be unique in the same request. Note: a request might contain multiple pages (such as a portal page).
  • It must be at the same level as the root element.

Special Elements

zk

Due to XML's syntax limitation, we can only specify one document root. Thus, if you have multiple root components, you must use <zk> as the document root to group these root components. In other words, <zk> is not a component and it, if used, must be the document root.

zscript

<zscript>...</zscript>
<zscript src="/WEB-INF/xx/yy.bs">
  • Specifies a script that shall be interpret when executing this page.
  • If you want to pre-compile Java codes, you could do
    <zscript>
    import com.MyCompany.MyPackage.MyClass;
    MyClass.doThis();
    MyClass.doThat();
    .</zscript>
  • Predefined variables:
    self
    The component itself
    self.parent
    The parent component, if any
    page
    The page (org.zkoss.zk.ui.Page)
    session
    The session (org.zkoss.zk.ui.Session)
    this
    The BeanShell namespace to interpret the script defined in this component. Advanced users only.
    super
    The BeanShell namespace to interpret the script defined in the parent component, if any. Advanced users only.
  • If you specify the id attribute for a component, a variable the same as the specified ID is created automatically.
  • If you want to resolve the EL's variables, such as a parameter, use page.resolveVariable(). Example: page.getELVariable('param').get('some')

Simple Elements

Common Attributes

<xxx [id="..."] [class="..."] [style="...] [use="..."]/>
  • If id is not specified, it is generated automatically. If specified, it must be unique in the whole page.
  • The class attribute defines the CSS class that this component shall refer.
  • The use attribute defines the Java class to use instead of the Java class defined in zk-xul-*.xml

textbox

<textbox [id="..."] [class="..."] [style="...] [use="..."]
[onChange="script"] [onChanging="script"] [value="value"] [type="|password"]
[maxlength="0|num"] [rows="3|num"] [cols="0|num"]
[disabled="false|true"] [readonly="false|true"] [multiline="false|true"] />
  • The onChange attribute is called after the value is really set.
    • Note: the script of the onChange attribute is called only if user input a different value. On the other hand, the setValue method is called either by a program or by user's input (if by a program, the value might not be changed).
  • The onChanging attribute is called when a user is chaning its content. onChanging won't cause the content being set. It is simply used to notify server for implementing auto-completion and other features.

window

<window [id="..."] [class="..."] [style="...] [use="..."] [title="..."] [border="normal|none"]/>
  • The title attribute defines the window title.

Implicit Objects

Depending on invoking from a script or from an EL expression, different implicit objects might be used.
NameDescriptionFrom ScriptFrom EL
self The current component that script/EL is interpreted upon.
It is the same as this in Java.
YesYes
spaceOwner The owner of the ID space that the current component belongs to (See What is an ID space"). It is null, if the current component doesn't belong to any space.
It is the same as self.getSpaceOwner() in script, self.root in EL and this.getSpaceOwner() in Java.
YesYes
desktopScope The attributes defined in the current desktop.
It is the same as this.getPage().getAttributes(name,DESKTOP_SCOPE) in Java.
YesYes
pageScope The attributes defined in the current page.
It is the same as this.getPage().getAttributes() in Java.
YesYes
spaceScope The attributes defined in the ID space that the current component belongs to (See What is an ID space"). It is the same as this.getAttributes() with SPACE_SCOPE in Java. YesYes
componentScope The attributes defined in the current component. It is the same as this.getAttributes() with COMPONENT_SCOPE in Java. YesYes
arg A map of parameters that are passed to Execution.createComponents(...).
It is the same as desktop.getExecution().getArg() in Java.
YesYes

How to browse components

In Java

Each window forms an independent ID space. To get a component from an ID space, use Component.getFellow against any component in the same ID space. If a window, say C, is a child of another window, say P, then C belongs the ID space of P, but descendants of C don't. Rather, descendants of C belong to the ID space of C. Notice: C belongs to the ID spaces of both C and P.

A page is also an independent ID space, Page.getFellow is used to retrieve a fellow in it.

  • To get the current page, use Component.getPage().
  • To get another page (in the same desktop), use Component.getPage(String).
  • To get a component of a page, use Page.getFellow(String) -- assuming the component is not a descendant of any window..
  • To get a child component of window, use Window.getFellow(String).
  • To get a fellow component, use Componnet.getFellow(String). All components belongs (aka., child or descendant of) to the same window are called fellows. If a window, say X, belongs to another window, say Y, then X, like other type of components, is a fellow of Y. However, children and descendants of X are NOT fellow of Y because they belong to X's space. Only X belongs to both X's and Y's spaces.

In Script and EL

Components that are specified with the id attribute (i.e., you have assign an ID) can be accessed directly by the value of the id attribute.

For example,

<label id="label" value="Not good enough?"/>
<button label="Change label" onClick="label.value = label.value + 'A'"/>
The scope of visibility, same as in Java, is controlled by the ID space. In other words, each window has an independent ID space. When you specified an ID, only the current ID space is searched.

Events

onOK and onCancel

When window intercepts whether ENTER or ESC is pressed, the onOK or onCancel event is sent, resprectively.

onCtrlKey

Window intercepts whether control or function keys is pressed if you specify what to intercept by use of the ctrlKeys attribute. For example, If ctrlKeys="GW2" is specified, it means Ctrl+G, Ctrl+W and F2 are all intercepted. Once user press one of them, the onCtrlKey event is sent.

Java Source File NameTypeComment
AbstractChartModel.javaClass A skeletal implementation for ChartModel .
AbstractListModel.javaClass A skeletal implementation for ListModel .
AbstractTreeModel.javaClass A skeletal implementation for TreeModel .
Area.javaClass An area of a Imagemap .
Attributes.javaClass Common attributes used for implementation.
Audio.javaClass An audio clip.
Auxhead.javaClass Used to define a collection of auxiliary headers ( Auxheader ).
Auxheader.javaClass An auxiliary header.
Bandbox.javaClass A band box.
Bandpopup.javaClass The popup that belongs to a Bandbox instance.
Box.javaClass A box.
Button.javaClass A button.
Calendar.javaClass A calendar.
Captcha.javaClass The generic captcha component.
Caption.javaClass A header for a Groupbox .
CategoryModel.javaInterface A catetory chart data model.
Chart.javaClass The generic chart component.
ChartModel.javaInterface Chart Model is used to hold the data model for the chart.
Checkbox.javaClass A checkbox.
ClientConstraint.javaInterface Addition interface implemented with Constraint to denote how to validate at the client.
Column.javaClass A single column in a Columns element.
Columns.javaClass Defines the columns of a grid.
Combobox.javaClass A combo box.

Non-XUL extension.

Comboitem.javaClass An item of a combo box.

Non-XUL extension.

ComboitemRenderer.javaInterface Identifies components that can be used as "rubber stamps" to paint the cells in a Combobox .

If you need better control, your renderer can also implement ComboitemRendererExt .

In addition, you could also implement RendererCtrl .

ComboitemRendererExt.javaInterface Provides additional control to ComboitemRenderer .
Constraint.javaInterface A constraint.
CustomConstraint.javaInterface Additional interface implemented with Constraint to denote a constraint supports a custom way to display the error message. If this interface is implemented, the default error box won't be displayed.
Datebox.javaClass An edit box for holding a date.

Default Datebox.getSclass : datebox.

The default format ( Datebox.getFormat ) depends on JVM's setting and the current user's locale.

Decimalbox.javaClass An edit box for holding BigDecimal.
Div.javaClass The same as HTML DIV tag.

An extension.

Doublebox.javaClass An edit box for holding an float point value (double).
Filedownload.javaClass File download utilities.
Fileupload.javaClass A fileupload dialog used to let user upload a file.

There are two ways to use Fileupload :

1.

Flash.javaClass A generic flash component.
Foot.javaClass Defines a set of footers ( Footer ) for a grid ( Grid ).
Footer.javaClass A column of the footer of a grid ( Grid ).
Grid.javaClass A grid is an element that contains both rows and columns elements. It is used to create a grid of elements. Both the rows and columns are displayed at once although only one will typically contain content, while the other may provide size information.

Besides creating Row programmingly, you can assign a data model (a ListModel instance) to a grid via Grid.setModel and then the grid will retrieve data by calling ListModel.getElementAt when necessary.

Besides assign a list model, you could assign a renderer (a RowRenderer instance) to a grid, such that the grid will use this renderer to render the data returned by ListModel.getElementAt . If not assigned, the default renderer, which assumes a label per row, is used. In other words, the default renderer adds a label to a row by calling toString against the object returned by ListModel.getElementAt

There are two ways to handle long content: scrolling and paging. If Grid.getMold is "default", scrolling is used if Grid.setHeight is called and too much content to display. If Grid.getMold is "paging", paging is used if two or more pages are required.

Groupbox.javaClass Groups a set of child elements to have a visual effect.
Hbox.javaClass A hbox.
HiLoModel.javaInterface A HiLo chart data model (date, open, close, high, low, volumn) usually used in stock market.
Html.javaClass A comonent used to embed the browser native content (i.e., HTML tags) into the output sent to the browser. The browser native content is specified by Html.setContent .

Notice that Html generates HTML SPAN to enclose the embedded HTML tags.

Iframe.javaClass Includes an inline frame.
Image.javaClass An image.

Note: IE 5.5/6 (not 7) has a bug that failed to render PNG with alpha transparency.

Imagemap.javaClass An image map.

There are two ways to use Imagemap:

  1. Listen to the onClick event, which is an instance of org.zkoss.zk.ui.event.MouseEvent .
Include.javaClass Includes the result generated by any servlet.
Intbox.javaClass An edit box for holding an integer.
Label.javaClass A label.
Listbox.javaClass A listbox.

Event:

  1. org.zkoss.zk.ui.event.SelectEvent is sent when user changes the selection.

See Specification.

Besides creating Listitem programmingly, you could assign a data model (a ListModel instance) to a listbox via Listbox.setModel and then the listbox will retrieve data via ListModel.getElementAt when necessary.

Besides assign a list model, you could assign a renderer (a ListitemRenderer instance) to a listbox, such that the listbox will use this renderer to render the data returned by ListModel.getElementAt . If not assigned, the default renderer, which assumes a label per list item, is used. In other words, the default renderer adds a label to a row by calling toString against the object returned by ListModel.getElementAt

There are two ways to handle long content: scrolling and paging. If Listbox.getMold is "default", scrolling is used if Listbox.setHeight is called and too much content to display. If Listbox.getMold is "paging", paging is used if two or more pages are required.

Listcell.javaClass A list cell.
Listfoot.javaClass A row of Listfooter .
Listfooter.javaClass A column of the footer of a list box ( Listbox ).
Listhead.javaClass A list headers used to define multi-columns and/or headers.
Listheader.javaClass The list header which defines the attributes and header of a columen of a list box.
Listitem.javaClass A list item.
ListitemComparator.javaClass A comparator used to compare Listitem , if not live data, or the data themselves, if live data.
ListitemRenderer.javaInterface Identifies components that can be used as "rubber stamps" to paint the cells in a Listbox .

If you need better control, your renderer can also implement ListitemRendererExt .

In addition, you could also implement RendererCtrl .

ListitemRendererExt.javaInterface Provides additional control to ListitemRenderer .
ListModel.javaInterface This interface defines the methods that components like Listbox and Grid use to get the content of items.
ListModelArray.javaClass

This is the ListModel as an Object array to be used with Listbox .

ListModelExt.javaInterface An extra interface that can be implemented with ListModel to control the sorting of the listbox.
ListModelList.javaClass

This is the ListModel as a java.util.List to be used with Listbox .

ListModelMap.javaClass

This is the ListModel as a java.util.Map to be used with Listbox .

ListModelSet.javaClass

This is the ListModel as a java.util.Set to be used with Listbox .

ListSubModel.javaInterface An extra interface that can be implemented with ListModel to control the extract of the combobox.
Longbox.javaClass An edit box for holding an integer.
Menu.javaClass An element, much like a button, that is placed on a menu bar.
Menubar.javaClass A container that usually contains menu elements.
Menuitem.javaClass sA single choice in a Menupopup element.
Menupopup.javaClass A container used to display menus.
Menuseparator.javaClass Used to create a separator between menu items.
Messagebox.javaClass Represents the message box.

You don't create Messagebox directly.

Paging.javaClass Paging of long content.
PieModel.javaInterface A Pie chart data model.
Popup.javaClass A container that is displayed as a popup.
Progressmeter.javaClass A progress meter is a bar that indicates how much of a task has been completed.
Radio.javaClass A radio button.

Radio buttons without a ancestor Radiogroup is considered as the same group. The nearest ancestor Radiogroup is the group that the radio belongs to.

Radiogroup.javaClass A radio group.

Note: To support the versatile layout, a radio group accepts any kind of children, including Radio .

RendererCtrl.javaInterface This interface defines the methods components like Listbox use to notify the renderer for several circumstance.

Though ListitemRenderer.render is called one item a timer, a request might have several items to render.

Row.javaClass A single row in a Rows element. Each child of the Row element is placed in each successive cell of the grid.
RowRenderer.javaInterface Identifies components that can be used as "rubber stamps" to paint the cells in a Grid .

If you need better control, your renderer can also implement RowRendererExt .

In addition, you could also implement RendererCtrl .

RowRendererExt.javaInterface Provides additional control to RowRenderer .
Rows.javaClass Defines the rows of a grid.
Script.javaClass A component to represent script codes running at the client. It is the same as HTML SCRIPT tag.

Note: it is the scripting codes running at the client, not at the server.

Separator.javaClass A separator.
SimpleCategoryModel.javaClass A Category data model implementation of CategoryModel .
SimpleConstraint.javaClass A simple constraint that you could build based the predefined constants.

Depending on the component (such as Intbox and Datebox , you could combine the flags, such as SimpleConstraint.NO_POSITIVE + SimpleConstraint.NO_ZERO to accept only negative number.

SimpleDateConstraint.javaClass A simple date constraint.
SimpleHiLoModel.javaClass A HiLo data model implementation of HiLoModel .
SimpleListModel.javaClass A simple implementation of ListModel . Note: It assumes the content is immutable.
SimplePieModel.javaClass A Pie chart data model implementation of PieModel .
SimpleTreeModel.javaClass A simple implementation of TreeModel .
SimpleTreeNode.javaClass
SimpleXYModel.javaClass A XY data model implementation of XYModel .
Slider.javaClass A slider.

To customize the look, you can specify the style class with Slider.setSclass .

Space.javaClass Space is a Separator with the orient default to "horizontal".
Splitter.javaClass An element which should appear before or after an element inside a box ( Box , Vbox and Hbox ).

When the splitter is dragged, the sibling elements of the splitter are resized.

Style.javaClass The style component used to specify CSS styles for the owner desktop.
Tab.javaClass A tab.
Tabbox.javaClass A tabbox.
Tabpanel.javaClass A tab panel.
Tabpanels.javaClass A collection of tab panels.
Tabs.javaClass A collection of tabs ( Tab ).
Textbox.javaClass A textbox.
Timebox.javaClass An edit box for holding a time (a java.util.Date Object , but only Hour & Minute are used.

Default Timebox.getSclass : datebox.

timebox doens't support customized format.

Timer.javaClass Fires one or more org.zkoss.zk.ui.event.Event after a specified delay.
Toolbar.javaClass A toolbar.
Toolbarbutton.javaClass A tool button.

The default CSS class is "button".

Non-xul extension: Toolbarbutton supports Toolbarbutton.getHref .

Tree.javaClass A container which can be used to hold a tabular or hierarchical set of rows of elements.
Treecell.javaClass A treecell.

In XUL, treecell cannot have any child, but ZUL allows it. Thus, you could place any kind of children in it.

Treechildren.javaClass A treechildren.
Treecol.javaClass A treecol.
Treecols.javaClass A treecols.
Treefoot.javaClass A row of Treefooter .
Treefooter.javaClass A column of the footer of a tree ( Tree ).
Treeitem.javaClass A treeitem.
TreeitemRenderer.javaInterface Identifies components that can be used as "rubber stamps" to paint the cells in a Tree .
TreeModel.javaInterface This interface defines the methods that component like Tree use to get the content of items.
Treerow.javaClass A treerow.
Vbox.javaClass A vbox.
Version.javaClass The version of the ZK XUL component set.
Window.javaClass A generic window.

Unlike other elements, each Window is an independent ID space (by implementing IdSpace ). It means a window and all its descendants forms a ID space and the ID of each of them is unique in this space. You could retrieve any of them in this space by calling Window.getFellow .

If a window X is a descendant of another window Y, X's descendants are not visible in Y's space.

XYModel.javaInterface A XY chart data model.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.