private GroupTreeItem MakeGroupTree(GroupHeaderBand groupBand)
        {
            GroupTreeItem  rootItem   = new GroupTreeItem(null);
            DataSourceBase dataSource = groupBand.DataSource;
            bool           isFirstRow = true;

            // cycle through rows
            dataSource.First();
            while (dataSource.HasMoreRows)
            {
                if (isFirstRow)
                {
                    InitGroupItem(groupBand, rootItem);
                }
                else
                {
                    CheckGroupItem(groupBand, rootItem);
                }

                dataSource.Next();
                isFirstRow = false;
                if (Report.Aborted)
                {
                    break;
                }
            }

            return(rootItem);
        }
示例#2
0
        private void InitGroupItem(GroupHeaderBand header, GroupTreeItem curItem)
        {
            while (header != null)
            {
                header.ResetGroupValue();
                header.AbsRowNo = 0;
                header.RowNo    = 0;

                curItem = curItem.AddItem(new GroupTreeItem(header));
                curItem.RowCount++;
                header = header.NestedGroup;
            }
        }
        private void CheckGroupItem(GroupHeaderBand header, GroupTreeItem curItem)
        {
            while (header != null)
            {
                if (header.GroupValueChanged())
                {
                    InitGroupItem(header, curItem);
                    break;
                }

                header  = header.NestedGroup;
                curItem = curItem.LastItem;
                curItem.RowCount++;
            }
        }
        private void ShowGroupTree(GroupTreeItem root)
        {
            if (root.Band != null)
            {
                root.Band.GroupDataBand.DataSource.CurrentRowNo = root.RowNo;
                ShowGroupHeader(root.Band);
            }

            if (root.Items.Count == 0)
            {
                if (root.RowCount != 0)
                {
                    int rowCount = root.RowCount;
                    int maxRows  = root.Band.GroupDataBand.MaxRows;
                    if (maxRows > 0 && rowCount > maxRows)
                    {
                        rowCount = maxRows;
                    }
                    bool keepFirstRow = NeedKeepFirstRow(root.Band);
                    bool keepLastRow  = NeedKeepLastRow(root.Band.GroupDataBand);
                    RunDataBand(root.Band.GroupDataBand, rowCount, keepFirstRow, keepLastRow);
                }
            }
            else
            {
                ShowDataHeader(root.FirstItem.Band);

                for (int i = 0; i < root.Items.Count; i++)
                {
                    GroupTreeItem item = root.Items[i];
                    item.Band.IsFirstRow = i == 0;
                    item.Band.IsLastRow  = i == root.Items.Count - 1;

                    ShowGroupTree(item);
                    if (Report.Aborted)
                    {
                        break;
                    }
                }

                ShowDataFooter(root.FirstItem.Band);
            }

            if (root.Band != null)
            {
                ShowGroupFooter(root.Band);
            }
        }
 public GroupTreeItem AddItem(GroupTreeItem item)
 {
     Items.Add(item);
     return(item);
 }