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: [email protected]
  t NL: +31 (20) 893 4337
  t ZA: + 27 (0) 81 826 8166
  w: http://musmato.com
- - - - - - - - - - - - - - - - - - - -

Reply via email to