-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all!
Quicky simple question: is there any proper way to apply a controller to a Component via Java on the fly?
Thanks in advance!
Giovanni
I was looking for the same solution before, but I figured out a work-around to share with you. I'm happy if someone else can offer a better solution.
What I did was to wrap the component, say window in my case, into a template.zul page.
<zk> <zscript><![CDATA[ Object apply = arg.get("controller"); ]]></zscript> <window apply="${apply}" /> </zk>
Composer controller = ....; Map args = new HashMap(); args.put("controller", controller); Executions.createComponents("template.zul", null, args);
hello !
why not using composite component ?
I create a demo for you two,
http://www.zkoss.org/zkdemo/composite/composite_component
notice that you need to do the auto wire and auto forward manually. (still very easy :p)
Thanks to both!
ConventionWires.wireController(comp, controller);
Made my day... but your example is quite nice Ryan... it would have saved many lines of crap code probably!
Giovanni
Asked: 2010-11-29 08:14:33 +0800
Seen: 485 times
Last updated: May 10 '13