P.S. this happens with T 5.0.9

Am 01.02.2008 um 10:02 schrieb Moritz Gmelin:

Hi,

I have an Editing page that I would like to use to edit different object implementing the same class. If I switch the object I want to edit I get a ClassCastException in the CoercingPropertyConduitWrapper (see below).

I have created a simple scenario to reproduce this.

First there is a Base Page CoercTest that hast 2 ActionLinks that lead to the ObjectEditPage

-----------------------------

public class CoercTest {

        @InjectPage
        private ObjectEditPage editPage;
                
        @OnEvent(component="typeTO1")
        public ObjectEditPage onTypeTO1() {
                editPage.setTestObject(new TO1());
                return editPage;
                
        }
        
        @OnEvent(component="typeTO2")
        public ObjectEditPage onTypeTO2() {
                editPage.setTestObject(new TO2());
                return editPage;
                
        }
        
}

----------------------------------

TO1 and TO2 both implement TestInterface

This is what ObjectEditPage looks like

-------------------

        @Persist
        private TestInterface testObject;
        
        public TestInterface getTestObject() {
                return testObject;
        }

        public void setTestObject(TestInterface to) {
                this.testObject = to;
        }
        
        public Object onSuccess() {
                testObject = null;
                return CoercTest.class;
        }

------------------------

the tml contains just a BeanForm to edit the "testObject"


Now if the user hits the first ActionLink on the CoercTest page, and submits the form everything looks OK. But as soons as he then hits the 2. ActionLink to edit an Object of the other SubType of TestInterface he gets the following Exception

------------------------

java.lang.ClassCastException
de.avetana.app.pages.test.TO2
Stack trace
org .apache .tapestry .internal .services .CoercingPropertyConduitWrapper .get(CoercingPropertyConduitWrapper.java:36) • org.apache.tapestry.corelib.components.PropertyEditor $1.getPropertyValue(PropertyEditor.java:151) org .apache.tapestry.internal.bindings.PropBinding.get(PropBinding.java: 54) org .apache .tapestry .internal .structure .InternalComponentResourcesImpl .readParameter(InternalComponentResourcesImpl.java:209) org .apache .tapestry .internal .structure .InternalComponentResourcesImpl .readParameter(InternalComponentResourcesImpl.java:224) • org.apache.tapestry.corelib.base.AbstractTextField._ $read_parameter_value(AbstractTextField.java) org .apache .tapestry .corelib.base.AbstractTextField.begin(AbstractTextField.java:154) org .apache .tapestry .corelib.base.AbstractTextField.beginRender(AbstractTextField.java) • org.apache.tapestry.internal.structure.ComponentPageElementImpl $10$1.run(ComponentPageElementImpl.java:327) org .apache .tapestry .internal .structure .ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:869) org .apache.tapestry.internal.structure.ComponentPageElementImpl.access $100(ComponentPageElementImpl.java:53) • org.apache.tapestry.internal.structure.ComponentPageElementImpl $10.render(ComponentPageElementImpl.java:331) org .apache .tapestry.internal.services.RenderQueueImpl.run(RenderQueueImpl.java: 58) org .apache .tapestry .internal .services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:63) • org.apache.tapestry.services.TapestryModule $19.renderMarkup(TapestryModule.java:1291) • org.apache.tapestry.services.TapestryModule $23.renderMarkup(TapestryModule.java:1399) • org.apache.tapestry.services.TapestryModule $22.renderMarkup(TapestryModule.java:1380)

----------------------------




Is there anything one can do to have EditingPages that can handle more than one object type?

M.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to