Requirement Constraints

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 30 March 2013

ZK MVVM Form Binding CRUD with Spring and Hibernate - Part 5

Posted on 02:57 by Unknown

Change Look and Feel

        


In the previous part 4, we have created UI presentation layer (i.e) two files userlist.zul and userCRUD.zul file. If you look more closely, we have used sclass for each component. There is no impact on the look and feel. Now we will create CSS Classes for all those sclass names and change the look and feel.

Before going into detail, first we will change the layout for our application. We will use border layout with four area such north, west, center and south. In the north/south/west, we will show some images to beautify the application. In the center area, we will display all our zul files.

At the end of this part 5, our application will look as follows

image

image

Step 1:
In order to display all our screens, we will design our main page where we will have border layout as said before and center area is our container to display our screens.

Under the webapp folder, create a zul file called main.zul as shown

image

Here is the code :

<?page title="Main" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="main" border="none" width="100%" height="100%"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('zkexample.zkoss.MainVM')">
<borderlayout id="mainlayout" height="100%">
<north id="north" height="19%" border="0">
<div>
<image sclass="fimgtopbkg"></image>
<image sclass="fimgsidetop"></image>
</div>
</north>
<west id="west" size="7%" border="0">
<div width="100%" height="100%">
<image sclass="fimgsidemid"></image>
<image sclass="fimgsidebgk"></image>
</div>
</west>
<center id="center" border="0">
<include src="userList.zul" />
</center>
<south id="south" border="0" size="4%">
<image sclass="fimgbottom"></image>
</south>
</borderlayout>
</window>
</zk>

And also we will create our viewmodel(MainVM) for the above main.zul as shown

image

package zkexample.zkoss;

import java.util.HashMap;

import org.zkoss.bind.annotation.AfterCompose;
import org.zkoss.bind.annotation.ContextParam;
import org.zkoss.bind.annotation.ContextType;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.select.Selectors;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;

public class MainVM {

@Wire("#mainlayout")
private Borderlayout borderLayout;

/**
* This method will be called after host component composition has been done
* (AfterCompose)
*
* @param view
* Root Component of the ZUL File.
*/

@AfterCompose
public void initSetup(@ContextParam(ContextType.VIEW) Component view) {

final HashMap<String, Object> map = new HashMap<String, Object>();

Selectors.wireComponents(view, this, false);

/* get an instance of the searched CENTER layout area */
Center c1 = borderLayout.getCenter();

/* clear the center child */
c1.getChildren().clear();

map.put("centerArea", c1);
/* Load the left navigation menu for patient cases */
Executions.createComponents("userList.zul", c1, map);
}
}


Step 2:
Let us create CSS and Images in the application. Under the webapp folder, create two folders called CSS and images.
image
Under the CSS Folder, create two css files such as style.css and ThemeStyle.css.  You can copy the CSS Content from the source which is available for download at the bottom of this post. 

The reason for having two css files as follows
1. If you look closely in the css files, both the css files will contain the same class name, but in the style.css, it will contain only alignment related properties, but all the color and images under the same class name are coded in the Themestyle.css. By this way, we can have build the different theme for each user. We will see this in the later part of this series.

Next from the downloaded source, copy all the images into image folder. Finally, the structure will look as follows
image



Since now we are going to display all our screens in the center area of the borderlayout, so I modified all the following files. No change in the business logic, just changed the way to accommodate the borderlayout.

All these following files are modifier. Please refer the source
userList.zul
UserCRUD.zul
UserListVM.java
UserCRUDVM.java

Now you can select the main.zul and run using tomcat server and observe the output.

Video Demo (It will take some to show)
http://screencast.com/t/eo4XUdj6GI

In the next part 6, We will see how to apply Spring security 3 integration with hibernate 4
You can download the source code here.



        

Email ThisBlogThis!Share to XShare to Facebook
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • ZK Example for inline Editing with Add New and Delete
    I am quite impressed on this demo from ZK . But adding new record and delete existing record is missing as part of typical CRUD. So i thoug...
  • EDI 5010 Documentation 837 Professional - Loop 2010BB Payer Name
    2010BB Payer Name          In this loop, all the information will be taken from Insurance master screen. Take a look of our sample screen...
  • EDI 5010 Documentation–837 - BHT - Beginning of Hierarchical Transaction
    BHT – Beginning of Hierarchical Transaction Loop Seg ID Segment Name Format Length Ref# Req Value   BHT Beginning of Hier...
  • Hibernate Validator Example 2
    In this example, we will see some more validation constraints such as @email, @past, @length, etc. And also we will also define custom error...
  • ZK Passing Parameter between two files using MVVM–Part 1
    Overview This is the first series of articles about Passing parameter between two zul files using MVVM Design pattern .This article will fo...
  • MVVM Command annotation and Notify change example
    Here is an example, how to pass parameter on a zul through MVVM Command binding annotation. ZK URL http://books.zkoss.org/wiki/ZK%20Develo...
  • History of Present Illness
    HPI - One of the main component of Clinical History. What is an HPI ? The history of present illness (HPI) is a chronological description...
  • Patient Demographics
    Patient browse (search) is the key element for any EMR / PMS Software. In my past 15 years experience, i involved more than 5 times in desig...
  • ViewModel Class Java Annotation @Init, @NotifyChange, @Command
    In following sections we'll list all syntaxes that can be used in implementing a ViewModel and applying ZK bind annotation. The ZK binde...
  • Good Website Design Links
    Form Design Label Placement in Forms International Address Fields in Web Forms 40 Eye-Catching Registration Pages blog-comment-form-...

Categories

  • Billing Process
  • C Workbook
  • C++ Workbook
  • Eclipse Tips
  • EDI 5010
  • EMR Appointment Features
  • EMR Labs Stuff
  • EMR PMS Links
  • EMR Use cases
  • EMR Vital Sign
  • Good Website Design
  • Hibernate Criteria Queries
  • Hibernate Introduction
  • Hibernate Introduction Setup
  • Hibernate Mapping
  • Hibernate POC
  • Hibernate Validator
  • Hibernate–Java Environment setup
  • HPI
  • Java
  • Maven
  • MU Certification
  • NPI
  • PQRS
  • Practice Management System
  • Spring Security
  • Tech Links
  • Today Tech Stuff
  • zk
  • ZK Hibernate
  • ZK 5 Databinding
  • ZK Application
  • ZK Calling Another ZUL
  • ZK CheckBox
  • ZK CreateComponents
  • ZK CSS
  • ZK extended Components
  • ZK Foreach
  • ZK Forum Posts
  • ZK Framework
  • ZK Hibernate Setup
  • ZK ID Space
  • ZK Include
  • ZK Installation
  • ZK iReport
  • ZK Layout
  • ZK Listitem Pagination
  • ZK Message Box
  • ZK MVC
  • ZK MVC Combox Box
  • ZK MVC CRUD Examples
  • ZK MVC Listbox
  • ZK MVVM
  • ZK MVVM Combo
  • ZK MVVM CRUD
  • ZK MVVM ListBox
  • ZK Spring
  • ZK TextBox

Blog Archive

  • ▼  2013 (105)
    • ►  December (3)
    • ►  September (7)
    • ►  August (13)
    • ►  July (1)
    • ►  June (11)
    • ►  May (3)
    • ►  April (14)
    • ▼  March (19)
      • ZK MVVM Form Binding CRUD with Spring and Hibernat...
      • ZK composite component Example
      • ZK MVVM Form Binding CRUD with Spring and Hibernat...
      • ZK MVVM Form Binding CRUD with Spring and Hibernat...
      • ZK MVVM Form Binding CRUD with Spring and Hibernat...
      • Electronic Claim Submission
      • ZK MVVM Form Binding CRUD with Spring and Hibernat...
      • ZK MVVM Form Binding CRUD with Spring and Hibernat...
      • Medical Billing–Patient Insurance
      • ZK + Spring Security Login form– Additional Login ...
      • Different format of Medical Forms
      • Sample CMS 1500 and UB04 Form
      • Medical Billing Process
      • ZK + Spring Security Login form–Part 3
      • ZK + Spring Security Login form–Part 2
      • ZK + Spring Security Login form–Part 1
      • ZK MVVM CRUD with Spring 3. and Hibernate 4
      • ZK MVVM CRUD With Spring 3 + JPA + Hibernate 4 Ent...
      • ZK MVVM CRUD With Spring 3 + JPA + Hibernate 4 Ent...
    • ►  February (21)
    • ►  January (13)
  • ►  2012 (177)
    • ►  December (1)
    • ►  November (13)
    • ►  October (19)
    • ►  September (24)
    • ►  August (26)
    • ►  July (6)
    • ►  June (37)
    • ►  May (30)
    • ►  April (16)
    • ►  March (1)
    • ►  January (4)
  • ►  2011 (5)
    • ►  December (1)
    • ►  November (1)
    • ►  July (1)
    • ►  June (1)
    • ►  April (1)
  • ►  2010 (1)
    • ►  September (1)
Powered by Blogger.

About Me

Unknown
View my complete profile