Пример #1
0
        /// <summary>
        /// Create diagram symbol nodes for each employee in the organization and add these symbols to the diagram
        /// Create links between manager and sub-employees to depict the org structure
        /// </summary>
        /// <param name="alemployees"> Employees list</param>
        protected void CreateOrgDiagramFromList(ArrayList alemployees)
        {
            // Temporarily suspend the Diagram Model redrawing
            this.diagram1.Model.BeginUpdate();

            foreach (Employee_CS emply in alemployees)
            {
#if !NETCORE
                String fileName = @"..\..\..\..\..\..\..\Common\Images\Diagram\OrgChart Layout\" + emply.ImageName + ".png";
#else
                String fileName = @"..\..\..\..\..\..\..\..\Common\Images\Diagram\OrgChart Layout\" + emply.ImageName + ".png";
#endif
                EmpSymbol emplysymbol = new EmpSymbol(fileName);
                emplysymbol.LineStyle.LineColor = Color.LightSkyBlue;
                emplysymbol.EmployeeName        = emply.EmployeeName;
                this.diagram1.Model.AppendChild(emplysymbol);
                this.IterCreateEmployeeSymbol(emply, emplysymbol);
            }

            // ReEnable the Model redraw
            this.diagram1.Model.EndUpdate();

            // Instruct the LayoutManager to calculate and layout the diagram nodes
            LayoutNodes();
        }
Пример #2
0
        void diagram1_MouseMove(object sender, MouseEventArgs e)
        {
            EmpSymbol node = diagram1.Controller.GetNodeAtPoint(diagram1.Controller.ConvertToModelCoordinates(e.Location)) as EmpSymbol;

            if (node != null)
            {
                node.MouseMove(diagram1.Controller.ConvertToModelCoordinates(e.Location));
            }
        }
Пример #3
0
    /// <summary>
    /// Create new method for expand current node
    /// </summary>
    /// <param name="SelectedNode"></param>
    public NodeCollection ExpandSubNodes(bool clickednode)
    {
        NodeCollection expandCollection = new NodeCollection();

        ExpandedCollection = new NodeCollection();
        IGraphNode thisNode = this as IGraphNode;

        if (thisNode != null)
        {
            ICollection edgesLeaving = thisNode.EdgesLeaving;
            if (edgesLeaving != null)
            {
                foreach (IGraphEdge curEdge in edgesLeaving)
                {
                    // Get from IGraphEdge link.
                    ConnectorBase outlink = curEdge as ConnectorBase;

                    if (outlink != null)
                    {
                        // Get from link children of current symbol.
                        EmpSymbol cursymbol = outlink.ToNode as EmpSymbol;
                        if (cursymbol != null)
                        {
                            // Check for explanded and explande nodes in child symbol.
                            if (cursymbol.IsExpanded)
                            {
                                cursymbol.ExpandSubNodes(false);
                            }

                            // Set current symbol as visible.
                            cursymbol.Visible = true;
                            expandCollection.Add(cursymbol);
                        }

                        // Set connected link as visible too.
                        outlink.Visible = true;
                        expandCollection.Add(outlink);
                    }
                }
            }
        }
        ExpandedCollection = expandCollection;
        // If this symbol is node under mouse click set node state as
        // expaned by make plus vertical line visibly.
        if (clickednode && HasChild())
        {
            // Set symbol shapes to indicate an expanded state.
            m_bExpanded = true;
        }
        return(expandCollection);
    }
Пример #4
0
        /// <summary>
        ///  Iterative sub-employee symbol node creation
        /// </summary>
        /// <param name="emply">Employess business object</param>
        /// <param name="emplysymbol">Employee Node</param>
        protected void IterCreateEmployeeSymbol(Employee_CS emply, EmpSymbol emplysymbol)
        {
            foreach (Employee_CS subemply in emply.SubEmployees)
            {
                String fileName = @"..\..\..\..\..\..\..\Common\Images\Diagram\OrgChart Layout\" + subemply.ImageName + ".png";
                // Create a EmployeeSymbol for each of the sub-employees of the particular employee //Waterfall, Horizontal
                EmpSymbol subemplysymbol = new EmpSymbol(fileName);
                subemplysymbol.LineStyle.LineColor = Color.LightSkyBlue;
                subemplysymbol.EmployeeName        = emply.EmployeeName;
                this.diagram1.Model.AppendChild(subemplysymbol);

                emplysymbol.EnableCentralPort    = true;
                subemplysymbol.EnableCentralPort = true;
                ConnectNodes(emplysymbol, subemplysymbol);

                this.IterCreateEmployeeSymbol(subemply, subemplysymbol);
            }
        }
Пример #5
0
    /// <summary>
    /// Create a new method for collapse current node
    /// </summary>
    /// <param name="SelectedNode"></param>


    public NodeCollection CollapseSubNodes(bool clickednode)
    {
        NodeCollection collapsedCollection = new NodeCollection();
        IGraphNode     thisNode            = this as IGraphNode;

        if (thisNode != null)
        {
            ICollection edgesLeaving = thisNode.EdgesLeaving;
            if (edgesLeaving != null)
            {
                // Convert to collection of IGraphEdges type.
                foreach (IGraphEdge curEdge in edgesLeaving)
                {
                    // Get from IGraphEdge link.
                    ConnectorBase outlink = curEdge as ConnectorBase;
                    if (outlink != null)
                    {
                        // Get from link current symbol children.
                        EmpSymbol cursymbol = outlink.ToNode as EmpSymbol;
                        if (cursymbol != null)
                        {
                            // Colapse nodes in child symbol.
                            cursymbol.CollapseSubNodes(false);

                            // Set current symbol as invisible.
                            cursymbol.Visible = false;
                        }
                        // Set connected link as invisible too.
                        outlink.Visible = false;
                        //CollapsedCollection.Add(outlink);
                    }
                }
            }
        }
        CollapsedCollection = collapsedCollection;
        // If this symbol is node under mouse click set node state as
        // expaned by make plus vertical line visibly.
        if (clickednode && HasChild())
        {
            // Set symbol shapes to indicate a collapsed state.
            m_bExpanded = false;
        }
        return(collapsedCollection);
    }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExpanderSymbol"/> class.
 /// </summary>
 /// <param name="src">The source node.</param>
 public EmpSymbol(EmpSymbol src)
     : base(src)
 {
     m_bExpanded = src.m_bExpanded;
 }