You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/11/17 17:33:30 UTC
T5: Grid's rowClass
Hi,
The doc says, the rowClass can be used to cycle between CSS values (for the
"zebra effect"), I put one like this: rowclass="literal:zebra", it applies
to all rows in the grid, any sample code ? thanks,
A.C.
--
View this message in context: http://www.nabble.com/T5%3A-Grid%27s-rowClass-tf4827079.html#a13810748
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Grid's rowClass
Posted by Angelo Chen <an...@yahoo.com.hk>.
hi,
might be nice to include that in the tapestry-core as this has a very common
use.
Howard Lewis Ship wrote:
>
> Cool idea. I'm trying to come up with a name for this approach, so
>
>
--
View this message in context: http://www.nabble.com/T5%3A-Grid%27s-rowClass-tp13810748p15818201.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Grid's rowClass
Posted by Howard Lewis Ship <hl...@gmail.com>.
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 <hr...@gmail.com> 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 <mv...@gmail.com> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator Apache Tapestry and Apache HiveMind
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Grid's rowClass
Posted by Davor Hrg <hr...@gmail.com>.
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 <mv...@gmail.com> 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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Grid's rowClass
Posted by Marcus <mv...@gmail.com>.
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;
}
Re: T5: Grid's rowClass
Posted by Sven Homburg <ho...@googlemail.com>.
impossible since weekend tapestry trunk.
tapestry throws an exception like this:
class de.hsofttec.tapestry.components.grid.ZebraGrid overrides final method
.
2008/3/3, Christian Koeberl <ch...@porsche.co.at>:
>
> You can override and extend Grid like this:
>
> package com.poi.egh.turntable.ui.components;
>
> /**
> * Grid component to be used in ProjectX.
> *
> * Provides the following extensions to the Tapestry TurntableGrid:
> * <ul>
> * <li>class="odd" for all odd rows</li>
> * </ul>
> *
> * @author Christian Köberl
> */
> public class ProjectXGrid extends
> org.apache.tapestry.corelib.components.Grid
> {
> private int rowIndex = 1;
>
> @Override
> public String getRowClass()
> {
> return rowIndex++ % 2 != 0 ? "odd" : "";
> }
> }
>
>
> --
> Chris
--
with regards
Sven Homburg
Re: T5: Grid's rowClass
Posted by Christian Koeberl <ch...@porsche.co.at>.
You can override and extend Grid like this:
package com.poi.egh.turntable.ui.components;
/**
* Grid component to be used in ProjectX.
*
* Provides the following extensions to the Tapestry TurntableGrid:
* <ul>
* <li>class="odd" for all odd rows</li>
* </ul>
*
* @author Christian Köberl
*/
public class ProjectXGrid extends
org.apache.tapestry.corelib.components.Grid
{
private int rowIndex = 1;
@Override
public String getRowClass()
{
return rowIndex++ % 2 != 0 ? "odd" : "";
}
}
--
Chris
Re: T5: Grid's rowClass
Posted by Ben Tomasini <be...@gmail.com>.
Does Tapestry itself provide a simpler way to do this? Alternating
row styles is very common and it would be nice to have this be more
automatic.
Ben
On Wed, Nov 28, 2007 at 5:54 PM, Angelo Chen <an...@yahoo.com.hk> wrote:
>
> Hi,
>
> 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;
>
> }
>
>
>
>
> Sorry, I don't get that, how did you do it?
>
> Thanks.
>
>
>
> Angelo Chen wrote:
> >
> > found the solution, have to write a getter to set the rowclass in the page
> > class.
> >
>
> --
> View this message in context: http://www.nabble.com/T5%3A-Grid%27s-rowClass-tf4827079.html#a14017918
>
>
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Grid's rowClass
Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi,
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;
}
Sorry, I don't get that, how did you do it?
Thanks.
Angelo Chen wrote:
>
> found the solution, have to write a getter to set the rowclass in the page
> class.
>
--
View this message in context: http://www.nabble.com/T5%3A-Grid%27s-rowClass-tf4827079.html#a14017918
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Grid's rowClass
Posted by Ektschn <fl...@gmail.com>.
Sorry, I don't get that, how did you do it?
Thanks.
found the solution, have to write a getter to set the rowclass in the page
class.
--
View this message in context: http://www.nabble.com/T5%3A-Grid%27s-rowClass-tf4827079.html#a14007782
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: Grid's rowClass
Posted by Angelo Chen <an...@yahoo.com.hk>.
found the solution, have to write a getter to set the rowclass in the page
class.
Angelo Chen wrote:
>
> Hi,
>
> The doc says, the rowClass can be used to cycle between CSS values (for
> the "zebra effect"), I put one like this: rowclass="literal:zebra", it
> applies to all rows in the grid, any sample code ? thanks,
>
> A.C.
>
--
View this message in context: http://www.nabble.com/T5%3A-Grid%27s-rowClass-tf4827079.html#a13810921
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org