0

Pure Java with ZK

asked 2008-12-02 18:43:16 +0800

lamh gravatar image lamh
84 3

I'd like to start a webapp project with ZK but doing everything in Java. This is an external application open to public. I have a few questions:

Does anyone take this approach?
What is your experience?
Would you do it again?
Pros and cons?

Thanks in advance.
Hayward

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2008-12-02 19:34:11 +0800

hkn gravatar image hkn
246 3

Hello Hayward,

I do "almost" everything in Java: controller, databinding, model etc but I
prefer zul files to design the view/GUI for some reasons:

- it is far easier and quicker to rearrange the components
- extend the GUI with new elements and show a customer without any coding and java and ide (notepad is ok in most cases)
- remove elements just by an attribute visible="false"

and all zul files are without any single line of script.

But without zul files you will loose all the flexibility.
For example test some new functions by adding some elements and some script.
I can see no reason or advantage to do all GUI stuff by pure java.
Maybe there is a reason!
What is your motivation or interest for this approach?

Regards
/Horst

link publish delete flag offensive edit

answered 2008-12-02 20:02:44 +0800

lamh gravatar image lamh
84 3

Thanks for your comments. My main reason is most of my UI will be dynamically generated. For example, the menu items will be user role based. It changes from user to user. Strong type checking will find problems in IDE instead of runtime. However, I think the ZK Studio can help in this area.

I can certainly see the advantage of doing UI in zk. It's a lot quicker and easier to try things out.

In terms of databinding, I thought it has to be done in zul file via "$" or "@". How is databinding done in Java?

link publish delete flag offensive edit

answered 2008-12-02 20:21:32 +0800

hkn gravatar image hkn
246 3

Yes. Look in the smalltalks and search for MVC and in this forum too.
Further search for "autowire" and "GenericForwardComposer",
Components.wireVariables() and Components.addForwards()

My zul do not contain any "$" or "@" annotations at all.

Regards

/Horst

link publish delete flag offensive edit

answered 2008-12-02 21:11:55 +0800

robertpic71 gravatar image robertpic71
1275 1

>> In terms of databinding, I thought it has to be done in zul file via "$" or "@". How is databinding done in Java?
1.) You can use the DataBinder via Java-API. Check this thread and the Java docs from the zkpluspacket.

2.) You could work like Swing: Model and Render - no annotations required.

However i prefer GUI-Code (check my comment here)

/Robert

link publish delete flag offensive edit

answered 2008-12-03 11:49:20 +0800

dastultz gravatar image dastultz
797 9

The only zul work I do is for examples I want to share here. Everything in production is Java. I write "business applications" that don't have a lot of variety in the layout of the screen - not like a marketing website or something. I like to be able to create common GUI elements with simple static method calls such as a Listbox based on a database query:

Listbox lb = ListboxFactory.createFromQuery(query, connection);

I could change the implementation of the one method to affect all occurrences. I supposed the same thing could be done with macro components, but this is a simple example.

/Daryl

link publish delete flag offensive edit

answered 2008-12-11 13:17:15 +0800

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

@lamh
@dastulz

my menus must be done user role based. So it's very interesting for me to see source code for building menus dynamically in pure Java.

Does anyone can show us a little bit code for this theme.

thanks
Stephan

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: 2008-12-02 18:43:16 +0800

Seen: 1,108 times

Last updated: Dec 11 '08

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