Ok, I just implemented my own. Seems to work.

In my code
        MyResizableBehavior resizableBehavior = new MyResizableBehavior();
        resizableBehavior.setStopEvent(new
MyResizableBehavior.AjaxResizeStopCallback() {
            @Override
            protected void resize(AjaxRequestTarget target, Component
source, int resizeHeight, int resizeWidth) {
....
            }

        });


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;
    }
}


On Wed, Jan 30, 2013 at 3:15 PM, Pieter Claassen <[email protected]> wrote:

> Ernesto,
>
> I cannot find any code in wiquery-6.2.0. that hooks into the stopEvent.
> The example you provided seems to still force a round trip on any change,
> not just on stopEvent.
>
> Maybe I am daft, but I don't see any code that does this? I assume one can
> extend ResizableBehaviour and add the stopEvent code to hook into a
> callback, but I don't want to do this if this functionality already exists
> and I just can't find it.
>
> Thanks for the help.
> Pieter
>
>
> On Wed, Jan 30, 2013 at 3:00 PM, Ernesto Reinaldo Barreiro <
> [email protected]> wrote:
>
>> Pieter,
>>
>> Look at this example.
>>
>>
>> http://antiliasoft.com/wiquery-plugins/?wicket:bookmarkablePage=:com.wiquery.plugins.demo.ResizablePage
>>
>> and click on the ? at the left corner/. It is exactly what you want...
>> Wiquery  already have a ResizableAjaxBehavior that hooks into stopEvent.
>> Fell free to copy or adapt it to your needs;-). Let me know if I can
>> further help you somehow.
>>
>> On Wed, Jan 30, 2013 at 2:46 PM, Pieter Claassen <[email protected]>
>> wrote:
>>
>> > Ernesto/Sebastien,
>> >
>> > I am stuck :-(
>> >
>> > Firstly, thanks for the resizablePanel in wicket-jquery-ui, but I have
>> to
>> > hold off until this code is implemented in a behavior since my
>> inheritance
>> > doesn't match your project (I cannot inherit from resizablePanel).
>> >
>> > I looked at what was available in wiquery and found the functionality
>> > there, except.....
>> >
>> > When I implement the code below, I force an ajax round-trip to the
>> service
>> > whenever the re-size event is triggered which is a lot during a
>> > panel re-size  This is not practical with the the model updates. Ideally
>> > one would like to only update the position on stopEvents but the API
>> > provides only for the setting of a JavaScript callback on stopEvents.
>> >
>> > Does anybody have a suggestion on how to make this behavior practically
>> > usable?
>> >
>> > Thanks,
>> > Pieter
>> >
>> >
>> >  ResizableBehavior resizableBehavior = new ResizableBehavior();
>> >     resizableBehavior.setResizeEvent(new
>> > ResizableBehavior.AjaxResizeCallback() {
>> >             @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);
>> >                 advancedFormatterFactory.save(advancedFormatter);
>> >             }
>> >
>> >         });
>> >
>> > This is available but only for JavaScript callbacks
>> >
>> >  resizableBehavior.setStopEvent(JsScopeUiEvent.quickScope("alert();"));
>> >
>> >
>> >
>> >
>> >
>> > On Mon, Jan 28, 2013 at 8:28 AM, Ernesto Reinaldo Barreiro <
>> > [email protected]> wrote:
>> >
>> > > Hi,
>> > >
>> > > On Mon, Jan 28, 2013 at 7:45 AM, Pieter Claassen <[email protected]>
>> > > wrote:
>> > >
>> > > > This is a general best practice question. I am using
>> wicket-jquery-ui
>> > > > because I don't seem to be able to find a resizable panel in the
>> > > > internal wicket ajax widgets.
>> > > >
>> > > > 1. Is there no problem loading new jquery libraries over the wicket
>> > > > implementation? What is best practice?
>> > > >
>> > >
>> > > Look at the existing jquery integrations and see what people do?
>> > >
>> > >
>> > >
>> > > > 2. I am looking for a way to get the resized panels' x and y size
>> > > > parameters into my wicket code? Any suggestions how to do this?
>> > > >
>> > > > You have to:
>> > >
>> > > 1-Hook onto the client side events triggered by resize and use
>> > > Wicket.AJA.get/post to stream back the parameters.
>> > > 2-Attach and AJAX behavior at server side component and on respond get
>> > and
>> > > parse those parameter.
>> > >
>> > > Examples?
>> > >
>> > >
>> > >
>> >
>> https://github.com/WiQuery/wiquery/blob/master/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/slider/AjaxSlider.java
>> > >
>> > >
>> >
>> https://github.com/WiQuery/wiquery/blob/master/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/tabs/Tabs.java
>> > >
>> > > or event better
>> > >
>> > >
>> > >
>> >
>> https://github.com/WiQuery/wiquery/blob/master/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/resizable/ResizableBehavior.java
>> > >
>> > > wihc already have that functionality (see AjaxResizeCallback)
>> > >
>> > >
>> > >
>> > > > Thanks,
>> > > > Pieter
>> > > >
>> > > >
>> ---------------------------------------------------------------------
>> > > > To unsubscribe, e-mail: [email protected]
>> > > > For additional commands, e-mail: [email protected]
>> > > >
>> > > >
>> > >
>> > >
>> > > --
>> > > Regards - Ernesto Reinaldo Barreiro
>> > > Antilia Soft
>> > > http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>> > >
>> >
>> >
>> >
>> > --
>> > - - - - - - - - - - - - - - - - - - - -
>> >   Pieter Claassen
>> >   Musmato B.V.
>> >   e: [email protected]
>> >   t: +31 877 848259
>> >   w: http://musmato.com
>> > - - - - - - - - - - - - - - - - - - - -
>> >
>>
>>
>>
>> --
>> Regards - Ernesto Reinaldo Barreiro
>> Antilia Soft
>> http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>>
>
>
>
> --
> - - - - - - - - - - - - - - - - - - - -
>   Pieter Claassen
>   Musmato B.V.
>   e: [email protected]
>   t: +31 877 848259
>   w: http://musmato.com
> - - - - - - - - - - - - - - - - - - - -
>



-- 
- - - - - - - - - - - - - - - - - - - -
  Pieter Claassen
  Musmato B.V.
  e: [email protected]
  t: +31 877 848259
  w: http://musmato.com
- - - - - - - - - - - - - - - - - - - -

Reply via email to