Exemple #1
0
        private void InitializeNodeTree()
        {
            for (int i = 0; i < treeList.Records.Count; i++)
            {
                XRTreeListNode currentNode = treeList.Records[i] as XRTreeListNode;

                object parentValue = currentNode.ParentValue;
                if (parentValue == null || parentValue.Equals(currentNode.KeyValue) || currentNode.KeyValue == null)
                {
                    treeList.Nodes.Add(currentNode);
                }
                else
                {
                    XRTreeListNode parentNode = nodeTable[parentValue] as XRTreeListNode;
                    if (parentNode == null)
                    {
                        treeList.Nodes.Add(currentNode);
                    }
                    else
                    {
                        parentNode.AddNode(currentNode);
                    }
                }
            }
        }
        private XRTreeListNodeCollection CreateDesignNodes()
        {
            XRTreeListNodeCollection designNodes = new XRTreeListNodeCollection(null);

            XRTreeListNode parentNode = null;

            for (int i = 0; i < 3; i++)
            {
                XRTreeListNode currentNode = new XRTreeListNode(TreeList);

                List <XRFieldHeader> visibleHeaders = TreeList.VisibleHeaders;

                for (int j = 0; j < visibleHeaders.Count; j++)
                {
                    if (visibleHeaders[j].FieldType != null)
                    {
                        currentNode[j] = visibleHeaders[j].FieldType.Name;
                    }
                }

                if (parentNode == null)
                {
                    designNodes.Add(currentNode);
                    parentNode = currentNode;
                }
                else
                {
                    parentNode.AddNode(currentNode);
                    parentNode = currentNode;
                }
            }

            return(designNodes);
        }
        protected override void CreateBricksForRecord(XRDataRecord record, PanelBrick parentBrick, bool isHeader, ref float actualHeight)
        {
            XRTreeListNode     node = record as XRTreeListNode;
            PrintNodeEventArgs args = new PrintNodeEventArgs(node);

            if (!isHeader)
            {
                TreeList.OnPrintNode(args);
            }

            if (args.SuppressType == NodeSuppressType.Leave)
            {
                int nodeLevel = node.Level;

                TreeListNodeBrick nodeBrick = new TreeListNodeBrick(TreeList, (DataContainerBrick)parentBrick, isHeader);
                nodeBrick.Style     = XRControlStyle.Default.Clone() as XRControlStyle;
                nodeBrick.Separable = false;

                RecordPrintCache cache = new TreeListNodePrintCache(nodeBrick, node.Level);

                List <VisualBrick>   childBricks    = new List <VisualBrick>();
                List <XRFieldHeader> visibleHeaders = TreeList.VisibleHeaders;

                for (int i = 0; i < visibleHeaders.Count; i++)
                {
                    VisualBrick valueBrick = CreateCellBrick(TreeList, parentBrick, node, i, isHeader);
                    childBricks.Add(valueBrick);
                }

                CorrectBrickBounds(nodeBrick, childBricks, nodeLevel * TreeList.NodeIndent, actualHeight);
                float nodeHeight = nodeBrick.Rect.Height;

                VisualBrickHelper.SetBrickBounds(nodeBrick, nodeBrick.Rect, TreeList.Dpi);

                parentBrick.Bricks.Add(nodeBrick);

                actualHeight += nodeHeight;

                if (!IsDesignMode)
                {
                    if (isHeader)
                    {
                        ((DataContainerBrick)parentBrick).PrintCache.HeaderCache = cache;
                    }
                    else
                    {
                        ((DataContainerBrick)parentBrick).PrintCache.RecordsCache.Add(cache);
                    }
                }
            }

            if (args.SuppressType != NodeSuppressType.SuppressWithChildren)
            {
                foreach (XRTreeListNode childNode in node.Nodes)
                {
                    CreateBricksForRecord(childNode, parentBrick, isHeader, ref actualHeight);
                }
            }
        }
Exemple #4
0
        protected override void InitializeRecord(XRDataRecord record, object dataItem)
        {
            base.InitializeRecord(record, dataItem);

            XRTreeListNode node = record as XRTreeListNode;

            node.KeyValue    = keyFieldDescriptor == null ? null : keyFieldDescriptor.GetValue(dataItem);
            node.ParentValue = parentFieldDescriptor == null ? null : parentFieldDescriptor.GetValue(dataItem);

            if (node.KeyValue != null && !nodeTable.ContainsKey(node.KeyValue))
            {
                nodeTable.Add(node.KeyValue, node);
            }
            else
            {
                nodeTable.Add(Guid.NewGuid(), node);
            }
        }
 public PrintNodeCellEventArgs(XRTreeListNode currentNode, XRTreeListColumn column, VisualBrick brick, BrickStyle style) : base(column, brick, style)
 {
     this.node = currentNode;
 }
 public PrintNodeEventArgs(XRTreeListNode currentNode)
 {
     this.Node    = currentNode;
     SuppressType = NodeSuppressType.Leave;
 }
 public void AddNode(XRTreeListNode childNode)
 {
     this.Nodes.Add(childNode);
     childNode.ParentNode = this;
 }
 public XRTreeListNodeCollection(XRTreeListNode parent)
 {
     this.parent = parent;
 }