Exemplo n.º 1
0
        public void PageHeaderShouldContainNoItem()
        {
            ICSharpCode.Reports.Core.BaseSection s = this.mockReportModel.ReportHeader;
            ReportItemCollection c = s.Items;

            Assert.AreEqual(0, s.Items.Count);
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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)));
        }
Exemplo n.º 4
0
		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);
 }
Exemplo n.º 7
0
        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);
		}
Exemplo n.º 9
0
		public SectionRenderEventArgs(BaseSection section,
		                              int pageNumber,int rowNumber,
		                              BaseSection currentSection):base(section){
		                             
			this.pageNumber = pageNumber;
			this.currentSection = currentSection;
			this.rowNumber = rowNumber;
		}
Exemplo n.º 10
0
        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)));
        }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
        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)));
        }
Exemplo n.º 14
0
        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));
        }
Exemplo n.º 15
0
		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;
	
		}
Exemplo n.º 16
0
        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);
            }
        }
Exemplo n.º 17
0
		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 ();
		}
Exemplo n.º 18
0
		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;
		}
Exemplo n.º 19
0
        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);
            }
        }
Exemplo n.º 20
0
        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);
            }
        }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
		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);
		}
Exemplo n.º 24
0
        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;
		}
Exemplo n.º 26
0
        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);
        }
Exemplo n.º 27
0
		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;
		}
Exemplo n.º 28
0
 public void PageFooterShouldContainNoItem()
 {
     ICSharpCode.Reports.Core.BaseSection s = this.mockReportModel.PageFooter;
     Assert.AreEqual(0, s.Items.Count);
 }
Exemplo n.º 29
0
 public void DetailShouldContainNoItem()
 {
     ICSharpCode.Reports.Core.BaseSection s = this.mockReportModel.DetailSection;
     Assert.AreEqual(0, s.Items.Count);
 }
Exemplo n.º 30
0
 public virtual void CreateDataSection(ICSharpCode.Reports.Core.BaseSection section)
 {
 }
Exemplo n.º 31
0
		public void StartLayoutAt (BaseSection section)
		{
			if (section == null) {
				throw new ArgumentNullException("section");
			}
			this.startSection = section;
		}
Exemplo n.º 32
0
 public SectionEventArgs(BaseSection section)
 {
     this.section = section;
 }
Exemplo n.º 33
0
        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;
        }
Exemplo n.º 34
0
        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);
 }
Exemplo n.º 36
0
 public void PageDetail_Should_Contain_Three_Items()
 {
     ICSharpCode.Reports.Core.BaseSection section = this.reportModel.DetailSection;
     Assert.That(section.Items.Count.Equals(3));
 }
Exemplo n.º 37
0
		public SectionEventArgs(BaseSection section){
			this.section = section;
		}