You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by membersound <me...@web.de> on 2012/11/04 14:48:38 UTC

Grid display several implementations of an object?

Can a list for a t:grid contain several implementations of an object? I just
want to make sure the following is in general possible?


class Fruit;
class Apple extends Fruit
class Banana extends Fruit

<t:grid source="fruits" row="fruit"/>

class Page {
	List<Fruit> fruits;
	Foo fruit;
}

Result atm:
Render queue error in BeginRender[Page:grid_0.rows.gridcell]: 
Banana cannot be cast to Apple.



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Grid-display-several-implementations-of-an-object-tp5717635.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: Grid display several implementations of an object?

Posted by membersound <me...@web.de>.
Ok even though I provide an BeanModel now, still having issues with this:

On one page, I display a t:grid list of Users, and if I click on one of the
users I display an additional t:grid below. I make use of 2 different
BeanModels here which works fine now.

BUT when I come from another page by a <t:pagelink context="user.id">, I'm
again getting the "cannot cast class" exception. Somehow the rendering fails
in these cases...



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Grid-display-several-implementations-of-an-object-tp5717635p5717638.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: Grid display several implementations of an object?

Posted by membersound <me...@web.de>.
Ok, but as I already have another BeanModel for another entity within the
same page, it seems as if I cannot create additional beanmodels like:

    @Inject
    @Property
    private BeanModel<UserProfile> userModel;
    
    @Inject
    @Property
    private BeanModel<Order> orderModel;

	void setupRender() {
		renderOrderModel();
		renderUserModel();
	}
	

When I make reference by <t:grid model="userModel"/> and <t:grid
model="orderModel">, the latest created model seems to override the first
created. Although I'm making reference to 2 different BeanModel!

SO: can't I have multiple beanmodels within the same page??





--
View this message in context: http://tapestry.1045711.n5.nabble.com/Grid-display-several-implementations-of-an-object-tp5717635p5717637.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: Grid display several implementations of an object?

Posted by Howard Lewis Ship <hl...@gmail.com>.
If you do not supply a GridDataModel, the Grid component generates one from
the first object in its source. I believe this is documented in its
JavaDoc..

On Sunday, November 4, 2012, membersound wrote:

> Can a list for a t:grid contain several implementations of an object? I
> just
> want to make sure the following is in general possible?
>
>
> class Fruit;
> class Apple extends Fruit
> class Banana extends Fruit
>
> <t:grid source="fruits" row="fruit"/>
>
> class Page {
>         List<Fruit> fruits;
>         Foo fruit;
> }
>
> Result atm:
> Render queue error in BeginRender[Page:grid_0.rows.gridcell]:
> Banana cannot be cast to Apple.
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Grid-display-several-implementations-of-an-object-tp5717635.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org<javascript:;>
> For additional commands, e-mail: users-help@tapestry.apache.org<javascript:;>
>
>

-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com