It is to provide GUI extensibility such as extended forms - Here a rough
description : 

Entity models : 

public class EntityA {
     private String foo;
     //accessors
     ...
}

public class EntityB extends EntityA{
    private String bla;
   //accessors
   ...
}

ComponentA : 

<t:form t:id="myForm">
        foo : <input t:type="textfield" t:id="foo" t:value="myEntity.foo"
name="foo"/>
        <t:extension-point id="formExtension"/>
        //submit button...
        ...
</t:form>               


public class ComponentA.java {

        @Persist
        private EntityA myEntity;

        @OnEvent(EventConstants.PREPARE_FOR_RENDER)
        public void init(){
                myEntity = new EntityA();       
        }
        
        @OnEvent(EventConstants.SUCCESS)
        public Object success(){
                //call manager to persist data
                return List.class;
        }
        
        //myEntity accessors
        ...
}


ComponentB :

<t:extend xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd";>
        <t:replace id="formExtension">
                bla : <input t:type="textfield" t:id="bla" 
t:value="myEntity.bla"
name="bla" />
        </t:replace>
</t:extend>

public class ComponentB extends ComponentA {
        
        @Persist
        @Property //works with tapestry 5.1, not with 5.2
        private EntityB myEntity; 
        
        @OnEvent(EventConstants.PREPARE_FOR_RENDER)
        public void init(){
                myEntity = new EntityB();
                //Use setter from the superclass
                setEntity(myEntity);
        }
        
        // override onsuccess event
        @OnEvent(EventConstants.SUCCESS)
        public Object sucess(){
            //call manager to store data
            return List.class;
        }
  ...   
}

ComponentA is part of a component library that runs as a standalone app (i
mean it is not a simple base class).

Nourredine.

-- 
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Pb-in-getOrCreateMethod-tp3403357p3403616.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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

Reply via email to