I'm trying to make a grid that is backed by a list of items which implement an interface, however it looks like the grid caches the concrete type of the first item and expects every other item to be of the same type.

Is there a way to avoid this behaviour?

Regards, Paul.

Caused by: java.lang.ClassCastException: package.entities.Type2 cannot be cast to package.entities.Type1 at $PropertyConduit_12c7bbcb301.getRoot($PropertyConduit_12c7bbcb301.java)
    at $PropertyConduit_12c7bbcb301.get($PropertyConduit_12c7bbcb301.java)
at org.apache.tapestry5.internal.services.CoercingPropertyConduitWrapper.get(CoercingPropertyConduitWrapper.java:36) at org.apache.tapestry5.corelib.base.AbstractPropertyOutput.readPropertyForObject(AbstractPropertyOutput.java:152) at org.apache.tapestry5.corelib.base.AbstractPropertyOutput.renderPropertyValue(AbstractPropertyOutput.java:132) at org.apache.tapestry5.corelib.components.GridCell.beginRender(GridCell.java:28)

public class Type1 implements MyInterface<A>
{....}

public class Type2 implements MyInterface<B>
{....}

public class MyPage
{
    public List<MyInterface<?>> getItems()
    {
        List<MyInterface<?>> list = new ArrayList<MyInterface<?>>();
        list.add(new Type1());
        list.add(new Type2());
        return list;
    }
}

MyPage.tml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> <t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"; xmlns:p="tapestry:parameter">

<t:grid source="items" />

</t:layout>

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

Reply via email to