You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by sorinev <so...@gmail.com> on 2016/10/06 15:49:43 UTC
7.3 : javascript attached to extended AjaxButton
We are upgrading from 1.4.17 to 7.3. A handful of runtime issues remain now
that all the build errors are fixed. One of them is in regards to the
AjaxButton, which we extended.
In 1.4.17 this was the class
The relevant javascript file is
After upgrading to 7.3, the update class, to fix build errors and most
runtime problems is
After upgrading to 7.3 the class now looks like this to fix build errors and
all but the runtime error at hand (so far)
When a page with this button is loaded, this stack dump appears.
Putting a break point in the debugger in the wicket classes shows that it's
treating the images folder in the deployment as a class to be loaded :
"wicket", "bookmarkable", "images", "ajax-loader.gif". ajax-loader.gif is a
file referenced by the javascript file that is attached to the button. It is
located in the images folder of the war deployment
(webapp/images/ajax-loader.gif).
This all worked just fine in 1.4.17, but something seems to be different in
7.3 in regards to this such that I've missed something when updating our
extended AjaxButton class to this version.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/7-3-javascript-attached-to-extended-AjaxButton-tp4675692.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: 7.3 : javascript attached to extended AjaxButton
Posted by Martin Grigorov <mg...@apache.org>.
panel.setBody("<center><img src=\"images/ajax-loader.gif\"/></center>")
This seems to create an <img> HTML element with JavaScript with src that is
relative to the current url in the address bar, i.e. the page url.
Wicket behaves properly.
Probably you need to mount the page at a specific url to make it working.
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Fri, Oct 21, 2016 at 12:47 AM, sorinev <so...@gmail.com> wrote:
> 1. We extend AjaxButton.
> 2. In renderHead(), we do a JavaScriptReferenceHeaderItem with a
> JavaScriptResourceReference that has a javascript file that is local to our
> class.
> 3. Inside the javascript file there is a yahoo widget panel that does this:
> panel.setBody("<center> <\"images/ajax-loader.gif\"> </center>").
>
> So it appears to be resolved relative to the page. I've tried many
> different
> ways to load an image, but they mostly seem to rely on manually adding a
> html tag in the file and giving it a wicket:id, but this image is not
> loaded
> in the standard wicket component way.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/7-3-javascript-attached-to-extended-
> AjaxButton-tp4675692p4675858.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: 7.3 : javascript attached to extended AjaxButton
Posted by sorinev <so...@gmail.com>.
1. We extend AjaxButton.
2. In renderHead(), we do a JavaScriptReferenceHeaderItem with a
JavaScriptResourceReference that has a javascript file that is local to our
class.
3. Inside the javascript file there is a yahoo widget panel that does this:
panel.setBody("<center> <\"images/ajax-loader.gif\"> </center>").
So it appears to be resolved relative to the page. I've tried many different
ways to load an image, but they mostly seem to rely on manually adding a
html tag in the file and giving it a wicket:id, but this image is not loaded
in the standard wicket component way.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/7-3-javascript-attached-to-extended-AjaxButton-tp4675692p4675858.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: 7.3 : javascript attached to extended AjaxButton
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
First you need to find how the url for the image is created.
Usually images are either in your Page, i.e. you use Image component.
Or they are referenced inside .css files. In this case if the urls are
relatetive then the request url should be like:
.../wicket/resource/com.example.SomeComponent/.../images/some.png.
If the url is
.../wicket/bookmarkable/com.example.SomePage/.../images/some.png then the
image is resolved relative to the current page, i.e. you have something
like <img src="images/some.png"/> in your html.
Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Thu, Oct 6, 2016 at 5:49 PM, sorinev <so...@gmail.com> wrote:
> We are upgrading from 1.4.17 to 7.3. A handful of runtime issues remain now
> that all the build errors are fixed. One of them is in regards to the
> AjaxButton, which we extended.
>
> In 1.4.17 this was the class
>
>
>
> The relevant javascript file is
>
>
>
> After upgrading to 7.3, the update class, to fix build errors and most
> runtime problems is
>
>
>
> After upgrading to 7.3 the class now looks like this to fix build errors
> and
> all but the runtime error at hand (so far)
>
>
>
> When a page with this button is loaded, this stack dump appears.
>
>
>
> Putting a break point in the debugger in the wicket classes shows that it's
> treating the images folder in the deployment as a class to be loaded :
> "wicket", "bookmarkable", "images", "ajax-loader.gif". ajax-loader.gif is a
> file referenced by the javascript file that is attached to the button. It
> is
> located in the images folder of the war deployment
> (webapp/images/ajax-loader.gif).
>
> This all worked just fine in 1.4.17, but something seems to be different in
> 7.3 in regards to this such that I've missed something when updating our
> extended AjaxButton class to this version.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/7-3-javascript-attached-to-extended-
> AjaxButton-tp4675692.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>