You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alec Leamas <le...@gmail.com> on 2008/03/16 16:47:40 UTC

T5, newbie: Grid use w dynamic columns

Trying the hard parts first, I'm trying to create a table where the 
columns are not known until runtime. The application is basically a 
viewer, and the underlying database schema varies from time to time.

My question: is it somehow possible to define what columns to use in the 
Grid component in runtime?  The T4 variant accepts a list, so it's no 
problem. The T5 variant uses a bean to define the columns, and this is 
trickier.

I've tried to use javassist to modify a a bean dynamically, but the Grid 
complains that it cannot find the source for the getter method I added 
to the bean.  This might just be the wrong way to do it, something wrong 
with my first attemps to use javassist, or some problem with the idea to 
use these kind of modified beans as source for the Grid.

Thanks for any help...

--Alec

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5, newbie: Grid use w dynamic columns

Posted by Alec Leamas <le...@gmail.com>.
One of these days... it works to add a property to a BeanModel. If I
 -  RTFM i. e., the javadocs.
 - Provide a PropertyConduit to add().  (I missed that)

Sorry for wasting bandwidth

--alec.


Michael Kolmodin wrote:
> Thanks for taking time for silly me :-)
>
> Should have said that, but I tried to add a property to a BeanModel. 
> However, this seems to fail if the class which was fed to the model's 
> constructor doesn't have the property getter. As I understand it, I 
> can enable/disable existing properties on a bean, but not create new 
> ones?!
>
> -----
> BeanModel model  =  beanModelSource.create( LdapRow.getClass(), false, 
> componentResources);
> model.add( "orvar");   -> Exception:
> --------------------
> Error: Render queue error in SetupRender[ReportPage:grid]: Failure 
> reading parameter 'model' of component ReportPage:grid: Class 
> net.kln.yalt.pages.ReportPage$LdapRow does not contain a property 
> named 'orvar' (within property expression 'orvar'). Available 
> properties: class.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5, newbie: Grid use w dynamic columns

Posted by Michael Kolmodin <Mi...@kolmodin.net>.
Thanks for taking time for silly me :-)

Should have said that, but I tried to add a property to a BeanModel. 
However, this seems to fail if the class which was fed to the model's 
constructor doesn't have the property getter. As I understand it, I can 
enable/disable existing properties on a bean, but not create new ones?!

-----
BeanModel model  =  beanModelSource.create( LdapRow.getClass(), false, 
componentResources);
model.add( "orvar");   -> Exception:
--------------------
Error: Render queue error in SetupRender[ReportPage:grid]: Failure 
reading parameter 'model' of component ReportPage:grid: Class 
net.kln.yalt.pages.ReportPage$LdapRow does not contain a property named 
'orvar' (within property expression 'orvar'). Available properties: class.





Davor Hrg wrote:
> Grid uses BeanModel, no need to mess with javassist
> 
> you can create default one by
> injecting BeanModelSource and create it with it
> after that you can play with the model.
> 
> or you can provide a list of columns to the grid to include/exclude
> 

-- 
--------------------------------------------------------------------------
Michael Kolmodin                        Fredsgatan 2
Phone:  +46 920 269413                  S-972 35 Lulea
Mobile  +46 70 551 6507                 Sweden

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5, newbie: Grid use w dynamic columns

Posted by Davor Hrg <hr...@gmail.com>.
Grid uses BeanModel, no need to mess with javassist

you can create default one by
injecting BeanModelSource and create it with it
after that you can play with the model.

or you can provide a list of columns to the grid to include/exclude

Davor Hrg

On Sun, Mar 16, 2008 at 4:47 PM, Alec Leamas <le...@gmail.com> wrote:
> Trying the hard parts first, I'm trying to create a table where the
>  columns are not known until runtime. The application is basically a
>  viewer, and the underlying database schema varies from time to time.
>
>  My question: is it somehow possible to define what columns to use in the
>  Grid component in runtime?  The T4 variant accepts a list, so it's no
>  problem. The T5 variant uses a bean to define the columns, and this is
>  trickier.
>
>  I've tried to use javassist to modify a a bean dynamically, but the Grid
>  complains that it cannot find the source for the getter method I added
>  to the bean.  This might just be the wrong way to do it, something wrong
>  with my first attemps to use javassist, or some problem with the idea to
>  use these kind of modified beans as source for the Grid.
>
>  Thanks for any help...
>
>  --Alec
>
>  ---------------------------------------------------------------------
>  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