Requirement Constraints

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

Friday, 6 July 2012

ZK Component extend

Posted on 09:28 by Unknown

In this post, we will see how we can create our component by extending ZK Component. All the jquery plugin can be used in ZK. The following example will explain how to create Phonebox, Zip Code and Tax ID.

For your further reference, you can see the following http://www.zkoss.org/zkdemo/effects/form_effect
You can download the jquery plugin from http://digitalbush.com/projects/masked-input-plugin/

ZK Version 6
Project Name : MyComponents
Project Structure:

image

Download the jquery plugin and Add in webcontent/js folder.

Here is the source for other files

Demo.jul

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="myWin" title="new page title" border="normal" >
<label value="Phone :" />
<phonebox id="phone" width='150px' />
<label value="Extension :" />
<Extension id="txtPhoneExt" />
<label value="zipCode :" />
<ZipCode id="txtZipCode" />
<label value="Tax ID:" />
<EIN id="txtEIN" />
<label value="Alpha Numeric :" />
<AlphaNumeric />
</window>
</zk>


AlphaNumeric.java


package components;

import org.zkoss.zul.Textbox;

public class AlphaNumeric extends Textbox {
private static final long serialVersionUID = 1L;

public AlphaNumeric() {
setWidgetListener("onBind", "jq(this).mask('******');");
}
}


EIN.java

package components;
import org.zkoss.zul.Textbox;

public class EIN extends Textbox {
private static final long serialVersionUID = 1L;
public EIN() {
setWidgetListener("onBind", "jq(this).mask('99-9999999');");
}
}

Extension.java

package components;

import org.zkoss.zul.Textbox;

public class Extension extends Textbox {
private static final long serialVersionUID = 1L;

public Extension() {
setWidgetListener("onBind", "jq(this).mask('99999');");
}
}

NPI.java

package components;

import org.zkoss.zul.Textbox;

public class NPI extends Textbox {
private static final long serialVersionUID = 1L;
public NPI() {
setWidgetListener("onBind", "jq(this).mask('9999999999');");
}
}

Phonebox.java

package components;
import org.zkoss.zul.Textbox;

public class Phonebox extends Textbox {
private static final long serialVersionUID = 1L;
public Phonebox() {
setWidgetListener("onBind", "jq(this).mask('(999) 999-9999');");
}
}

ZipCode.java

package components;

import org.zkoss.zul.Textbox;

public class ZipCode extends Textbox {
private static final long serialVersionUID = 1L;

public ZipCode() {
setWidgetListener("onBind", "jq(this).mask('99999-9999');");
}
}


In the webcontent folder, create a file in the name of my-addon.xml (you can keep any file name)


<?xml version="1.0" encoding="UTF-8"?>
<language-addon>
<addon-name>ecosmos</addon-name>
<language-name>xul/html</language-name>

<component>
<component-name>phonebox</component-name>
<component-class>components.Phonebox
</component-class>
<extends>textbox</extends>
</component>

<component>
<component-name>EIN</component-name>
<component-class>components.EIN</component-class>
<extends>textbox</extends>
</component>

<component>
<component-name>NPI</component-name>
<component-class>components.NPI</component-class>
<extends>textbox</extends>
</component>

<component>
<component-name>Extension</component-name>
<component-class>components.Extension
</component-class>
<extends>textbox</extends>
</component>


<component>
<component-name>ZipCode</component-name>
<component-class>components.ZipCode
</component-class>
<extends>textbox</extends>
</component>

<component>
<component-name>AlphaNumeric</component-name>
<component-class>components.AlphaNumeric
</component-class>
<extends>textbox</extends>
</component>





<addon-name>my.extension</addon-name><!-- any name you like -->
<javascript src="js/jquery.maskedinput-1.3.js" /> <!-- assume you package it as /myjs/foo.js -->

</language-addon>


And in the ZK.Xml , add the reference for the above file as follows


<?xml version="1.0" encoding="UTF-8"?>

<!-- Created by ZK Studio -->

<zk>
<device-config>
<device-type>ajax</device-type>
<timeout-uri>/timeout.zul</timeout-uri><!-- An empty URL can cause the
browser to reload the same URL -->
</device-config>


<language-config>
<addon-uri>/WEB-INF/my-addon.xml</addon-uri>
</language-config>

</zk>


Now you can run the demo.zul and check the output


image


You can download source here

Email ThisBlogThis!Share to XShare to Facebook
Posted in ZK extended Components | 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)
    • ►  February (21)
    • ►  January (13)
  • ▼  2012 (177)
    • ►  December (1)
    • ►  November (13)
    • ►  October (19)
    • ►  September (24)
    • ►  August (26)
    • ▼  July (6)
      • My date box Component
      • Tech Links
      • ZK Hibernate one to one annotation mapping bidirec...
      • ZK Component extend
      • ZK Messagebox Styling
      • EDI 5010 Documentation 837 Professional - Loop 230...
    • ►  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