Property Values to be modified

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Property Values to be modified

Akshay
Dear all,

I have a strange scenario like below :-

I have a component A
{
 @Parameter(required = true)
    private boolean isXYZ;

}


On debug, i see two parameters associated to the above field

-----isXYZ and isXYZ_FieldConduit.

Somehow, the values of both the fields are loaded differently and are not
in sync.
I want the value of isXYZ_FieldConduit. to be same as the isXYZ ( which
should be the default working scenario for the tapestry).

Hence, when i used the above parameter to be passed to another component
its always passed incorrectlly since the field conduit value is incorrect.


Now, I look for a solution where in, I can hijack and change the value of
"password_FieldConduit". I see that there exists a class called Transform
Field/ClassTransformation which has something to do with it, but I am not
sure about its usage or is it really possible to do it.

May be its something which is just against the tapestry way. Not sure, any
suggestion will be helpful.


Regards!!
Akshay
Reply | Threaded
Open this post in threaded view
|

Re: Property Values to be modified

Thiago H de Paula Figueiredo
On Fri, 21 Nov 2014 12:13:51 -0200, akshay <[hidden email]>  
wrote:

> Dear all,
>
> I have a strange scenario like below :-
>
> I have a component A
> {
>  @Parameter(required = true)
>     private boolean isXYZ;
>
> }
>
>
> On debug, i see two parameters associated to the above field
>
> -----isXYZ and isXYZ_FieldConduit.

They're not parameters. They're fields. Please use the right vocabulary or  
people won't understand what you're saying. :)

> Somehow, the values of both the fields are loaded differently and are not
> in sync.

the _FieldConduit thing is actually a PropertyConduit instance, not the  
field type, so they're supposed to be different. You shouldn't worry about  
the _FieldConduit thing at all.

Is production mode off? If yes, Tapestry should keep the field updated.

What exactly is the problem you're having?

> May be its something which is just against the tapestry way. Not sure,  
> any suggestion will be helpful.

This is actually how Tapestry works on page, component and mixin fields:  
by transforming them. ;) This field, which is a parameter, is only left on  
class, but any access to it (setting a value or reading it) is done  
through the PropertyConduit.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Property Values to be modified

Akshay
Hi Thiago,

Yes it should be field, just a typo :). But anyways, below is the scneario:-


I have a component A and Component B


Component A{

  @Component(id = "B", parameters = { "sortAscending=sortAscending"})
  private ComponentB  b;

  @Property
  private boolean sortAscending=true;


}


Component B{

    @Persist
    private ComponentA a;

    @Parameter(required = true)
    private boolean sortAscending;

 Object setupRender(){


a.updateXXX(sortAscending);

}}

When the values is true, which is set by default it works all fine. But
when the value is moved to false, On debug I see that
 the value stored by sortAscending in ComponentB is correct but as soon as
it goes within the  method a.updateXXX(sortAscending), its
its replaced by true.

For identifying the reason, I checked that my property conduit value is
always true in component B. I just changed the value of the conduit
properties manually through debugger to false and then made the call to the
above metioned component method and everything worked fine. This leads me
to a conclusion that the conduit field property has something to do
here, if I am not doing something wrong here.


Best Regards
Akshay

On Fri, Nov 21, 2014 at 3:41 PM, Thiago H de Paula Figueiredo <
[hidden email]> wrote:

> On Fri, 21 Nov 2014 12:13:51 -0200, akshay <[hidden email]>
> wrote:
>
>  Dear all,
>>
>> I have a strange scenario like below :-
>>
>> I have a component A
>> {
>>  @Parameter(required = true)
>>     private boolean isXYZ;
>>
>> }
>>
>>
>> On debug, i see two parameters associated to the above field
>>
>> -----isXYZ and isXYZ_FieldConduit.
>>
>
> They're not parameters. They're fields. Please use the right vocabulary or
> people won't understand what you're saying. :)
>
>  Somehow, the values of both the fields are loaded differently and are not
>> in sync.
>>
>
> the _FieldConduit thing is actually a PropertyConduit instance, not the
> field type, so they're supposed to be different. You shouldn't worry about
> the _FieldConduit thing at all.
>
> Is production mode off? If yes, Tapestry should keep the field updated.
>
> What exactly is the problem you're having?
>
>  May be its something which is just against the tapestry way. Not sure,
>> any suggestion will be helpful.
>>
>
> This is actually how Tapestry works on page, component and mixin fields:
> by transforming them. ;) This field, which is a parameter, is only left on
> class, but any access to it (setting a value or reading it) is done through
> the PropertyConduit.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Cheers!!
Akshay
Reply | Threaded
Open this post in threaded view
|

Re: Property Values to be modified

Chris Poulsen
don't initialize the property where you declare it. Use onActivate
setupRender or similar to set det default value

On Fri, Nov 21, 2014 at 4:06 PM, akshay <[hidden email]> wrote:

> Hi Thiago,
>
> Yes it should be field, just a typo :). But anyways, below is the
> scneario:-
>
>
> I have a component A and Component B
>
>
> Component A{
>
>   @Component(id = "B", parameters = { "sortAscending=sortAscending"})
>   private ComponentB  b;
>
>   @Property
>   private boolean sortAscending=true;
>
>
> }
>
>
> Component B{
>
>     @Persist
>     private ComponentA a;
>
>     @Parameter(required = true)
>     private boolean sortAscending;
>
>  Object setupRender(){
>
>
> a.updateXXX(sortAscending);
>
> }}
>
> When the values is true, which is set by default it works all fine. But
> when the value is moved to false, On debug I see that
>  the value stored by sortAscending in ComponentB is correct but as soon as
> it goes within the  method a.updateXXX(sortAscending), its
> its replaced by true.
>
> For identifying the reason, I checked that my property conduit value is
> always true in component B. I just changed the value of the conduit
> properties manually through debugger to false and then made the call to the
> above metioned component method and everything worked fine. This leads me
> to a conclusion that the conduit field property has something to do
> here, if I am not doing something wrong here.
>
>
> Best Regards
> Akshay
>
> On Fri, Nov 21, 2014 at 3:41 PM, Thiago H de Paula Figueiredo <
> [hidden email]> wrote:
>
> > On Fri, 21 Nov 2014 12:13:51 -0200, akshay <[hidden email]>
> > wrote:
> >
> >  Dear all,
> >>
> >> I have a strange scenario like below :-
> >>
> >> I have a component A
> >> {
> >>  @Parameter(required = true)
> >>     private boolean isXYZ;
> >>
> >> }
> >>
> >>
> >> On debug, i see two parameters associated to the above field
> >>
> >> -----isXYZ and isXYZ_FieldConduit.
> >>
> >
> > They're not parameters. They're fields. Please use the right vocabulary
> or
> > people won't understand what you're saying. :)
> >
> >  Somehow, the values of both the fields are loaded differently and are
> not
> >> in sync.
> >>
> >
> > the _FieldConduit thing is actually a PropertyConduit instance, not the
> > field type, so they're supposed to be different. You shouldn't worry
> about
> > the _FieldConduit thing at all.
> >
> > Is production mode off? If yes, Tapestry should keep the field updated.
> >
> > What exactly is the problem you're having?
> >
> >  May be its something which is just against the tapestry way. Not sure,
> >> any suggestion will be helpful.
> >>
> >
> > This is actually how Tapestry works on page, component and mixin fields:
> > by transforming them. ;) This field, which is a parameter, is only left
> on
> > class, but any access to it (setting a value or reading it) is done
> through
> > the PropertyConduit.
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
> --
> Cheers!!
> Akshay
>
Reply | Threaded
Open this post in threaded view
|

RE: Property Values to be modified

Akshay
Hi

Yes,I agree to your point,have tried that also.

Infact, the idea to intialize it in the way given below is taken from the Grid component of tapestry,as I am trying to build a customized grid over the tapestry default grid. The value transferred from Component A to B doesn't seem to be a problem...Its the transfer of field value from B to A using the method as given in the  mail.Not sure if there is something to do with the binding stuff or I am overlooking something here.

Thanks
Akshay

-----Original Message-----
From: "Chris Poulsen" <[hidden email]>
Sent: ‎21-‎11-‎2014 17:07
To: "Tapestry users" <[hidden email]>
Subject: Re: Property Values to be modified

don't initialize the property where you declare it. Use onActivate
setupRender or similar to set det default value

On Fri, Nov 21, 2014 at 4:06 PM, akshay <[hidden email]> wrote:

> Hi Thiago,
>
> Yes it should be field, just a typo :). But anyways, below is the
> scneario:-
>
>
> I have a component A and Component B
>
>
> Component A{
>
>   @Component(id = "B", parameters = { "sortAscending=sortAscending"})
>   private ComponentB  b;
>
>   @Property
>   private boolean sortAscending=true;
>
>
> }
>
>
> Component B{
>
>     @Persist
>     private ComponentA a;
>
>     @Parameter(required = true)
>     private boolean sortAscending;
>
>  Object setupRender(){
>
>
> a.updateXXX(sortAscending);
>
> }}
>
> When the values is true, which is set by default it works all fine. But
> when the value is moved to false, On debug I see that
>  the value stored by sortAscending in ComponentB is correct but as soon as
> it goes within the  method a.updateXXX(sortAscending), its
> its replaced by true.
>
> For identifying the reason, I checked that my property conduit value is
> always true in component B. I just changed the value of the conduit
> properties manually through debugger to false and then made the call to the
> above metioned component method and everything worked fine. This leads me
> to a conclusion that the conduit field property has something to do
> here, if I am not doing something wrong here.
>
>
> Best Regards
> Akshay
>
> On Fri, Nov 21, 2014 at 3:41 PM, Thiago H de Paula Figueiredo <
> [hidden email]> wrote:
>
> > On Fri, 21 Nov 2014 12:13:51 -0200, akshay <[hidden email]>
> > wrote:
> >
> >  Dear all,
> >>
> >> I have a strange scenario like below :-
> >>
> >> I have a component A
> >> {
> >>  @Parameter(required = true)
> >>     private boolean isXYZ;
> >>
> >> }
> >>
> >>
> >> On debug, i see two parameters associated to the above field
> >>
> >> -----isXYZ and isXYZ_FieldConduit.
> >>
> >
> > They're not parameters. They're fields. Please use the right vocabulary
> or
> > people won't understand what you're saying. :)
> >
> >  Somehow, the values of both the fields are loaded differently and are
> not
> >> in sync.
> >>
> >
> > the _FieldConduit thing is actually a PropertyConduit instance, not the
> > field type, so they're supposed to be different. You shouldn't worry
> about
> > the _FieldConduit thing at all.
> >
> > Is production mode off? If yes, Tapestry should keep the field updated.
> >
> > What exactly is the problem you're having?
> >
> >  May be its something which is just against the tapestry way. Not sure,
> >> any suggestion will be helpful.
> >>
> >
> > This is actually how Tapestry works on page, component and mixin fields:
> > by transforming them. ;) This field, which is a parameter, is only left
> on
> > class, but any access to it (setting a value or reading it) is done
> through
> > the PropertyConduit.
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
> --
> Cheers!!
> Akshay
>
Reply | Threaded
Open this post in threaded view
|

Re: Property Values to be modified

Thiago H de Paula Figueiredo
In reply to this post by Akshay
On Fri, 21 Nov 2014 13:06:25 -0200, akshay <[hidden email]>  
wrote:

> Hi Thiago,

Hi!

>
> Yes it should be field, just a typo :). But anyways, below is the  
> scneario:-
>
>
> I have a component A and Component B
>
>
> Component A{
>
>   @Component(id = "B", parameters = { "sortAscending=sortAscending"})
>   private ComponentB  b;
>
>   @Property
>   private boolean sortAscending=true;

Never, never, never ever initialize a Tapestry page, component or mixin  
field in its declaration. I cannot repeat this enough.

> For identifying the reason, I checked that my property conduit value is
> always true in component B.

How? A PropertyConduit doesn't have a value. It provides access to it.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Property Values to be modified

Thiago H de Paula Figueiredo
In reply to this post by Akshay
On Fri, 21 Nov 2014 15:17:11 -0200, Akshay <[hidden email]>  
wrote:

> Hi

Hi!

> Infact, the idea to intialize it in the way given below is taken from  
> the Grid component of tapestry,as I am trying to build a customized grid  
> over the tapestry default grid. The value transferred from Component A  
> to B doesn't seem to be a problem...Its the transfer of field value from  
> B to A using the method as given in the  mail.Not sure if there is  
> something to do with the binding stuff or I am overlooking something  
> here.

In your code below, Component A uses Component B. You bind the  
A.sortAscending property to the B.sortAscending parameter. This way, any  
changes to the value of B.sortAscending will be immediately propagated to  
A.sortAscending.
The prop binding, the default one, is bidirectional. That's how the Loop's  
value parameter works.

>> Component A{
>>
>>   @Component(id = "B", parameters = { "sortAscending=sortAscending"})
>>   private ComponentB  b;
>>
>>   @Property
>>   private boolean sortAscending=true;
>>
>>
>> }
>>
>>
>> Component B{
>>
>>     @Persist
>>     private ComponentA a;
>>
>>     @Parameter(required = true)
>>     private boolean sortAscending;
>>
>>  Object setupRender(){
>>
>>
>> a.updateXXX(sortAscending);
>>
>> }}

By the way, why the hell are you persisting a component instance? There's  
absolutely no scenario in which this is correct. In addition, one  
component calling another's method should be avoided.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]