0

Convert zul to Java class

asked 2010-01-14 17:28:11 +0800

mklaene gravatar image mklaene
87

I'm writing an application and I am using 100% java. This approach is appealing to me for a number of reasons, not the least of which because I've been told that using more java and less script should improve performance.

Well, I'm getting the hang of it, but I can't say I like it all that much. It is much more tedious to build a layout in Java vs. zul (Tabpanels, Box components, etc.). No big news here. I've reached the point where I'll mock something up in a zul file and then write it again in java. This got me thinking - I wonder how ZK, internally, processes markup prior to running the app? Is there a point where a .zul file is translated and compiled into a concrete Java class? If this is the case, I'm wondering how this might be useful to me to create some kind of tool that would output a .java class when I provide a .zul file?

Anyone have any thoughts on this?

Thanks,
Mike

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2010-01-14 19:46:31 +0800

joylo0122 gravatar image joylo0122
688 1
www.zkoss.org

@mklaene

Hi mklaene, our zul page will just build a dom tree, it won't be parsed to a java class, it's not the structure that zk did.
If you want to use more java to build a dom tree, you can write a composer and use lot of setParent() to instead declared tags in zul file.

/Joy

link publish delete flag offensive edit

answered 2010-01-15 05:35:28 +0800

mklaene gravatar image mklaene
87

Thanks for the reply. I figured that was how it was done. I've used a composer in the past. I'm still trying to find the right balance. I have lots of dynamic activity on the site which is suited to java. I reasoned that it was better to be consistent and do the entire site in java. I may go back to a combination of the two. We'll see. Thanks.

link publish delete flag offensive edit

answered 2010-01-15 07:28:56 +0800

caclark gravatar image caclark
1753 2 5
http://clarktrips.intltwi...

mklaene, I think you misunderstood someone that said "that using more java and less script should improve performance". I think they were talking specifically about <zscript> blocks and not ZUL layout. From what I can tell, when a ZUL file is processed, it is cached and reused until it changes again; much like a JSP. I don't believe you'll see significant speed improvement from users 2 - n. Plus, doing it *all* in Java is a huge pain in the butt. I can't imagine the development cycle being fast at all.

This is from my experience. I'm interested in what others have to share.

link publish delete flag offensive edit

answered 2010-01-15 14:54:54 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2010-01-15 14:58:14 +0800

In my case it's like in the real world. The golden middle way works for me at best.

It's like caClark said. It's a huge pain to do all comonents created in Java.

I put the main components in the zul-file. All other logic is in the java controllers.
So i try to hold my zul files small. One zul-file=one controller.
If i have several tabs, i have several zul.files for it and several controllers.

Only needed dynamically components are created in the code.

best
Stephan

link publish delete flag offensive edit

answered 2010-01-16 06:10:43 +0800

mklaene gravatar image mklaene
87

Thanks for the feedback. I do believe I will go back to a more hybrid approach to doing things... It is just too tedious to try and do everything with java. I do think that pure Java development could be made a little more 'pleasant' with some helper classes/methods. Even though this article has been out a while, regarding MVC, I just came upon it yesterday : http://www.zkoss.org/smalltalks/mvc3/ It looks very useful and I will try to incorporate it into my app.

Mike

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-01-14 17:28:11 +0800

Seen: 600 times

Last updated: Jan 16 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More