Hi Howard,

Thanks, I tried to follow the "Using the BeanEditForm Component" article and
come out with a basic editor, my initial plan is, just to edit it first in a
textfield, following is my code based exactly on the article, but I got this
error:

org.apache.tapestry.internal.services.RenderQueueException
Render queue error in BeginRender[TestPage1:rec.beaneditor.propertyeditor]:
Unable to locate a block to edit property 'dob' (with data type 'timestamp')
of object [EMAIL PROTECTED]: Unable to resolve 'AppPropertyEditBlocks' to
a

I have put AppPropertyEditBlocks.java and AppPropertyEditBlocks.tml in the
component folders, any idea?
Thanks,

A.C.

my test page is:
  <t:beanEditForm t:id="rec" object="rec" />

public class TestPage1 {
    private Myrec rec;
    public Myrec getRec() { return rec;}
    public void setRec(Myrec rec) { this.rec = rec;}
}

public class Myrec {
    private String name;
    private Timestamp dob;
        // getters/setters here...
}

AppPropertyEditBlocks.java

public class AppPropertyEditBlocks {

    @Environmental
    private PropertyEditContext _context;

    @Component(parameters =
    { "value=context.propertyValue", "label=prop:context.label",
            "translate=prop:timestampTranslator",
"validate=prop:timestampValidator",
            "clientId=prop:context.propertyId" })
    private TextField _timestamp;

    public PropertyEditContext getContext() { return _context; }

    public FieldValidator getTimestampValidator()
    {
        return _context.getValidator(_timestamp);
    }

    public Translator getTimestampTranslator() {
        return _context.getTranslator();
    }
}

AppPropertyEditBlocks.tml

<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>

    <t:block id="timestamp">
    <t:label for="timestamp"/>
    <t:textfield t:id="timestamp" size="20"/>
  </t:block>

</div>

AppModule.java:

        public static void
contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
configuration)
    {
        configuration.add(Timestamp.class, "timestamp");
    }

    public static void
contributeBeanBlockSource(Configuration<BeanBlockContribution>
configuration)
        {
                configuration.add(new BeanBlockContribution("timestamp",
"AppPropertyEditBlocks", "timestamp", true));
        }

        
Howard Lewis Ship wrote:
> 
>       You'll need to supply your own data type and editor for Timestamp.   A
>       data type is a logial name for a Java type that is used to select an
>       editor Block and output Block, used by Grid, BeanDisplay,
>       BeanEditForm, etc.
> 
>       Tapestry is treating a Timestamp like a java.util.Date, because of
>       inheritance ... then finding it can't really do it (the coercion
>       exception).
> 
>       You should be able to build your own editor consisting of a DateField
>       plus a TextField (for the time portion) ... or building something more
>       complicated!
> 
>       


-- 
View this message in context: 
http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p15796880.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to