You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tim de jager <de...@gmail.com> on 2008/06/09 16:07:16 UTC

T5 Questions

Hi,

I have a few questions regarding some issues i've been having working with
the T5 framework.

I used the maven archteype supplied in the new Tapestry 5: Building Web
Applications book to build the skeleton project. And i believe the archetype
doesn't specify which tapestry framework version to download but downloads
the most recent?

Issues:
1. Not having an @Property anntotation at least it can't be imported.
2. t:label inside an input not generating exceptions but not being displayed
either.
Has anybody else encountered these issues or does anyone have a solution

Also is their a way to use add a input to a beanedit form that doesn't
directly map to the underlying bean, I'm asking this because the bean is a
hiberante entity and has a many to one relation with User. And im wondering
if i can store the text value in the page class and look up the appropriate
user before saving the entity.

Thanks,

Tim de Jager
-- 
View this message in context: http://www.nabble.com/T5-Questions-tp17733559p17733559.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


Re: T5 Questions

Posted by Robert Zeigler <ro...@scazdl.org>.
Yes, that's correct for the custom editor.
Have a look, for example, at:
http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html
Under the section "Adding new property editors".
If you need a "display", you can similarly add a contribution to  
BeanBlockSource for your data-type, but the last parameter of the  
BeanBlockContribution constructor would be false.

For "real" examples of this, see, for instance:

For contributions to BeanBlockSource:
http://code.google.com/p/tapestry5-cayenne/source/browse/trunk/tapestry5-cayenne-core/src/main/java/com/googlecode/tapestry5cayenne/services/TapestryCayenneCoreModule.java

For the editor component:
http://code.google.com/p/tapestry5-cayenne/source/browse/trunk/tapestry5-cayenne-core/src/main/java/com/googlecode/tapestry5cayenne/components/ToOneEditor.java

For the setup of the appropriate editor/viewer blocks:
http://code.google.com/p/tapestry5-cayenne/source/browse/trunk/tapestry5-cayenne-core/src/main/java/com/googlecode/tapestry5cayenne/pages/CayenneEditBlockContributions.java

and

http://code.google.com/p/tapestry5-cayenne/source/browse/trunk/tapestry5-cayenne-core/src/main/java/com/googlecode/tapestry5cayenne/pages/CayenneViewBlockContributions.java

HTH,

Robert

On Jun 10, 2008, at 6/102:27 PM , Tim de jager wrote:

>
> Thanks a lot for the prompt response!
>
> Regarding the customer editor, do you have a link which has an  
> explanation
> or example?
> Is it like extending the BeanEditForm so it correctly displays an  
> input
> field for the (in my case User entity)
> object of the underlying bean?
>
> Thanks,
>
> Tim
>
>
> Robert Zeigler wrote:
>>
>> Hi Tim,
>>
>> 1) The framework version corresponds to the quickstart archetype
>> version.  So if you use the quickstart archetype version 5.0.6, you
>> get the framework version 5.0.6.  You can always check to see what
>> version of tapestry you're using.  Edit your pom.xml, and look for  
>> the
>> definition of the property: tapestry-release-version.
>>
>> For your issues:
>> 1) @Property was added recently (5.0.11); I suspect you're using an
>> older version of T5.
>> 2) There are two pieces to a label.  The t:label property of an input
>> is used for validation messages (eg: You must supply a value for X,
>> where X is the t:label value, with sensible defaults).  If you want  
>> an
>> html label, you need to use the Label component:
>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Label.html
>>
>> Regarding the bean edit form: there are a variety of ways of dealing
>> with this.
>> a) One way would be to have your entity class use a pseudo-property
>> that is the text value.  Then you just need to specify the "real"
>> property in the "exclude" parameter of BeanEditForm (or even add
>> @NonVisual to the "real" property, so that it's never included).
>>
>> b) Alternatively (and more powerfully) you can add an editor for the
>> User property type.  If you're using T5 & hibernate, make sure to
>> check out the tapestry-hibernate integration module, which will auto-
>> add ValueEncoders for all of your hibernate entities, so you don't
>> have to think about converting User->String->User; it will happen
>> automagically.
>>
>> c) or a brute-force approach, you could probably do something along
>> the lines of specifying a property in "includes", and then including
>> the appropriate editor block as a t:parameter, and then writing the
>> editor directly into the page.
>>
>> B is going to be your best option, long term.
>>
>> Cheers,
>>
>> Robert
>>
>> On Jun 9, 2008, at 6/99:07 AM , Tim de jager wrote:
>>
>>>
>>> Hi,
>>>
>>> I have a few questions regarding some issues i've been having
>>> working with
>>> the T5 framework.
>>>
>>> I used the maven archteype supplied in the new Tapestry 5: Building
>>> Web
>>> Applications book to build the skeleton project. And i believe the
>>> archetype
>>> doesn't specify which tapestry framework version to download but
>>> downloads
>>> the most recent?
>>>
>>> Issues:
>>> 1. Not having an @Property anntotation at least it can't be  
>>> imported.
>>> 2. t:label inside an input not generating exceptions but not being
>>> displayed
>>> either.
>>> Has anybody else encountered these issues or does anyone have a
>>> solution
>>>
>>> Also is their a way to use add a input to a beanedit form that  
>>> doesn't
>>> directly map to the underlying bean, I'm asking this because the
>>> bean is a
>>> hiberante entity and has a many to one relation with User. And im
>>> wondering
>>> if i can store the text value in the page class and look up the
>>> appropriate
>>> user before saving the entity.
>>>
>>> Thanks,
>>>
>>> Tim de Jager
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/T5-Questions-tp17733559p17733559.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-Questions-tp17733559p17762864.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


Re: T5 Questions

Posted by Tim de jager <de...@gmail.com>.
Thanks a lot for the prompt response!

Regarding the customer editor, do you have a link which has an explanation
or example?
Is it like extending the BeanEditForm so it correctly displays an input
field for the (in my case User entity)
object of the underlying bean?

Thanks,

Tim 


Robert Zeigler wrote:
> 
> Hi Tim,
> 
> 1) The framework version corresponds to the quickstart archetype  
> version.  So if you use the quickstart archetype version 5.0.6, you  
> get the framework version 5.0.6.  You can always check to see what  
> version of tapestry you're using.  Edit your pom.xml, and look for the  
> definition of the property: tapestry-release-version.
> 
> For your issues:
> 1) @Property was added recently (5.0.11); I suspect you're using an  
> older version of T5.
> 2) There are two pieces to a label.  The t:label property of an input  
> is used for validation messages (eg: You must supply a value for X,  
> where X is the t:label value, with sensible defaults).  If you want an  
> html label, you need to use the Label component:
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Label.html
> 
> Regarding the bean edit form: there are a variety of ways of dealing  
> with this.
> a) One way would be to have your entity class use a pseudo-property  
> that is the text value.  Then you just need to specify the "real"  
> property in the "exclude" parameter of BeanEditForm (or even add  
> @NonVisual to the "real" property, so that it's never included).
> 
> b) Alternatively (and more powerfully) you can add an editor for the  
> User property type.  If you're using T5 & hibernate, make sure to  
> check out the tapestry-hibernate integration module, which will auto- 
> add ValueEncoders for all of your hibernate entities, so you don't  
> have to think about converting User->String->User; it will happen  
> automagically.
> 
> c) or a brute-force approach, you could probably do something along  
> the lines of specifying a property in "includes", and then including  
> the appropriate editor block as a t:parameter, and then writing the  
> editor directly into the page.
> 
> B is going to be your best option, long term.
> 
> Cheers,
> 
> Robert
> 
> On Jun 9, 2008, at 6/99:07 AM , Tim de jager wrote:
> 
>>
>> Hi,
>>
>> I have a few questions regarding some issues i've been having  
>> working with
>> the T5 framework.
>>
>> I used the maven archteype supplied in the new Tapestry 5: Building  
>> Web
>> Applications book to build the skeleton project. And i believe the  
>> archetype
>> doesn't specify which tapestry framework version to download but  
>> downloads
>> the most recent?
>>
>> Issues:
>> 1. Not having an @Property anntotation at least it can't be imported.
>> 2. t:label inside an input not generating exceptions but not being  
>> displayed
>> either.
>> Has anybody else encountered these issues or does anyone have a  
>> solution
>>
>> Also is their a way to use add a input to a beanedit form that doesn't
>> directly map to the underlying bean, I'm asking this because the  
>> bean is a
>> hiberante entity and has a many to one relation with User. And im  
>> wondering
>> if i can store the text value in the page class and look up the  
>> appropriate
>> user before saving the entity.
>>
>> Thanks,
>>
>> Tim de Jager
>> -- 
>> View this message in context:
>> http://www.nabble.com/T5-Questions-tp17733559p17733559.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-Questions-tp17733559p17762864.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


Re: T5 Questions

Posted by Robert Zeigler <ro...@scazdl.org>.
Hi Tim,

1) The framework version corresponds to the quickstart archetype  
version.  So if you use the quickstart archetype version 5.0.6, you  
get the framework version 5.0.6.  You can always check to see what  
version of tapestry you're using.  Edit your pom.xml, and look for the  
definition of the property: tapestry-release-version.

For your issues:
1) @Property was added recently (5.0.11); I suspect you're using an  
older version of T5.
2) There are two pieces to a label.  The t:label property of an input  
is used for validation messages (eg: You must supply a value for X,  
where X is the t:label value, with sensible defaults).  If you want an  
html label, you need to use the Label component:
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Label.html

Regarding the bean edit form: there are a variety of ways of dealing  
with this.
a) One way would be to have your entity class use a pseudo-property  
that is the text value.  Then you just need to specify the "real"  
property in the "exclude" parameter of BeanEditForm (or even add  
@NonVisual to the "real" property, so that it's never included).

b) Alternatively (and more powerfully) you can add an editor for the  
User property type.  If you're using T5 & hibernate, make sure to  
check out the tapestry-hibernate integration module, which will auto- 
add ValueEncoders for all of your hibernate entities, so you don't  
have to think about converting User->String->User; it will happen  
automagically.

c) or a brute-force approach, you could probably do something along  
the lines of specifying a property in "includes", and then including  
the appropriate editor block as a t:parameter, and then writing the  
editor directly into the page.

B is going to be your best option, long term.

Cheers,

Robert

On Jun 9, 2008, at 6/99:07 AM , Tim de jager wrote:

>
> Hi,
>
> I have a few questions regarding some issues i've been having  
> working with
> the T5 framework.
>
> I used the maven archteype supplied in the new Tapestry 5: Building  
> Web
> Applications book to build the skeleton project. And i believe the  
> archetype
> doesn't specify which tapestry framework version to download but  
> downloads
> the most recent?
>
> Issues:
> 1. Not having an @Property anntotation at least it can't be imported.
> 2. t:label inside an input not generating exceptions but not being  
> displayed
> either.
> Has anybody else encountered these issues or does anyone have a  
> solution
>
> Also is their a way to use add a input to a beanedit form that doesn't
> directly map to the underlying bean, I'm asking this because the  
> bean is a
> hiberante entity and has a many to one relation with User. And im  
> wondering
> if i can store the text value in the page class and look up the  
> appropriate
> user before saving the entity.
>
> Thanks,
>
> Tim de Jager
> -- 
> View this message in context: http://www.nabble.com/T5-Questions-tp17733559p17733559.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