Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic text position, lines, automatic node position (Read 3999 times)
Rico
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: May 4th, 2009
text position, lines, automatic node position
May 11th, 2009 at 1:08pm
Print Post  
Hi,
is it possible to put text next to the nodes or only within the nodes? And is there a function to draw the nodes withyou setting the exactly positions? A function which calculates the positions and I only have to set the hierarchical order?
And the third question I have is wether I can draw horizontal lines between nodes.

Thank you very much,
Rico
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: text position, lines, automatic node position
Reply #1 - May 11th, 2009 at 1:30pm
Print Post  
Hi,

Quote:
is it possible to put text next to the nodes or only within the nodes?


Create a custom Shape definition whose text area is outside the 0-100,0-100 range. Another possibility is to use separate nodes as labels, and attach them to the main node using the attachTo method.

Quote:
And is there a function to draw the nodes withyou setting the exactly positions? A function which calculates the positions and I only have to set the hierarchical order?


Try TreeLayout.arrange() if your graphs are trees, or some of the other layout classes otherwise.

Quote:
And the third question I have is wether I can draw horizontal lines between nodes.


If just for decoration, you could create some unconnected links and lock them, or handle the drawBackground event and draw the lines using the Graphics2D API. If you need the real links between nodes to be always horizontal, try aligning the links ControlPoints in response to some events, such as linkCreated and linkModified.

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


I love YaBB 1G - SP1!

Posts: 6
Joined: May 4th, 2009
Re: text position, lines, automatic node position
Reply #2 - May 19th, 2009 at 11:59am
Print Post  
Hi,

where can I define the position of the text area? I tried to use a seperate node for the label but I don't understand the sense of the second parameter of the function attachTo. How can I create a Node without defining the position? It doesn't change anything if I change the value of the second parameter because the node will always be at the position I defined when the instance of the node was created.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: text position, lines, automatic node position
Reply #3 - May 19th, 2009 at 1:04pm
Print Post  
Hi,

This defines a rectangular shape where the text is displayed below the rectangle:

Code
Select All
Shape sp = new Shape(
	new ElementTemplate[]
	{
		new LineTemplate(0,0,0,100),
		new LineTemplate(0,100, 100, 100),
		new LineTemplate(100, 100, 100, 0),
		new LineTemplate(100, 0, 0, 0)
	},
	null,
	new ElementTemplate[]
	{
		new LineTemplate(0,110, 100,110),
		new LineTemplate(100,110, 100, 200),
		new LineTemplate(100, 200, 0,200),
		new LineTemplate(0, 200, 0, 110 )
	}, 0, "newShape");

	diagram.setDefaultShape(sp);
 



The attachTo argument specifies a corner to which the attached node should be anchored. It is not aligned to that corner, but the group preserves the original distance from the child node to that corner.

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


I love YaBB 1G - SP1!

Posts: 6
Joined: May 4th, 2009
Re: text position, lines, automatic node position
Reply #4 - May 20th, 2009 at 9:07am
Print Post  
Hi,

I can see only the text when the node is invisible.
Because I need text within the box AND outside, I'll use the attached node.

I still have another question. I have to use the tooltip. I already found out that I can display multiple lines by useing setToolTip("<html>first line<br>last line</html>"); But the tooltip disapears after a few seconds. I need it as long as the mouse is over the node. How can I do this? I couldn't find something like: ToolTipControl.Show in JDiagram.

Thank you for your help,
Rico
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: text position, lines, automatic node position
Reply #5 - May 20th, 2009 at 3:14pm
Print Post  
Hi,


Try this:
ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);

What do you mean by seeing the text only for invisible nodes?

Stoyan
  
Back to top
 
IP Logged
 
Rico
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 6
Joined: May 4th, 2009
Re: text position, lines, automatic node position
Reply #6 - May 22nd, 2009 at 8:54am
Print Post  
Hi,

sorry I mean transparent.
I cannot see any text within or next to the box of the node. Only when I set node.setTransparent(true); But then I see now frame. So it's senseless for me. But Because I think there is no way to create two seperate texfields within one node (one in the frame and one outside) I have to use attached nodes.

Thank you for your help with the tool tip. It works perfectly

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: text position, lines, automatic node position
Reply #7 - May 22nd, 2009 at 9:12am
Print Post  
Hi,

Have you set the shape's Image or the NoWrap flag? Seems in that case the control applies clipping to the shape outlines, which does not work that great if the text region is set outside the outlines.

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