Re: wiquery ResizableBehavior weird results on stop

2013-03-09 Thread Pieter Claassen
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 <
reier...@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 
> 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 getExtraParameters()
> > {
> > List 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.claas...@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/ 
>



-- 
- - - - - - - - - - - - - - - - - - - -
  Pieter Claassen
  Musmato B.V.
  e: pieter.claas...@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

2013-03-09 Thread Ernesto Reinaldo Barreiro
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  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 getExtraParameters()
> {
> List 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.claas...@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/ 


wiquery ResizableBehavior weird results on stop

2013-03-09 Thread Pieter Claassen
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 getExtraParameters()
{
List 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.claas...@musmato.com
  t NL: +31 (20) 893 4337
  t ZA: + 27 (0) 81 826 8166
  w: http://musmato.com
- - - - - - - - - - - - - - - - - - - -


Re: Wicket 6: AjaxFormComponentUpdatingBehavior on dropdown leads to page reload

2013-03-09 Thread Martin Dietze
On Sat, March 09, 2013, Bernard wrote:

> I would try to debug the constructor of the page and/or override and
> debug life cycle methods of the page and then work up the call stack
> why they are executed.

Thank you for your reply. Having slept a night over it I found
the problem. Like a couple of times before, whenever it comes to
request handling in a Wicket 1.5+ system, debugging mapRequest()
in CompountRequestMapper is extremely helpful for understanding
how your system works :)

In my case one from a number of custom page mappers in my
system (most of which derive from or wrap a MountedMapper) was
the culprit. After doing some magic on the request, in
mapRequest() it just returned a RenderPageRequestHandler instead
of passing the request on to super.mapRequest().

I actually like the RequestMappers introduced in 1.5, but being
so powerful they also exhibit plenty of ways to shoot yourself
into the foot and produce rather bizarre effects..

Cheers,

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
In an organization, each person rises to the level of his own incompetency.
   -- The Peter Principle 

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org