You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Gunnar Eketrapp <gu...@gmail.com> on 2010/12/17 15:22:31 UTC
and user types ...
Hi!
I just started to use the grid component and noticed that all fields that
have a type other then standrad java types gets silently ignored.
Can I add something to get them displayed or do I have create display
classes with simpler value types for each grid !?
Yea yea .... I am reading the grid doc but it's quite huge ... and it's
friday efternoon ... soon beer time ...
TIA, Gunnar Eketrapp
Re: and user types ...
Posted by Gunnar Eketrapp <gu...@gmail.com>.
Great and thanks for the info! Now it works without writing any
conduit classes ...
2011/1/10 Yohan Yudanara <yo...@gmail.com>:
> Oops.. sorry, Gunnar. Thiago is right. You don't need PropertyConduit.
> We need PropertyConduit if we add non-property column on Grid.
>
> So, you just need this on setupRender:
> void setupRender() {
> beanModel = beanModelSource.createEditModel(<your bean class>,
> messages);
> beanModel.add("<your user type property name>");
> }
>
> Best Regards,
> Yohan
>
> On 1/10/11, Thiago H. de Paula Figueiredo <th...@gmail.com> wrote:
>> On Mon, 10 Jan 2011 06:13:33 -0200, Gunnar Eketrapp
>> <gu...@gmail.com> wrote:
>>
>>> Thanks Yohan !
>>> I now got it to work with my Money type in the grid + sorting.
>>> I created a TransactionAmountPropertyConduit as you advised ...
>>> But it's less then ideal to have to write a
>>> <Entity><Field>PropertyConduit class every time you use an own defined
>>> type in a grid.
>>
>> You don't need to write your own PropertyConduit unless the value you want
>> to show or edit isn't a a property, as you have the PropertyConduitSource
>> to do that. It's exactly the same service that is used by BeanModelSource
>> to create the PropertyConduit's.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>> and instructor
>> Owner, Ars Machina Tecnologia da Informação Ltda.
>> http://www.arsmachina.com.br
>>
>> ---------------------------------------------------------------------
>> 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
>
>
--
[Hem: 08-715 59 57, Mobil: 0708-52 62 90]
Allévägen 2A, 132 42 Saltsjö-Boo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: and user types ...
Posted by Yohan Yudanara <yo...@gmail.com>.
Oops.. sorry, Gunnar. Thiago is right. You don't need PropertyConduit.
We need PropertyConduit if we add non-property column on Grid.
So, you just need this on setupRender:
void setupRender() {
beanModel = beanModelSource.createEditModel(<your bean class>,
messages);
beanModel.add("<your user type property name>");
}
Best Regards,
Yohan
On 1/10/11, Thiago H. de Paula Figueiredo <th...@gmail.com> wrote:
> On Mon, 10 Jan 2011 06:13:33 -0200, Gunnar Eketrapp
> <gu...@gmail.com> wrote:
>
>> Thanks Yohan !
>> I now got it to work with my Money type in the grid + sorting.
>> I created a TransactionAmountPropertyConduit as you advised ...
>> But it's less then ideal to have to write a
>> <Entity><Field>PropertyConduit class every time you use an own defined
>> type in a grid.
>
> You don't need to write your own PropertyConduit unless the value you want
> to show or edit isn't a a property, as you have the PropertyConduitSource
> to do that. It's exactly the same service that is used by BeanModelSource
> to create the PropertyConduit's.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> 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: and user types ...
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 10 Jan 2011 06:13:33 -0200, Gunnar Eketrapp
<gu...@gmail.com> wrote:
> Thanks Yohan !
> I now got it to work with my Money type in the grid + sorting.
> I created a TransactionAmountPropertyConduit as you advised ...
> But it's less then ideal to have to write a
> <Entity><Field>PropertyConduit class every time you use an own defined
> type in a grid.
You don't need to write your own PropertyConduit unless the value you want
to show or edit isn't a a property, as you have the PropertyConduitSource
to do that. It's exactly the same service that is used by BeanModelSource
to create the PropertyConduit's.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: and user types ...
Posted by Gunnar Eketrapp <gu...@gmail.com>.
Thanks Yohan !
I now got it to work with my Money type in the grid + sorting.
I created a TransactionAmountPropertyConduit as you advised ...
But it's less then ideal to have to write a
<Entity><Field>PropertyConduit class every time you use an own defined
type in a grid.
Have I missed something ...
Thanks anyhow !!!
Gunnar
2011/1/9 Yohan Yudanara <yo...@gmail.com>:
> If you want simpler solution, just add property with java type that
> can represent your user type in your bean class.
>
> On 1/9/11, Yohan Yudanara <yo...@gmail.com> wrote:
>> You can take a look at
>> http://tapestry.1045711.n5.nabble.com/Grid-sortable-additionnal-column-td2433091.html.
>>
>> On .tml file, you need to use beanModel attribute on the Grid component:
>> <t:grid t:source="transactionList" row="transaction"
>> t:model="beanModel" >
>>
>> On .java file, you need to add your "amount" property to the beanModel:
>> @Inject
>> private BeanModelSource beanModelSource;
>>
>> @Inject
>> private Messages messages;
>>
>> private BeanModel beanModel;
>>
>> public BeanModel getBeanModel() {
>> return beanModel;
>> }
>>
>> void setupRender() {
>> beanModel = beanModelSource.createEditModel(<your bean class>,
>> messages);
>> beanModel.add("<your user type property name>", <propertyConduit>);
>> }
>>
>> If your user type implements Comparable, then your property will be
>> displayed as sortable column.
>>
>> Best regards,
>> Yohan Yudanara
>>
>>
>> On 1/9/11, Gunnar Eketrapp <gu...@gmail.com> wrote:
>>> Hi Thiago and others ...
>>>
>>> I still haven't managed to display and sort user types in the grid. If
>>> I do the cell rendering on my own as in ...
>>>
>>> <p:amountCell>
>>> ${transaction.amount.format()}
>>> </p:amountCell>
>>>
>>> .. the sorting goes away ....
>>>
>>> I have added a MoneyTranslator but that one is only used by forms I
>>> guess.
>>>
>>> Your last advice was ...
>>>
>>>> You can also provide a view block for your own types:
>>>> http://tapestry.apache.org/beaneditform-guide.html, section Adding New
>>>> Property Editors. This option is better suited when you use the same
>>>> property types in many grids. If it's just one, a > cell override is
>>>> the
>>>> best option.
>>>
>>> ... which I have read but dont understand how to use. (To stupid I guess
>>> ...)
>>>
>>> Do you mean that I by adding a property editor for my Money class I
>>> will be able to display and sort my money type in grid's.
>>>
>>> Thanks in advance !!!
>>> Gunnar Eketrapp,
>>>
>>> 2010/12/17 Thiago H. de Paula Figueiredo <th...@gmail.com>:
>>>> On Fri, 17 Dec 2010 12:42:14 -0200, Stephan Windmüller
>>>> <st...@tu-dortmund.de> wrote:
>>>>
>>>>> You have to define the layout of the cell by yourself. Have a look at
>>>>>
>>>>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html
>>>>
>>>> You can also provide a view block for your own types:
>>>> http://tapestry.apache.org/beaneditform-guide.html, section Adding New
>>>> Property Editors. This option is better suited when you use the same
>>>> property types in many grids. If it's just one, a cell override is the
>>>> best
>>>> option.
>>>>
>>>> --
>>>> Thiago H. de Paula Figueiredo
>>>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>>>> and
>>>> instructor
>>>> Owner, Ars Machina Tecnologia da Informação Ltda.
>>>> http://www.arsmachina.com.br
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> [Hem: 08-715 59 57, Mobil: 0708-52 62 90]
>>> Allévägen 2A, 132 42 Saltsjö-Boo
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>
--
[Hem: 08-715 59 57, Mobil: 0708-52 62 90]
Allévägen 2A, 132 42 Saltsjö-Boo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: and user types ...
Posted by Yohan Yudanara <yo...@gmail.com>.
If you want simpler solution, just add property with java type that
can represent your user type in your bean class.
On 1/9/11, Yohan Yudanara <yo...@gmail.com> wrote:
> You can take a look at
> http://tapestry.1045711.n5.nabble.com/Grid-sortable-additionnal-column-td2433091.html.
>
> On .tml file, you need to use beanModel attribute on the Grid component:
> <t:grid t:source="transactionList" row="transaction"
> t:model="beanModel" >
>
> On .java file, you need to add your "amount" property to the beanModel:
> @Inject
> private BeanModelSource beanModelSource;
>
> @Inject
> private Messages messages;
>
> private BeanModel beanModel;
>
> public BeanModel getBeanModel() {
> return beanModel;
> }
>
> void setupRender() {
> beanModel = beanModelSource.createEditModel(<your bean class>,
> messages);
> beanModel.add("<your user type property name>", <propertyConduit>);
> }
>
> If your user type implements Comparable, then your property will be
> displayed as sortable column.
>
> Best regards,
> Yohan Yudanara
>
>
> On 1/9/11, Gunnar Eketrapp <gu...@gmail.com> wrote:
>> Hi Thiago and others ...
>>
>> I still haven't managed to display and sort user types in the grid. If
>> I do the cell rendering on my own as in ...
>>
>> <p:amountCell>
>> ${transaction.amount.format()}
>> </p:amountCell>
>>
>> .. the sorting goes away ....
>>
>> I have added a MoneyTranslator but that one is only used by forms I
>> guess.
>>
>> Your last advice was ...
>>
>>> You can also provide a view block for your own types:
>>> http://tapestry.apache.org/beaneditform-guide.html, section Adding New
>>> Property Editors. This option is better suited when you use the same
>>> property types in many grids. If it's just one, a > cell override is
>>> the
>>> best option.
>>
>> ... which I have read but dont understand how to use. (To stupid I guess
>> ...)
>>
>> Do you mean that I by adding a property editor for my Money class I
>> will be able to display and sort my money type in grid's.
>>
>> Thanks in advance !!!
>> Gunnar Eketrapp,
>>
>> 2010/12/17 Thiago H. de Paula Figueiredo <th...@gmail.com>:
>>> On Fri, 17 Dec 2010 12:42:14 -0200, Stephan Windmüller
>>> <st...@tu-dortmund.de> wrote:
>>>
>>>> You have to define the layout of the cell by yourself. Have a look at
>>>>
>>>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html
>>>
>>> You can also provide a view block for your own types:
>>> http://tapestry.apache.org/beaneditform-guide.html, section Adding New
>>> Property Editors. This option is better suited when you use the same
>>> property types in many grids. If it's just one, a cell override is the
>>> best
>>> option.
>>>
>>> --
>>> Thiago H. de Paula Figueiredo
>>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>>> and
>>> instructor
>>> Owner, Ars Machina Tecnologia da Informação Ltda.
>>> http://www.arsmachina.com.br
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> [Hem: 08-715 59 57, Mobil: 0708-52 62 90]
>> Allévägen 2A, 132 42 Saltsjö-Boo
>>
>> ---------------------------------------------------------------------
>> 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: and user types ...
Posted by Yohan Yudanara <yo...@gmail.com>.
You can take a look at
http://tapestry.1045711.n5.nabble.com/Grid-sortable-additionnal-column-td2433091.html.
On .tml file, you need to use beanModel attribute on the Grid component:
<t:grid t:source="transactionList" row="transaction"
t:model="beanModel" >
On .java file, you need to add your "amount" property to the beanModel:
@Inject
private BeanModelSource beanModelSource;
@Inject
private Messages messages;
private BeanModel beanModel;
public BeanModel getBeanModel() {
return beanModel;
}
void setupRender() {
beanModel = beanModelSource.createEditModel(<your bean class>,
messages);
beanModel.add("<your user type property name>", <propertyConduit>);
}
If your user type implements Comparable, then your property will be
displayed as sortable column.
Best regards,
Yohan Yudanara
On 1/9/11, Gunnar Eketrapp <gu...@gmail.com> wrote:
> Hi Thiago and others ...
>
> I still haven't managed to display and sort user types in the grid. If
> I do the cell rendering on my own as in ...
>
> <p:amountCell>
> ${transaction.amount.format()}
> </p:amountCell>
>
> .. the sorting goes away ....
>
> I have added a MoneyTranslator but that one is only used by forms I guess.
>
> Your last advice was ...
>
>> You can also provide a view block for your own types:
>> http://tapestry.apache.org/beaneditform-guide.html, section Adding New
>> Property Editors. This option is better suited when you use the same
>> property types in many grids. If it's just one, a > cell override is the
>> best option.
>
> ... which I have read but dont understand how to use. (To stupid I guess
> ...)
>
> Do you mean that I by adding a property editor for my Money class I
> will be able to display and sort my money type in grid's.
>
> Thanks in advance !!!
> Gunnar Eketrapp,
>
> 2010/12/17 Thiago H. de Paula Figueiredo <th...@gmail.com>:
>> On Fri, 17 Dec 2010 12:42:14 -0200, Stephan Windmüller
>> <st...@tu-dortmund.de> wrote:
>>
>>> You have to define the layout of the cell by yourself. Have a look at
>>>
>>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html
>>
>> You can also provide a view block for your own types:
>> http://tapestry.apache.org/beaneditform-guide.html, section Adding New
>> Property Editors. This option is better suited when you use the same
>> property types in many grids. If it's just one, a cell override is the
>> best
>> option.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>> and
>> instructor
>> Owner, Ars Machina Tecnologia da Informação Ltda.
>> http://www.arsmachina.com.br
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> [Hem: 08-715 59 57, Mobil: 0708-52 62 90]
> Allévägen 2A, 132 42 Saltsjö-Boo
>
> ---------------------------------------------------------------------
> 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: and user types ...
Posted by Gunnar Eketrapp <gu...@gmail.com>.
Hi Thiago and others ...
I still haven't managed to display and sort user types in the grid. If
I do the cell rendering on my own as in ...
<p:amountCell>
${transaction.amount.format()}
</p:amountCell>
.. the sorting goes away ....
I have added a MoneyTranslator but that one is only used by forms I guess.
Your last advice was ...
> You can also provide a view block for your own types: http://tapestry.apache.org/beaneditform-guide.html, section Adding New Property Editors. This option is better suited when you use the same property types in many grids. If it's just one, a > cell override is the best option.
... which I have read but dont understand how to use. (To stupid I guess ...)
Do you mean that I by adding a property editor for my Money class I
will be able to display and sort my money type in grid's.
Thanks in advance !!!
Gunnar Eketrapp,
2010/12/17 Thiago H. de Paula Figueiredo <th...@gmail.com>:
> On Fri, 17 Dec 2010 12:42:14 -0200, Stephan Windmüller
> <st...@tu-dortmund.de> wrote:
>
>> You have to define the layout of the cell by yourself. Have a look at
>>
>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html
>
> You can also provide a view block for your own types:
> http://tapestry.apache.org/beaneditform-guide.html, section Adding New
> Property Editors. This option is better suited when you use the same
> property types in many grids. If it's just one, a cell override is the best
> option.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
> instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
[Hem: 08-715 59 57, Mobil: 0708-52 62 90]
Allévägen 2A, 132 42 Saltsjö-Boo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: and user types ...
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 17 Dec 2010 12:42:14 -0200, Stephan Windmüller
<st...@tu-dortmund.de> wrote:
> You have to define the layout of the cell by yourself. Have a look at
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html
You can also provide a view block for your own types:
http://tapestry.apache.org/beaneditform-guide.html, section Adding New
Property Editors. This option is better suited when you use the same
property types in many grids. If it's just one, a cell override is the
best option.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: and user types ...
Posted by Stephan Windmüller <st...@tu-dortmund.de>.
On 17.12.2010 15:22, Gunnar Eketrapp wrote:
> I just started to use the grid component and noticed that all fields that
> have a type other then standrad java types gets silently ignored.
>
> Can I add something to get them displayed or do I have create display
> classes with simpler value types for each grid !?
You have to define the layout of the cell by yourself. Have a look at
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html
Scroll down to the example for "UserList.tml"
HTH
Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org