Friday, October 17, 2014

How to Use Eclipse Code formatter from your own Java code?

I am looking a solution how Eclipse code formatted used formatting the code in eclipse ? Can we use same for-matter for our own use and i found the answer is yes .
If you will use Maven it will be great so need following dependency in pom.xml file



Now here is the Java code for formatting the code



Here you can check why i added


If you will not add above code and format a code which contain generics formatting will not work .

Thursday, September 25, 2014

How to get value of Comboxbox and Textbox In JavaScript/Jquery code


Here is the sample example

Monday, September 1, 2014

How to show Customize message with ZK Constraint?


Here is the code you can follow

Here two condition added

Textbox should not be empty .

Textbox not allow any space trailing and leading spaces.

Friday, August 29, 2014

How to use regular expression in ZK textbox Which not allowed spaces ?

I have a requirement for ZK TextBox


1- Not Allow any space when nothing entered in textbox
2- Not allow space before and after the string.
3- Allow Space in between two keyword like Ram Singh should be valid
4- Only Ram Should be also valid

for above these requirements which not allow trailing/white spaces you can below textbox with regular expression






Monday, May 26, 2014

ZK Include : How to pass and get parameter with zk include

Index.zul

In above code you can check it pass argument with URL here test is argument name and value=5


In this page we used ${param.test} to get the parameter passed in index.zul HeaderComposer.java
ANOTHER WAY TO PASS THE ARGUMENT WITH INCLUDE

Another way to pass Argument and And get it back
Let Us suppose you included menu_component.zul in parent.zul file

Now in menu_component.zul you can get parameter like this

Now use data anywhere in zul and pass value to View Model

Tuesday, May 13, 2014

How to Notify Single Item or Record or Single Column from ZK ListBox Not Whole ListBox?

Here is Demo code for this


ZUL file
Please share if you found any better solution

Wednesday, May 7, 2014

ZK SelectorComposer and GenericForwardComposer

First we can check the ZK documentation what all written in ZK? See below

SelectorComposer
It supports the autowiring based on Java annotation and a CSS3-based selector. If you don't know which one to use, use SelectorComposer.
GenericForwardComposer
It supports the autowiring based on naming convention. You don't need to specify annotations explicitly, but it is error-prone if it is used improperly.

As they clearly mentioned If you don't know which one to use, use SelectorComposer. I will also suggest same if you are using MVC framework

Monday, January 27, 2014

ZK Modal Window prevent to close when used closable=true attribute.

Lets talk about some scenario or you can say business requirements.
Let us suppose a scenario I am opening a modal window to show employee information and user can edit few columns now after editing anything if user going to close the modal window i have to show a Zk MessageBox that something changed to you want to continue If user will press ok button then modal Window will close other wise user click on Cancel button modal Window should not be close.How to achieve this ? Any idea? May be lots of people can do it lots of way.
Here i got one issue thats why its encourage me to write this blog
I am using below code when someone click on Cross Mark of Modal Window


Now if you will check the above code it have a big drawback how i got that drawback read this official post about zk
By setting the closable property (Window.setClosable(boolean)) to true, a close button is shown for the window, which enables a to close the window by clicking the button. Once the user clicks on the close button, an onClose event is sent to the window which is processed by the onClose method of the Window component. Then, onClose, by default, detaches the window itself.
So here i in above code i got same issue as i am using closable="true" it automatically detach the window and when user press OK button of MessageBox i got Null Pointer exception because my Window is already detach or destroyed. To prevent this zk itself give a solution read this
Notice that event.stopPropagation() (Event.stopPropagation()) must be called to prevent the default onClose handler (Window.onClose()) being called.
So i used Zk this tip and used below code.


Now this line of code

Help me to prevent to close the modal Window..

ZK MVVM Get Which Event fired in ZUL

Most of time in ZK MVVM framework we used @Command to capture the event. But sometime we need to capture which event is fired by user so on that case we can use below code


Monday, January 13, 2014

How to enable bilingual support in Zk Framework?

Here is the demo code how you can change the language in zk project in one shot. Zk Supports lots of language like Hindi,English,French etc. More information you can check ZK framework official website