Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic TreeLayout.EnableAssistants (Read 5325 times)
bentech
YaBB Newbies
*
Offline



Posts: 2
Location: Ontario, Canada
Joined: Aug 19th, 2009
TreeLayout.EnableAssistants
Aug 19th, 2009 at 8:57pm
Print Post  
Hi,

I'm trying to set the property of a treelayout [color=Red]EnableAssistants[/color] from JavaScript unfortunately it generate a error. Can someone help find out the problem. Thanks

My code goes as follow

var fcApplet = <%= diagramView.AppletElement %>;
var fc = fcApplet.getDiagramView().getDiagram();
var tl = fcApplet.getScriptHelper().createTreeLayout();
[color=Red]tl.EnableAssistants = true;[/color]
tl.setNodeDistance(10);
tl.setLevelDistance(10);
tl.setLinkStyle(2);
tl.arrange(fc);
tl.ResizeToFitItems(2, false);
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout.EnableAssistants
Reply #1 - Aug 20th, 2009 at 8:31am
Print Post  
Hi,

Seems this feature hasn't been implemented yet in the applet code. We'll add it for the next release.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout.EnableAssistants
Reply #2 - Aug 24th, 2009 at 3:53pm
Print Post  
Hi,

This version implements support for org.chart assistant nodes in the applet:
https://mindfusion.eu/_temp/netdiag_assistants.zip

You can set the property in JavaScript like this:

Code
Select All
var tl = applet.getScriptHelper().createTreeLayout();
tl.setEnableAssistants(true);
tl.setNodeDistance(10);
tl.setLevelDistance(10);
tl.setLinkStyle(2);
tl.arrange(diagram);

diagram.resizeToFitItems(2);
 



You must also use the updated .NET assemblies - now they implement transfer of LayoutTraits[Assistant] to the applet.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bentech
YaBB Newbies
*
Offline



Posts: 2
Location: Ontario, Canada
Joined: Aug 19th, 2009
Re: TreeLayout.EnableAssistants
Reply #3 - Aug 31st, 2009 at 4:37pm
Print Post  
Thank you very much!

It is working beautifully

  
Back to top
 
IP Logged
 
princji
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 8th, 2009
Re: TreeLayout.EnableAssistants
Reply #4 - Oct 8th, 2009 at 1:40pm
Print Post  
Hello,

How would I get/set the Assistant status of a node in Javascript?

Thank you.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout.EnableAssistants
Reply #5 - Oct 8th, 2009 at 2:10pm
Print Post  
Hi,

Try using the ScriptHelper.getConstant method to get the LayoutTraits key:

var key = scriptHelper.getConstant("com.mindfusion.diagramming.jlayout.TreeLayoutTraits", "Assistant");
var assistant = node.getLayoutTraits().get(key);

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
princji
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 8th, 2009
Re: TreeLayout.EnableAssistants
Reply #6 - Oct 8th, 2009 at 2:21pm
Print Post  
When adding shapes, I would like to set the Assistant status of the new node. Would that be possible?

    var key = sh.getConstant("com.mindfusion.diagramming.jlayout.TreeLayoutTraits", "Assistant");
    alert(key);
    var assistant = newNode.getLayoutTraits.get(key);
    alert(assistant);

The second alert gives me Null value...  Undecided
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout.EnableAssistants
Reply #7 - Oct 8th, 2009 at 2:35pm
Print Post  
LayoutTraits is a hashtable and it is expected to return null if you haven't explicitly set the value at some point. I think the Java method to set the value is called put:

newNode.getLayoutTraits().put(key, true);
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TreeLayout.EnableAssistants
Reply #8 - Oct 8th, 2009 at 2:38pm
Print Post  
Additionaly, the expected value should not be a boolean, but a member of the AssistantType enum, so you must use the script helper method to get one of the following members, or just use the respective numeric value from 0 to 3:

public static final int None = 0;
/**
* The node is an assistant and its relative position is determined
* automatically by the layout.
*/
public static final int Normal = 1;

/**
* The node is an assistant and it is always positioned to the left
* of its parent.
*/
public static final int Left = 2;

/**
* The node is an assistant and it is always positioned to the right
* of its parent.
*/
public static final int Right = 3;
  
Back to top
 
IP Logged
 
princji
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 17
Joined: Sep 8th, 2009
Re: TreeLayout.EnableAssistants
Reply #9 - Oct 8th, 2009 at 2:40pm
Print Post  
You have helped a LOT. Thank you
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint