Cool idea. I'm trying to come up with a name for this approach, so far the best I have is "multi-dimensional reuse". The idea that you can customize not in terms of just what a component does with data, but even where a flow of data comes from, is "subtle and powerful".
On Mon, Mar 3, 2008 at 1:11 PM, Davor Hrg <[EMAIL PROTECTED]> wrote: > I have something to avoid creating getter for zebra effect > > the usage is simple > <t:grid .... rowClass="cycle:line1,line2"> > > or > <t:grid .... rowClass="cycle:normal,zebra"> > > or more than two > <t:grid .... rowClass="cycle:line1,line2,line3"> > > or any loop > <t:loop ...> > <div class="${cycle:line1,line2}">aaaa</div> > </tloop> > > just created a wiki page so anyone can try it.... > http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefixCycle > > Davor Hrg > > > > > On Mon, Mar 3, 2008 at 9:07 PM, Marcus <[EMAIL PROTECTED]> wrote: > > Hi Angelo, > > > > If we use boolean type for "cssClass", maybe we don't need a set method. > > > > private boolean cssClass = false; > > > > public String getRowClass() { > > cssClass = !cssClass; > > return (cssClass ? "" : "zebra"); > > } > > > > Marcus > > > > > > > > > > > > Angelo Chen wrote: > > > > In your tml you define a css class: > > > > <style type="text/css"> > > .zebra { > > background-color: silver; > > } > > </style> > > > > <table t:type="grid" .... rowClass="rowClass" /> > > > > then in your page class, you put something like this: > > > > private int row = 0; > > > > public String getRowClass() { > > if (row % 2 != 0) { > > return ""; > > } else > > return "zebra"; > > } > > > > in a setter, inc the row: > > > > public void setCurrentCmt(Comment currentCmt) { > > row++; > > this.currentCmt = currentCmt; > > } > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]