You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by akshay <ak...@gmail.com> on 2015/03/30 15:54:18 UTC

Dynamic Properties addition to the Grid

Hi All,


I am trying to add properties to the grid dynamically. Below I have
described, what I try to acheive:-

  @Property
  private BeanModel<A> myModel;
 @Inject
  private BeanModelSource beanModelSource;


 myModel= beanModelSource.createDisplayModel(A.class,
        messages);

//logic for including and re-ordering existing properties defined in model
class A.

//some database calls and then we add the new properties based on business
logic

myModel.add("new propertyName", "valueToBeShown");

The method used here is "add(String propertyName, String expression);"

For ex:- The new property name can be "status" with the values as read from
db



I get an exception stating that  "Exception generating conduit for
expression 'valueToBeShown': Class mint.abc.model.A does not contain a
property (or public field) named 'valueToBeShown'.

I think, I need to use Property Conduit somehow to fix this, I am unsure
about the usage of the same . Any help will be appreciated.





Best Regards!
Akshay

Re: Dynamic Properties addition to the Grid

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 30 Mar 2015 11:51:09 -0300, akshay <ak...@gmail.com>  
wrote:

> Wii your logic help me in this case.how would we go about capturing the
> "name property cell" when we are unsure about the name of it ? Can you
> please show me an example ?

In this case, when you don't know the names of the properties beforehand,  
you need to take a look at how to add viewing blocks for BeanModel-based  
components (Grid, BeanDisplay) and also contribute to the DataTypeAnalyzer  
service.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Dynamic Properties addition to the Grid

Posted by Dimitris Zenios <di...@gmail.com>.
You can omit the model then and tapestry will create a model based on the
properties of your beans.In the other hand you can look at how tapestry 5
grid components inspects and creates a default model and follow that to do
what you need.

On Mon, Mar 30, 2015 at 5:51 PM, akshay <ak...@gmail.com> wrote:

> Yes, I know that we can add n number of properties, but i believe the
> scenario , you are trying to talk about is to do with the case when we are
> aware of the "propertynames" before hand.
>
> In my case i only come to know about it during runtime.
>
> Wii your logic help me in this case.how would we go about capturing the
> "name property cell" when we are unsure about the name of it ? Can you
> please show me an example ?
>
> Best Regards
> Akhsay
> On 30 Mar 2015 16:43, "Dimitris Zenios" <di...@gmail.com> wrote:
>
> > You can add as many properties you want.You can also add them via add
> > method of grid in tml file
> >
> > On Mon, Mar 30, 2015 at 5:35 PM, akshay <ak...@gmail.com>
> wrote:
> >
> > > Hi Dimitris,
> > >
> > > Thanks, but will it work, when i have list of properties to be added?
> > >
> > > I am aware that we can add the property,like the way u have said or we
> > can
> > > just have mymodel.add("propertyname") and hijack name cell in the tml
> for
> > > further actions.
> > >
> > > I havent given a try, just had a view looking into the approach.
> > >
> > > Regards
> > > Akshay
> > > On 30 Mar 2015 16:26, "Dimitris Zenios" <di...@gmail.com>
> > wrote:
> > >
> > > > try myModel.addEmpty("propertyName");
> > > >
> > > >
> > > > and in the tml class
> > > > you can do
> > > > <t:grid t:source="values" t:row="value" t:model="myModel">
> > > > <p:propertyNameCell>
> > > > ${value.propertyName}
> > > > </p:propertyNameCell>
> > > > </t:grid>
> > > >
> > > > Regards
> > > > Dimitris Zenios
> > > >
> > > > On Mon, Mar 30, 2015 at 4:54 PM, akshay <ak...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi All,
> > > > >
> > > > >
> > > > > I am trying to add properties to the grid dynamically. Below I have
> > > > > described, what I try to acheive:-
> > > > >
> > > > >   @Property
> > > > >   private BeanModel<A> myModel;
> > > > >  @Inject
> > > > >   private BeanModelSource beanModelSource;
> > > > >
> > > > >
> > > > >  myModel= beanModelSource.createDisplayModel(A.class,
> > > > >         messages);
> > > > >
> > > > > //logic for including and re-ordering existing properties defined
> in
> > > > model
> > > > > class A.
> > > > >
> > > > > //some database calls and then we add the new properties based on
> > > > business
> > > > > logic
> > > > >
> > > > > myModel.add("new propertyName", "valueToBeShown");
> > > > >
> > > > > The method used here is "add(String propertyName, String
> > expression);"
> > > > >
> > > > > For ex:- The new property name can be "status" with the values as
> > read
> > > > from
> > > > > db
> > > > >
> > > > >
> > > > >
> > > > > I get an exception stating that  "Exception generating conduit for
> > > > > expression 'valueToBeShown': Class mint.abc.model.A does not
> contain
> > a
> > > > > property (or public field) named 'valueToBeShown'.
> > > > >
> > > > > I think, I need to use Property Conduit somehow to fix this, I am
> > > unsure
> > > > > about the usage of the same . Any help will be appreciated.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Best Regards!
> > > > > Akshay
> > > > >
> > > >
> > >
> >
>

Re: Dynamic Properties addition to the Grid

Posted by akshay <ak...@gmail.com>.
Yes, I know that we can add n number of properties, but i believe the
scenario , you are trying to talk about is to do with the case when we are
aware of the "propertynames" before hand.

In my case i only come to know about it during runtime.

Wii your logic help me in this case.how would we go about capturing the
"name property cell" when we are unsure about the name of it ? Can you
please show me an example ?

Best Regards
Akhsay
On 30 Mar 2015 16:43, "Dimitris Zenios" <di...@gmail.com> wrote:

> You can add as many properties you want.You can also add them via add
> method of grid in tml file
>
> On Mon, Mar 30, 2015 at 5:35 PM, akshay <ak...@gmail.com> wrote:
>
> > Hi Dimitris,
> >
> > Thanks, but will it work, when i have list of properties to be added?
> >
> > I am aware that we can add the property,like the way u have said or we
> can
> > just have mymodel.add("propertyname") and hijack name cell in the tml for
> > further actions.
> >
> > I havent given a try, just had a view looking into the approach.
> >
> > Regards
> > Akshay
> > On 30 Mar 2015 16:26, "Dimitris Zenios" <di...@gmail.com>
> wrote:
> >
> > > try myModel.addEmpty("propertyName");
> > >
> > >
> > > and in the tml class
> > > you can do
> > > <t:grid t:source="values" t:row="value" t:model="myModel">
> > > <p:propertyNameCell>
> > > ${value.propertyName}
> > > </p:propertyNameCell>
> > > </t:grid>
> > >
> > > Regards
> > > Dimitris Zenios
> > >
> > > On Mon, Mar 30, 2015 at 4:54 PM, akshay <ak...@gmail.com>
> > wrote:
> > >
> > > > Hi All,
> > > >
> > > >
> > > > I am trying to add properties to the grid dynamically. Below I have
> > > > described, what I try to acheive:-
> > > >
> > > >   @Property
> > > >   private BeanModel<A> myModel;
> > > >  @Inject
> > > >   private BeanModelSource beanModelSource;
> > > >
> > > >
> > > >  myModel= beanModelSource.createDisplayModel(A.class,
> > > >         messages);
> > > >
> > > > //logic for including and re-ordering existing properties defined in
> > > model
> > > > class A.
> > > >
> > > > //some database calls and then we add the new properties based on
> > > business
> > > > logic
> > > >
> > > > myModel.add("new propertyName", "valueToBeShown");
> > > >
> > > > The method used here is "add(String propertyName, String
> expression);"
> > > >
> > > > For ex:- The new property name can be "status" with the values as
> read
> > > from
> > > > db
> > > >
> > > >
> > > >
> > > > I get an exception stating that  "Exception generating conduit for
> > > > expression 'valueToBeShown': Class mint.abc.model.A does not contain
> a
> > > > property (or public field) named 'valueToBeShown'.
> > > >
> > > > I think, I need to use Property Conduit somehow to fix this, I am
> > unsure
> > > > about the usage of the same . Any help will be appreciated.
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Best Regards!
> > > > Akshay
> > > >
> > >
> >
>

Re: Dynamic Properties addition to the Grid

Posted by Dimitris Zenios <di...@gmail.com>.
You can add as many properties you want.You can also add them via add
method of grid in tml file

On Mon, Mar 30, 2015 at 5:35 PM, akshay <ak...@gmail.com> wrote:

> Hi Dimitris,
>
> Thanks, but will it work, when i have list of properties to be added?
>
> I am aware that we can add the property,like the way u have said or we can
> just have mymodel.add("propertyname") and hijack name cell in the tml for
> further actions.
>
> I havent given a try, just had a view looking into the approach.
>
> Regards
> Akshay
> On 30 Mar 2015 16:26, "Dimitris Zenios" <di...@gmail.com> wrote:
>
> > try myModel.addEmpty("propertyName");
> >
> >
> > and in the tml class
> > you can do
> > <t:grid t:source="values" t:row="value" t:model="myModel">
> > <p:propertyNameCell>
> > ${value.propertyName}
> > </p:propertyNameCell>
> > </t:grid>
> >
> > Regards
> > Dimitris Zenios
> >
> > On Mon, Mar 30, 2015 at 4:54 PM, akshay <ak...@gmail.com>
> wrote:
> >
> > > Hi All,
> > >
> > >
> > > I am trying to add properties to the grid dynamically. Below I have
> > > described, what I try to acheive:-
> > >
> > >   @Property
> > >   private BeanModel<A> myModel;
> > >  @Inject
> > >   private BeanModelSource beanModelSource;
> > >
> > >
> > >  myModel= beanModelSource.createDisplayModel(A.class,
> > >         messages);
> > >
> > > //logic for including and re-ordering existing properties defined in
> > model
> > > class A.
> > >
> > > //some database calls and then we add the new properties based on
> > business
> > > logic
> > >
> > > myModel.add("new propertyName", "valueToBeShown");
> > >
> > > The method used here is "add(String propertyName, String expression);"
> > >
> > > For ex:- The new property name can be "status" with the values as read
> > from
> > > db
> > >
> > >
> > >
> > > I get an exception stating that  "Exception generating conduit for
> > > expression 'valueToBeShown': Class mint.abc.model.A does not contain a
> > > property (or public field) named 'valueToBeShown'.
> > >
> > > I think, I need to use Property Conduit somehow to fix this, I am
> unsure
> > > about the usage of the same . Any help will be appreciated.
> > >
> > >
> > >
> > >
> > >
> > > Best Regards!
> > > Akshay
> > >
> >
>

Re: Dynamic Properties addition to the Grid

Posted by akshay <ak...@gmail.com>.
Hi Dimitris,

Thanks, but will it work, when i have list of properties to be added?

I am aware that we can add the property,like the way u have said or we can
just have mymodel.add("propertyname") and hijack name cell in the tml for
further actions.

I havent given a try, just had a view looking into the approach.

Regards
Akshay
On 30 Mar 2015 16:26, "Dimitris Zenios" <di...@gmail.com> wrote:

> try myModel.addEmpty("propertyName");
>
>
> and in the tml class
> you can do
> <t:grid t:source="values" t:row="value" t:model="myModel">
> <p:propertyNameCell>
> ${value.propertyName}
> </p:propertyNameCell>
> </t:grid>
>
> Regards
> Dimitris Zenios
>
> On Mon, Mar 30, 2015 at 4:54 PM, akshay <ak...@gmail.com> wrote:
>
> > Hi All,
> >
> >
> > I am trying to add properties to the grid dynamically. Below I have
> > described, what I try to acheive:-
> >
> >   @Property
> >   private BeanModel<A> myModel;
> >  @Inject
> >   private BeanModelSource beanModelSource;
> >
> >
> >  myModel= beanModelSource.createDisplayModel(A.class,
> >         messages);
> >
> > //logic for including and re-ordering existing properties defined in
> model
> > class A.
> >
> > //some database calls and then we add the new properties based on
> business
> > logic
> >
> > myModel.add("new propertyName", "valueToBeShown");
> >
> > The method used here is "add(String propertyName, String expression);"
> >
> > For ex:- The new property name can be "status" with the values as read
> from
> > db
> >
> >
> >
> > I get an exception stating that  "Exception generating conduit for
> > expression 'valueToBeShown': Class mint.abc.model.A does not contain a
> > property (or public field) named 'valueToBeShown'.
> >
> > I think, I need to use Property Conduit somehow to fix this, I am unsure
> > about the usage of the same . Any help will be appreciated.
> >
> >
> >
> >
> >
> > Best Regards!
> > Akshay
> >
>

Re: Dynamic Properties addition to the Grid

Posted by Dimitris Zenios <di...@gmail.com>.
try myModel.addEmpty("propertyName");


and in the tml class
you can do
<t:grid t:source="values" t:row="value" t:model="myModel">
<p:propertyNameCell>
${value.propertyName}
</p:propertyNameCell>
</t:grid>

Regards
Dimitris Zenios

On Mon, Mar 30, 2015 at 4:54 PM, akshay <ak...@gmail.com> wrote:

> Hi All,
>
>
> I am trying to add properties to the grid dynamically. Below I have
> described, what I try to acheive:-
>
>   @Property
>   private BeanModel<A> myModel;
>  @Inject
>   private BeanModelSource beanModelSource;
>
>
>  myModel= beanModelSource.createDisplayModel(A.class,
>         messages);
>
> //logic for including and re-ordering existing properties defined in model
> class A.
>
> //some database calls and then we add the new properties based on business
> logic
>
> myModel.add("new propertyName", "valueToBeShown");
>
> The method used here is "add(String propertyName, String expression);"
>
> For ex:- The new property name can be "status" with the values as read from
> db
>
>
>
> I get an exception stating that  "Exception generating conduit for
> expression 'valueToBeShown': Class mint.abc.model.A does not contain a
> property (or public field) named 'valueToBeShown'.
>
> I think, I need to use Property Conduit somehow to fix this, I am unsure
> about the usage of the same . Any help will be appreciated.
>
>
>
>
>
> Best Regards!
> Akshay
>