You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Juan Pablo Coen Mitrani <fo...@gmail.com> on 2008/03/06 13:03:19 UTC

Palette and recorderComponent initialization (Wicket 1.3.1)

Hi,
I've noticed that recorderComponent initialization has been moved from
Palette constructor to private initFactories() method which is called by
onBeforeRender() method.

I was trying to add an Ajax behavior to a new Palette like this:
   Palette palette = new Palette( ... );
   AjaxFormComponentUpdatingBehavior ajaxBehavior =
   new AjaxFormComponentUpdatingBehavior("onchange") { ... };

   palette.getRecorderComponent().add(ajaxBehavior);
   add(palette);

This is obviously giving me a NullPointerException, as recorderComponent is
null at the time I'm trying to get it.

Is there a new way to add a behavior to the Palette?

Thanks,
Juan Pablo
-- 
View this message in context: http://www.nabble.com/Palette-and-recorderComponent-initialization-%28Wicket-1.3.1%29-tp15871741p15871741.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: Palette and recorderComponent initialization (Wicket 1.3.1)

Posted by "juan.pablo.coen.mitrani" <fo...@gmail.com>.
Ok, I will keep 1.2.6 til next stable release

Thanks


juan.pablo.coen.mitrani wrote:
> 
> The method "newRecorderComponent()" is private, so I can't override it...
> 
> 
> igor.vaynberg wrote:
>> 
>> isnt recorder component represented by input type="hidden" in html? im
>> not sure if those receive onchange events...
>> 
>> anyways, what you want can be implementing as following:
>> 
>> new palette() {
>>    newrecordercomponent() { component c=super.newrecordercomponent();
>> c.add(...); return c; }
>> }
>> 
>> -igor
>> 
> 
> 


-----
Juan Pablo Coen Mitrani
-- 
View this message in context: http://www.nabble.com/Palette-and-recorderComponent-initialization-%28Wicket-1.3.1%29-tp15871741p15882150.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: Palette and recorderComponent initialization (Wicket 1.3.1)

Posted by Igor Vaynberg <ig...@gmail.com>.
it is now protected in trunk

-igor


On Thu, Mar 6, 2008 at 11:13 AM, juan.pablo.coen.mitrani
<fo...@gmail.com> wrote:
>
>  The method "newRecorderComponent()" is private, so I can't override it...
>
>
>
>  igor.vaynberg wrote:
>  >
>  > isnt recorder component represented by input type="hidden" in html? im
>  > not sure if those receive onchange events...
>  >
>  > anyways, what you want can be implementing as following:
>  >
>  > new palette() {
>  >    newrecordercomponent() { component c=super.newrecordercomponent();
>  > c.add(...); return c; }
>  > }
>  >
>  > -igor
>  >
>
>
>  -----
>  Juan Pablo Coen Mitrani
>  --
>  View this message in context: http://www.nabble.com/Palette-and-recorderComponent-initialization-%28Wicket-1.3.1%29-tp15871741p15881636.html
>
>
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>

Re: Palette and recorderComponent initialization (Wicket 1.3.1)

Posted by "juan.pablo.coen.mitrani" <fo...@gmail.com>.
The method "newRecorderComponent()" is private, so I can't override it...


igor.vaynberg wrote:
> 
> isnt recorder component represented by input type="hidden" in html? im
> not sure if those receive onchange events...
> 
> anyways, what you want can be implementing as following:
> 
> new palette() {
>    newrecordercomponent() { component c=super.newrecordercomponent();
> c.add(...); return c; }
> }
> 
> -igor
> 


-----
Juan Pablo Coen Mitrani
-- 
View this message in context: http://www.nabble.com/Palette-and-recorderComponent-initialization-%28Wicket-1.3.1%29-tp15871741p15881636.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: Palette and recorderComponent initialization (Wicket 1.3.1)

Posted by Igor Vaynberg <ig...@gmail.com>.
isnt recorder component represented by input type="hidden" in html? im
not sure if those receive onchange events...

anyways, what you want can be implementing as following:

new palette() {
   newrecordercomponent() { component c=super.newrecordercomponent();
c.add(...); return c; }
}

-igor


On Thu, Mar 6, 2008 at 11:06 AM, juan.pablo.coen.mitrani
<fo...@gmail.com> wrote:
>
>  I don't understand what you are saying.
>
>  I have the Java code I posted before and I'm using it with this HTML
>
>
>  Do I have to add anything to HTML?
>  Do I have to manually implement the RecordComponent?
>  This code worked correctly in 1.2.6... do I have to do something different
>  for Wicket 1.3.1?
>
>  I think I might be missing something...
>
>  Thanks
>
>
>
>  igor.vaynberg wrote:
>  >
>  > are you sure a hidden field receives onchange events?
>  >
>  > -igor
>  >
>
>
>  -----
>  Juan Pablo Coen Mitrani
>  --
>  View this message in context: http://www.nabble.com/Palette-and-recorderComponent-initialization-%28Wicket-1.3.1%29-tp15871741p15881493.html
>
>
> Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>

Re: Palette and recorderComponent initialization (Wicket 1.3.1)

Posted by "juan.pablo.coen.mitrani" <fo...@gmail.com>.
I don't understand what you are saying.

I have the Java code I posted before and I'm using it with this HTML
   

Do I have to add anything to HTML?
Do I have to manually implement the RecordComponent?
This code worked correctly in 1.2.6... do I have to do something different
for Wicket 1.3.1?

I think I might be missing something...

Thanks


igor.vaynberg wrote:
> 
> are you sure a hidden field receives onchange events?
> 
> -igor
> 


-----
Juan Pablo Coen Mitrani
-- 
View this message in context: http://www.nabble.com/Palette-and-recorderComponent-initialization-%28Wicket-1.3.1%29-tp15871741p15881493.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.


Re: Palette and recorderComponent initialization (Wicket 1.3.1)

Posted by themugprogrammer <pa...@transport.wa.gov.au>.
try calling palettes beforeRender() method but only after you have added the
palette to the form. Seems to force initlialization of the recorder
component

vehicleDetailForm.add(conditionCodePalette);
        
        conditionCodePalette.beforeRender();
        conditionCodePalette.getRecorderComponent().add(new
AjaxFormComponentUpdatingBehavior("onchange") {
            
            @Override
            protected void onUpdate(AjaxRequestTarget target){
                
            }
            
        });

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Palette-and-recorderComponent-initialization-Wicket-1-3-1-tp1908616p3551387.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.

Re: Palette and recorderComponent initialization (Wicket 1.3.1)

Posted by themugprogrammer <pa...@transport.wa.gov.au>.
try calling palettes beforeRender() method but only after you have added the
palette to the form. Seems to force initlialization of the recorder
component

vehicleDetailForm.add(conditionCodePalette);
        
        conditionCodePalette.beforeRender();
        conditionCodePalette.getRecorderComponent().add(new
AjaxFormComponentUpdatingBehavior("onchange") {
            
            @Override
            protected void onUpdate(AjaxRequestTarget target){
                
            }
            
        });

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Palette-and-recorderComponent-initialization-Wicket-1-3-1-tp1908616p3551386.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.

Re: Palette and recorderComponent initialization (Wicket 1.3.1)

Posted by Igor Vaynberg <ig...@gmail.com>.
are you sure a hidden field receives onchange events?

-igor


On Thu, Mar 6, 2008 at 4:03 AM, Juan Pablo Coen Mitrani
<fo...@gmail.com> wrote:
>
>  Hi,
>  I've noticed that recorderComponent initialization has been moved from
>  Palette constructor to private initFactories() method which is called by
>  onBeforeRender() method.
>
>  I was trying to add an Ajax behavior to a new Palette like this:
>    Palette palette = new Palette( ... );
>    AjaxFormComponentUpdatingBehavior ajaxBehavior =
>    new AjaxFormComponentUpdatingBehavior("onchange") { ... };
>
>    palette.getRecorderComponent().add(ajaxBehavior);
>    add(palette);
>
>  This is obviously giving me a NullPointerException, as recorderComponent is
>  null at the time I'm trying to get it.
>
>  Is there a new way to add a behavior to the Palette?
>
>  Thanks,
>  Juan Pablo
>  --
>  View this message in context: http://www.nabble.com/Palette-and-recorderComponent-initialization-%28Wicket-1.3.1%29-tp15871741p15871741.html
>  Sent from the Wicket - Dev mailing list archive at Nabble.com.
>
>

Re: Palette and recorderComponent initialization (Wicket 1.3.1)

Posted by exequiel aguirre <ex...@yahoo.com>.



juan.pablo.coen.mitrani wrote:
> 
> Hi,
> I've noticed that recorderComponent initialization has been moved from
> Palette constructor to private initFactories() method which is called by
> onBeforeRender() method.
> 
> I was trying to add an Ajax behavior to a new Palette like this:
>    Palette palette = new Palette( ... );
>    AjaxFormComponentUpdatingBehavior ajaxBehavior =
>    new AjaxFormComponentUpdatingBehavior("onchange") { ... };
> 
>    palette.getRecorderComponent().add(ajaxBehavior);
>    add(palette);
> 
> This is obviously giving me a NullPointerException, as recorderComponent
> is null at the time I'm trying to get it.
> 
> Is there a new way to add a behavior to the Palette?
> 
> Thanks,
> Juan Pablo
> 

Hi Juan Pablo,by now, you posibly don't need this, but...
A possible solution to this is:

Palette palette=new Palette(....){
			@Override
			protected void onBeforeRender() {			
				super.onBeforeRender();
				getRecorderComponent().add(
new AjaxFormComponentUpdatingBehavior(...){});

so, super.onBeforeRender(); creates the recorderComponent and the internal
ids array.
I'm using it this way, and so far,it's working fine

Exequiel Aguirre
-- 
View this message in context: http://www.nabble.com/Palette-and-recorderComponent-initialization-%28Wicket-1.3.1%29-tp15871741p22587661.html
Sent from the Wicket - Dev mailing list archive at Nabble.com.