You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by CarstenM <Ca...@1822-s-inform.de> on 2007/11/09 09:39:10 UTC
T5.0.6 - GirdModelProvider for GridRows - example?
Hello,
still trying to use the GridRows component.
Can someone give an example for a GridModelProvider or the GridRows
component?
Well, the Grid is an implementation of GridModelProvider but I would like to
customize my rows.
Thanks,
Carsten
(Thread relates to T5.0.6 - How to use GridRows)
--
View this message in context: http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13663230
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.0.6 - GirdModelProvider for GridRows - example?
Posted by Ezra Epstein <ez...@yahoo.com>.
Maybe you've got a different Model class. The add() method with a null conduit works fine.
That said, I didn't realize you were inside a form. Howard as mentioned that this is an area that needs work.
CarstenM <Ca...@1822-s-inform.de> wrote:
Hi,
the line
model.add("action", null );
caused the NullPointer.
I am not sure if your suggestion is what I ma looking for.
I am looking for a grid inside a form. A grid row (GridRow component?)
should contain
a textfield and a checkbox for example.
Cheers.
Vashon-Ez wrote:
>
> Maybe you could show more of your .tml (and .java) file(s). I'm new to
> Tap5 and all I've discovered so far in the realm of models is how to
> supply a one to a BeanEditor and to a Grid. I've never gone to the level
> of t:gridcell and from what I've learned one generally does not need to --
> you can configure a lot at the t:grid level and via nested t:parameter
> elements.
>
> Ezra
>
> CarstenM wrote:
> Hi,
>
> ok, I tried this but I get a NullPointerException (line 4 of .tml).
>
> 1
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> 2
> volatile="inherit:volatile">
> 3
> 4
> overrides="componentResources.containerResources"/>
> 5
> 6
> 7
>
> #
> org.apache.tapestry.corelib.base.AbstractPropertyOutput.readPropertyForObject(AbstractPropertyOutput.java:134)
> #
> org.apache.tapestry.corelib.base.AbstractPropertyOutput.renderPropertyValue(AbstractPropertyOutput.java:117)
> #
> org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java:28)
> #
> org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java)
>
> Do I forget something?
>
> Thanks.
>
>
> Vashon-Ez wrote:
>>
>> It's a two step process.
>>
>> 1. Define a model in your Java class. It's easy to just use the
>> standard
>> definition and extend it like so:
>>
>> @Inject
>> private BeanModelSource _beanModelSource;
>>
>> @Inject
>> private ComponentResources _resources;
>>
>> @Retain
>> private BeanModel _model;
>>
>> void pageLoaded() {
>> _model = _beanModelSource.create(VideoClip.class, true,
>> _resources);
>>
>> _model.remove("id");
>>
>> _model.add("action", null);
>> }
>>
>> public BeanModel getModel() {
>> return _model;
>> }
>>
>> Note the _model.add("action", null); that sets a null conduit meaning
>> the
>> grid will not try to pull values for that column from the underlying
>> bean.
>> In other words, its a utility column where you can put whatever you like.
>> Note the name of the model is just model as its accessed via the
>> getModel() method.
>>
>> 2. Add a model="name-of-your-model-in-your-Java-class" to your grid in
>> your .tml file. In this case it is model="model" e.g.:
>>
>>
>> rowsPerPage="5" pagerPosition="both">
>>
>>
>> context="video.id">${video.title}
>>
>>
>>
>> context="video.id">Edit
>>
>>
>>
>> I've added a bunch of other stuff, but you should get the idea.
>>
>> HTH
>>
>> CarstenM wrote:
>> Hi again,
>>
>> no example for this or what's wrong?
>>
>> Cheers
>> Carsten
>>
>>
>>
>> CarstenM wrote:
>>>
>>> Hello,
>>>
>>> still trying to use the GridRows component.
>>> Can someone give an example for a GridModelProvider or the GridRows
>>> component?
>>> Well, the Grid is an implementation of GridModelProvider but I would
>>> like
>>> to
>>> customize my rows.
>>>
>>> Thanks,
>>> Carsten
>>>
>>>
>>> (Thread relates to T5.0.6 - How to use GridRows)
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
>> 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
>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13729112
> 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
>
>
>
>
--
View this message in context: http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13743083
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.0.6 - GirdModelProvider for GridRows - example?
Posted by CarstenM <Ca...@1822-s-inform.de>.
Hi,
the line
model.add("action", null );
caused the NullPointer.
I am not sure if your suggestion is what I ma looking for.
I am looking for a grid inside a form. A grid row (GridRow component?)
should contain
a textfield and a checkbox for example.
Cheers.
Vashon-Ez wrote:
>
> Maybe you could show more of your .tml (and .java) file(s). I'm new to
> Tap5 and all I've discovered so far in the realm of models is how to
> supply a one to a BeanEditor and to a Grid. I've never gone to the level
> of t:gridcell and from what I've learned one generally does not need to --
> you can configure a lot at the t:grid level and via nested t:parameter
> elements.
>
> Ezra
>
> CarstenM <Ca...@1822-s-inform.de> wrote:
> Hi,
>
> ok, I tried this but I get a NullPointerException (line 4 of .tml).
>
> 1
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> 2
> volatile="inherit:volatile">
> 3
> 4
> overrides="componentResources.containerResources"/>
> 5
> 6
> 7
>
> #
> org.apache.tapestry.corelib.base.AbstractPropertyOutput.readPropertyForObject(AbstractPropertyOutput.java:134)
> #
> org.apache.tapestry.corelib.base.AbstractPropertyOutput.renderPropertyValue(AbstractPropertyOutput.java:117)
> #
> org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java:28)
> #
> org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java)
>
> Do I forget something?
>
> Thanks.
>
>
> Vashon-Ez wrote:
>>
>> It's a two step process.
>>
>> 1. Define a model in your Java class. It's easy to just use the
>> standard
>> definition and extend it like so:
>>
>> @Inject
>> private BeanModelSource _beanModelSource;
>>
>> @Inject
>> private ComponentResources _resources;
>>
>> @Retain
>> private BeanModel _model;
>>
>> void pageLoaded() {
>> _model = _beanModelSource.create(VideoClip.class, true,
>> _resources);
>>
>> _model.remove("id");
>>
>> _model.add("action", null);
>> }
>>
>> public BeanModel getModel() {
>> return _model;
>> }
>>
>> Note the _model.add("action", null); that sets a null conduit meaning
>> the
>> grid will not try to pull values for that column from the underlying
>> bean.
>> In other words, its a utility column where you can put whatever you like.
>> Note the name of the model is just model as its accessed via the
>> getModel() method.
>>
>> 2. Add a model="name-of-your-model-in-your-Java-class" to your grid in
>> your .tml file. In this case it is model="model" e.g.:
>>
>>
>> rowsPerPage="5" pagerPosition="both">
>>
>>
>> context="video.id">${video.title}
>>
>>
>>
>> context="video.id">Edit
>>
>>
>>
>> I've added a bunch of other stuff, but you should get the idea.
>>
>> HTH
>>
>> CarstenM wrote:
>> Hi again,
>>
>> no example for this or what's wrong?
>>
>> Cheers
>> Carsten
>>
>>
>>
>> CarstenM wrote:
>>>
>>> Hello,
>>>
>>> still trying to use the GridRows component.
>>> Can someone give an example for a GridModelProvider or the GridRows
>>> component?
>>> Well, the Grid is an implementation of GridModelProvider but I would
>>> like
>>> to
>>> customize my rows.
>>>
>>> Thanks,
>>> Carsten
>>>
>>>
>>> (Thread relates to T5.0.6 - How to use GridRows)
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
>> 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
>>
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13729112
> 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
>
>
>
>
--
View this message in context: http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13743083
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.0.6 - GirdModelProvider for GridRows - example?
Posted by Ezra Epstein <ez...@yahoo.com>.
Maybe you could show more of your .tml (and .java) file(s). I'm new to Tap5 and all I've discovered so far in the realm of models is how to supply a one to a BeanEditor and to a Grid. I've never gone to the level of t:gridcell and from what I've learned one generally does not need to -- you can configure a lot at the t:grid level and via nested t:parameter elements.
Ezra
CarstenM <Ca...@1822-s-inform.de> wrote:
Hi,
ok, I tried this but I get a NullPointerException (line 4 of .tml).
1
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
2
volatile="inherit:volatile">
3
4
overrides="componentResources.containerResources"/>
5
6
7
#
org.apache.tapestry.corelib.base.AbstractPropertyOutput.readPropertyForObject(AbstractPropertyOutput.java:134)
#
org.apache.tapestry.corelib.base.AbstractPropertyOutput.renderPropertyValue(AbstractPropertyOutput.java:117)
#
org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java:28)
# org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java)
Do I forget something?
Thanks.
Vashon-Ez wrote:
>
> It's a two step process.
>
> 1. Define a model in your Java class. It's easy to just use the standard
> definition and extend it like so:
>
> @Inject
> private BeanModelSource _beanModelSource;
>
> @Inject
> private ComponentResources _resources;
>
> @Retain
> private BeanModel _model;
>
> void pageLoaded() {
> _model = _beanModelSource.create(VideoClip.class, true,
> _resources);
>
> _model.remove("id");
>
> _model.add("action", null);
> }
>
> public BeanModel getModel() {
> return _model;
> }
>
> Note the _model.add("action", null); that sets a null conduit meaning the
> grid will not try to pull values for that column from the underlying bean.
> In other words, its a utility column where you can put whatever you like.
> Note the name of the model is just model as its accessed via the
> getModel() method.
>
> 2. Add a model="name-of-your-model-in-your-Java-class" to your grid in
> your .tml file. In this case it is model="model" e.g.:
>
>
> rowsPerPage="5" pagerPosition="both">
>
>
> context="video.id">${video.title}
>
>
>
> context="video.id">Edit
>
>
>
> I've added a bunch of other stuff, but you should get the idea.
>
> HTH
>
> CarstenM wrote:
> Hi again,
>
> no example for this or what's wrong?
>
> Cheers
> Carsten
>
>
>
> CarstenM wrote:
>>
>> Hello,
>>
>> still trying to use the GridRows component.
>> Can someone give an example for a GridModelProvider or the GridRows
>> component?
>> Well, the Grid is an implementation of GridModelProvider but I would like
>> to
>> customize my rows.
>>
>> Thanks,
>> Carsten
>>
>>
>> (Thread relates to T5.0.6 - How to use GridRows)
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
> 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
>
>
>
>
--
View this message in context: http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13729112
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.0.6 - GirdModelProvider for GridRows - example?
Posted by CarstenM <Ca...@1822-s-inform.de>.
Hi,
ok, I tried this but I get a NullPointerException (line 4 of .tml).
1<tr class="${rowClass}"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
2<t:loop source="propertyNames" value="propertyName"
volatile="inherit:volatile">
3<td class="${cellClass}">
4<t:gridcell model="columnModel" object="row"
overrides="componentResources.containerResources"/>
5</td>
6</t:loop>
7</tr>
#
org.apache.tapestry.corelib.base.AbstractPropertyOutput.readPropertyForObject(AbstractPropertyOutput.java:134)
#
org.apache.tapestry.corelib.base.AbstractPropertyOutput.renderPropertyValue(AbstractPropertyOutput.java:117)
#
org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java:28)
# org.apache.tapestry.corelib.components.GridCell.beginRender(GridCell.java)
Do I forget something?
Thanks.
Vashon-Ez wrote:
>
> It's a two step process.
>
> 1. Define a model in your Java class. It's easy to just use the standard
> definition and extend it like so:
>
> @Inject
> private BeanModelSource _beanModelSource;
>
> @Inject
> private ComponentResources _resources;
>
> @Retain
> private BeanModel _model;
>
> void pageLoaded() {
> _model = _beanModelSource.create(VideoClip.class, true,
> _resources);
>
> _model.remove("id");
>
> _model.add("action", null);
> }
>
> public BeanModel getModel() {
> return _model;
> }
>
> Note the _model.add("action", null); that sets a null conduit meaning the
> grid will not try to pull values for that column from the underlying bean.
> In other words, its a utility column where you can put whatever you like.
> Note the name of the model is just model as its accessed via the
> getModel() method.
>
> 2. Add a model="name-of-your-model-in-your-Java-class" to your grid in
> your .tml file. In this case it is model="model" e.g.:
>
> <table t:type="grid" source="videos" row="video" model="model"
> rowsPerPage="5" pagerPosition="both">
> <t:parameter name="titleCell">
> <t:pagelink page="demo/VideoDetails"
> context="video.id">${video.title}</t:pagelink>
> </t:parameter>
> <t:parameter name="actionCell">
> <t:pagelink page="demo/EditVideo"
> context="video.id">Edit</t:pagelink>
> </t:parameter>
> </table>
>
> I've added a bunch of other stuff, but you should get the idea.
>
> HTH
>
> CarstenM <Ca...@1822-s-inform.de> wrote:
> Hi again,
>
> no example for this or what's wrong?
>
> Cheers
> Carsten
>
>
>
> CarstenM wrote:
>>
>> Hello,
>>
>> still trying to use the GridRows component.
>> Can someone give an example for a GridModelProvider or the GridRows
>> component?
>> Well, the Grid is an implementation of GridModelProvider but I would like
>> to
>> customize my rows.
>>
>> Thanks,
>> Carsten
>>
>>
>> (Thread relates to T5.0.6 - How to use GridRows)
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
> 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
>
>
>
>
--
View this message in context: http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13729112
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.0.6 - GirdModelProvider for GridRows - example?
Posted by Ezra Epstein <ez...@yahoo.com>.
It's a two step process.
1. Define a model in your Java class. It's easy to just use the standard definition and extend it like so:
@Inject
private BeanModelSource _beanModelSource;
@Inject
private ComponentResources _resources;
@Retain
private BeanModel _model;
void pageLoaded() {
_model = _beanModelSource.create(VideoClip.class, true, _resources);
_model.remove("id");
_model.add("action", null);
}
public BeanModel getModel() {
return _model;
}
Note the _model.add("action", null); that sets a null conduit meaning the grid will not try to pull values for that column from the underlying bean. In other words, its a utility column where you can put whatever you like. Note the name of the model is just model as its accessed via the getModel() method.
2. Add a model="name-of-your-model-in-your-Java-class" to your grid in your .tml file. In this case it is model="model" e.g.:
<table t:type="grid" source="videos" row="video" model="model" rowsPerPage="5" pagerPosition="both">
<t:parameter name="titleCell">
<t:pagelink page="demo/VideoDetails" context="video.id">${video.title}</t:pagelink>
</t:parameter>
<t:parameter name="actionCell">
<t:pagelink page="demo/EditVideo" context="video.id">Edit</t:pagelink>
</t:parameter>
</table>
I've added a bunch of other stuff, but you should get the idea.
HTH
CarstenM <Ca...@1822-s-inform.de> wrote:
Hi again,
no example for this or what's wrong?
Cheers
Carsten
CarstenM wrote:
>
> Hello,
>
> still trying to use the GridRows component.
> Can someone give an example for a GridModelProvider or the GridRows
> component?
> Well, the Grid is an implementation of GridModelProvider but I would like
> to
> customize my rows.
>
> Thanks,
> Carsten
>
>
> (Thread relates to T5.0.6 - How to use GridRows)
>
>
--
View this message in context: http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
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.0.6 - GirdModelProvider for GridRows - example?
Posted by CarstenM <Ca...@1822-s-inform.de>.
Hi again,
no example for this or what's wrong?
Cheers
Carsten
CarstenM wrote:
>
> Hello,
>
> still trying to use the GridRows component.
> Can someone give an example for a GridModelProvider or the GridRows
> component?
> Well, the Grid is an implementation of GridModelProvider but I would like
> to
> customize my rows.
>
> Thanks,
> Carsten
>
>
> (Thread relates to T5.0.6 - How to use GridRows)
>
>
--
View this message in context: http://www.nabble.com/T5.0.6---GirdModelProvider-for-GridRows---example--tf4776423.html#a13723905
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