Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Java applet in browser widget covers modal dialogs
Java applet in browser widget covers modal dialogs [message #996992] Thu, 03 January 2013 11:02 Go to next message
Tiburon T is currently offline Tiburon TFriend
Messages: 53
Registered: October 2011
Member
Hello!

I am working on some kind of custom widget, that is composed of a Java Applet embedded in an html page and displayed in a browser widget within an RAP application. The applet and the application communicate via BrowserFunction and JavaScript.
It works quite well, but I have a problem with modal dialogs that should cover parts of the applet. The applet is always displayed on top of everything... If I hide the browser widget by setting its visibility to false everything works fine, so I thought maybe I could do that anytime a modal dialog is shown.
Therefore I am now looking for some kind of event that is sent to the widget or its parent shell when it should get disabled. It is not possible to hide the browser manually for every dialog, because it needs to be done for system dialogs like the session timeout notification as well.
I tried to attach nearly all available listeners including DisposeListener, ShellListener(and ShellAdapter) and PaintListener, but none is called at the right moment.
Am I missing something or is there no such event?
Of course any other idea on how to hide the applet would be highly appreciated, too.

[Updated on: Thu, 03 January 2013 11:03]

Report message to a moderator

Re: Java applet in browser widget covers modal dialogs [message #997100 is a reply to message #996992] Thu, 03 January 2013 16:48 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 387
Registered: July 2009
Senior Member
Hi.

> its parent shell when it should get disabled. It is not possible to hide
> the browser manually for every dialog, because it needs to be done for
> system dialogs like the session timeout notification as well.

When a connection error like session timeout appears, the server has no
more control over the client, therefore i think this is not possible to
properly fix with only Java. We had issues like this before, browser
widgets (and other custom widgets) may render over overlaying elements,
or consume events. (See Bug 370901 [1], which also discusses a possible
fix.)

I think this could be regarded as a bug in RAP, as it is a known browser
limitation that can currently not be worked around by application
developers. I suggest you open a bugzilla entry [2], though i don't
think a change this big will be part of any service release, so you
might have to update if it gets fixed.

Greetings,
Tim


[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=370901
[2] http://eclipse.org/rap/bugs/

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Java applet in browser widget covers modal dialogs [message #997188 is a reply to message #997100] Fri, 04 January 2013 11:02 Go to previous messageGo to next message
Tiburon T is currently offline Tiburon TFriend
Messages: 53
Registered: October 2011
Member
Hello,

thank you for your support Tim.

I did some more research this morning and found the following:

- The problem does not exist in Mozilla Firefox (even menus and regular modal dialogs are drawn over the applet correctly)

- Issues with the z-index of iframes containing flash or applets seem to be very common and the most popular workaround is putting everything that is supposed to be drawn above the iframe in iframes also (iframe shimming)

As a side note: Wouldn't it be a good idea to put at least the timeout notification into its own iframe?

- It is possible to hide the applet by setting the "display" css property to none, which can be done with javascript from within the html-page displayed in the iframe.

The last point would actually fix the issue for us for now, and I am trying to implement a JavaScript function for it. Therefore I am looking for a way to be notified in javascript, when the gray div (z-index 100000) is shown, that is supposed to shadow the page behind the session timeout notification (z-index 100001). Can you give me a hint if there is an event or anything I could attach a new listener to?

Greetings
Tiburon


[Updated on: Fri, 04 January 2013 11:06]

Report message to a moderator

Re: Java applet in browser widget covers modal dialogs [message #997620 is a reply to message #997188] Fri, 04 January 2013 17:58 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 387
Registered: July 2009
Senior Member
Hi.

> As a side note: Wouldn't it be a good idea to put at least the timeout
> notification into its own iframe?

This would be good quickfix for that specific issue, but we can't do
that on all elements that might hover over an iframe.

>
> - It is possible to hide the applet by setting the "display" css
> property to none, which can be done with javascript from withing the
> html-page displayed in the iframe.

That would be the same as hiding the entire browser widget i think.

> The last point would actually fix the issue for us for now, and I am
> trying to implement a function for it. Therefore I am looking for a way
> to be notified in javascript, when the gray div (z-index 100000) is
> shown, that is supposed to shadow the page behind the session timeout
> notification (z-index 100001). Can you give me a hint if there is an
> event or anything I could attach a new listener to?

As i explained, this can only be done in JavaScript, and currently only
with internal API. While i can point you to the right API if you tell me
what RAP version exactly you are using, there are two issues:
a) Using internal API will mean it can break anytime.
b) Once you are notified in javascript, how do you access the browser
widget?

These are the reasons i think the framework has to solve this, or at
least has to provide some sort of workaround.

Greetings,
Tim

> Greetings
> Tiburon
>
>
>

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Java applet in browser widget covers modal dialogs [message #997717 is a reply to message #996992] Tue, 08 January 2013 15:42 Go to previous messageGo to next message
Tiburon T is currently offline Tiburon TFriend
Messages: 53
Registered: October 2011
Member
Hi,

Quote:

> The last point would actually fix the issue for us for now, and I am
> trying to implement a function for it. Therefore I am looking for a way
> to be notified in javascript, when the gray div (z-index 100000) is
> shown, that is supposed to shadow the page behind the session timeout
> notification (z-index 100001). Can you give me a hint if there is an
> event or anything I could attach a new listener to?

As i explained, this can only be done in JavaScript, and currently only
with internal API. While i can point you to the right API if you tell me
what RAP version exactly you are using, there are two issues:
a) Using internal API will mean it can break anytime.
b) Once you are notified in javascript, how do you access the browser
widget?


It would be great if you could point me to the event for RAP 1.5.0.20120612-1510. It is not necessary to access the browser widget. The Java applet is embedded in a HTML document which is displayed inside the browser. In this document I can hide the applet using the CSS property display, which can be changed dynamically with JavaScript. Here is a small example:

<html>
    <head>
        <title>...</title>
    </head>
    <body style="overflow:hidden">
   	    <embed id="applet" style = "display:block;"
       		...
       	    />
	    <script type="text/javascript">
	    	hideApplet = function hideApplet(){
				document.getElementById('applet').style.display = 'none';
			};
	    </script>
    </body>
</html>


I am aware, that this is just a quick fix that can break anytime soon, but it would really help if I could implement it without changing to a newer version immediately.
I would be happy to provide a bug report and hope for a better solution in a future version.

Greeting
Tiburon


Re: Java applet in browser widget covers modal dialogs [message #997810 is a reply to message #997717] Tue, 08 January 2013 19:41 Go to previous messageGo to next message
Zach Toups is currently offline Zach ToupsFriend
Messages: 1
Registered: January 2013
Junior Member
Hey, Tiburon-

We've encountered the exact same problem; unfortunately the shim solution does not work.

What is working for me right now is to hide and show the applet using the style property visibility. To detect when to hide/show, in my Composite (that contains the Browser with the webpage with the applet), I listen for SWT.Show, SWT.Hide, SWT.Close, and SWT.Dispose by invoking:

PlatformUI.getWorkbench().getDisplay().addFilter(...)


In my handleEvent(...) method, I only look at instances of Shell, and I keep track of all of the Shells that have popped up (so hide the applet for the first, then show it after the last one has been been cleared (SWT.Hide, SWT.Close, and SWT.Dispose).

So far so good, it's been working great.

Hope that helps!

All best,
-Zach
Re: Java applet in browser widget covers modal dialogs [message #998048 is a reply to message #997810] Wed, 09 January 2013 09:02 Go to previous messageGo to next message
Tiburon T is currently offline Tiburon TFriend
Messages: 53
Registered: October 2011
Member
Hi Zach,

thank you, that is a great hint on how to generally hide the applet for all SWT shells overlaying it.

Unfortunately this does not work for all elements, such as the session timeout dialog, because it is not a SWT shell(as I understand it) and thus does not trigger the listener. That is why I am trying to find an additional way around that using JavaScript.

Greetings
Tiburon

Re: Java applet in browser widget covers modal dialogs [message #1001740 is a reply to message #997717] Thu, 17 January 2013 10:05 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 387
Registered: July 2009
Senior Member
Hi.

I'm very sorry, i didn't see your post for a while. Did you answer to
your own post instead of mine? Anyway:

> It would be great if you could point me to the event for RAP
> 1.5.0.20120612-1510. It is not necessary to access the browser widget.

While i still doubt the last part, here is how to add the listeners:

var blocker = qx.ui.core.ClientDocument.getInstance()._getBlocker();
blocker.addEventListener( "appear", function() { } );
blocker.addEventListener( "disappear", function() { } );

By the way, we have a bug for this by now:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=397557

Greetings,
Tim
--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Java applet in browser widget covers modal dialogs [message #1002502 is a reply to message #1001740] Fri, 18 January 2013 18:07 Go to previous messageGo to next message
Tiburon T is currently offline Tiburon TFriend
Messages: 53
Registered: October 2011
Member
Hi,

thanks a lot Tim, no need to be sorry! I just tried the code you provided, unfortunately "qx" is undefined in the HTML page displayed in the browser widget. Do I have to wrap some qx.Class.define around it? I will try it again on monday.

Greetings,
Tiburon
Re: Java applet in browser widget covers modal dialogs [message #1003464 is a reply to message #1002502] Mon, 21 January 2013 09:37 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 387
Registered: July 2009
Senior Member
Hi.


> provided, unfortunately "qx" is undefined in the HTML page displayed in
> the browser widget. Do I have to wrap some qx.Class.define around it? I

Now i understand what you are trying to do.
No, the qx is undefined because it is part of the parent frame.
Therefore you need to get to the parent frame first. If you have access
to it, you can simply write "window.top.qx".

Greetings,
Tim

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Java applet in browser widget covers modal dialogs [message #1005097 is a reply to message #1003464] Thu, 24 January 2013 13:25 Go to previous messageGo to next message
Tiburon T is currently offline Tiburon TFriend
Messages: 53
Registered: October 2011
Member
Hi,

I successfully added the listeners to the blocker element and it works fine to hide the applet when the blocker is shown. Unfortunately this is not really the required behavior, because the applet itself is displayed on a modal dialog. (which of course makes the blocker to appear)
Is there a way to add the listener directly to the session timeout dialog? I am trying to find the right object by debugging the JavaScript, but with no success until now.

Greetings
Tiburon
Re: Java applet in browser widget covers modal dialogs [message #1005406 is a reply to message #1005097] Fri, 25 January 2013 09:47 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 387
Registered: July 2009
Senior Member
Hi.

> Is there a way to add the listener directly to the session timeout
> dialog? I am trying to find the right object by debugging the

There is no event for that (yet), sorry. I can only point you to the
method that does it:

org.eclipse.rwt.ErrorHandler.showErrorBox

You might be able to hack or replace the method so it does what you
want. However, it's too complicated to give detailed instructions here.
(If i had the time to do that i could just implement that feature right
away.) Perhaps it helps anyway. In RAP 2.0 it would be a bit easier,
because we have a public event API there already.

Greetings,
Tim



--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Java applet in browser widget covers modal dialogs [message #1005430 is a reply to message #1005406] Fri, 25 January 2013 12:16 Go to previous message
Tiburon T is currently offline Tiburon TFriend
Messages: 53
Registered: October 2011
Member
Ok, I will try to find a way to modify the function, maybe I'll post my results later.

Thanks again for all your help,
Tiburon
Previous Topic:Replacing javax.servlet Dependency
Next Topic:RAP 2.0 demo app in Virgo VTS
Goto Forum:
  


Current Time: Sun Nov 23 13:35:03 GMT 2014

Powered by FUDForum. Page generated in 0.02495 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software