public void PageHeaderShouldContainNoItem() { ICSharpCode.Reports.Core.BaseSection s = this.mockReportModel.ReportHeader; ReportItemCollection c = s.Items; Assert.AreEqual(0, s.Items.Count); }
private void FixLayout(ICSharpCode.Reports.Core.BaseSection section, BaseReportItem item, GlobalEnums.ItemsLayout layout) { item.Size = new Size(GlobalValues.PreferedSize.Width, GlobalValues.PreferedSize.Height); Point p = Point.Empty; switch (layout) { case GlobalEnums.ItemsLayout.Left: p = new Point(this.ReportModel.ReportSettings.LeftMargin, GlobalValues.ControlMargins.Top); break; case GlobalEnums.ItemsLayout.Center: p = new Point((section.Size.Width / 2) - (item.Size.Width / 2), GlobalValues.ControlMargins.Top); break; case GlobalEnums.ItemsLayout.Right: p = new Point(section.Size.Width - item.Size.Width - GlobalValues.ControlMargins.Right, GlobalValues.ControlMargins.Top); break; default: break; } item.Location = p; }
public void PageDetailShouldContainRowItem() { ICSharpCode.Reports.Core.BaseSection s = this.reportModel.DetailSection; BaseReportItem item = s.Items[0]; Assert.That(item, Is.InstanceOf(typeof(ICSharpCode.Reports.Core.BaseRowItem))); }
public Rectangle Layout(Graphics graphics,BaseSection section) { if (graphics == null) { throw new ArgumentNullException("graphics"); } if (section == null) { throw new ArgumentNullException("section"); } //section.Items.SortByLocation(); IEnumerable<BaseReportItem> canGrowShrinkCollection = from bt in section.Items where bt.CanGrow == true select bt; Rectangle desiredSectionRectangle = new Rectangle(section.Location.X, section .Location.Y, section .Size.Width, section.Size.Height); if (canGrowShrinkCollection.Count() > 0) { int extend = section.Size.Height - canGrowShrinkCollection.First().Size.Height; Rectangle surroundingRec = FindSurroundingRectangle(graphics,canGrowShrinkCollection); if (surroundingRec.Height > desiredSectionRectangle .Height) { desiredSectionRectangle = new Rectangle(section.Location.X, section .Location.Y, section .Size.Width, surroundingRec.Size.Height + extend); } } return desiredSectionRectangle; }
public void PageFooterShouldContainOneItem() { ICSharpCode.Reports.Core.BaseSection s = this.reportModel.PageFooter; Assert.AreEqual(1, s.Items.Count); ICSharpCode.Reports.Core.BaseTextItem item = (ICSharpCode.Reports.Core.BaseTextItem)s.Items[0]; Assert.IsNotNull(item); }
public void PageFooterContainsPageNumberFunction() { ICSharpCode.Reports.Core.BaseSection s = this.reportModel.PageFooter; ICSharpCode.Reports.Core.BaseTextItem item = (ICSharpCode.Reports.Core.BaseTextItem)s.Items[0]; Assert.AreEqual("=Globals!PageNumber", item.Text); Assert.AreEqual("PageNumber1", item.Name); }
public void Section_Should_Contain_DataRow() { ICSharpCode.Reports.Core.BaseSection section = this.reportModel.DetailSection; //DatatRow var c = new Collection <ICSharpCode.Reports.Core.BaseRowItem>(section.Items.OfType <ICSharpCode.Reports.Core.BaseRowItem>().ToList()); Assert.That(c.Count, Is.GreaterThanOrEqualTo(1)); }
public void Init() { Label l = new Label(); this.graphics = l.CreateGraphics(); section = new BaseSection(); section.Location = new Point (50,50); section.Size = new Size(400,200); }
public SectionRenderEventArgs(BaseSection section, int pageNumber,int rowNumber, BaseSection currentSection):base(section){ this.pageNumber = pageNumber; this.currentSection = currentSection; this.rowNumber = rowNumber; }
public void PageHeaderRowShouldContainTextItems() { ICSharpCode.Reports.Core.BaseSection section = this.reportModel.PageHeader; BaseReportItem item = section.Items[0]; Assert.IsInstanceOf <ICSharpCode.Reports.Core.BaseRowItem>(item, "Wrong object, should be 'ICSharpCode.Reports.Core.BaseRowItem"); }
public void Row_Should_Contain_Dataitems() { ICSharpCode.Reports.Core.BaseSection s = this.reportModel.DetailSection; ICSharpCode.Reports.Core.BaseRowItem dataRow = (ICSharpCode.Reports.Core.BaseRowItem)s.Items[0]; var item = dataRow.Items[0]; Assert.That(item, Is.InstanceOf(typeof(ICSharpCode.Reports.Core.BaseDataItem))); }
public void PageHeaderShouldContainOneItem() { ICSharpCode.Reports.Core.BaseSection section = this.createdReportModel.ReportHeader; ReportItemCollection c = section.Items; Assert.AreEqual(1, section.Items.Count); ICSharpCode.Reports.Core.BaseReportItem item = section.Items[0]; Assert.IsNotNull(item); }
public void PageDetailShouldContainDataItems() { ICSharpCode.Reports.Core.BaseSection s = this.reportModel.DetailSection; ICSharpCode.Reports.Core.BaseRowItem rowItem = (ICSharpCode.Reports.Core.BaseRowItem)s.Items[0]; Assert.IsTrue(rowItem.Items.Count > 0); BaseReportItem item = rowItem.Items[0]; Assert.That(item, Is.InstanceOf(typeof(ICSharpCode.Reports.Core.BaseDataItem))); }
public void PageDetail_Should_Contains_GroupedHeader() { ICSharpCode.Reports.Core.BaseSection section = this.reportModel.DetailSection; //GroupHeader var c = new Collection <ICSharpCode.Reports.Core.GroupHeader>(section.Items.OfType <ICSharpCode.Reports.Core.GroupHeader>().ToList()); Assert.That(c.Count, Is.GreaterThanOrEqualTo(1)); }
public RenderTable(IDataNavigator datanavigator,Rectangle parentRectangle,ISinglePage singlePage,ILayouter layouter,BaseSection section) { this.dataNavigator = datanavigator; this.parentRectangle = parentRectangle; this.singlePage = singlePage; this.layouter = layouter; this.currentSection = section; }
protected static void AddItemsToSection(ICSharpCode.Reports.Core.BaseSection section, ReportItemCollection items) { int defY = section.Location.Y + GlobalValues.ControlMargins.Top; int defX = section.Size.Width / items.Count; int startX = section.Location.X + GlobalValues.ControlMargins.Left; foreach (var ir in items) { Point np = new Point(startX, defY); startX += defX; ir.Location = np; section.Items.Add(ir); } }
public override void Initialize(IComponent component) { if (component == null) { throw new ArgumentNullException("component"); } base.Initialize(component); this.section = (BaseSection)component; if (String.IsNullOrEmpty(component.Site.Name)) { component.Site.Name = section.Name; } else { section.Name = component.Site.Name; } GetService (); }
public static IBaseRenderer CreateRenderer (BaseReportItem itemToConvert,IDataNavigator dataNavigator, ISinglePage singlePage,ILayouter layouter,BaseSection section) { Type t = itemToConvert.GetType(); if (t.Equals(typeof(BaseTableItem))) { return new RenderTable(dataNavigator,Rectangle.Empty,singlePage,layouter,section); } if (t.Equals(typeof(BaseRowItem))) { // return new GroupedRowConverter (dataNavigator,singlePage,layouter); // Console.WriteLine("render Row"); } return null; }
public override void CreateDataSection(ICSharpCode.Reports.Core.BaseSection section) { if (section == null) { throw new ArgumentNullException("section"); } if (base.ParentItem != null) { base.AddItemsToContainer(base.ReportModel.DetailSection, this.reportItems); } else { AddItemsToSection(base.ReportModel.DetailSection, this.reportItems); } }
protected void AddItemsToContainer(ICSharpCode.Reports.Core.BaseSection section, ReportItemCollection items) { section.Items.Add(this.parentItem as BaseReportItem); ICSharpCode.Reports.Core.BaseReportItem bri = this.parentItem as ICSharpCode.Reports.Core.BaseReportItem; int defY = bri.Location.Y + GlobalValues.ControlMargins.Top; int defX = bri.Size.Width / items.Count; int startX = bri.Location.X + GlobalValues.ControlMargins.Left; foreach (var ir in items) { Point np = new Point(startX, defY); startX += defX; ir.Location = np; this.parentItem.Items.Add(ir); } }
public override void CreateDataSection(ICSharpCode.Reports.Core.BaseSection section) { if (section == null) { throw new ArgumentNullException("section"); } System.Drawing.Printing.Margins margin = GlobalValues.ControlMargins; ICSharpCode.Reports.Core.BaseTableItem table = new ICSharpCode.Reports.Core.BaseTableItem(); ICSharpCode.Reports.Core.BaseRowItem detailRow = new ICSharpCode.Reports.Core.BaseRowItem(); table.Name = "Table1"; base.Container = table; AdjustContainer(base.ReportModel.DetailSection, table); base.ReportModel.DetailSection.Items.Add(table); ICSharpCode.Reports.Core.BaseRowItem headerRow = CreateRowWithTextColumns(Container); Container.Items.Add(headerRow); Point insertLocation = new Point(margin.Left, headerRow.Location.Y + headerRow.Size.Height + margin.Bottom + margin.Top); if (base.ReportModel.ReportSettings.GroupColumnsCollection.Count > 0) { //Groupheader var groupHeader = base.CreateGroupHeader(insertLocation); Container.Items.Add(groupHeader); insertLocation = new Point(margin.Left, insertLocation.Y + groupHeader.Size.Height + margin.Bottom + margin.Top); //Detail CreateDetail(detailRow, insertLocation); Container.Items.Add(detailRow); // GroupFooter var groupFooter = base.CreateFooter(new Point(margin.Left, 130)); Container.Items.Add(groupFooter); } else { CreateDetail(detailRow, insertLocation); Container.Items.Add(detailRow); } CalculateContainerSize(); section.Size = new Size(section.Size.Width, Container.Size.Height + margin.Top + margin.Bottom); }
public override void CreateDataSection(ICSharpCode.Reports.Core.BaseSection section) { if (section == null) { throw new ArgumentNullException("section"); } System.Drawing.Printing.Margins margin = GlobalValues.ControlMargins; ICSharpCode.Reports.Core.BaseTableItem table = new ICSharpCode.Reports.Core.BaseTableItem(); table.Name = "Table1"; AdjustContainer(base.ReportModel.DetailSection, table); ICSharpCode.Reports.Core.BaseRowItem r1 = CreateRowWithTextColumns(table, this.reportItems); ICSharpCode.Reports.Core.BaseRowItem r2 = new ICSharpCode.Reports.Core.BaseRowItem(); AdjustContainer(table, r2); r2.Location = new Point(margin.Left, r1.Location.Y + r1.Size.Height + margin.Bottom + margin.Top); int defX = r2.Size.Width / this.reportItems.Count; int startX = r2.Location.X + margin.Left; foreach (ICSharpCode.Reports.Core.BaseReportItem ir in this.reportItems) { Point np = new Point(startX, margin.Top); startX += defX; ir.Location = np; ir.Parent = r2; r2.Items.Add(ir); } table.Size = new Size(table.Size.Width, margin.Top + r1.Size.Height + margin.Bottom + r2.Size.Height + margin.Bottom); section.Size = new Size(section.Size.Width, table.Size.Height + margin.Top + margin.Bottom); table.Items.Add(r1); table.Items.Add(r2); base.ReportModel.DetailSection.Items.Add(table); }
public void MeasureReportHeader (BaseSection section) { if (section == null) { throw new ArgumentNullException("section"); } Size size = Size.Empty; section.SectionOffset = this.printableArea.Location.Y; if (this.firstPage) { if (section.Items.Count > 0) { size = new Size(this.marginBounds.Width,section.Size.Height + 3 * GlobalValues.GapBetweenContainer); } else { size = new Size(this.marginBounds.Width,0); } } else { size = new Size(this.marginBounds.Width,0); } this.reportHeaderRectangle = new Rectangle(this.printableArea.Location,size); }
private Point DoContainerControl(BaseSection section, ISimpleContainer container, ReportPageEventArgs rpea) { Point drawPoint = Point.Empty; if (section.Visible) { //Always set section.size to it's original value section.Size = this.SectionBounds.DetailSectionRectangle.Size; Size containerSize = new Size(section.Items[0].Size.Width, section.Items[0].Size.Height); ISimpleContainer row = (ISimpleContainer)section.Items[0]; PrintHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics, base.Layout, row); section.Render(rpea); foreach (BaseReportItem item in section.Items) { if (item.Parent == null) { item.Parent = section; } item.SectionOffset = section.SectionOffset; item.Render(rpea); drawPoint = new Point(item.Location.X, section.SectionOffset + section.Size.Height); rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, section.SectionOffset + section.Size.Height); } section.Items[0].Size = containerSize; if ((section.CanGrow == false) && (section.CanShrink == false)) { return(new Point(section.Location.X, section.Size.Height)); } section.Items[0].Size = containerSize; return(drawPoint); } return(drawPoint); }
private Point DoContainerControl (BaseSection section, ISimpleContainer container, ReportPageEventArgs rpea) { Point drawPoint = Point.Empty; if (section.Visible){ //Always set section.size to it's original value section.Size = this.SectionBounds.DetailSectionRectangle.Size; Size containerSize = new Size (section.Items[0].Size.Width,section.Items[0].Size.Height); ISimpleContainer row =(ISimpleContainer) section.Items[0]; PrintHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics,base.Layout,row); section.Render (rpea); foreach (BaseReportItem item in section.Items) { if (item.Parent == null) { item.Parent = section; } item.SectionOffset = section.SectionOffset; item.Render(rpea); drawPoint = new Point(item.Location.X, section.SectionOffset + section.Size.Height); rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height); } section.Items[0].Size = containerSize; if ((section.CanGrow == false)&& (section.CanShrink == false)) { return new Point(section.Location.X,section.Size.Height); } section.Items[0].Size = containerSize; return drawPoint; } return drawPoint; }
public override void CreateDataSection(ICSharpCode.Reports.Core.BaseSection section) { if (section == null) { throw new ArgumentNullException("section"); } Size detailSize = Size.Empty; Size itemSize = Size.Empty; Point rowLoction = Point.Empty; if (base.ReportModel.ReportSettings.GroupColumnsCollection.Count > 0) { var groupheader = base.CreateGroupHeader(new Point(GlobalValues.ControlMargins.Left, GlobalValues.ControlMargins.Top)); base.ReportModel.DetailSection.Items.Add(groupheader); // Detail itemSize = CreateDetail(); detailSize = new Size(Container.Size.Width, itemSize.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom); // GroupFooter var groupFooter = base.CreateFooter(new Point(GlobalValues.ControlMargins.Left, 80)); base.ReportModel.DetailSection.Items.Add(groupFooter); section.Size = new Size(section.Size.Width, 125); rowLoction = new Point(Container.Location.X, 45); } else { itemSize = CreateDetail(); detailSize = new Size(Container.Size.Width, itemSize.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom); section.Size = new Size(section.Size.Width, Container.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom); rowLoction = new Point(Container.Location.X, GlobalValues.ControlMargins.Top); } base.ConfigureDetails(rowLoction, detailSize); section.Items.Add(Container as BaseReportItem); }
private Point RenderSectionWithSimpleContainer (BaseSection section, ISimpleContainer container, Point offset, ReportPageEventArgs rpea) { Point currentPosition = new Point(section.Location.X + container.Location.X,offset.Y); // if (section.VisibleInReport) // { //Always set section.size to it's original value section.Size = this.SectionBounds.DetailSectionRectangle.Size; Size containerSize = new Size (section.Items[0].Size.Width,section.Items[0].Size.Height); LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics,base.Layout,container); section.Render (rpea); PrintHelper.AdjustParent(section,section.Items); foreach (BaseReportItem item in section.Items) { ISimpleContainer con = item as ISimpleContainer; if (con != null) { Rectangle r = StandardPrinter.RenderContainer(container,Evaluator,offset,rpea); currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r); } else { item.SectionOffset = section.SectionOffset; Point saveLocation = item.Location; item.Render(rpea); item.Location = saveLocation; ISimpleContainer cont = item as ISimpleContainer; Rectangle r = StandardPrinter.RenderContainer(cont,Evaluator,currentPosition,rpea); currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r); item.Location = saveLocation; rpea.LocationAfterDraw = new Point (rpea.LocationAfterDraw.X,section.SectionOffset + section.Size.Height); } section.Items[0].Size = containerSize; return currentPosition; } return currentPosition; // } // return currentPosition; }
public void PageFooterShouldContainNoItem() { ICSharpCode.Reports.Core.BaseSection s = this.mockReportModel.PageFooter; Assert.AreEqual(0, s.Items.Count); }
public void DetailShouldContainNoItem() { ICSharpCode.Reports.Core.BaseSection s = this.mockReportModel.DetailSection; Assert.AreEqual(0, s.Items.Count); }
public virtual void CreateDataSection(ICSharpCode.Reports.Core.BaseSection section) { }
public void StartLayoutAt (BaseSection section) { if (section == null) { throw new ArgumentNullException("section"); } this.startSection = section; }
public SectionEventArgs(BaseSection section) { this.section = section; }
public RenderTable(IDataNavigator datanavigator, Rectangle parentRectangle, ISinglePage singlePage, ILayouter layouter, BaseSection section) { this.dataNavigator = datanavigator; this.parentRectangle = parentRectangle; this.singlePage = singlePage; this.layouter = layouter; this.currentSection = section; }
public static IBaseRenderer CreateRenderer(BaseReportItem itemToConvert, IDataNavigator dataNavigator, ISinglePage singlePage, ILayouter layouter, BaseSection section) { Type t = itemToConvert.GetType(); if (t.Equals(typeof(BaseTableItem))) { Console.WriteLine("render Table"); return(new RenderTable(dataNavigator, Rectangle.Empty, singlePage, layouter, section)); } if (t.Equals(typeof(BaseRowItem))) { // return new GroupedRowConverter (dataNavigator,singlePage,layouter); Console.WriteLine("render Row"); } return(null); }
private ICSharpCode.Reports.Core.BaseTableItem CreateContainer() { ICSharpCode.Reports.Core.BaseSection section = this.reportModel.DetailSection; ICSharpCode.Reports.Core.BaseTableItem table = section.Items[0] as ICSharpCode.Reports.Core.BaseTableItem; return(table); }
public void PageDetail_Should_Contain_Three_Items() { ICSharpCode.Reports.Core.BaseSection section = this.reportModel.DetailSection; Assert.That(section.Items.Count.Equals(3)); }
public SectionEventArgs(BaseSection section){ this.section = section; }