getCallbackUrl question

View: New views
3 Messages — Rating Filter:   Alert me  

getCallbackUrl question

by egolan74 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
I am playing around with WiQuery which looks very cool.
In their examples they show an advanced dialog that uses
AbstractDefaultAjaxBehavior#getCallbackUrl
In the example, the behavior is added to a page.
Then, in the script (I'll put it below), the 'getCallbackUrl' is called.

The problem I am having is that my dialog is located inside a Panel.
I create everything in the constructor, so when that method is being called,
I get the IllegalStateException from Component#getPage that is being called
indirectly from getCallbackUrl .

My solution was to add the dialog to the onBeforeRender of the panel.

Is this the only way to fix the problem?

Here's the script that the WiQuery button of the WiQuery Dialog has:
        buttonsAdv.add(new DialogButton("Save",
JsScope.quickScope("wicketSubmitFormById('" + "form" + "','"
                + *deleteSnapshotFormAjaxBehavior.getCallbackUrl(false)* +
"', null, null, null, null, null);")));

and here's the behavior:
        deleteSnapshotFormAjaxBehavior = new AbstractDefaultAjaxBehavior() {
            private static final long serialVersionUID = 1L;

            /* (non-Javadoc)
             * @see
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#respond(org.apache.wicket.ajax.AjaxRequestTarget)
             */
            @Override
            protected void respond(AjaxRequestTarget target) {
                getSession().cleanupFeedbackMessages();
                extractionManager.deleteSnapshot(snapshotToDelete);
                target.addComponent(snapshotsTable);
                target.addComponent(feedback);
                info(getString("extract.rdb.message.snapshot.deleted", new
Model(snapshotToDelete)));
                snapshotToDelete = null;
                advancedDialog.close(target);
            }
        };


Thanks for help...

Eyal Golan
egolan74@...

Visit: http://jvdrums.sourceforge.net/
LinkedIn: http://www.linkedin.com/in/egolan74

P  Save a tree. Please don't print this e-mail unless it's really necessary
Eyal Golan
egolan74@...

Visit: JVDrums
LinkedIn: LinkedIn

Re: getCallbackUrl question

by egolan74 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Any one ?
Eyal Golan
egolan74@...

Visit: JVDrums
LinkedIn: LinkedIn

Re: getCallbackUrl question

by vineet semwal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

i have not used wiquery but I do the same in such cases ,
in some cases i attach the placeholder for components in panel constructor
and
replace them in onbeforerender

component.getPage() inside panel constructor is wrong because panel is
attached after
instantiation,


--
regards,
Vineet Semwal

On Mon, Nov 9, 2009 at 1:15 AM, Eyal Golan <egolan74@...> wrote:

> Any one ?
>