Exemple #1
0
        /// <summary>
        /// Write balloon, make its coordinates and draw all child items like static texts, dynamic texts, etc.        /// 
        /// </summary>
        /// <param name="balloon">current ballon that should be used as template for creating new one</param>
        /// <param name="page">current page</param>
        /// <param name="parentBalloon">parent ballon in which this new one should be stored</param>
        /// <param name="isStaticBalloon">is new ballon of static type, meaning that it will be placed where put</param>
        /// <param name="level">just level of recursion parameter</param>
        /// <param name="drawChildren">should this method draw items in ballon or just allocate space</param>
        /// <param name="staticBottomDockedFlag">This flag is set if this should create static Bottom docked balloon</param>
        /// <returns>newly created balloon that should be placed on page</returns>
        Balloon WriteBalloon(Balloon balloon, ReportPage page, Balloon parentBalloon, 
            bool isStaticBalloon, bool drawChildren, bool staticBottomDockedFlag,
            int level)
        {
            string logTab = "";
            for (int i = 0; i < level; i++)
            {
                logTab += "\t";
            }

            Loger.LogMessage(logTab + "WriteBalloon Begin");

            StaticBalloon newStaticBalloon;
            DynamicBalloon newDynamicBalloon;
            UnitsManager unitConverter;

            unitConverter = UnitsManager.Instance;

            // if this balloon is static then place it exactly where it should go
            if (isStaticBalloon)
            {
                newStaticBalloon = (StaticBalloon)CreateNewBalloon(balloon, page, parentBalloon, isStaticBalloon);

                // we don't check if static balloons fall inside parents as they should always be included. Just allocate space for it in parent
                if(parentBalloon != null)
                {
                    parentBalloon.AddChild(newStaticBalloon, true, false);
                    if (drawChildren)
                    {
                        AddNonBalloonChildren(balloon, newStaticBalloon);
                    }
                }
                else
                {
                    page.AddChild(newStaticBalloon, true, false);
                    if (drawChildren)
                    {
                        AddNonBalloonChildren(balloon, newStaticBalloon);
                    }
                }

                Loger.LogMessage(logTab + "WriteBalloon End - return static balloon");
                return newStaticBalloon;
            }
            else
            {
                newDynamicBalloon = (DynamicBalloon)CreateNewBalloon(balloon, page, parentBalloon, isStaticBalloon);

                // in case of dynamic balloons we do next thing
                if(parentBalloon != null)
                {
                    if(!parentBalloon.AddChild(newDynamicBalloon, false, staticBottomDockedFlag))
                    {
                        Loger.LogMessage(logTab + "WriteBalloon End - return NULL - AddChild failed when Parent balloon != null");
                        return null;
                    }
                    else
                    {
                        if (drawChildren)
                        {
                            AddNonBalloonChildren(balloon, newDynamicBalloon);
                        }
                    }
                }
                else
                {
                    //newDynamicBalloon.Parent = EditorController.Instance.EditorProject.ReportPage;
                    //EditorController.Instance.EditorProject.PreviewList.Add(newDynamicBalloon);
                    if(!page.AddChild(newDynamicBalloon, false, false))
                    {
                        Loger.LogMessage(logTab + "WriteBalloon End - return NULL - AddChild failed when Parent balloon == null");
                        return null;
                    }
                    else
                    {
                        if (drawChildren)
                        {
                            AddNonBalloonChildren(balloon, newDynamicBalloon);
                        }
                    }
                }

                Loger.LogMessage(logTab + "WriteBalloon End - return dynamic balloon");
                return newDynamicBalloon;
            }

            //return null;
            // 4.    Make balloon graphically.
            // 5.    For each item in balloon
            // 6.      Process each item and request data when needed by using RequestDataCallback
            // 7.    End
            // do static balloon logic. Static balloons are placed where specified and have static dimensions
        }