virtual protected void RegisterTransformers(GoXmlReaderWriterBase rw)
 {
     foreach (var bt in Transformers)
     {
         rw.AddTransformer(bt);
     }
 }
Пример #2
0
        // TODO: adapt the XML elements and attributes to match your classes and their properties
        private static void InitReaderWriter(GoXmlReaderWriterBase rw)
        {
            GoXmlBindingTransformer.DefaultTracingEnabled = true;  // for debugging, check your Output window (trace listener)
            GoXmlBindingTransformer t;

            t = new GoXmlBindingTransformer("statechart", new StateChartDocument());
            t.AddBinding("version", "Version", GoXmlBindingFlags.RethrowsExceptions);  // let exception from Version setter propagate out
            t.AddBinding("name", "Name");
            t.AddBinding("path", "Path");
            rw.AddTransformer(t);

            t = new GoXmlBindingTransformer("comment", NewComment());
            t.IdAttributeUsedForSharedObjects = true; // each GoComment gets a unique ID
            t.AddBinding("label", "Text");
            t.AddBinding("center", "Center");         // last property, since it depends on content/alignment
            AddBrushBindings(t, "", "Shape");
            AddPenBindings(t, "pen", "Shape");
            AddFontBindings(t, "label", "Label");
            rw.AddTransformer(t);

            t = new GoXmlBindingTransformer("state", NewNode());
            t.IdAttributeUsedForSharedObjects = true; // each GraphNode gets a unique ID
            t.HandlesNamedPorts = true;               // generate attributes for each of the named ports, specifying their IDs
            t.AddBinding("label", "Text");
            t.AddBinding("loc", "Location");
            AddBrushBindings(t, "", "Shape");
            AddPenBindings(t, "pen", "Shape");
            AddFontBindings(t, "label", "Label");
            //t.AddBinding("userFlags", "UserFlags");
            rw.AddTransformer(t);



            t = new GoXmlBindingTransformer("transition", new AnimatedLink());
            t.AddBinding("from", "FromPort");
            t.AddBinding("to", "ToPort");
            t.AddBinding("curviness", "Curviness");
            t.AddBinding("brush", "RealLink.BrushColor");
            t.AddBinding("adjusted", "RealLink.AdjustingStyle");
            t.AddBinding("points", "RealLink.Points");
            t.AddBinding("label", "Text");
            //t.AddBinding("userFlags", "UserFlags");
            AddPenBindings(t, "pen", "RealLink");
            AddFontBindings(t, "label", "MidLabel");
            rw.AddTransformer(t);
        }
Пример #3
0
        // TODO: adapt the XML elements and attributes to match your classes and their properties
        private static void InitReaderWriter(GoXmlReaderWriterBase rw)
        {
            GoXmlBindingTransformer.DefaultTracingEnabled = true;  // for debugging, check your Output window (trace listener)
            GoXmlBindingTransformer t;

            t = new GoXmlBindingTransformer("flowchart", new GraphDoc());
            t.AddBinding("version", "Version", GoXmlBindingFlags.RethrowsExceptions);  // let exception from Version setter propagate out
            t.AddBinding("name", "Name");
            t.AddBinding("nextnodepos", "InternalNextNodePos");
            rw.AddTransformer(t);

            t = new GoXmlBindingTransformer("node", new GraphNode());
            t.IdAttributeUsedForSharedObjects = true; // each GraphNode gets a unique ID
            t.HandlesNamedPorts = true;               // generate attributes for each of the named ports, specifying their IDs
            t.AddBinding("kind", "Kind");
            t.AddBinding("text", "Text");
            t.AddBinding("pos", "Position");
            rw.AddTransformer(t);

            t = new GoXmlBindingTransformer("title", new Title());
            rw.AddTransformer(t);

            t = new GoXmlBindingTransformer("comment", new GoComment());
            t.IdAttributeUsedForSharedObjects = true;  // each GoComment and Title gets a unique ID
            t.AddBinding("text", "Text");
            t.AddBinding("familyname", "Label.FamilyName");
            t.AddBinding("fontsize", "Label.FontSize");
            t.AddBinding("alignment", "Label.Alignment");
            t.AddBinding("bold", "Label.Bold");
            t.AddBinding("italic", "Label.Italic");
            t.AddBinding("strikethrough", "Label.StrikeThrough");
            t.AddBinding("underline", "Label.Underline");
            t.AddBinding("multiline", "Label.Multiline");
            t.AddBinding("wrapping", "Label.Wrapping");
            t.AddBinding("wrappingwidth", "Label.WrappingWidth");
            t.AddBinding("editable", "Label.Editable");
            t.AddBinding("loc", "Location");  // last property, since it depends on content/alignment
            rw.AddTransformer(t);

            t = new GoXmlBindingTransformer("link", new GraphLink());
            t.AddBinding("from", "FromPort");
            t.AddBinding("to", "ToPort");
            //t.AddBinding("LabelType", "FromOrTo");
            t.AddBinding("label", "Text");
            rw.AddTransformer(t);
        }
Пример #4
0
        private static void InitReaderWriterA(GoXmlReaderWriterBase rw)
        {
            GoXmlBindingTransformer tr = new GoXmlBindingTransformer("node", new GraphNode(GraphNodeKind.End));

            // indicate that the XML consists of nested elements
            tr.TreeStructured = true;
            // provide the prototype link for connecting the nodes
            tr.TreeLinkPrototype = new GoLink();
            // indicate the direction of the link (from parent to child)
            tr.TreeLinksToChildren = true;
            //tr.AddBinding("label", "Text");

            //tr.AddBinding("kind", "Kind");
            tr.AddBinding("text", "Text");

            rw.AddTransformer(tr);
        }