Example #1
0
        /// <summary>
        /// Creates a node for the label call
        /// </summary>
        /// <param name="dfbStateFrame"></param>
        /// <param name="pos_X"></param>
        /// <param name="pos_Y"></param>
        /// <param name="dfbStateFrameBegValues"></param>
        /// <param name="shapeName"></param>
        /// <returns></returns>
        private GraphViz.Node CreateNode(
            DFBStateFrame dfbStateFrame,
            double?pos_X, double?
            pos_Y,
            DFBStateFrame dfbStateFrameBegValues,
            string shapeName)
        {
            const int COL1MINWIDTH = 30;
            const int COL2MINWIDTH = 30;
            const int COL3MINWIDTH = 30;

            // Add Node
            var node = new GraphViz.Node(shapeName)
            {
                Tag = dfbStateFrame
            };

            node.NodeAttributes.shape = GraphViz.Shape.none;

            // tootip doesn't work in webbrowser control - it bases tooltips off of title attribute
            //node.NodeAttributes.tooltip = new GraphViz.escString(dfbStateFrame.CodeStateCycle.Instruction.InstructionText);

            if (pos_X.HasValue && pos_Y.HasValue)
            {
                node.NodeAttributes.pos = new GraphViz.Point
                {
                    InputOnly = true,
                    X         = pos_X.Value,
                    Y         = pos_Y.Value
                };
            }

            var table = new HtmlTable
            {
                Border = 0
            };

            table.Attributes.Add("CELLBORDER", "1");
            table.CellSpacing = 0;

            // Header
            var    row   = new HtmlTableRow();
            string label = null;

            if (dfbStateFrame.CodeStateCycle.GroupName.Length > callDiagramMaxLabelChars)
            {
                label = dfbStateFrame.CodeStateCycle.GroupName.Substring(0, callDiagramMaxLabelChars - 3) + "...";
            }
            else
            {
                label = dfbStateFrame.CodeStateCycle.GroupName;
            }
            AddHeader1Cell(row, null, 3, label);
            table.Rows.Add(row);

            // Details
            row = new HtmlTableRow();
            AddDetailCell(row, COL1MINWIDTH, null, null, "Cycle:", false, true);
            AddDetailCell(row, COL2MINWIDTH, null, 2, dfbStateFrame.Cycle.ToString());
            table.Rows.Add(row);

            row = new HtmlTableRow();
            AddDetailCell(row, COL1MINWIDTH, null, null, "ACU", false, true);
            AddDetailCell(row, COL2MINWIDTH, null, null, "Beg");
            AddDetailCell(row, COL3MINWIDTH, null, null, "End");
            table.Rows.Add(row);

            row = new HtmlTableRow();
            AddDetailCell(row, COL1MINWIDTH, null, null, "A.reg", false, true);
            AddDetailCell(row, COL3MINWIDTH, null, null, dfbStateFrameBegValues != null ? dfbStateFrameBegValues.ACU_A.Reg_reg.FormattedValue : "");
            AddDetailCell(row, COL2MINWIDTH, null, null, dfbStateFrame.ACU_A.Reg_reg.FormattedValue);
            table.Rows.Add(row);

            row = new HtmlTableRow();
            AddDetailCell(row, COL1MINWIDTH, null, null, "B.reg", false, true);
            AddDetailCell(row, COL3MINWIDTH, null, null, dfbStateFrameBegValues != null ? dfbStateFrameBegValues.ACU_B.Reg_reg.FormattedValue : "");
            AddDetailCell(row, COL2MINWIDTH, null, null, dfbStateFrame.ACU_B.Reg_reg.FormattedValue);
            table.Rows.Add(row);

            // Add table as label
            node.NodeAttributes.label = table.ToGraphvizLabelFormat();

            return(node);
        }