예제 #1
0
        private static bool GenerateOneHtmlRow(TextWriter writer, IEnumerable <TreeGraphNodeBase> graphNodes, int width)
        {
            if (graphNodes.Count() == 0)
            {
                return(false);
            }

            Dictionary <int, TreeGraphNodeBase> graphNodesDict = new Dictionary <int, TreeGraphNodeBase>();

            graphNodes.ForEach(g => graphNodesDict[g.X] = g);

            writer.WriteLine();
            writer.WriteLine("<div style=\"margin: 0px 0px 0px 0px;\">");

            for (int i = 0; i < width; i++)
            {
                TreeGraphNodeBase matchedGraphNode = null;

                Control cell = null;
                if (graphNodesDict.TryGetValue(i, out matchedGraphNode))
                {
                    cell = CreateMatchedCell(matchedGraphNode);
                }
                else
                {
                    cell = CreatePlaceHolderCell();
                }

                writer.Write(cell.GetHtml());
            }

            writer.WriteLine("</div>");

            return(true);
        }
        private static void OutputTreeGraphRecursively(TreeGraphNodeBase graphNode)
        {
            OutputTreeGraphNode(graphNode);

            foreach (TreeGraphNodeBase child in graphNode.Children)
                OutputTreeGraphRecursively(child);
        }
예제 #3
0
        private static void OutputTreeGraphRecursively(TreeGraphNodeBase graphNode)
        {
            OutputTreeGraphNode(graphNode);

            foreach (TreeGraphNodeBase child in graphNode.Children)
            {
                OutputTreeGraphRecursively(child);
            }
        }
예제 #4
0
 private static void OutputTreeGraphNode(TreeGraphNodeBase graphNode)
 {
     if (graphNode.NodeType == TreeGraphNodeType.Label)
     {
         Console.WriteLine("Name = {0}, X = {1}, Y = {2} ", ((TreeGraphLabelNode)graphNode).Name, graphNode.X, graphNode.Y);
     }
     else
     {
         Console.WriteLine("Type = {0}, X = {1}, Y = {2} ", graphNode.NodeType, graphNode.X, graphNode.Y);
     }
 }
예제 #5
0
        private static Control CreateMatchedCell(TreeGraphNodeBase graphNode)
        {
            Control result = null;

            if (graphNode is TreeGraphLabelNode)
            {
                result = CreateLabelCell((TreeGraphLabelNode)graphNode);
            }
            else
            if (graphNode is TreeGraphConnectorNode)
            {
                result = CreateConnectorCell((TreeGraphConnectorNode)graphNode);
            }

            return(result);
        }
        private static Control CreateMatchedCell(TreeGraphNodeBase graphNode)
        {
            Control result = null;

            if (graphNode is TreeGraphLabelNode)
                result = CreateLabelCell((TreeGraphLabelNode)graphNode);
            else
                if (graphNode is TreeGraphConnectorNode)
                    result = CreateConnectorCell((TreeGraphConnectorNode)graphNode);

            return result;
        }
 private static void OutputTreeGraphNode(TreeGraphNodeBase graphNode)
 {
     if (graphNode.NodeType == TreeGraphNodeType.Label)
         Console.WriteLine("Name = {0}, X = {1}, Y = {2} ", ((TreeGraphLabelNode)graphNode).Name, graphNode.X, graphNode.Y);
     else
         Console.WriteLine("Type = {0}, X = {1}, Y = {2} ", graphNode.NodeType, graphNode.X, graphNode.Y);
 }