Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic how to set a node not deletable and limit outlink? (Read 4447 times)
jay
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 59
Joined: Feb 4th, 2009
how to set a node not deletable and limit outlink?
Feb 12th, 2009 at 6:19am
Print Post  
Hi,
   
   I want to know whether the following things are possible to implement.

1. to set a node not deletable but it allows outgoing links.

2. to limit a node to certain outgoing links , like node should permit only one outgoing link.

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to set a node not deletable and limit outl
Reply #1 - Feb 12th, 2009 at 8:18am
Print Post  
Hi,

You can do both by handling some validation events, e.g. nodeDeleting, linkCreating, linkModifying.

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


I love YaBB 1G - SP1!

Posts: 59
Joined: Feb 4th, 2009
Re: how to set a node not deletable and limit outl
Reply #2 - Feb 12th, 2009 at 8:52am
Print Post  
hi,

   For outgoing links it can be done by deleting link which is exceeding limit on linkcreate event.

   But how to set node not deletable?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to set a node not deletable and limit outl
Reply #3 - Feb 12th, 2009 at 9:25am
Print Post  
Hi,

Handle DiagramListener.nodeDeleting() and call e.setCancel(true).

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


I love YaBB 1G - SP1!

Posts: 59
Joined: Feb 4th, 2009
Re: how to set a node not deletable and limit outl
Reply #4 - Feb 12th, 2009 at 11:22am
Print Post  
hi,

I am doing it as following but it shows e.setCancel(Boolean) method is undefined for NodeEvent


diag.addDiagramListener(new DiagramAdapter()
{


public void nodeDeleting(NodeEvent e) {
DiagramNode deletedNode = e.getNode();
if(deletedNode.getTag().toString().equals("1")) {
e.setCancel(true);
}
}
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: how to set a node not deletable and limit outl
Reply #5 - Feb 12th, 2009 at 11:26am
Print Post  
The method signature should be
void nodeDeleting(NodeValidationEvent e);

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


I love YaBB 1G - SP1!

Posts: 59
Joined: Feb 4th, 2009
Re: how to set a node not deletable and limit outl
Reply #6 - Feb 12th, 2009 at 12:13pm
Print Post  
Hi stoyan,

  Thank you very much, This worked for me.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint