-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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
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?
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
>> 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
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
@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
Asked: 2008-12-02 18:43:16 +0800
Seen: 1,108 times
Last updated: Dec 11 '08