0

Composer Vs traditional programmer

asked 2010-12-16 16:38:01 +0800

lramellavotta gravatar image lramellavotta flag of Italy
200 1 8

After doing some tests I would have to ask a question to the community:
what is the advantage of a programming in "Forward" mode Vs programming "standard"?
By standard I mean: the screen. zul + programming with some controls inside the file. java so no need to "forward" events.

Sorry for the question but I really do not know what is best.
Luca

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-12-19 12:40:40 +0800

robertpic71 gravatar image robertpic71
1275 1

updated 2010-12-19 12:40:59 +0800

Please describe standard?

1.) zscript inside the zul file
<button onClick="xy.submit();"/>

+ hot deployment, no restart is required, ideal for prototyping
- needs more memory (=slower) and cpu because it's interpreted by beanshell
- not part of eclipse/netbeans refactoring
- beanshell make some troubles in clusterenvironment (this are userreports, i do not use zscript for productive products)

2. - 5.) Are faster then zscript (1.). There is no performance advantage between this variants.

2.) Swing way (Add events listeners with anonym classes)
I see no advantage for this style. It's the most code and you have some limits inside a anonym class.

+ usefull if you port a swing/swt application to web/zk
+/- you could add eventlisteners to dynamic created UI-Elements (smarter: the ZK Utilclasses)
- most code, needs a onw class

3.) autowired by (name)convention (ForwardComposer or Utilclass)
This is my prefered variant.

<button id="ok"..>
public void onClick$ok(ForwardEvent event)...

+ less code
- don't work for dynamic nested zul's

4.) forward
<button forward="onClick=onSave">

+/- less code the swing-style, but more code than autowired
+ can forward accept a path as target, i.e. onClick=/win.onSave
+ you can foward different events to the some eventhandler (i.e. onClick by Button or onOK from the inputfield to the onSave)

5.) extend UI-Component
<window use="class" onOK="onSave"..>

- no good choise if you working with zul-files, you don't have a java class for each component
+ usefull if you want create own standard UI's i.e. a special textbox for your customernumber ..

My best practice:

I use zscript (Variant 1) only for prototyping or maintanaince-zuls.

I use autowired (Variant 3) whenever it possible.

I use the forward-attribute (variant 4) if autowired not possible i.e.
for dynamic added zul's, extra UI-Events for the same controller-event (i.e. onClick by autowired, onOK by forward)

I only extend UI-Components for creating a new standard UI-Component, i.e. a special bandbox, textbox.

/Robert

link publish delete flag offensive edit

answered 2010-12-20 07:51:03 +0800

lramellavotta gravatar image lramellavotta flag of Italy
200 1 8

Hi Robert,

thanks for your reply. I'm looking for the best way to use zk. Your reply helps me a lot.

Luca

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-12-16 16:38:01 +0800

Seen: 439 times

Last updated: Dec 20 '10

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