0

ZK Component Classes via Spring...

asked 2006-12-01 10:28:36 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4039314

By: marvulix

Hi,

we're in a conceptional phase for a new application that will utilize ZK and Spring.

Spring has an quite interesting feature, the dependency injection. And for our application design, it would be great to use this to utilize the ZK "Component Classes" via Spring to use this.

In detail:

if you have a ZK component, like a window, you can attach a "Controller Class"
via <window use="[controller class]">. This controller class is instantiated each time the window is needed.

If this controller needs other beans from spring, these beans have to be resolved via SpringUtil.getBean(...) - for each bean you need. It would be more 'spring'
if this component class is a bean itself, referred by <window use="[bean name]"
and instantiated via SpringUtil.getBean() - with all configured dependency injection done...

I had a first view on the source. My ideas is to utilize an own "ui-factory-class"
in zk.xml that decides on the name specified in use="" if it has to create a new spring bean or class instance.

What do you think? Is this an good or bad idea?

Will there be any complications / rough violations against the ZK concepts?
(haven't studied ZK in detail right now...).

Are there any obvious problems expected if the instance is created by spring and not within ZK?

Thanks,
marvulix

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2006-12-02 06:57:46 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4040414

By: henrichen

This is an interesting idea. Looks that you want to use Spring to compose the ZK component structures. I think it is doable. And the right way is exactly what you suggested: write a UiFactory and do what you want.

All ZK component are POJOs only. I don't think there would be any issues. Looking forward to your implementation.

/henri


link publish delete flag offensive edit

answered 2006-12-03 10:12:11 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4041284

By: marvulix

Hi,

i've written a prototype and it seems to work - at least basically. It seems that there's a problem with loading the proper CSS or maybe it's an issue with the ID's. Hadn't the time to do further investigations yet. Maybe you have an idea or something where i could have a look at first.

I intend to contribute the code. Are there any contribution guidelines / rules?

We also thinking about doing an integration of acegi-security - something like the acegi servlet filter, but the ZK way ;)

and maybe an annotation command to hide items depending on the user rules,
like:
<a:acegi hasPermission="manager"> or <a:acegi authenticated="true">...

have a nice day,
marvulix

link publish delete flag offensive edit

answered 2006-12-04 02:51:54 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4042015

By: henrichen

Hi, marvulix,

1. I don't quite catch your issue. What do you mean by "a problem with loading the proper CSS". Are you talking about those ZK basic CSS files (norm**.css)?
They should be ready when rendering the desktop, shouldn't they?

2. The contribution issue. Please email me (henrichen <at> potix <dot> com)

3. It would be fantastic to have that acegi-security in ZK way. Looking forward to your implementation. Should any issues regarding this, please let us know.

Sincerely,

/henri


link publish delete flag offensive edit

answered 2007-02-12 22:44:23 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4154799

By: c_armeanu

Did you ever proceed with implementing this UiFactory?
I am currently attempting the same thing and would very much like to see your implementation.

Thanks,
Chris


link publish delete flag offensive edit

answered 2007-02-12 23:10:00 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4154832

By: c_armeanu

Did you ever proceed with implementing this UiFactory?
I am currently attempting the same thing and would very much like to see your implementation.

Thanks,
Chris

link publish delete flag offensive edit

answered 2007-02-13 09:05:37 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4155396

By: hgangadh

Marvulix -

Have you seen my example code from "Making Acegi work with ZK" small talk? The code integrates ZK, Spring and Hibernate. Also a work around for what you were asking in the first post is there - you need to use the org.zkoss.zkplus.spring.DelegatingVariableResolver. Instead of creating a bean that is a subclass of component, maybe it is better to use a controller class with methods that accept the component as the argument.. Just look at this and let me know if I missed your point.

So instead of using:
<?xml version="1.0" encoding="utf-8"?>
<?page title="Welcome to Wisdom"?>

<window id="myWindow" use="com.domain.MyWindow"> ...
...
<button label="Send Event" onClick="sendEvent()" /> </window> Here the sendEvent() is in the MyWindow class


You can use:


<?xml version="1.0" encoding="utf-8"?>
<?variable-resolver
class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?page title="Welcome to Wisdom"?>
<window id="myWindow">
...
...
<button label="Send Event" onClick="sendEventController.execute(myWindow)" /> </window> Here that method is in the spring bean sendEventController and it accepts Window as a parameter.


http://www.zkoss.org/smalltalks/zkacegi2/zkacegi2.dsp

-- Hari Gangadharan

link publish delete flag offensive edit

answered 2007-02-13 18:43:54 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4156271

By: loukili

we have an implementation of UiFactory that uses J2ee4All framework, it can help you to implement yours in spring way.
see http://sourceforge.net/projects/j2ee4all (j2ee4all-web2 subproject) and a thread that I writen before
https://sourceforge.net/forum/forum.php?thread_id=1665973&forum_id=510208

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: 2006-12-01 10:28:36 +0800

Seen: 318 times

Last updated: Feb 13 '07

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