Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic error in node.setShape(shape) (Read 3151 times)
hans
Junior Member
**
Offline


I Love MindFusion!

Posts: 81
Location: Netherlands
Joined: Mar 17th, 2012
error in node.setShape(shape)
May 4th, 2012 at 1:32pm
Print Post  
When I try to set the shape of an existing node, my code works fine with IE9
With Firefox, Opera and Chrome I always get this error:
Uncaught exception: Error: java.lang.IllegalArgumentException: No method found matching name setShape and arguments [sun.plugin2.main.client.MessagePassingJSObject]

my code:

var selectednodes = diagram.getSelection().getNodes();
var node = selectednodes.get(0);
var shape = scriptHelperShapes.shapeFromId("Decision");
node.setShape(shape);

node does exist. When I try:
    var test = node.getText();
test has the correct string.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: error in node.setShape(shape)
Reply #1 - May 4th, 2012 at 5:37pm
Print Post  
Is scriptHelperShapes set to a ScriptHelper instance returned by the same applet whose Diagram you are accessing?
  
Back to top
 
IP Logged
 
hans
Junior Member
**
Offline


I Love MindFusion!

Posts: 81
Location: Netherlands
Joined: Mar 17th, 2012
Re: error in node.setShape(shape)
Reply #2 - May 5th, 2012 at 9:11am
Print Post  
Thanks for this suggestion, it works great now.

I cannot use applet1.getnodes().get(0).getShape()
in applet2

But I can use this shape:
applet2.scriptHelper.shapeFromId( applet1.getnodes().get(0).getShape().getId() )
  
Back to top
 
IP Logged
 
hans
Junior Member
**
Offline


I Love MindFusion!

Posts: 81
Location: Netherlands
Joined: Mar 17th, 2012
Re: error in node.setShape(shape)
Reply #3 - May 5th, 2012 at 9:42am
Print Post  
I cheared to soon.IE9 and Chrome work fine,
Opera and Firefox still have the same error message:

uncaught exception: java.lang.IllegalArgumentException: No method found matching name setShape and arguments [sun.plugin2.main.client.MessagePassingJSObject]

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: error in node.setShape(shape)
Reply #4 - May 7th, 2012 at 7:32am
Print Post  
Technically you are still passing a Java object (of type String) from one applet instance to another. This is a confirmed bug in the Java plugin, which our developers reported to Sun/Oracle some time ago; you could vote for it here:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6989193

As a work-around you might try first converting the Java's string to a JavaScript string by calling the String's constructor:
var jsStringId = new String(applet2...getId());
applet1...(jsStringId);

Obviously this will not help for passing other types of Java objects between two applets, so you'd better use a single instance of the DiagramApplet class. That bug is one of the reasons we moved the misc. controls to the main DiagramView applet in this release:
http://mindfusion.eu/Forum/YaBB.pl?num=1331713838

If you absolutely must show two DiagramViews on the page, we'll think of some way to support this from the same applet.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint