You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by nquirynen <na...@pensionarchitects.be> on 2011/03/15 08:58:52 UTC

Tapestry5 - Grid with variable "row" type

Hi,

I have a page where i load a list of objects depending on some other
variables. This list of objects can be of the type of 1 of several type of
entity objects. 

So I have declared it as :

private List tableData;

and 

t:grid source="tableData" ... 

This works, but the problem is when defining the "row" attribute, I can't
use a variable of type "Object", as I won't be able to use this as needed.
Each type of object has the same property "action", but when trying to
access it as:

private Object row;

and 

${row.action}

--> Object does not have this property

I understand that this won't work, but is there anyone who has an idea how I
can solve my problem or if this even will be possible?

I just wanted to make the grid reusable so I won't have to make one for each
type of entity...

Greetings and thanks in advance!

Nathan

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry5-Grid-with-variable-row-type-tp3685421p3685421.html
Sent from the Tapestry - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Tapestry5 - Grid with variable "row" type

Posted by Ulrich Stärk <ul...@spielviel.de>.
wrong list. See http://tapestry.apache.org/community.html#Community-ReportingProblems%2FGettingSupport

Uli

On 15.03.2011 08:58, nquirynen wrote:
> Hi,
> 
> I have a page where i load a list of objects depending on some other
> variables. This list of objects can be of the type of 1 of several type of
> entity objects. 
> 
> So I have declared it as :
> 
> private List tableData;
> 
> and 
> 
> t:grid source="tableData" ... 
> 
> This works, but the problem is when defining the "row" attribute, I can't
> use a variable of type "Object", as I won't be able to use this as needed.
> Each type of object has the same property "action", but when trying to
> access it as:
> 
> private Object row;
> 
> and 
> 
> ${row.action}
> 
> --> Object does not have this property
> 
> I understand that this won't work, but is there anyone who has an idea how I
> can solve my problem or if this even will be possible?
> 
> I just wanted to make the grid reusable so I won't have to make one for each
> type of entity...
> 
> Greetings and thanks in advance!
> 
> Nathan
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry5-Grid-with-variable-row-type-tp3685421p3685421.html
> Sent from the Tapestry - Dev mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Re: Tapestry5 - Grid with variable "row" type

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 15 Mar 2011 04:58:52 -0300, nquirynen  
<na...@pensionarchitects.be> wrote:

> Hi,

Hi!

> This works, but the problem is when defining the "row" attribute, I can't
> use a variable of type "Object", as I won't be able to use this as  
> needed.

This is not entirely correct.

> private Object row;
> and
> ${row.action}

You can create a method in your page or component class to return it:

public String getAction() {

	if (row instanceof Entity1) {
		Entity1 entity1 = (Entity1) row;
		return entity1.getAction();
	}

	...

}

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org