You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Pieter Claassen <pi...@musmato.com> on 2013/03/09 14:55:13 UTC

wiquery ResizableBehavior weird results on stop

I am still only interested in getting the size of a component on resize
stop.

Below is my code that I use to try and implement a call back to only call
on "stop". However, the x and y sizes I get are all over the place. Not at
all corresponding with the window sizes I actually see when  resizing.

I am using wiquery 6.2.0 and wicket 6.5.0.

Any advice as to what I am doing wrong?

Regards,
Pieter

        MyResizableBehavior resizableBehavior = new MyResizableBehavior();
        resizableBehavior.setStopEvent(new
MyResizableBehavior.AjaxResizeStopCallback() {
            @Override
            protected void resize(AjaxRequestTarget target, Component
source, int resizeHeight, int resizeWidth) {
                AdvancedFormatter advancedFormatter =
questionBaseWebModel.getEntity().getStatement().getFormatter();
                advancedFormatter.setWidth((float) resizeWidth / 800 * 100);
                advancedFormatter.setHeight((float) resizeHeight);
                System.out.println("Width:"+resizeWidth+"
Height:"+resizeHeight);
                advancedFormatterFactory.save(advancedFormatter);
            }

        });
        resizableBehavior.setAutoHide(true).setGhost(true).setAnimate(true);
        resizableBehavior.setGrid(50, 50);

....

public class MyResizableBehavior extends ResizableBehavior {
    public abstract static class AjaxResizeStopCallback extends
AbstractAjaxEventCallback
    {
        private static final long serialVersionUID = 1L;

        public AjaxResizeStopCallback()
        {
            super("stop");
        }

        @Override
        protected List<CallbackParameter> getExtraParameters()
        {
            List<CallbackParameter> ret = super.getExtraParameters();
            ret.add(CallbackParameter.resolved("resizeHeight",
ResizableBehavior.UI_SIZE
                    + ".height"));
            ret.add(CallbackParameter.resolved("resizeWidth",
ResizableBehavior.UI_SIZE + ".width"));
            return ret;
        }

        @Override
        public final void call(AjaxRequestTarget target, Component source)
        {
            IRequestParameters req =
RequestCycle.get().getRequest().getRequestParameters();

            int resizeHeight =
req.getParameterValue("resizeHeight").toInt(-1);
            int resizeWidth =
req.getParameterValue("resizeWidth").toInt(-1);
            resize(target, source, resizeHeight, resizeWidth);
        }

        protected abstract void resize(AjaxRequestTarget target, Component
source,
                                       int resizeHeight, int resizeWidth);
    }


    public MyResizableBehavior
setStopEvent(MyResizableBehavior.AjaxResizeStopCallback callback){

        setEventListener(callback);
        return this;
    }
}



-- 
- - - - - - - - - - - - - - - - - - - -
  Pieter Claassen
  Musmato B.V.
  e: pieter.claassen@musmato.com
  t NL: +31 (20) 893 4337
  t ZA: + 27 (0) 81 826 8166
  w: http://musmato.com
- - - - - - - - - - - - - - - - - - - -

Re: wiquery ResizableBehavior weird results on stop

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Check your JS libraries inclusion against quick-start... There might be
something weird going on (like several versions of wiquery-UI)

On Mon, Mar 11, 2013 at 5:17 PM, Pieter Claassen <pi...@musmato.com> wrote:

> Ok, I can confirm that the request URI contains the wrong (old
> parameters). Below is a request URI I get after resizing the window to max
> width (note the width here is 4px while the real panel is 800px).
>
> Could this be that I have some dud JS floating around that is messing this
> up?
>
>
> wicket/page?140-1.IBehaviorListener.1-templateeditdetailpanel-questionrenderpanel-container-rows-0-row-0-question-holder&eventName=stop&resizeHeight=29&resizeWidth=4&_=1363018206108
>
> This is what I have loaded ito ajax libraries in my header.
>
> [image: Inline image 1]
>
> Regards,
> Pieter
>
>
> On Mon, Mar 11, 2013 at 5:34 PM, Pieter Claassen <pi...@musmato.com>wrote:
>
>> Ernesto,
>>
>> This is very strange. When I use your snapshot code in a quickstart
>> project, it functions fine. But when I include it in my project, I always
>> get the old x and y values (of one resize ago) in my callback.
>>
>> Can you think of any reason why this would be happening? Could this be an
>> issue with the javascript code? I see my wicket ajax debug window does not
>> show my function parameters being used in the call so I can't see if it is
>> JS or wicket issue. How do I start to debug this?
>>
>> Regards,
>> Pieter
>>
>>
>> On Sun, Mar 10, 2013 at 10:02 AM, Ernesto Reinaldo Barreiro <
>> reiern70@gmail.com> wrote:
>>
>>> Pieter,
>>>
>>> Can you create a quickstart or "something" I can give it a try? Or give
>>> it
>>> a try to what I have added to wiquery: test panel I have created there
>>> seems to be working fine. If those changes work fine for you I can as
>>> other
>>> team member to roll out a new version of wiquery next week;-)
>>>
>>> On Sun, Mar 10, 2013 at 8:56 AM, Pieter Claassen <pi...@musmato.com>
>>> wrote:
>>>
>>> > Ernesto,
>>> >
>>> > Ok, I implemented your changes but something very strange is
>>> happening. In
>>> > my callback, I get the resizeHeight and resizeWidth values of the
>>> previous
>>> > window resize event, not the current one.
>>> >
>>> > I don't really know how to debug this other than drag the window
>>> smaller
>>> > and larger and checking whether the values increase or decrease.
>>> >
>>> > Any suggestion for how to debug this?
>>> >
>>> > Regards,
>>> > Pieter
>>> >
>>> >
>>> >
>>> > On Sat, Mar 9, 2013 at 4:56 PM, Ernesto Reinaldo Barreiro <
>>> > reiern70@gmail.com> wrote:
>>> >
>>> > > Pieter,
>>> > >
>>> > > I have just fixed wiquery to support the stop event. See commit
>>> > >
>>> > >
>>> > >
>>> >
>>> https://github.com/WiQuery/wiquery/commit/c2e8242c9d1aba9ae64f7c67654e0e6539d36b78
>>> > >
>>> > > On problem there is that parameter coming form client are float
>>> values. I
>>> > > have added a test panel and ResizableStopAjaxBehavior seems to be
>>> working
>>> > > as expected.
>>> > >
>>> > > Hope this helps.
>>> > >
>>> > > Cheers.
>>> > >
>>> > > Ernesto
>>> > >
>>> > >
>>> > > On Sat, Mar 9, 2013 at 2:55 PM, Pieter Claassen <pi...@musmato.com>
>>> > > wrote:
>>> > >
>>> > > > I am still only interested in getting the size of a component on
>>> resize
>>> > > > stop.
>>> > > >
>>> > > > Below is my code that I use to try and implement a call back to
>>> only
>>> > call
>>> > > > on "stop". However, the x and y sizes I get are all over the
>>> place. Not
>>> > > at
>>> > > > all corresponding with the window sizes I actually see when
>>>  resizing.
>>> > > >
>>> > > > I am using wiquery 6.2.0 and wicket 6.5.0.
>>> > > >
>>> > > > Any advice as to what I am doing wrong?
>>> > > >
>>> > > > Regards,
>>> > > > Pieter
>>> > > >
>>> > > >         MyResizableBehavior resizableBehavior = new
>>> > > MyResizableBehavior();
>>> > > >         resizableBehavior.setStopEvent(new
>>> > > > MyResizableBehavior.AjaxResizeStopCallback() {
>>> > > >             @Override
>>> > > >             protected void resize(AjaxRequestTarget target,
>>> Component
>>> > > > source, int resizeHeight, int resizeWidth) {
>>> > > >                 AdvancedFormatter advancedFormatter =
>>> > > > questionBaseWebModel.getEntity().getStatement().getFormatter();
>>> > > >                 advancedFormatter.setWidth((float) resizeWidth /
>>> 800 *
>>> > > > 100);
>>> > > >                 advancedFormatter.setHeight((float) resizeHeight);
>>> > > >                 System.out.println("Width:"+resizeWidth+"
>>> > > > Height:"+resizeHeight);
>>> > > >                 advancedFormatterFactory.save(advancedFormatter);
>>> > > >             }
>>> > > >
>>> > > >         });
>>> > > >
>>> > > >
>>> resizableBehavior.setAutoHide(true).setGhost(true).setAnimate(true);
>>> > > >         resizableBehavior.setGrid(50, 50);
>>> > > >
>>> > > > ....
>>> > > >
>>> > > > public class MyResizableBehavior extends ResizableBehavior {
>>> > > >     public abstract static class AjaxResizeStopCallback extends
>>> > > > AbstractAjaxEventCallback
>>> > > >     {
>>> > > >         private static final long serialVersionUID = 1L;
>>> > > >
>>> > > >         public AjaxResizeStopCallback()
>>> > > >         {
>>> > > >             super("stop");
>>> > > >         }
>>> > > >
>>> > > >         @Override
>>> > > >         protected List<CallbackParameter> getExtraParameters()
>>> > > >         {
>>> > > >             List<CallbackParameter> ret =
>>> super.getExtraParameters();
>>> > > >             ret.add(CallbackParameter.resolved("resizeHeight",
>>> > > > ResizableBehavior.UI_SIZE
>>> > > >                     + ".height"));
>>> > > >             ret.add(CallbackParameter.resolved("resizeWidth",
>>> > > > ResizableBehavior.UI_SIZE + ".width"));
>>> > > >             return ret;
>>> > > >         }
>>> > > >
>>> > > >         @Override
>>> > > >         public final void call(AjaxRequestTarget target, Component
>>> > > source)
>>> > > >         {
>>> > > >             IRequestParameters req =
>>> > > > RequestCycle.get().getRequest().getRequestParameters();
>>> > > >
>>> > > >             int resizeHeight =
>>> > > > req.getParameterValue("resizeHeight").toInt(-1);
>>> > > >             int resizeWidth =
>>> > > > req.getParameterValue("resizeWidth").toInt(-1);
>>> > > >             resize(target, source, resizeHeight, resizeWidth);
>>> > > >         }
>>> > > >
>>> > > >         protected abstract void resize(AjaxRequestTarget target,
>>> > > Component
>>> > > > source,
>>> > > >                                        int resizeHeight, int
>>> > > resizeWidth);
>>> > > >     }
>>> > > >
>>> > > >
>>> > > >     public MyResizableBehavior
>>> > > > setStopEvent(MyResizableBehavior.AjaxResizeStopCallback callback){
>>> > > >
>>> > > >         setEventListener(callback);
>>> > > >         return this;
>>> > > >     }
>>> > > > }
>>> > > >
>>> > > >
>>> > > >
>>> > > > --
>>> > > > - - - - - - - - - - - - - - - - - - - -
>>> > > >   Pieter Claassen
>>> > > >   Musmato B.V.
>>> > > >   e: pieter.claassen@musmato.com
>>> > > >   t NL: +31 (20) 893 4337
>>> > > >   t ZA: + 27 (0) 81 826 8166
>>> > > >   w: http://musmato.com
>>> > > > - - - - - - - - - - - - - - - - - - - -
>>> > > >
>>> > >
>>> > >
>>> > >
>>> > > --
>>> > > Regards - Ernesto Reinaldo Barreiro
>>> > > Antilia Soft
>>> > > http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>>> > >
>>> >
>>> >
>>> >
>>> > --
>>> > - - - - - - - - - - - - - - - - - - - -
>>> >   Pieter Claassen
>>> >   Musmato B.V.
>>> >   e: pieter.claassen@musmato.com
>>> >   t NL: +31 (20) 893 4337
>>> >   t ZA: + 27 (0) 81 826 8166
>>> >   w: http://musmato.com
>>> > - - - - - - - - - - - - - - - - - - - -
>>> >
>>>
>>>
>>>
>>> --
>>> Regards - Ernesto Reinaldo Barreiro
>>> Antilia Soft
>>> http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>>>
>>
>>
>>
>> --
>> - - - - - - - - - - - - - - - - - - - -
>>   Pieter Claassen
>>   Musmato B.V.
>>   e: pieter.claassen@musmato.com
>>   t NL: +31 (20) 893 4337
>>   t ZA: + 27 (0) 81 826 8166
>>   w: http://musmato.com
>> - - - - - - - - - - - - - - - - - - - -
>>
>
>
>
> --
> - - - - - - - - - - - - - - - - - - - -
>   Pieter Claassen
>   Musmato B.V.
>   e: pieter.claassen@musmato.com
>   t NL: +31 (20) 893 4337
>   t ZA: + 27 (0) 81 826 8166
>   w: http://musmato.com
> - - - - - - - - - - - - - - - - - - - -
>



-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>

Re: wiquery ResizableBehavior weird results on stop

Posted by Pieter Claassen <pi...@musmato.com>.
Ok, I can confirm that the request URI contains the wrong (old parameters).
Below is a request URI I get after resizing the window to max width (note
the width here is 4px while the real panel is 800px).

Could this be that I have some dud JS floating around that is messing this
up?

wicket/page?140-1.IBehaviorListener.1-templateeditdetailpanel-questionrenderpanel-container-rows-0-row-0-question-holder&eventName=stop&resizeHeight=29&resizeWidth=4&_=1363018206108

This is what I have loaded ito ajax libraries in my header.

[image: Inline image 1]

Regards,
Pieter

On Mon, Mar 11, 2013 at 5:34 PM, Pieter Claassen <pi...@musmato.com> wrote:

> Ernesto,
>
> This is very strange. When I use your snapshot code in a quickstart
> project, it functions fine. But when I include it in my project, I always
> get the old x and y values (of one resize ago) in my callback.
>
> Can you think of any reason why this would be happening? Could this be an
> issue with the javascript code? I see my wicket ajax debug window does not
> show my function parameters being used in the call so I can't see if it is
> JS or wicket issue. How do I start to debug this?
>
> Regards,
> Pieter
>
>
> On Sun, Mar 10, 2013 at 10:02 AM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
>> Pieter,
>>
>> Can you create a quickstart or "something" I can give it a try? Or give it
>> a try to what I have added to wiquery: test panel I have created there
>> seems to be working fine. If those changes work fine for you I can as
>> other
>> team member to roll out a new version of wiquery next week;-)
>>
>> On Sun, Mar 10, 2013 at 8:56 AM, Pieter Claassen <pi...@musmato.com>
>> wrote:
>>
>> > Ernesto,
>> >
>> > Ok, I implemented your changes but something very strange is happening.
>> In
>> > my callback, I get the resizeHeight and resizeWidth values of the
>> previous
>> > window resize event, not the current one.
>> >
>> > I don't really know how to debug this other than drag the window smaller
>> > and larger and checking whether the values increase or decrease.
>> >
>> > Any suggestion for how to debug this?
>> >
>> > Regards,
>> > Pieter
>> >
>> >
>> >
>> > On Sat, Mar 9, 2013 at 4:56 PM, Ernesto Reinaldo Barreiro <
>> > reiern70@gmail.com> wrote:
>> >
>> > > Pieter,
>> > >
>> > > I have just fixed wiquery to support the stop event. See commit
>> > >
>> > >
>> > >
>> >
>> https://github.com/WiQuery/wiquery/commit/c2e8242c9d1aba9ae64f7c67654e0e6539d36b78
>> > >
>> > > On problem there is that parameter coming form client are float
>> values. I
>> > > have added a test panel and ResizableStopAjaxBehavior seems to be
>> working
>> > > as expected.
>> > >
>> > > Hope this helps.
>> > >
>> > > Cheers.
>> > >
>> > > Ernesto
>> > >
>> > >
>> > > On Sat, Mar 9, 2013 at 2:55 PM, Pieter Claassen <pi...@musmato.com>
>> > > wrote:
>> > >
>> > > > I am still only interested in getting the size of a component on
>> resize
>> > > > stop.
>> > > >
>> > > > Below is my code that I use to try and implement a call back to only
>> > call
>> > > > on "stop". However, the x and y sizes I get are all over the place.
>> Not
>> > > at
>> > > > all corresponding with the window sizes I actually see when
>>  resizing.
>> > > >
>> > > > I am using wiquery 6.2.0 and wicket 6.5.0.
>> > > >
>> > > > Any advice as to what I am doing wrong?
>> > > >
>> > > > Regards,
>> > > > Pieter
>> > > >
>> > > >         MyResizableBehavior resizableBehavior = new
>> > > MyResizableBehavior();
>> > > >         resizableBehavior.setStopEvent(new
>> > > > MyResizableBehavior.AjaxResizeStopCallback() {
>> > > >             @Override
>> > > >             protected void resize(AjaxRequestTarget target,
>> Component
>> > > > source, int resizeHeight, int resizeWidth) {
>> > > >                 AdvancedFormatter advancedFormatter =
>> > > > questionBaseWebModel.getEntity().getStatement().getFormatter();
>> > > >                 advancedFormatter.setWidth((float) resizeWidth /
>> 800 *
>> > > > 100);
>> > > >                 advancedFormatter.setHeight((float) resizeHeight);
>> > > >                 System.out.println("Width:"+resizeWidth+"
>> > > > Height:"+resizeHeight);
>> > > >                 advancedFormatterFactory.save(advancedFormatter);
>> > > >             }
>> > > >
>> > > >         });
>> > > >
>> > > > resizableBehavior.setAutoHide(true).setGhost(true).setAnimate(true);
>> > > >         resizableBehavior.setGrid(50, 50);
>> > > >
>> > > > ....
>> > > >
>> > > > public class MyResizableBehavior extends ResizableBehavior {
>> > > >     public abstract static class AjaxResizeStopCallback extends
>> > > > AbstractAjaxEventCallback
>> > > >     {
>> > > >         private static final long serialVersionUID = 1L;
>> > > >
>> > > >         public AjaxResizeStopCallback()
>> > > >         {
>> > > >             super("stop");
>> > > >         }
>> > > >
>> > > >         @Override
>> > > >         protected List<CallbackParameter> getExtraParameters()
>> > > >         {
>> > > >             List<CallbackParameter> ret =
>> super.getExtraParameters();
>> > > >             ret.add(CallbackParameter.resolved("resizeHeight",
>> > > > ResizableBehavior.UI_SIZE
>> > > >                     + ".height"));
>> > > >             ret.add(CallbackParameter.resolved("resizeWidth",
>> > > > ResizableBehavior.UI_SIZE + ".width"));
>> > > >             return ret;
>> > > >         }
>> > > >
>> > > >         @Override
>> > > >         public final void call(AjaxRequestTarget target, Component
>> > > source)
>> > > >         {
>> > > >             IRequestParameters req =
>> > > > RequestCycle.get().getRequest().getRequestParameters();
>> > > >
>> > > >             int resizeHeight =
>> > > > req.getParameterValue("resizeHeight").toInt(-1);
>> > > >             int resizeWidth =
>> > > > req.getParameterValue("resizeWidth").toInt(-1);
>> > > >             resize(target, source, resizeHeight, resizeWidth);
>> > > >         }
>> > > >
>> > > >         protected abstract void resize(AjaxRequestTarget target,
>> > > Component
>> > > > source,
>> > > >                                        int resizeHeight, int
>> > > resizeWidth);
>> > > >     }
>> > > >
>> > > >
>> > > >     public MyResizableBehavior
>> > > > setStopEvent(MyResizableBehavior.AjaxResizeStopCallback callback){
>> > > >
>> > > >         setEventListener(callback);
>> > > >         return this;
>> > > >     }
>> > > > }
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > - - - - - - - - - - - - - - - - - - - -
>> > > >   Pieter Claassen
>> > > >   Musmato B.V.
>> > > >   e: pieter.claassen@musmato.com
>> > > >   t NL: +31 (20) 893 4337
>> > > >   t ZA: + 27 (0) 81 826 8166
>> > > >   w: http://musmato.com
>> > > > - - - - - - - - - - - - - - - - - - - -
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > Regards - Ernesto Reinaldo Barreiro
>> > > Antilia Soft
>> > > http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>> > >
>> >
>> >
>> >
>> > --
>> > - - - - - - - - - - - - - - - - - - - -
>> >   Pieter Claassen
>> >   Musmato B.V.
>> >   e: pieter.claassen@musmato.com
>> >   t NL: +31 (20) 893 4337
>> >   t ZA: + 27 (0) 81 826 8166
>> >   w: http://musmato.com
>> > - - - - - - - - - - - - - - - - - - - -
>> >
>>
>>
>>
>> --
>> Regards - Ernesto Reinaldo Barreiro
>> Antilia Soft
>> http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>>
>
>
>
> --
> - - - - - - - - - - - - - - - - - - - -
>   Pieter Claassen
>   Musmato B.V.
>   e: pieter.claassen@musmato.com
>   t NL: +31 (20) 893 4337
>   t ZA: + 27 (0) 81 826 8166
>   w: http://musmato.com
> - - - - - - - - - - - - - - - - - - - -
>



-- 
- - - - - - - - - - - - - - - - - - - -
  Pieter Claassen
  Musmato B.V.
  e: pieter.claassen@musmato.com
  t NL: +31 (20) 893 4337
  t ZA: + 27 (0) 81 826 8166
  w: http://musmato.com
- - - - - - - - - - - - - - - - - - - -

Re: wiquery ResizableBehavior weird results on stop

Posted by Pieter Claassen <pi...@musmato.com>.
Ernesto,

This is very strange. When I use your snapshot code in a quickstart
project, it functions fine. But when I include it in my project, I always
get the old x and y values (of one resize ago) in my callback.

Can you think of any reason why this would be happening? Could this be an
issue with the javascript code? I see my wicket ajax debug window does not
show my function parameters being used in the call so I can't see if it is
JS or wicket issue. How do I start to debug this?

Regards,
Pieter

On Sun, Mar 10, 2013 at 10:02 AM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Pieter,
>
> Can you create a quickstart or "something" I can give it a try? Or give it
> a try to what I have added to wiquery: test panel I have created there
> seems to be working fine. If those changes work fine for you I can as other
> team member to roll out a new version of wiquery next week;-)
>
> On Sun, Mar 10, 2013 at 8:56 AM, Pieter Claassen <pi...@musmato.com>
> wrote:
>
> > Ernesto,
> >
> > Ok, I implemented your changes but something very strange is happening.
> In
> > my callback, I get the resizeHeight and resizeWidth values of the
> previous
> > window resize event, not the current one.
> >
> > I don't really know how to debug this other than drag the window smaller
> > and larger and checking whether the values increase or decrease.
> >
> > Any suggestion for how to debug this?
> >
> > Regards,
> > Pieter
> >
> >
> >
> > On Sat, Mar 9, 2013 at 4:56 PM, Ernesto Reinaldo Barreiro <
> > reiern70@gmail.com> wrote:
> >
> > > Pieter,
> > >
> > > I have just fixed wiquery to support the stop event. See commit
> > >
> > >
> > >
> >
> https://github.com/WiQuery/wiquery/commit/c2e8242c9d1aba9ae64f7c67654e0e6539d36b78
> > >
> > > On problem there is that parameter coming form client are float
> values. I
> > > have added a test panel and ResizableStopAjaxBehavior seems to be
> working
> > > as expected.
> > >
> > > Hope this helps.
> > >
> > > Cheers.
> > >
> > > Ernesto
> > >
> > >
> > > On Sat, Mar 9, 2013 at 2:55 PM, Pieter Claassen <pi...@musmato.com>
> > > wrote:
> > >
> > > > I am still only interested in getting the size of a component on
> resize
> > > > stop.
> > > >
> > > > Below is my code that I use to try and implement a call back to only
> > call
> > > > on "stop". However, the x and y sizes I get are all over the place.
> Not
> > > at
> > > > all corresponding with the window sizes I actually see when
>  resizing.
> > > >
> > > > I am using wiquery 6.2.0 and wicket 6.5.0.
> > > >
> > > > Any advice as to what I am doing wrong?
> > > >
> > > > Regards,
> > > > Pieter
> > > >
> > > >         MyResizableBehavior resizableBehavior = new
> > > MyResizableBehavior();
> > > >         resizableBehavior.setStopEvent(new
> > > > MyResizableBehavior.AjaxResizeStopCallback() {
> > > >             @Override
> > > >             protected void resize(AjaxRequestTarget target, Component
> > > > source, int resizeHeight, int resizeWidth) {
> > > >                 AdvancedFormatter advancedFormatter =
> > > > questionBaseWebModel.getEntity().getStatement().getFormatter();
> > > >                 advancedFormatter.setWidth((float) resizeWidth / 800
> *
> > > > 100);
> > > >                 advancedFormatter.setHeight((float) resizeHeight);
> > > >                 System.out.println("Width:"+resizeWidth+"
> > > > Height:"+resizeHeight);
> > > >                 advancedFormatterFactory.save(advancedFormatter);
> > > >             }
> > > >
> > > >         });
> > > >
> > > > resizableBehavior.setAutoHide(true).setGhost(true).setAnimate(true);
> > > >         resizableBehavior.setGrid(50, 50);
> > > >
> > > > ....
> > > >
> > > > public class MyResizableBehavior extends ResizableBehavior {
> > > >     public abstract static class AjaxResizeStopCallback extends
> > > > AbstractAjaxEventCallback
> > > >     {
> > > >         private static final long serialVersionUID = 1L;
> > > >
> > > >         public AjaxResizeStopCallback()
> > > >         {
> > > >             super("stop");
> > > >         }
> > > >
> > > >         @Override
> > > >         protected List<CallbackParameter> getExtraParameters()
> > > >         {
> > > >             List<CallbackParameter> ret = super.getExtraParameters();
> > > >             ret.add(CallbackParameter.resolved("resizeHeight",
> > > > ResizableBehavior.UI_SIZE
> > > >                     + ".height"));
> > > >             ret.add(CallbackParameter.resolved("resizeWidth",
> > > > ResizableBehavior.UI_SIZE + ".width"));
> > > >             return ret;
> > > >         }
> > > >
> > > >         @Override
> > > >         public final void call(AjaxRequestTarget target, Component
> > > source)
> > > >         {
> > > >             IRequestParameters req =
> > > > RequestCycle.get().getRequest().getRequestParameters();
> > > >
> > > >             int resizeHeight =
> > > > req.getParameterValue("resizeHeight").toInt(-1);
> > > >             int resizeWidth =
> > > > req.getParameterValue("resizeWidth").toInt(-1);
> > > >             resize(target, source, resizeHeight, resizeWidth);
> > > >         }
> > > >
> > > >         protected abstract void resize(AjaxRequestTarget target,
> > > Component
> > > > source,
> > > >                                        int resizeHeight, int
> > > resizeWidth);
> > > >     }
> > > >
> > > >
> > > >     public MyResizableBehavior
> > > > setStopEvent(MyResizableBehavior.AjaxResizeStopCallback callback){
> > > >
> > > >         setEventListener(callback);
> > > >         return this;
> > > >     }
> > > > }
> > > >
> > > >
> > > >
> > > > --
> > > > - - - - - - - - - - - - - - - - - - - -
> > > >   Pieter Claassen
> > > >   Musmato B.V.
> > > >   e: pieter.claassen@musmato.com
> > > >   t NL: +31 (20) 893 4337
> > > >   t ZA: + 27 (0) 81 826 8166
> > > >   w: http://musmato.com
> > > > - - - - - - - - - - - - - - - - - - - -
> > > >
> > >
> > >
> > >
> > > --
> > > Regards - Ernesto Reinaldo Barreiro
> > > Antilia Soft
> > > http://antiliasoft.com/ <http://antiliasoft.com/antilia>
> > >
> >
> >
> >
> > --
> > - - - - - - - - - - - - - - - - - - - -
> >   Pieter Claassen
> >   Musmato B.V.
> >   e: pieter.claassen@musmato.com
> >   t NL: +31 (20) 893 4337
> >   t ZA: + 27 (0) 81 826 8166
> >   w: http://musmato.com
> > - - - - - - - - - - - - - - - - - - - -
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
> Antilia Soft
> http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>



-- 
- - - - - - - - - - - - - - - - - - - -
  Pieter Claassen
  Musmato B.V.
  e: pieter.claassen@musmato.com
  t NL: +31 (20) 893 4337
  t ZA: + 27 (0) 81 826 8166
  w: http://musmato.com
- - - - - - - - - - - - - - - - - - - -

Re: wiquery ResizableBehavior weird results on stop

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Pieter,

Can you create a quickstart or "something" I can give it a try? Or give it
a try to what I have added to wiquery: test panel I have created there
seems to be working fine. If those changes work fine for you I can as other
team member to roll out a new version of wiquery next week;-)

On Sun, Mar 10, 2013 at 8:56 AM, Pieter Claassen <pi...@musmato.com> wrote:

> Ernesto,
>
> Ok, I implemented your changes but something very strange is happening. In
> my callback, I get the resizeHeight and resizeWidth values of the previous
> window resize event, not the current one.
>
> I don't really know how to debug this other than drag the window smaller
> and larger and checking whether the values increase or decrease.
>
> Any suggestion for how to debug this?
>
> Regards,
> Pieter
>
>
>
> On Sat, Mar 9, 2013 at 4:56 PM, Ernesto Reinaldo Barreiro <
> reiern70@gmail.com> wrote:
>
> > Pieter,
> >
> > I have just fixed wiquery to support the stop event. See commit
> >
> >
> >
> https://github.com/WiQuery/wiquery/commit/c2e8242c9d1aba9ae64f7c67654e0e6539d36b78
> >
> > On problem there is that parameter coming form client are float values. I
> > have added a test panel and ResizableStopAjaxBehavior seems to be working
> > as expected.
> >
> > Hope this helps.
> >
> > Cheers.
> >
> > Ernesto
> >
> >
> > On Sat, Mar 9, 2013 at 2:55 PM, Pieter Claassen <pi...@musmato.com>
> > wrote:
> >
> > > I am still only interested in getting the size of a component on resize
> > > stop.
> > >
> > > Below is my code that I use to try and implement a call back to only
> call
> > > on "stop". However, the x and y sizes I get are all over the place. Not
> > at
> > > all corresponding with the window sizes I actually see when  resizing.
> > >
> > > I am using wiquery 6.2.0 and wicket 6.5.0.
> > >
> > > Any advice as to what I am doing wrong?
> > >
> > > Regards,
> > > Pieter
> > >
> > >         MyResizableBehavior resizableBehavior = new
> > MyResizableBehavior();
> > >         resizableBehavior.setStopEvent(new
> > > MyResizableBehavior.AjaxResizeStopCallback() {
> > >             @Override
> > >             protected void resize(AjaxRequestTarget target, Component
> > > source, int resizeHeight, int resizeWidth) {
> > >                 AdvancedFormatter advancedFormatter =
> > > questionBaseWebModel.getEntity().getStatement().getFormatter();
> > >                 advancedFormatter.setWidth((float) resizeWidth / 800 *
> > > 100);
> > >                 advancedFormatter.setHeight((float) resizeHeight);
> > >                 System.out.println("Width:"+resizeWidth+"
> > > Height:"+resizeHeight);
> > >                 advancedFormatterFactory.save(advancedFormatter);
> > >             }
> > >
> > >         });
> > >
> > > resizableBehavior.setAutoHide(true).setGhost(true).setAnimate(true);
> > >         resizableBehavior.setGrid(50, 50);
> > >
> > > ....
> > >
> > > public class MyResizableBehavior extends ResizableBehavior {
> > >     public abstract static class AjaxResizeStopCallback extends
> > > AbstractAjaxEventCallback
> > >     {
> > >         private static final long serialVersionUID = 1L;
> > >
> > >         public AjaxResizeStopCallback()
> > >         {
> > >             super("stop");
> > >         }
> > >
> > >         @Override
> > >         protected List<CallbackParameter> getExtraParameters()
> > >         {
> > >             List<CallbackParameter> ret = super.getExtraParameters();
> > >             ret.add(CallbackParameter.resolved("resizeHeight",
> > > ResizableBehavior.UI_SIZE
> > >                     + ".height"));
> > >             ret.add(CallbackParameter.resolved("resizeWidth",
> > > ResizableBehavior.UI_SIZE + ".width"));
> > >             return ret;
> > >         }
> > >
> > >         @Override
> > >         public final void call(AjaxRequestTarget target, Component
> > source)
> > >         {
> > >             IRequestParameters req =
> > > RequestCycle.get().getRequest().getRequestParameters();
> > >
> > >             int resizeHeight =
> > > req.getParameterValue("resizeHeight").toInt(-1);
> > >             int resizeWidth =
> > > req.getParameterValue("resizeWidth").toInt(-1);
> > >             resize(target, source, resizeHeight, resizeWidth);
> > >         }
> > >
> > >         protected abstract void resize(AjaxRequestTarget target,
> > Component
> > > source,
> > >                                        int resizeHeight, int
> > resizeWidth);
> > >     }
> > >
> > >
> > >     public MyResizableBehavior
> > > setStopEvent(MyResizableBehavior.AjaxResizeStopCallback callback){
> > >
> > >         setEventListener(callback);
> > >         return this;
> > >     }
> > > }
> > >
> > >
> > >
> > > --
> > > - - - - - - - - - - - - - - - - - - - -
> > >   Pieter Claassen
> > >   Musmato B.V.
> > >   e: pieter.claassen@musmato.com
> > >   t NL: +31 (20) 893 4337
> > >   t ZA: + 27 (0) 81 826 8166
> > >   w: http://musmato.com
> > > - - - - - - - - - - - - - - - - - - - -
> > >
> >
> >
> >
> > --
> > Regards - Ernesto Reinaldo Barreiro
> > Antilia Soft
> > http://antiliasoft.com/ <http://antiliasoft.com/antilia>
> >
>
>
>
> --
> - - - - - - - - - - - - - - - - - - - -
>   Pieter Claassen
>   Musmato B.V.
>   e: pieter.claassen@musmato.com
>   t NL: +31 (20) 893 4337
>   t ZA: + 27 (0) 81 826 8166
>   w: http://musmato.com
> - - - - - - - - - - - - - - - - - - - -
>



-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>

Re: wiquery ResizableBehavior weird results on stop

Posted by Pieter Claassen <pi...@musmato.com>.
Ernesto,

Ok, I implemented your changes but something very strange is happening. In
my callback, I get the resizeHeight and resizeWidth values of the previous
window resize event, not the current one.

I don't really know how to debug this other than drag the window smaller
and larger and checking whether the values increase or decrease.

Any suggestion for how to debug this?

Regards,
Pieter



On Sat, Mar 9, 2013 at 4:56 PM, Ernesto Reinaldo Barreiro <
reiern70@gmail.com> wrote:

> Pieter,
>
> I have just fixed wiquery to support the stop event. See commit
>
>
> https://github.com/WiQuery/wiquery/commit/c2e8242c9d1aba9ae64f7c67654e0e6539d36b78
>
> On problem there is that parameter coming form client are float values. I
> have added a test panel and ResizableStopAjaxBehavior seems to be working
> as expected.
>
> Hope this helps.
>
> Cheers.
>
> Ernesto
>
>
> On Sat, Mar 9, 2013 at 2:55 PM, Pieter Claassen <pi...@musmato.com>
> wrote:
>
> > I am still only interested in getting the size of a component on resize
> > stop.
> >
> > Below is my code that I use to try and implement a call back to only call
> > on "stop". However, the x and y sizes I get are all over the place. Not
> at
> > all corresponding with the window sizes I actually see when  resizing.
> >
> > I am using wiquery 6.2.0 and wicket 6.5.0.
> >
> > Any advice as to what I am doing wrong?
> >
> > Regards,
> > Pieter
> >
> >         MyResizableBehavior resizableBehavior = new
> MyResizableBehavior();
> >         resizableBehavior.setStopEvent(new
> > MyResizableBehavior.AjaxResizeStopCallback() {
> >             @Override
> >             protected void resize(AjaxRequestTarget target, Component
> > source, int resizeHeight, int resizeWidth) {
> >                 AdvancedFormatter advancedFormatter =
> > questionBaseWebModel.getEntity().getStatement().getFormatter();
> >                 advancedFormatter.setWidth((float) resizeWidth / 800 *
> > 100);
> >                 advancedFormatter.setHeight((float) resizeHeight);
> >                 System.out.println("Width:"+resizeWidth+"
> > Height:"+resizeHeight);
> >                 advancedFormatterFactory.save(advancedFormatter);
> >             }
> >
> >         });
> >
> > resizableBehavior.setAutoHide(true).setGhost(true).setAnimate(true);
> >         resizableBehavior.setGrid(50, 50);
> >
> > ....
> >
> > public class MyResizableBehavior extends ResizableBehavior {
> >     public abstract static class AjaxResizeStopCallback extends
> > AbstractAjaxEventCallback
> >     {
> >         private static final long serialVersionUID = 1L;
> >
> >         public AjaxResizeStopCallback()
> >         {
> >             super("stop");
> >         }
> >
> >         @Override
> >         protected List<CallbackParameter> getExtraParameters()
> >         {
> >             List<CallbackParameter> ret = super.getExtraParameters();
> >             ret.add(CallbackParameter.resolved("resizeHeight",
> > ResizableBehavior.UI_SIZE
> >                     + ".height"));
> >             ret.add(CallbackParameter.resolved("resizeWidth",
> > ResizableBehavior.UI_SIZE + ".width"));
> >             return ret;
> >         }
> >
> >         @Override
> >         public final void call(AjaxRequestTarget target, Component
> source)
> >         {
> >             IRequestParameters req =
> > RequestCycle.get().getRequest().getRequestParameters();
> >
> >             int resizeHeight =
> > req.getParameterValue("resizeHeight").toInt(-1);
> >             int resizeWidth =
> > req.getParameterValue("resizeWidth").toInt(-1);
> >             resize(target, source, resizeHeight, resizeWidth);
> >         }
> >
> >         protected abstract void resize(AjaxRequestTarget target,
> Component
> > source,
> >                                        int resizeHeight, int
> resizeWidth);
> >     }
> >
> >
> >     public MyResizableBehavior
> > setStopEvent(MyResizableBehavior.AjaxResizeStopCallback callback){
> >
> >         setEventListener(callback);
> >         return this;
> >     }
> > }
> >
> >
> >
> > --
> > - - - - - - - - - - - - - - - - - - - -
> >   Pieter Claassen
> >   Musmato B.V.
> >   e: pieter.claassen@musmato.com
> >   t NL: +31 (20) 893 4337
> >   t ZA: + 27 (0) 81 826 8166
> >   w: http://musmato.com
> > - - - - - - - - - - - - - - - - - - - -
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
> Antilia Soft
> http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>



-- 
- - - - - - - - - - - - - - - - - - - -
  Pieter Claassen
  Musmato B.V.
  e: pieter.claassen@musmato.com
  t NL: +31 (20) 893 4337
  t ZA: + 27 (0) 81 826 8166
  w: http://musmato.com
- - - - - - - - - - - - - - - - - - - -

Re: wiquery ResizableBehavior weird results on stop

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Pieter,

I have just fixed wiquery to support the stop event. See commit

https://github.com/WiQuery/wiquery/commit/c2e8242c9d1aba9ae64f7c67654e0e6539d36b78

On problem there is that parameter coming form client are float values. I
have added a test panel and ResizableStopAjaxBehavior seems to be working
as expected.

Hope this helps.

Cheers.

Ernesto


On Sat, Mar 9, 2013 at 2:55 PM, Pieter Claassen <pi...@musmato.com> wrote:

> I am still only interested in getting the size of a component on resize
> stop.
>
> Below is my code that I use to try and implement a call back to only call
> on "stop". However, the x and y sizes I get are all over the place. Not at
> all corresponding with the window sizes I actually see when  resizing.
>
> I am using wiquery 6.2.0 and wicket 6.5.0.
>
> Any advice as to what I am doing wrong?
>
> Regards,
> Pieter
>
>         MyResizableBehavior resizableBehavior = new MyResizableBehavior();
>         resizableBehavior.setStopEvent(new
> MyResizableBehavior.AjaxResizeStopCallback() {
>             @Override
>             protected void resize(AjaxRequestTarget target, Component
> source, int resizeHeight, int resizeWidth) {
>                 AdvancedFormatter advancedFormatter =
> questionBaseWebModel.getEntity().getStatement().getFormatter();
>                 advancedFormatter.setWidth((float) resizeWidth / 800 *
> 100);
>                 advancedFormatter.setHeight((float) resizeHeight);
>                 System.out.println("Width:"+resizeWidth+"
> Height:"+resizeHeight);
>                 advancedFormatterFactory.save(advancedFormatter);
>             }
>
>         });
>
> resizableBehavior.setAutoHide(true).setGhost(true).setAnimate(true);
>         resizableBehavior.setGrid(50, 50);
>
> ....
>
> public class MyResizableBehavior extends ResizableBehavior {
>     public abstract static class AjaxResizeStopCallback extends
> AbstractAjaxEventCallback
>     {
>         private static final long serialVersionUID = 1L;
>
>         public AjaxResizeStopCallback()
>         {
>             super("stop");
>         }
>
>         @Override
>         protected List<CallbackParameter> getExtraParameters()
>         {
>             List<CallbackParameter> ret = super.getExtraParameters();
>             ret.add(CallbackParameter.resolved("resizeHeight",
> ResizableBehavior.UI_SIZE
>                     + ".height"));
>             ret.add(CallbackParameter.resolved("resizeWidth",
> ResizableBehavior.UI_SIZE + ".width"));
>             return ret;
>         }
>
>         @Override
>         public final void call(AjaxRequestTarget target, Component source)
>         {
>             IRequestParameters req =
> RequestCycle.get().getRequest().getRequestParameters();
>
>             int resizeHeight =
> req.getParameterValue("resizeHeight").toInt(-1);
>             int resizeWidth =
> req.getParameterValue("resizeWidth").toInt(-1);
>             resize(target, source, resizeHeight, resizeWidth);
>         }
>
>         protected abstract void resize(AjaxRequestTarget target, Component
> source,
>                                        int resizeHeight, int resizeWidth);
>     }
>
>
>     public MyResizableBehavior
> setStopEvent(MyResizableBehavior.AjaxResizeStopCallback callback){
>
>         setEventListener(callback);
>         return this;
>     }
> }
>
>
>
> --
> - - - - - - - - - - - - - - - - - - - -
>   Pieter Claassen
>   Musmato B.V.
>   e: pieter.claassen@musmato.com
>   t NL: +31 (20) 893 4337
>   t ZA: + 27 (0) 81 826 8166
>   w: http://musmato.com
> - - - - - - - - - - - - - - - - - - - -
>



-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>