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 <[email protected]> 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: [email protected] > 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>
