Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Reusable Nodes (Code Snippet kind of Functionaliy) (Read 1449 times)
Aziz ur Rahman
YaBB Newbies
*
Offline



Posts: 43
Joined: Feb 23rd, 2009
Reusable Nodes (Code Snippet kind of Functionaliy)
Mar 25th, 2009 at 11:14am
Print Post  
I am working on an application in which we have a lot of custom shape nodes having different properties. The user have to set the properties of the custom nodes to do some kind of operations.

I want to provide the users of my application to have a Code Snippet kind of functionality as in VS.Net. i.e. The user will add some custom nodes in diagrm from some toolbar. The user can put these nodes inside a Container Node.

Now the user CAN add this container node to his collection of resuable components. He can then later use the same container nodes (having different custom nodes) in some other diagram.

What will be simplest way of acheiving this task?

I am thinking of saving the XML of container node, XML of its child nodes, XML of links between the child nodes in some place. Then if user wants to add the snippet again, i have to make all the nodes and links again programmatically...

Can you suggest some better solution?
  

Syed Aziz ur Rahman
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Reusable Nodes (Code Snippet kind of Functiona
Reply #1 - Mar 25th, 2009 at 2:07pm
Print Post  
You could implement the toolbar using a DiagramView. If you do that, saving and loading the toolbar snippets could be a simple call to the SaveTo / LoadFrom methods. Copying items from the toolbar to the diagram could be done using copy constructors or the CopySelection and PasteSelection methods.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Aziz ur Rahman
YaBB Newbies
*
Offline



Posts: 43
Joined: Feb 23rd, 2009
Re: Reusable Nodes (Code Snippet kind of Functiona
Reply #2 - Mar 25th, 2009 at 2:31pm
Print Post  
Limitation:
The user will input a name of his snippets and then
ser can see all of his already made NODE SNIPPETS in a ListBox like we have toolbars in Visual Studio. Later user can drag and drop any of his snippets and it will be added to the diagram view .

So.... any other simple solution?

Second question:
By copy constructor do you mean the constructor having a node as an agurment?
  

Syed Aziz ur Rahman
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Reusable Nodes (Code Snippet kind of Functiona
Reply #3 - Mar 25th, 2009 at 2:55pm
Print Post  
Yes, the constructors that take a 'prototype' argument are copy constructors.

The name set by the user can be displayed in an additional ShapeNode displayed near the 'snippet' node.

If you prefer to use a list box, check how one is implemented in the Flowcharter example.

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