onCreate wiring up the controller

  • Simon Massey

    Simon Massey - 2007-11-26

    Here http://www.zkoss.org/doc/devguide/ch11s01s02.html it says to to avoid a beanshell onCreate so that deferred can be used to avoid the init. The catch with that is that here http://zkforge.svn.sourceforge.net/viewvc/zkforge/trunk/foodToGo/src/main/webapp/zul/index.zul?revision=627&view=markup at about line 24 I am including spring support then at lines 45-50 I let the interpreter initialize my controller class with references to the components on the page and with the spring bean façade. I know that I can re-write the application to use:

    public class ControllerClass extends Window implements org.zkoss.zk.ui.ext.AfterCompose {
        public void afterCompose() { /* programmatically get my spring bean and references the components that I update */ }

    but that would make the code a bit daunting for beginners. I would consider tuning a commercial application using AfterCompose but only after prototyping it with "zero codes". As foodToGo is an example app it appears to much to tune it in a way that seems daunting to beginners. Can anyone advise me of a 3rd approach that might be a good idea for either a beginner or a hardcore ZK programmer looking to tune an app?

    • Henri Chen

      Henri Chen - 2007-11-28

      beanshell is slower but convenient. I think it is easier for beginners and prototyping using beanshell. When it comes to the performance tuning phase, programmers can start to refactor their beanshell codes to Java classes.

      The question is really how easy the refactoring can be. Robbie is publishing a smalltalk talking about the "Trilogy of ZK's MVC practice" tomorrow. I think the new GenericComposer and  "apply" property should provide some good practice on that.



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks