Ejemplo n.º 1
0
        /// <summary>
        /// Get the node names of all format nodes.
        /// </summary>
        /// <returns></returns>
        private string[] GetAllFormatNames()
        {
            Queue <FormatTreeNode> queue    = new Queue <FormatTreeNode>(SyncFormatConstants.FormatCategories);
            List <string>          allNames = new List <string>();

            while (queue.Count > 0)
            {
                FormatTreeNode node       = queue.Dequeue();
                string         fullName   = node.Name;
                FormatTreeNode parentNode = node.ParentNode;
                while (parentNode != null)
                {
                    fullName   = parentNode.Name + SyncFormatConstants.FormatNameSeparator + fullName;
                    parentNode = parentNode.ParentNode;
                }
                allNames.Add(fullName);

                if (node.ChildrenNodes == null)
                {
                    continue;
                }
                foreach (FormatTreeNode child in node.ChildrenNodes)
                {
                    queue.Enqueue(child);
                }
            }

            return(allNames.ToArray());
        }
Ejemplo n.º 2
0
 private static FormatTreeNode[] InitFormatCategories()
 {
     FormatTreeNode[] formats = new FormatTreeNode[]
     {
         new FormatTreeNode(
             "Text",
             new FormatTreeNode("Font", new Format(typeof(FontFormat))),
             new FormatTreeNode("Font Size", new Format(typeof(FontSizeFormat))),
             new FormatTreeNode("Font Color", new Format(typeof(FontColorFormat))),
             new FormatTreeNode("Style", new Format(typeof(FontStyleFormat)))),
         new FormatTreeNode(
             "Fill",
             new FormatTreeNode("Color", new Format(typeof(FillFormat))),
             new FormatTreeNode("Transparency", new Format(typeof(FillTransparencyFormat)))),
         new FormatTreeNode(
             "Line",
             new FormatTreeNode("Width", new Format(typeof(LineWeightFormat))),
             new FormatTreeNode("Compound Type", new Format(typeof(LineCompoundTypeFormat))),
             new FormatTreeNode("Dash Type", new Format(typeof(LineDashTypeFormat))),
             new FormatTreeNode("Arrow", new Format(typeof(LineArrowFormat))),
             new FormatTreeNode("Color", new Format(typeof(LineFillFormat))),
             new FormatTreeNode("Transparency", new Format(typeof(LineTransparencyFormat)))),
         new FormatTreeNode(
             "Size/Position",
             new FormatTreeNode("Width", new Format(typeof(PositionWidthFormat))),
             new FormatTreeNode("Height", new Format(typeof(PositionHeightFormat))),
             new FormatTreeNode("X", new Format(typeof(PositionXFormat))),
             new FormatTreeNode("Y", new Format(typeof(PositionYFormat))))
     };
     return(formats);
 }
Ejemplo n.º 3
0
 private void InitPage()
 {
     this.formatNodes         = new ArrayList();
     this.propChangesPending  = false;
     this.fontNameChanged     = false;
     this.currentFormatNode   = null;
     this.currentFormatObject = null;
     this.formatTree.Nodes.Clear();
     this.InitFormatUI();
 }
Ejemplo n.º 4
0
 private void AssertValidFormat(FormatTreeNode node)
 {
     if (node.IsFormatNode)
     {
         AssertValidFormatType(node.Format.FormatType);
     }
     else
     {
         AssertValidFormat(node.ChildrenNodes);
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the node at the end of the format tree, as specified by the string name
        /// Returns early with the last matching node if the next node cannot be found
        /// </summary>
        private FormatTreeNode GetEndNode(FormatTreeNode[] formats, string name)
        {
            string[]       path        = name.Split(SyncFormatConstants.FormatNameSeparator.ToCharArray());
            FormatTreeNode currentRoot = new FormatTreeNode("root", formats);

            foreach (string nodeName in path)
            {
                int nextIndex = LastIndexOf(currentRoot.ChildrenNodes, nodeName);
                if (nextIndex < 0)
                {
                    break;
                }
                currentRoot = currentRoot.ChildrenNodes[nextIndex];
            }
            return(currentRoot);
        }
Ejemplo n.º 6
0
 private void OnSelChangedFormatObject(object source, TreeViewEventArgs e)
 {
     if (this.propChangesPending)
     {
         this.SaveFormatProperties();
     }
     this.currentFormatNode = (FormatTreeNode)this.formatTree.SelectedNode;
     if (this.currentFormatNode != null)
     {
         this.currentFormatObject = this.currentFormatNode.FormatObject;
     }
     else
     {
         this.currentFormatObject = null;
     }
     this.LoadFormatProperties();
 }
Ejemplo n.º 7
0
        protected override void SaveComponent()
        {
            if (this.propChangesPending)
            {
                this.SaveFormatProperties();
            }
            IEnumerator enumerator = this.formatNodes.GetEnumerator();

            while (enumerator.MoveNext())
            {
                FormatTreeNode current = (FormatTreeNode)enumerator.Current;
                if (current.Dirty)
                {
                    current.FormatObject.SaveFormatInfo();
                    current.Dirty = false;
                }
            }
            base.GetBaseDesigner().OnStylesChanged();
        }
Ejemplo n.º 8
0
        private void InitFormatTree()
        {
            FormatTreeNode node;
            FormatObject   obj2;

            if (base.IsDataGridMode)
            {
                System.Web.UI.WebControls.DataGrid baseControl = (System.Web.UI.WebControls.DataGrid)base.GetBaseControl();
                obj2 = new FormatStyle(baseControl.ControlStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_EntireDG"), obj2);
                this.formatTree.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(baseControl.HeaderStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Header"), obj2);
                this.formatTree.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(baseControl.FooterStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Footer"), obj2);
                this.formatTree.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(baseControl.PagerStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Pager"), obj2);
                this.formatTree.Nodes.Add(node);
                this.formatNodes.Add(node);
                FormatTreeNode node2 = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Items"), null);
                this.formatTree.Nodes.Add(node2);
                obj2 = new FormatStyle(baseControl.ItemStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_NormalItems"), obj2);
                node2.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(baseControl.AlternatingItemStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_AltItems"), obj2);
                node2.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(baseControl.SelectedItemStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_SelItems"), obj2);
                node2.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(baseControl.EditItemStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_EditItems"), obj2);
                node2.Nodes.Add(node);
                this.formatNodes.Add(node);
                DataGridColumnCollection columns = baseControl.Columns;
                int count = columns.Count;
                if (count != 0)
                {
                    FormatTreeNode node3 = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Columns"), null);
                    this.formatTree.Nodes.Add(node3);
                    for (int i = 0; i < count; i++)
                    {
                        DataGridColumn runtimeColumn = columns[i];
                        string         text          = "Columns[" + i.ToString(NumberFormatInfo.CurrentInfo) + "]";
                        string         headerText    = runtimeColumn.HeaderText;
                        if (headerText.Length != 0)
                        {
                            text = text + " - " + headerText;
                        }
                        obj2 = new FormatColumn(runtimeColumn);
                        obj2.LoadFormatInfo();
                        FormatTreeNode node4 = new FormatTreeNode(text, obj2);
                        node3.Nodes.Add(node4);
                        this.formatNodes.Add(node4);
                        obj2 = new FormatStyle(runtimeColumn.HeaderStyle);
                        obj2.LoadFormatInfo();
                        node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Header"), obj2);
                        node4.Nodes.Add(node);
                        this.formatNodes.Add(node);
                        obj2 = new FormatStyle(runtimeColumn.FooterStyle);
                        obj2.LoadFormatInfo();
                        node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Footer"), obj2);
                        node4.Nodes.Add(node);
                        this.formatNodes.Add(node);
                        obj2 = new FormatStyle(runtimeColumn.ItemStyle);
                        obj2.LoadFormatInfo();
                        node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Items"), obj2);
                        node4.Nodes.Add(node);
                        this.formatNodes.Add(node);
                    }
                }
            }
            else
            {
                DataList list = (DataList)base.GetBaseControl();
                obj2 = new FormatStyle(list.ControlStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_EntireDL"), obj2);
                this.formatTree.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(list.HeaderStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Header"), obj2);
                this.formatTree.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(list.FooterStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Footer"), obj2);
                this.formatTree.Nodes.Add(node);
                this.formatNodes.Add(node);
                FormatTreeNode node5 = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Items"), null);
                this.formatTree.Nodes.Add(node5);
                obj2 = new FormatStyle(list.ItemStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_NormalItems"), obj2);
                node5.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(list.AlternatingItemStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_AltItems"), obj2);
                node5.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(list.SelectedItemStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_SelItems"), obj2);
                node5.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(list.EditItemStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_EditItems"), obj2);
                node5.Nodes.Add(node);
                this.formatNodes.Add(node);
                obj2 = new FormatStyle(list.SeparatorStyle);
                obj2.LoadFormatInfo();
                node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Separators"), obj2);
                this.formatTree.Nodes.Add(node);
                this.formatNodes.Add(node);
            }
        }
 private void OnSelChangedFormatObject(object source, TreeViewEventArgs e)
 {
     if (this.propChangesPending)
     {
         this.SaveFormatProperties();
     }
     this.currentFormatNode = (FormatTreeNode) this.formatTree.SelectedNode;
     if (this.currentFormatNode != null)
     {
         this.currentFormatObject = this.currentFormatNode.FormatObject;
     }
     else
     {
         this.currentFormatObject = null;
     }
     this.LoadFormatProperties();
 }
 private void InitPage()
 {
     this.formatNodes = new ArrayList();
     this.propChangesPending = false;
     this.fontNameChanged = false;
     this.currentFormatNode = null;
     this.currentFormatObject = null;
     this.formatTree.Nodes.Clear();
     this.InitFormatUI();
 }
 private void InitFormatTree()
 {
     FormatTreeNode node;
     FormatObject obj2;
     if (base.IsDataGridMode)
     {
         System.Web.UI.WebControls.DataGrid baseControl = (System.Web.UI.WebControls.DataGrid) base.GetBaseControl();
         obj2 = new FormatStyle(baseControl.ControlStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_EntireDG"), obj2);
         this.formatTree.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(baseControl.HeaderStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Header"), obj2);
         this.formatTree.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(baseControl.FooterStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Footer"), obj2);
         this.formatTree.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(baseControl.PagerStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Pager"), obj2);
         this.formatTree.Nodes.Add(node);
         this.formatNodes.Add(node);
         FormatTreeNode node2 = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Items"), null);
         this.formatTree.Nodes.Add(node2);
         obj2 = new FormatStyle(baseControl.ItemStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_NormalItems"), obj2);
         node2.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(baseControl.AlternatingItemStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_AltItems"), obj2);
         node2.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(baseControl.SelectedItemStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_SelItems"), obj2);
         node2.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(baseControl.EditItemStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_EditItems"), obj2);
         node2.Nodes.Add(node);
         this.formatNodes.Add(node);
         DataGridColumnCollection columns = baseControl.Columns;
         int count = columns.Count;
         if (count != 0)
         {
             FormatTreeNode node3 = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Columns"), null);
             this.formatTree.Nodes.Add(node3);
             for (int i = 0; i < count; i++)
             {
                 DataGridColumn runtimeColumn = columns[i];
                 string text = "Columns[" + i.ToString(NumberFormatInfo.CurrentInfo) + "]";
                 string headerText = runtimeColumn.HeaderText;
                 if (headerText.Length != 0)
                 {
                     text = text + " - " + headerText;
                 }
                 obj2 = new FormatColumn(runtimeColumn);
                 obj2.LoadFormatInfo();
                 FormatTreeNode node4 = new FormatTreeNode(text, obj2);
                 node3.Nodes.Add(node4);
                 this.formatNodes.Add(node4);
                 obj2 = new FormatStyle(runtimeColumn.HeaderStyle);
                 obj2.LoadFormatInfo();
                 node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Header"), obj2);
                 node4.Nodes.Add(node);
                 this.formatNodes.Add(node);
                 obj2 = new FormatStyle(runtimeColumn.FooterStyle);
                 obj2.LoadFormatInfo();
                 node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Footer"), obj2);
                 node4.Nodes.Add(node);
                 this.formatNodes.Add(node);
                 obj2 = new FormatStyle(runtimeColumn.ItemStyle);
                 obj2.LoadFormatInfo();
                 node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Items"), obj2);
                 node4.Nodes.Add(node);
                 this.formatNodes.Add(node);
             }
         }
     }
     else
     {
         DataList list = (DataList) base.GetBaseControl();
         obj2 = new FormatStyle(list.ControlStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_EntireDL"), obj2);
         this.formatTree.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(list.HeaderStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Header"), obj2);
         this.formatTree.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(list.FooterStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Footer"), obj2);
         this.formatTree.Nodes.Add(node);
         this.formatNodes.Add(node);
         FormatTreeNode node5 = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Items"), null);
         this.formatTree.Nodes.Add(node5);
         obj2 = new FormatStyle(list.ItemStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_NormalItems"), obj2);
         node5.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(list.AlternatingItemStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_AltItems"), obj2);
         node5.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(list.SelectedItemStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_SelItems"), obj2);
         node5.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(list.EditItemStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_EditItems"), obj2);
         node5.Nodes.Add(node);
         this.formatNodes.Add(node);
         obj2 = new FormatStyle(list.SeparatorStyle);
         obj2.LoadFormatInfo();
         node = new FormatTreeNode(System.Design.SR.GetString("BDLFmt_Node_Separators"), obj2);
         this.formatTree.Nodes.Add(node);
         this.formatNodes.Add(node);
     }
 }