Get ZK Up and Running with MVC"

From Documentation
Line 30: Line 30:
  
 
=Sketch User Interface =
 
=Sketch User Interface =
 +
 +
In ZK, you can use a XML-formatted language, XUL,  to describe user interface.
 +
 +
<source lang="xml">
 +
 +
<window id="searchWin" title="Search Product" width="800px" border="normal"
 +
style="padding-top:10px;padding-left:10px;" apply="tutorial.SearchProductComposer">
 +
<vlayout>
 +
<vlayout >
 +
<hlayout>
 +
<textbox />
 +
<button label="search" image="img/search.png"/>
 +
</hlayout>
 +
<listbox id="productListbox" mold="paging" pageSize="5">
 +
<template name="model" >
 +
<listitem>
 +
<listcell label="${each.name}"></listcell>
 +
</listitem>
 +
</template>
 +
</listbox>
 +
</vlayout>
 +
<separator bar="true" height="10px" />
 +
<hlayout id="detailArea" visible="false">
 +
<image id="thumbImage" />
 +
<vlayout>
 +
<label id="nameLabel" style="font-size:1.5em"/>
 +
<hlayout>Price: <label id="priceLabel" style="font-size:1.3em;color:red"/> </hlayout>
 +
<div ><label id="descriptionLabel"/></div>
 +
</vlayout>
 +
</hlayout>
 +
</vlayout>
 +
</window>
 +
</source>
  
 
= Manipulate UI =
 
= Manipulate UI =

Revision as of 09:13, 28 June 2012

WarningTriangle-32x32.png This page is under construction, so we cannot guarantee the accuracy of the content!

Introduction

In this tutorial, we will teach you how to build a web application with ZK.

The target application we are going to build is a search product application.

Tutorial-searchexample.png

Installation

In this section, we'll tell you how to setup up ZK in a web application project.

Download

Download the ZK CE first,

If you use maven, please add following dependencies:

Setup Class Path

Configure web.xml

The Domain in this tutorial

Sketch User Interface

In ZK, you can use a XML-formatted language, XUL, to describe user interface.

	<window id="searchWin" title="Search Product" width="800px" border="normal"
	 style="padding-top:10px;padding-left:10px;" apply="tutorial.SearchProductComposer">
		<vlayout>
			<vlayout >
				<hlayout>
					<textbox />
					<button label="search" image="img/search.png"/>
				</hlayout>
				<listbox id="productListbox" mold="paging" pageSize="5">
					<template name="model" >
						<listitem>
							<listcell label="${each.name}"></listcell>
						</listitem>
					</template>
				</listbox>
			</vlayout>
			<separator bar="true" height="10px" />
				<hlayout id="detailArea" visible="false">
					<image id="thumbImage" />
					<vlayout>
						<label id="nameLabel" style="font-size:1.5em"/>
						<hlayout>Price: <label id="priceLabel" style="font-size:1.3em;color:red"/> </hlayout>
						<div ><label id="descriptionLabel"/></div>
					</vlayout>
				</hlayout>
		</vlayout>
	</window>

Manipulate UI

Stuff a bunch of data

Handling User Action

UI Control Patterns

MVC v.s MVVM

When to use & Restriction

Bind UI Automatically

Binding data

Handling UI commands

Test ZK Application

Deploy and Run