RowRenderer vs. Annotations

2007-11-26
2013-05-28
  • Simon Massey

    Simon Massey - 2007-11-26

    The first cut of ZKFoodToGo used the "databindings 1" approach of subclassing. I am keen to keep foodToGo as lightweight as possible with a "zero code" sort of approach.

    I am not a big fan of RowRenderer as it does not seem very "zero code" for folks that don't know Java. Given that I can use annotations to stamp out listbox rows as per lines 64-80 here (as per "databindings 4"):

    http://zkforge.svn.sourceforge.net/viewvc/zkforge/trunk/foodToGo/src/main/webapp/zul/index.zul?revision=627&view=markup

    I am not so happy that to pump out the grid rows with data-bindings to a list of POJOs I am using lines 98-109 here:

    http://zkforge.svn.sourceforge.net/viewvc/zkforge/trunk/foodToGo/src/main/webapp/WEB-INF/zscript/controller-class.zs?revision=630&view=markup

    okay in the zul that I stamp out using Executions.createComponents(...) then in the zul for the components use forward to push the event back into the controller that can update the POJOs. It is just that when I think about writing up for a new article the inconsistency bugs me.

    Any ideas?

     
    • Henri Chen

      Henri Chen - 2007-11-28

      Grid supports the same model and template row concept as Listbox does. You can try something like the following codes.

      When the listbox's onSelect triggers the change of the selectedResturant, the databinding "load-on-save" mechanism will load the grid's model with the new selectedResturant.manuItems. Which in term refresh the grid's rows automatically :)

      <grid model="@{selectedResturant.manuItems}">
      <rows>
      <row self="@{each=item}">
      <label value="@{item}"/>
      </rows>
      </grid>

      /henri

       

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks