Example #1
0
        internal void RunPage(Pages pgs, Row row)
        {
            WorkClass wc = this.GetValue(pgs.Report);

            if (wc.OutputRow == row && wc.OutputPage == pgs.CurrentPage)
            {
                return;
            }

            Page p = pgs.CurrentPage;

            //we need to run through all parent  groupings to see if there are groups that we are to repeat on new page
            float height = p.YOffset + HeightOfRows(pgs, row);

            if (height > pgs.BottomOfPage)
            {
                bool  bRepeatedParent = this.RepeatOnNewPage;
                Table t = OwnerTable;
                if (Parent.GetType() == typeof(TableGroup))
                {
                    TableGroup  tg  = (TableGroup)Parent;
                    TableGroups tmp = (TableGroups)tg.Parent;

                    for (int i = 0; i < tmp.Items.Count; i++)
                    {
                        if (tmp.Items[i] == tg) //if we reached current header - break(no need to look at child groups)
                        {
                            break;
                        }
                        if (tmp.Items[i].Header._RepeatOnNewPage)
                        {
                            bRepeatedParent = true;
                            break;
                        }
                    }
                }
                //if we have repeated parent group - we call RunPageHeader to repeat them
                //if current header is repeating too - we return(as we already put it)
                //if no - we put it to new page
                p = t.RunPageNew(pgs, p);
                if (bRepeatedParent)
                {
                    t.RunPageHeader(pgs, row, false, null);
                    if (this.RepeatOnNewPage)
                    {
                        return;
                    }
                }
            }
            //this will add current header
            _TableRows.RunPage(pgs, row);
            wc.OutputRow  = row;
            wc.OutputPage = pgs.CurrentPage;
            return;
        }
Example #2
0
 internal Rows(Report rpt, TableGroups tg, Grouping g, Sorting s)
 {
     _Rpt    = rpt;
     _SortBy = new List <RowsSortExpression>();
     // Pull all the sort expression together
     if (tg != null)
     {
         foreach (TableGroup t in tg.Items)
         {
             foreach (GroupExpression ge in t.Grouping.GroupExpressions.Items)
             {
                 _SortBy.Add(new RowsSortExpression(ge.Expression));
             }
             // TODO what to do with the sort expressions!!!!
         }
     }
     if (g != null)
     {
         if (g.ParentGroup != null)
         {
             _SortBy.Add(new RowsSortExpression(g.ParentGroup));
         }
         else if (g.GroupExpressions != null)
         {
             foreach (GroupExpression ge in g.GroupExpressions.Items)
             {
                 _SortBy.Add(new RowsSortExpression(ge.Expression));
             }
         }
     }
     if (s != null)
     {
         foreach (SortBy sb in s.Items)
         {
             _SortBy.Add(new RowsSortExpression(sb.SortExpression, sb.Direction == SortDirectionEnum.Ascending));
         }
     }
     if (_SortBy.Count > 0)
     {
         _SortBy.TrimExcess();
     }
     else
     {
         _SortBy = null;
     }
 }
Example #3
0
        internal Table(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p, xNode)
        {
            _TableColumns             = null;
            _Header                   = null;
            _TableGroups              = null;
            _Details                  = null;
            _Footer                   = null;
            _FillPage                 = true;
            _DetailDataElementName    = "Details";
            _DetailDataCollectionName = "Details_Collection";
            _DetailDataElementOutput  = DataElementOutputEnum.Output;
            _IsGrid                   = xNode.Name != "Table"; // a grid is a restricted table to no data behind it

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "TableColumns":
                    _TableColumns = new TableColumns(r, this, xNodeLoop);
                    break;

                case "Header":
                    _Header = new Header(r, this, xNodeLoop);
                    break;

                case "TableGroups":
                    _TableGroups = new TableGroups(r, this, xNodeLoop);
                    break;

                case "Details":
                    _Details = new Details(r, this, xNodeLoop);
                    break;

                case "Footer":
                    _Footer = new Footer(r, this, xNodeLoop);
                    break;

                case "FillPage":
                    _FillPage = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "DetailDataElementName":
                    _DetailDataElementName = xNodeLoop.InnerText;
                    break;

                case "DetailDataCollectionName":
                    _DetailDataCollectionName = xNodeLoop.InnerText;
                    break;

                case "DetailDataElementOutput":
                    _DetailDataElementOutput = Engine.DataElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    if (DataRegionElement(xNodeLoop))                                   // try at DataRegion level
                    {
                        break;
                    }
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown " + xNode.Name + " element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            DataRegionFinish();                                 // Tidy up the DataRegion
            if (_TableColumns == null)
            {
                OwnerReport.rl.LogError(8, "TableColumns element must be specified for a " + xNode.Name + ".");
                return;
            }

            // Verify Grid restrictions
            if (_IsGrid)
            {
                if (_TableGroups != null)
                {
                    OwnerReport.rl.LogError(8, "TableGroups not allowed in Grid element '" + xNode.Name + "'.");
                }
            }

            if (OwnerReport.rl.MaxSeverity < 8)
            {
                VerifyCC();                                     // Verify column count
            }
        }