dialog component (wiquery) and ajax

3 messages Options
Embed this post
Permalink
Decebal Suiu

dialog component (wiquery) and ajax

Reply Threaded More More options
Print post
Permalink
Hello

I have some troubles with a dialog component in a web page when I use ajax.
Bellow is my code (in WebPage):

                final Dialog modal = new Dialog("modal");
                modal.setOutputMarkupId(true);
                modal.add(new EmptyPanel("child"));
                add(modal);
               
                AjaxLink<String> renameLink = new AjaxLink<String>("rename") {
                       
                        @Override
                        public void onClick(AjaxRequestTarget target) {
                                modal.setTitle("Rename");
                                modal.setWidth(250);
                                modal.setHeight(100);
                                modal.replace(new RenamePanel("child", getSelectedEntity()) {

                                        @Override
                                        public void onRename(AjaxRequestTarget target, Entity entity) {
                                            // do something
                                        }

                                });
                                modal.setAutoOpen(true);
                                target.addComponent(modal);
                        }
                       
                };
                add(renameLink);


When I click on rename link I retrieves an error

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:174)
        at java.lang.StringBuilder.charAt(StringBuilder.java:55)
        at org.odlabs.wiquery.core.javascript.JsStatement.render(JsStatement.java:198)
        at org.odlabs.wiquery.core.javascript.JsQuery.renderHead(JsQuery.java:187)
        at org.odlabs.wiquery.core.commons.WiQueryCoreHeaderContributor.renderHead(WiQueryCoreHeaderContributor.java:123)
        at org.apache.wicket.behavior.AbstractHeaderContributor.renderHead(AbstractHeaderContributor.java:67)
        at org.apache.wicket.Component.renderHead(Component.java:2698)
        at org.apache.wicket.ajax.AjaxRequestTarget.respondHeaderContribution(AjaxRequestTarget.java:1046)
        at org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget.java:773)
        at org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:667)
        at org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:579)
        at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
        at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1244)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1315)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1414)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:542)

I use wicket 1.4-rc2 and wiquery form svn/branches/1.0-alpha. What can I do?

Thanks,
Decebal

Lionel Armanet

Re: dialog component (wiquery) and ajax

Reply Threaded More More options
Print post
Permalink
Hi, it seems that the JsStatement class fails with your code. I think it's a bug of the alpha version.

I'll correct that ASAP, sorry for the inconvenience.

On Tue, Apr 21, 2009 at 12:57 PM, Decebal Suiu (via Nabble) <[hidden email]> wrote:
Hello

I have some troubles with a dialog component in a web page when I use ajax.
Bellow is my code (in WebPage):

                final Dialog modal = new Dialog("modal");
                modal.setOutputMarkupId(true);
                modal.add(new EmptyPanel("child"));
                add(modal);
               
                AjaxLink<String> renameLink = new AjaxLink<String>("rename") {
                       
                        @Override
                        public void onClick(AjaxRequestTarget target) {
                                modal.setTitle("Rename");
                                modal.setWidth(250);
                                modal.setHeight(100);
                                modal.replace(new RenamePanel("child", getSelectedEntity()) {

                                        @Override
                                        public void onRename(AjaxRequestTarget target, Entity entity) {
                                            // do something
                                        }

                                });
                                modal.setAutoOpen(true);
                                target.addComponent(modal);
                        }
                       
                };
                add(renameLink);


When I click on rename link I retrieves an error

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:174)
        at java.lang.StringBuilder.charAt(StringBuilder.java:55)
        at org.odlabs.wiquery.core.javascript.JsStatement.render(JsStatement.java:198)
        at org.odlabs.wiquery.core.javascript.JsQuery.renderHead(JsQuery.java:187)
        at org.odlabs.wiquery.core.commons.WiQueryCoreHeaderContributor.renderHead(WiQueryCoreHeaderContributor.java:123)
        at org.apache.wicket.behavior.AbstractHeaderContributor.renderHead(AbstractHeaderContributor.java:67)
        at org.apache.wicket.Component.renderHead(Component.java:2698)
        at org.apache.wicket.ajax.AjaxRequestTarget.respondHeaderContribution(AjaxRequestTarget.java:1046)
        at org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget.java:773)
        at org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget.java:667)
        at org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:579)
        at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
        at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1244)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1315)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1414)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:542)

I use wicket 1.4-rc2 and wiquery form svn/branches/1.0-alpha. What can I do?

Thanks,
Decebal




--
__________________________________

Lionel Armanet
WickeXt becomes WiQuery ! http://code.google.com/p/wiquery
gmail: lionel.armanet*at*gmail.com


Decebal Suiu

Re: dialog component (wiquery) and ajax

Reply Threaded More More options
Print post
Permalink
With the last version from svn the error disappears but the dialog box isn't showing up on click.
I changed "modal.setAutoOpen(true)" with "modal.open(target)" in the onClick() method but with the same result.
Any idea is welcome.