Hi,
I have the following SubGraph.
Here, Inside nodes are also subgraph, some are with handle and some are without handle. Handle is invisible because there is not inside anything in that subgraph or not added anything in it yet.
I want to write an XML of the subgraph. I have created some bindings for this subgraph referring user guide and sample application. These bindings include, binding for document, node and link. Currently, I can write XML and read it. After reading I get only subgraph without links and ports. There is some information generated about links in XML.
In my XMLreadwrite base, have following bindings,
GoXmlBindingTransformer bt;
//////// Prototype element: Document///////
GoDocument doc = new GoDocument(); // this.goView2.Document;
bt = new GoXmlBindingTransformer("CustomSubgraphView", doc);
bt.AddBinding("version", "Version", GoXmlBindingFlags.RethrowsExceptions);
bt.AddBinding("name", "Name");
rw.AddTransformer(bt);
//////prototype element: subgraph//////
CustomSubgraph sg = new CustomSubgraph("a", "b", "c");
sg.Port = new CustomSubgraphPort();
bt = new GoXmlBindingTransformer("CustomSubgraph", sg);
bt.HandlesNamedPorts = true;
bt.HandlesChildren = true;
bt.HandlesChildAttributes = true;
bt.HandlesSubGraphCollapsedChildren = true;
bt.AddBinding("abel", "Label.Text");
bt.AddBinding("xy", "Position");
bt.AddBinding("back", "BackgroundColor");
bt.AddBinding("opacity", "Opacity");
bt.AddBinding("border", "BorderPen.Color");
bt.AddBinding("borderwidth", "BorderPen.Width");
bt.AddBinding("loc", "Location");
rw.AddTransformer(bt);
////prototype element : port
CustomSubgraphPort prt = new CustomSubgraphPort();
bt = new GoXmlBindingTransformer("port", sg.Port);
bt.IdAttributeUsedForSharedObjects = true;
bt.AddBinding("prtloc", "Location");
bt.AddBinding("prtsize", "Size");
rw.AddTransformer(bt);
/////prototype element : link
GoLink lnk = new GoLink();
lnk.Style = GoStrokeStyle.Bezier;
lnk.ToArrow = true;
lnk.FromArrow = false;
t = new GoXmlBindingTransformer("link", lnk);
t.AddBinding("from", "FromPort");
t.AddBinding("to", "ToPort");
The above binding can create subgraph without ports properly. But if I add ports and try to write and read XML, it creates ports but locations are not as that of original diagram. Links are not at all shown.
Could you please tell me what could be the problem?
I also want to save lists generated while creating the subgraph in the subgraph class. For example there will be child list associated with each subgraph which contains subgraphs inside the subgraph… Could you please provide me sample code to do such bindings? Beacause currenlty when XML is read only graphical objects are created but behind data is not stored in each node object on the diagram. Each node on the diagram also have data associted with that node. But en I read XML only graphical diagram is created without assigning data associated with each node.
Please help me to do such binding with sample example.
Thank you.