Quantcast

t5: BeanEditform and Timestamp

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

t5: BeanEditform and Timestamp

angelochen
Hi,

I use BeanEditForm with an entity that has Timestamp field, it has DateField dialog in the page, how to encode the time? and when click 'update', I got this error:

Failure writing parameter value of component core/PropertyEditBlocks:datefield: Could not find a coercion from type java.util.Date to type java.sql.Timestamp.

Any idea how to use Timestamp with BeanEditForm? Thanks.

A.C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

Howard Lewis Ship
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!

The DefaultDataTypeAnalayzer service configuration is how Tapestry
maps from property type to data type.

The BeanBlockSource service's configuration is how Tapestry maps from
data type to editor and display Block.

On Wed, Feb 27, 2008 at 10:50 PM, Angelo Chen
<[hidden email]> wrote:

>
>  Hi,
>
>  I use BeanEditForm with an entity that has Timestamp field, it has DateField
>  dialog in the page, how to encode the time? and when click 'update', I got
>  this error:
>
>  Failure writing parameter value of component
>  core/PropertyEditBlocks:datefield: Could not find a coercion from type
>  java.util.Date to type java.sql.Timestamp.
>
>  Any idea how to use Timestamp with BeanEditForm? Thanks.
>
>  A.C.
>  --
>  View this message in context: http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p15730716.html
>  Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [hidden email]
>  For additional commands, e-mail: [hidden email]
>
>



--
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

Marcus Veloso
Hi Angelo,

Maybe this help:

http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/beaneditform.html
"Adding New Property Editors"

Marcus
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

angelochen
In reply to this post by Howard Lewis Ship
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 org.bfe.Myrec@965af8: 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!

       
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

mister_bobby
I do exactly have the same problem (my data type name is  type ) :
Render queue error in BeginRender[Search:beaneditform.editor.propertyeditor]: Unable to locate a block to edit property 'type' (with data type 'type') of object fr.popol.mapper.model.Source@15d252d: Unable to resolve 'AppPropertyEditBlocks' to a known page name. Available page names: (blank), ExceptionReport, Index, PropertyDisplayBlocks, PropertyEditBlocks, Search, ServiceStatus.
What happens ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

Howard Lewis Ship
That looks like it can't find your AppPropertyEditBlocks class.
What's the full package name?  Have you verified that the .class file
is present where it should be?

On Tue, Jul 1, 2008 at 6:43 AM, mister_bobby
<[hidden email]> wrote:

>
> I do exactly have the same problem (my data type name is  type ) :
> Render queue error in
> BeginRender[Search:beaneditform.editor.propertyeditor]: Unable to locate a
> block to edit property 'type' (with data type 'type') of object
> fr.popol.mapper.model.Source@15d252d: Unable to resolve
> 'AppPropertyEditBlocks' to a known page name. Available page names: (blank),
> ExceptionReport, Index, PropertyDisplayBlocks, PropertyEditBlocks, Search,
> ServiceStatus.
> What happens ?
> --
> View this message in context: http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p18214383.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



--
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

bob_k

I'm running into the same problem regarding customizing BeanEditForm.

If someone was able to solve this problem could they post the solution?

Thanks.

-Bob

Howard Lewis Ship wrote
That looks like it can't find your AppPropertyEditBlocks class.
What's the full package name?  Have you verified that the .class file
is present where it should be?

On Tue, Jul 1, 2008 at 6:43 AM, mister_bobby
<clement.collin@digimind.com> wrote:
>
> I do exactly have the same problem (my data type name is  type ) :
> Render queue error in
> BeginRender[Search:beaneditform.editor.propertyeditor]: Unable to locate a
> block to edit property 'type' (with data type 'type') of object
> fr.popol.mapper.model.Source@15d252d: Unable to resolve
> 'AppPropertyEditBlocks' to a known page name. Available page names: (blank),
> ExceptionReport, Index, PropertyDisplayBlocks, PropertyEditBlocks, Search,
> ServiceStatus.
> What happens ?
> --
> View this message in context: http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p18214383.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
>
>



--
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

Robert Zeigler
As HLS said already, the exception is that it can't locate the page  
"AppPropertyEditBlocks".
What is the name of the page on which you are putting your  
BeanEditForm-customizing blocks?
What package is it in?

Robert


On Feb 12, 2009, at 2/123:32 PM , bob_k wrote:

>
>
> I'm running into the same problem regarding customizing BeanEditForm.
>
> If someone was able to solve this problem could they post the  
> solution?
>
> Thanks.
>
> -Bob
>
>
> Howard Lewis Ship wrote:
>>
>> That looks like it can't find your AppPropertyEditBlocks class.
>> What's the full package name?  Have you verified that the .class file
>> is present where it should be?
>>
>> On Tue, Jul 1, 2008 at 6:43 AM, mister_bobby
>> <[hidden email]> wrote:
>>>
>>> I do exactly have the same problem (my data type name is  type ) :
>>> Render queue error in
>>> BeginRender[Search:beaneditform.editor.propertyeditor]: Unable to  
>>> locate
>>> a
>>> block to edit property 'type' (with data type 'type') of object
>>> fr.popol.mapper.model.Source@15d252d: Unable to resolve
>>> 'AppPropertyEditBlocks' to a known page name. Available page names:
>>> (blank),
>>> ExceptionReport, Index, PropertyDisplayBlocks, PropertyEditBlocks,
>>> Search,
>>> ServiceStatus.
>>> What happens ?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p18214383.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator Apache Tapestry and Apache HiveMind
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p21985466.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

bob_k

The page I'm trying to use it with is called "Presentations".

It's located in com.eveo.speakertraining.tapestry.webapp.pages.admin

The AppPropertyEditBlocks.java and AppPropertyEditBlocks.tml files are located in com.eveo.speakertraining.tapestry.webapp.components

Should these files not be in the "components" folder?

Robert Zeigler wrote
As HLS said already, the exception is that it can't locate the page  
"AppPropertyEditBlocks".
What is the name of the page on which you are putting your  
BeanEditForm-customizing blocks?
What package is it in?

Robert


On Feb 12, 2009, at 2/123:32 PM , bob_k wrote:

>
>
> I'm running into the same problem regarding customizing BeanEditForm.
>
> If someone was able to solve this problem could they post the  
> solution?
>
> Thanks.
>
> -Bob
>
>
> Howard Lewis Ship wrote:
>>
>> That looks like it can't find your AppPropertyEditBlocks class.
>> What's the full package name?  Have you verified that the .class file
>> is present where it should be?
>>
>> On Tue, Jul 1, 2008 at 6:43 AM, mister_bobby
>> <clement.collin@digimind.com> wrote:
>>>
>>> I do exactly have the same problem (my data type name is  type ) :
>>> Render queue error in
>>> BeginRender[Search:beaneditform.editor.propertyeditor]: Unable to  
>>> locate
>>> a
>>> block to edit property 'type' (with data type 'type') of object
>>> fr.popol.mapper.model.Source@15d252d: Unable to resolve
>>> 'AppPropertyEditBlocks' to a known page name. Available page names:
>>> (blank),
>>> ExceptionReport, Index, PropertyDisplayBlocks, PropertyEditBlocks,
>>> Search,
>>> ServiceStatus.
>>> What happens ?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p18214383.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
>>>
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator Apache Tapestry and Apache HiveMind
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p21985466.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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

Robert Zeigler
They should be in the "pages" folder; they are pages that act as  
"holders" for components.

Robert

On Feb 12, 2009, at 2/123:59 PM , bob_k wrote:

>
>
> The page I'm trying to use it with is called "Presentations".
>
> It's located in com.eveo.speakertraining.tapestry.webapp.pages.admin
>
> The AppPropertyEditBlocks.java and AppPropertyEditBlocks.tml files are
> located in com.eveo.speakertraining.tapestry.webapp.components
>
> Should these files not be in the "components" folder?
>
>
> Robert Zeigler wrote:
>>
>> As HLS said already, the exception is that it can't locate the page
>> "AppPropertyEditBlocks".
>> What is the name of the page on which you are putting your
>> BeanEditForm-customizing blocks?
>> What package is it in?
>>
>> Robert
>>
>>
>> On Feb 12, 2009, at 2/123:32 PM , bob_k wrote:
>>
>>>
>>>
>>> I'm running into the same problem regarding customizing  
>>> BeanEditForm.
>>>
>>> If someone was able to solve this problem could they post the
>>> solution?
>>>
>>> Thanks.
>>>
>>> -Bob
>>>
>>>
>>> Howard Lewis Ship wrote:
>>>>
>>>> That looks like it can't find your AppPropertyEditBlocks class.
>>>> What's the full package name?  Have you verified that the .class  
>>>> file
>>>> is present where it should be?
>>>>
>>>> On Tue, Jul 1, 2008 at 6:43 AM, mister_bobby
>>>> <[hidden email]> wrote:
>>>>>
>>>>> I do exactly have the same problem (my data type name is  type ) :
>>>>> Render queue error in
>>>>> BeginRender[Search:beaneditform.editor.propertyeditor]: Unable to
>>>>> locate
>>>>> a
>>>>> block to edit property 'type' (with data type 'type') of object
>>>>> fr.popol.mapper.model.Source@15d252d: Unable to resolve
>>>>> 'AppPropertyEditBlocks' to a known page name. Available page  
>>>>> names:
>>>>> (blank),
>>>>> ExceptionReport, Index, PropertyDisplayBlocks, PropertyEditBlocks,
>>>>> Search,
>>>>> ServiceStatus.
>>>>> What happens ?
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p18214383.html
>>>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Howard M. Lewis Ship
>>>>
>>>> Creator Apache Tapestry and Apache HiveMind
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p21985466.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p21985855.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

bob_k
Thanks for your help so far.

After placing the files in the "pages" folder I came across an exception:

Parameter 'translate' of component AppPropertyEditBlocks:duration is bound to null. This
parameter is not allowed to be null. [at context:AppPropertyEditBlocks.tml, line 5, column 57]


public class AppPropertyEditBlocks
{
        @Property
    @Environmental
    private PropertyEditContext context;
 
    @Component(parameters =
    { "value=context.propertyValue", "label=prop:context.label",
            "translate=prop:durationTranslator", "validate=prop:durationValidator",
            "clientId=prop:context.propertyId", "annotationProvider=context" })
    private TextField duration;
   
    @Inject
    private ComponentResources resources;

    public FieldValidator getDurationValidator()
    {
      return context.getValidator(duration);
    }
   
    public FieldTranslator getDurationTranslator()
    {
      return context.getTranslator(duration);
    }

}

The corresponding TML file:

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

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

</div>

The AppModule.java file:

           public static void contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String> configuration)
           {
                   configuration.add(java.sql.Time.class, "duration");
           }
           
           public static void contributeBeanBlockSource(Configuration<BeanBlockContribution> configuration)
           {
                   configuration.add(new BeanBlockContribution("duration", "AppPropertyEditBlocks", "duration", true));
           }

Robert Zeigler wrote
They should be in the "pages" folder; they are pages that act as  
"holders" for components.

Robert

On Feb 12, 2009, at 2/123:59 PM , bob_k wrote:

>
>
> The page I'm trying to use it with is called "Presentations".
>
> It's located in com.eveo.speakertraining.tapestry.webapp.pages.admin
>
> The AppPropertyEditBlocks.java and AppPropertyEditBlocks.tml files are
> located in com.eveo.speakertraining.tapestry.webapp.components
>
> Should these files not be in the "components" folder?
>
>
> Robert Zeigler wrote:
>>
>> As HLS said already, the exception is that it can't locate the page
>> "AppPropertyEditBlocks".
>> What is the name of the page on which you are putting your
>> BeanEditForm-customizing blocks?
>> What package is it in?
>>
>> Robert
>>
>>
>> On Feb 12, 2009, at 2/123:32 PM , bob_k wrote:
>>
>>>
>>>
>>> I'm running into the same problem regarding customizing  
>>> BeanEditForm.
>>>
>>> If someone was able to solve this problem could they post the
>>> solution?
>>>
>>> Thanks.
>>>
>>> -Bob
>>>
>>>
>>> Howard Lewis Ship wrote:
>>>>
>>>> That looks like it can't find your AppPropertyEditBlocks class.
>>>> What's the full package name?  Have you verified that the .class  
>>>> file
>>>> is present where it should be?
>>>>
>>>> On Tue, Jul 1, 2008 at 6:43 AM, mister_bobby
>>>> <clement.collin@digimind.com> wrote:
>>>>>
>>>>> I do exactly have the same problem (my data type name is  type ) :
>>>>> Render queue error in
>>>>> BeginRender[Search:beaneditform.editor.propertyeditor]: Unable to
>>>>> locate
>>>>> a
>>>>> block to edit property 'type' (with data type 'type') of object
>>>>> fr.popol.mapper.model.Source@15d252d: Unable to resolve
>>>>> 'AppPropertyEditBlocks' to a known page name. Available page  
>>>>> names:
>>>>> (blank),
>>>>> ExceptionReport, Index, PropertyDisplayBlocks, PropertyEditBlocks,
>>>>> Search,
>>>>> ServiceStatus.
>>>>> What happens ?
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p18214383.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
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Howard M. Lewis Ship
>>>>
>>>> Creator Apache Tapestry and Apache HiveMind
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p21985466.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
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p21985855.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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: t5: BeanEditform and Timestamp

Robert Zeigler
context.getTranslator will look up the "default" translator for the  
field, based on the bound type.
Ultimately, the FieldTranslatorSource service derives its translators  
from the TranslatorSource service; tapestry does not provide out-of-
the-box support for Date or Time translators. If your application will  
use the same format anywhere that you're using a Timestamp, then you  
should be able to just contribute a translator to the TranslatorSource  
service for Timestamp.  If not, then you'll need to return a custom  
FieldTranslator implementation from getDurationTranslator, rather than  
relying on context.getTranslator.


Robert

On Feb 12, 2009, at 2/124:46 PM , bob_k wrote:

>
> Thanks for your help so far.
>
> After placing the files in the "pages" folder I came across an  
> exception:
>
> Parameter 'translate' of component AppPropertyEditBlocks:duration is  
> bound
> to null. This
> parameter is not allowed to be null. [at  
> context:AppPropertyEditBlocks.tml,
> line 5, column 57]
>
>
> public class AppPropertyEditBlocks
> {
> @Property
>    @Environmental
>    private PropertyEditContext context;
>
>    @Component(parameters =
>    { "value=context.propertyValue", "label=prop:context.label",
>            "translate=prop:durationTranslator",
> "validate=prop:durationValidator",
>            "clientId=prop:context.propertyId",  
> "annotationProvider=context"
> })
>    private TextField duration;
>
>    @Inject
>    private ComponentResources resources;
>
>    public FieldValidator getDurationValidator()
>    {
>      return context.getValidator(duration);
>    }
>
>    public FieldTranslator getDurationTranslator()
>    {
>      return context.getTranslator(duration);
>    }
>
> }
>
> The corresponding TML file:
>
> <div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>
> <t:block id="duration">
>     <t:label for="duration"/>
>     <t:textfield t:id="duration" t:value="" size="20"/>
>   </t:block>
>
> </div>
>
> The AppModule.java file:
>
>   public static void
> contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
> configuration)
>   {
>   configuration.add(java.sql.Time.class, "duration");
>   }
>
>   public static void
> contributeBeanBlockSource(Configuration<BeanBlockContribution>
> configuration)
>   {
>   configuration.add(new BeanBlockContribution("duration",
> "AppPropertyEditBlocks", "duration", true));
>   }
>
>
> Robert Zeigler wrote:
>>
>> They should be in the "pages" folder; they are pages that act as
>> "holders" for components.
>>
>> Robert
>>
>> On Feb 12, 2009, at 2/123:59 PM , bob_k wrote:
>>
>>>
>>>
>>> The page I'm trying to use it with is called "Presentations".
>>>
>>> It's located in com.eveo.speakertraining.tapestry.webapp.pages.admin
>>>
>>> The AppPropertyEditBlocks.java and AppPropertyEditBlocks.tml files  
>>> are
>>> located in com.eveo.speakertraining.tapestry.webapp.components
>>>
>>> Should these files not be in the "components" folder?
>>>
>>>
>>> Robert Zeigler wrote:
>>>>
>>>> As HLS said already, the exception is that it can't locate the page
>>>> "AppPropertyEditBlocks".
>>>> What is the name of the page on which you are putting your
>>>> BeanEditForm-customizing blocks?
>>>> What package is it in?
>>>>
>>>> Robert
>>>>
>>>>
>>>> On Feb 12, 2009, at 2/123:32 PM , bob_k wrote:
>>>>
>>>>>
>>>>>
>>>>> I'm running into the same problem regarding customizing
>>>>> BeanEditForm.
>>>>>
>>>>> If someone was able to solve this problem could they post the
>>>>> solution?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> -Bob
>>>>>
>>>>>
>>>>> Howard Lewis Ship wrote:
>>>>>>
>>>>>> That looks like it can't find your AppPropertyEditBlocks class.
>>>>>> What's the full package name?  Have you verified that the .class
>>>>>> file
>>>>>> is present where it should be?
>>>>>>
>>>>>> On Tue, Jul 1, 2008 at 6:43 AM, mister_bobby
>>>>>> <[hidden email]> wrote:
>>>>>>>
>>>>>>> I do exactly have the same problem (my data type name is  
>>>>>>> type ) :
>>>>>>> Render queue error in
>>>>>>> BeginRender[Search:beaneditform.editor.propertyeditor]: Unable  
>>>>>>> to
>>>>>>> locate
>>>>>>> a
>>>>>>> block to edit property 'type' (with data type 'type') of object
>>>>>>> fr.popol.mapper.model.Source@15d252d: Unable to resolve
>>>>>>> 'AppPropertyEditBlocks' to a known page name. Available page
>>>>>>> names:
>>>>>>> (blank),
>>>>>>> ExceptionReport, Index, PropertyDisplayBlocks,  
>>>>>>> PropertyEditBlocks,
>>>>>>> Search,
>>>>>>> ServiceStatus.
>>>>>>> What happens ?
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p18214383.html
>>>>>>> Sent from the Tapestry - User mailing list archive at  
>>>>>>> Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Howard M. Lewis Ship
>>>>>>
>>>>>> Creator Apache Tapestry and Apache HiveMind
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: [hidden email]
>>>>>> For additional commands, e-mail: [hidden email]
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p21985466.html
>>>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [hidden email]
>>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p21985855.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/t5%3A-BeanEditform-and-Timestamp-tp15730716p21986665.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...