Toggle Menu [-]

Busy again :)) - update

Published by admin on Tuesday, July 21, 2009 - 15:30:28 - Filed under General, News, Plugins/beans, Servoy, Java

In the end I have found a workaround for the plugin problem in Firefox and in modal dialogs in IE. (A few minutes after I had finished the last blog entry in fact :))

You temember that it was the fact that I needed to add some code to the html header for the plugin call to work, mainly <script src=”…”> tags for jQuery and blockUI plugin, a CSS reference and some custom method code…

I discovered that Firefox didn’t like the insertion from an Ajax call, and IE didn’t like it either in case of a modal dialog. When you actualized you page, the code was added in the header from the previous call to the plugin (and was there for each subsequent calls), so it was OK after the first use.

That really annoyed me for a while…
And I was going to ask for a feature request for some static method in a global IPageContributor, or something like a addPermanentHeaderContribution() method (which I still think could be a great addition to the API), but I was not having too much hope to see it anytime soon.

So I imagined that if I couldn’t rely on the API to do it, maybe I could ask the user, so I added a prepare() method to the plugin to be used in the onShow event of the form where you will lately call the plugin (it doesn’t work in the onLoad though, for some reason). And that did the trick!

So if you plan to use the plugin in the web client on a form, you just need to add this code in a method called by the the “onShow” event of the form:

if (application.getApplicationType() == 5) {
    plugins.busy.prepare();
}

That’s it, and it only took me a few lines in 3 classes!

So the morale of the story is: if the API can’t do it, ask your users to do it instead ;-)