Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Problem with Applet and OverviewApplet (Read 8001 times)
JR
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 86
Joined: Jun 12th, 2007
Problem with Applet and OverviewApplet
Nov 25th, 2011 at 1:57pm
Print Post  
Hello,

I have a problem with the DiagramApplet and the OverviewApplet with some navigators.
I am using JDiagram3.3 as customer.

It works fine with IE, but when I use Opera 11, Firefox 8 or Chrome 15, the overview is not displayed.

I have the DiagramApplet in a frame, the OverviewApplet in another frame. The 2 are both loaded.

When I do in javascript the link between the 2 applets it does not work. the script is exited when i call the following instruction :
ov.setDiagramView(fcv);

[code]
var VrbNll;
var fcv;
var ov;

var Applet = parent.centre.document.getElementById("jDiagApplet");

var OverView = parent.leftFrame.document.getElementById("jOverviewApplet");

if ((Applet != VrbNll) && (OverView != VrbNll))
{
fcv = Applet.getDiagramView();

ov = OverView.getOverview();
ov.setDiagramView(fcv);
ov.setFitAll(false);
ov.setShowScrollbars(true);
ov.setScaleFactor(5);
}
}
[/code]

I can give you the way to reproduce the problem (9 files).

Can you help me to solve the problem ?

Thanks a lot

PS : do you know that when you use google chrome or opera, the appletstarted event is not triggered !
You can test it with your own online demo.

Regards
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Applet and OverviewApplet
Reply #1 - Nov 28th, 2011 at 9:55am
Print Post  
This is a confirmed bug in the Java plugin which our developer reported to Sun / Oracle last year. It was happening only in Firefox back then, but apparently the same code is now used by Chrome and Opera. You could vote for it here, they should pay more attention to it with more votes:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6989193

Until that's fixed, I think your only option is to create a custom applet and load both the Overview and DiagramView from the same applet. E.g. the Overview could be opened in its own JFrame, or placed in the main frame together with the DiagramView.

Stoyan
  
Back to top
 
IP Logged
 
JR
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 86
Joined: Jun 12th, 2007
Re: Problem with Applet and OverviewApplet
Reply #2 - Nov 28th, 2011 at 12:32pm
Print Post  
Hello,

I 'm trying to vote, but it is too long to display the vote page :.......

I tryed to reproduce the incident described in your Oracle bug form. It works on IE8, Chrome15 and Safari 5. It does not work in Firefox8 nor in Opera 11.*.

Given the time resolution of this incident (more than 1 year ago), I'm not sure this is the priority of the developers of Sun /Oracle Java.

So I am not sure that it is the same problem (my problem exists even in Chrome). Maybe I am mistaken ? I don't have the following errors in the java console :
Error: uncaught exception: java.lang.IllegalArgumentException: No method found matching name setTest and arguments [sun.plugin2.main.client.MessagePassingJSObject].
I don't have any message.

My problem is not quite the same ... The 2 applets are also in 2 differents frames. Due to the architecture of our web application, I can't put the overview and the Diagram in the same applet...

PS : Do you have a solution for the appletstarted problem in Opera and Chrome ?

Regards
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Applet and OverviewApplet
Reply #3 - Nov 28th, 2011 at 2:42pm
Print Post  
If you cannot pass a Java object reference from one applet to another when they are in the same frame, I'm sure it won't work when they are in different frames either.

Regarding Chrome, I have just tested it and the Overview worked in both cases. However for some reason it did not repaint automatically when using frames, and the diagram showed in the overview only after selecting or drawing an item. The overview shows the diagram immediately if you explicitly call its repaint method (f1 and f2 are the names of the frames in my test):

Code
Select All
var applet = document.getElementById("jDiagApplet");
var appletOverview = parent.f2.document.getElementById("jOverviewApplet");
var overview = appletOverview.getOverview();
overview.setDiagramView(applet.getDiagramView());
overview.repaint(); 



Our developer will check what happens with the started script.

Stoyan
  
Back to top
 
IP Logged
 
JR
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 86
Joined: Jun 12th, 2007
Re: Problem with Applet and OverviewApplet
Reply #4 - Nov 28th, 2011 at 3:40pm
Print Post  
Thanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Applet and OverviewApplet
Reply #5 - Nov 29th, 2011 at 12:50pm
Print Post  
Apparently the JSObject.call() method we use to call JavaScript functions fails silently in Chrome without returning any useful information. That happens only for the AppletStarted event, so our developers' guess is that Chrome doesn't allow JSObject calls before the applet's start() method completes.

You could use this as a work-around:

Code
Select All
<body onload="initAppletWhenStarted()">

function initAppletWhenStarted()
{
	var applet = document.getElementById("jDiagApplet");
	try
	{
		if (applet.getHasStarted())
		{
			// init the applet
			applet.getDiagram().getFactory().createShapeNode(40, 40, 30, 20).setText("test");
		}
		else
		{
			setTimeout("initAppletWhenStarted()", 1000);
		}
	}
	catch (error)
	{
		setTimeout("initAppletWhenStarted()", 1000);
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JR
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 86
Joined: Jun 12th, 2007
Re: Problem with Applet and OverviewApplet
Reply #6 - Nov 29th, 2011 at 4:20pm
Print Post  
Hello,

Your solution is very interesting but I have a little question.
Remember that I use your 2 applets.
DiagramApplet has a hasStarted field, but OverviewApplet does not have any equivalent field.

How can I know that the overviewapplet has been started ?

Thanks

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with Applet and OverviewApplet
Reply #7 - Nov 30th, 2011 at 12:41pm
Print Post  
We have moved the getHasStarted() method to the JDiagram's base AppletEx class, so now you can also check it from OverviewApplet and ShapeListBoxApplet. You can find updated version on the PM page.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JR
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 86
Joined: Jun 12th, 2007
Re: Problem with Applet and OverviewApplet
Reply #8 - Nov 30th, 2011 at 1:24pm
Print Post  
Thank you for the changes, it works!

But that does not solve the original problem with two frames and two applets.
But that's not your fault.

Thank you
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint