Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic shapenode label (Read 5379 times)
tmtton
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
shapenode label
May 28th, 2008 at 4:02am
Print Post  
I need to have a shapeNode label that must reside inside the box (which could be a circle, a rectangle, or a diamond)  and is separate from the shapeNode text.

I attach the labelNode, laying it on top of the shapeNode. This almost does what I want. Two pending issues:

1) cut/copy/paste doesn't work on the labelNode

2) when the shapeNode's text is long, it fills up the whole box and overlaps with the labelNode's text appearing at the top of the shapeNode. how to prevent the "shapeNode label area" from being written to?

Thanks in advance for any suggestions.

--- code snippet ---
ShapeNode shapeNode = new ShapeNode(diagram);
// set shapeNode properties ...

ShapeNode labelNode = new ShapeNode(diagram);
labelNode.setText("Node Label X");
labelNode.setLocked(true);
labelNode.setTransparent(true);
// set other labelNode properties ...

labelNode.attachTo(shapeNode, attachToNode.TopCenter);

diagram.add(shapeNode);
diagram.add(labelNode);

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: shapenode label
Reply #1 - May 28th, 2008 at 9:10am
Print Post  
1. Set the "groups" argument to true when calling the CopyToClipboard and CutToClipboard methods.

2. You could use a custom Shape definition whose text area excludes the region where the labelNode would be located.

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


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
Re: shapenode label
Reply #2 - May 29th, 2008 at 1:38am
Print Post  
Thank you. The group=true setting works for copy and cut to clipboard function. However, when a user uses the Delete key to remove the selected shapeNode, the associated labelNode is not deleted from the diagram.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: shapenode label
Reply #3 - May 29th, 2008 at 7:36am
Print Post  
After attaching the labelNode, call shapeNode.getSubordinateGroup().setAutoDeleteItems(true).

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


I love YaBB 1G - SP1!

Posts: 39
Joined: May 9th, 2008
Re: shapenode label
Reply #4 - May 30th, 2008 at 12:13pm
Print Post  
I have this scenario.
- create a shapeNode. create a labelNode. attach the labelNode to the shapeNode.
- execute an undo
- the labelNode is detached from the group (labelNode is removed and the shapeNode now has no label)
- execute an undo again
- the shapeNode is then removed

How do we prevent the detachment? We need the label + shape to come and go together.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: shapenode label
Reply #5 - May 30th, 2008 at 2:43pm
Print Post  
Call Diagram.getUndoManager().startComposite() before creating and attaching the nodes, and CompositeCmd.execute() after that.

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