Browse Source

Rework Interfaces, test's for ContainerConverter

reports
Peter Forstmeier 13 years ago
parent
commit
7568743d2a
  1. 17
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj
  2. 43
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs
  3. 13
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/PageInfo.cs
  4. 7
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ExportColumnFactory.cs
  5. 6
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportColumn.cs
  6. 23
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportContainer.cs
  7. 22
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPage.cs
  8. 24
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPageInfo.cs
  9. 17
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IPrintableObject.cs
  10. 12
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportContainer.cs
  11. 1
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportCreator.cs
  12. 10
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs
  13. 15
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs
  14. 11
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs
  15. 23
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs
  16. 40
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportContainer.cs
  17. 27
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs
  18. 13
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs
  19. 18
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs
  20. 4
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs
  21. 53
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs
  22. 47
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/SectionConverter.cs
  23. 11
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportColumn.cs
  24. 28
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportContainer.cs
  25. 3
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportText.cs
  26. 64
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs
  27. 1
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj
  28. 14
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/BaseConvertFixture.cs
  29. 74
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/ContainerConverterFixture.cs
  30. 27
      src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs

17
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/ICSharpCode.Reporting.csproj

@ -60,21 +60,27 @@ @@ -60,21 +60,27 @@
<Compile Include="Src\Configuration\AssemblyInfo.cs" />
<Compile Include="Src\Factories\ExportColumnFactory.cs" />
<Compile Include="Src\Factories\SectionFactory.cs" />
<Compile Include="Src\Interfaces\IExportColumn.cs" />
<Compile Include="Src\Interfaces\IReportItem.cs" />
<Compile Include="Src\Interfaces\Export\IExportColumn.cs" />
<Compile Include="Src\Interfaces\Export\IExportContainer.cs" />
<Compile Include="Src\Interfaces\Export\IPage.cs" />
<Compile Include="Src\Interfaces\Export\IPageInfo.cs" />
<Compile Include="Src\Interfaces\IPrintableObject.cs" />
<Compile Include="Src\Interfaces\IReportContainer.cs" />
<Compile Include="Src\Interfaces\IReportCreator.cs" />
<Compile Include="Src\Interfaces\ISection.cs" />
<Compile Include="Src\Items\BaseSection.cs" />
<Compile Include="Src\Globals\GlobalEnums.cs" />
<Compile Include="Src\Globals\GlobalValues.cs" />
<Compile Include="Src\Interfaces\IReportModel.cs" />
<Compile Include="Src\Items\BaseTextItem.cs" />
<Compile Include="Src\Items\PrintableItem.cs" />
<Compile Include="Src\Items\ReportContainer.cs" />
<Compile Include="Src\Items\ReportItem.cs" />
<Compile Include="Src\Items\ReportModel.cs" />
<Compile Include="Src\Items\ReportSettings.cs" />
<Compile Include="Src\PageBuilder\BasePageBuilder.cs" />
<Compile Include="Src\PageBuilder\Converter\SectionConverter.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\BaseExportColumn.cs" />
<Compile Include="Src\PageBuilder\Converter\ContainerConverter.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportColumn.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportContainer.cs" />
<Compile Include="Src\PageBuilder\ExportColumns\ExportText.cs" />
<Compile Include="Src\PageBuilder\FormPageBuilder.cs" />
<Compile Include="Src\ReportingFactory.cs" />
@ -86,6 +92,7 @@ @@ -86,6 +92,7 @@
<Folder Include="Src\Globals" />
<Folder Include="Src" />
<Folder Include="Src" />
<Folder Include="Src\Interfaces\Export" />
<Folder Include="Src\Items" />
<Folder Include="Src\BaseClasses" />
<Folder Include="Src\Factories" />

43
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/Page.cs

@ -8,37 +8,30 @@ @@ -8,37 +8,30 @@
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.BaseClasses
{
/// <summary>
/// Description of Page.
/// </summary>
///
public interface IPage{
bool IsFirstPage {get;set;}
IPageInfo PageInfo {get;}
List<IExportColumn> Items {get; set;}
}
///
public class Page:IPage
{
public Page(IPageInfo pageInfo)
public Page(IPageInfo pageInfo,Size pageSize)
{
if (pageInfo == null) {
throw new ArgumentNullException("pageInfo");
}
PageInfo = pageInfo;
Items = new List<IExportColumn>();
Name = "Page";
Size = pageSize;
ExportedItems = new List<IExportColumn>();
}
public bool IsFirstPage {get;set;}
@ -46,6 +39,22 @@ namespace ICSharpCode.Reporting.BaseClasses @@ -46,6 +39,22 @@ namespace ICSharpCode.Reporting.BaseClasses
public IPageInfo PageInfo {get;private set;}
public List<IExportColumn> Items {get; set;}
public string Name {get;set;}
public System.Drawing.Size Size {get;set;}
public System.Drawing.Point Location {get;set;}
public List<IExportColumn> ExportedItems {get;set;}
public IExportContainer CreateExportColumn()
{
throw new NotImplementedException();
}
}
}

13
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/BaseClasses/PageInfo.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.BaseClasses
{
@ -14,17 +15,7 @@ namespace ICSharpCode.Reporting.BaseClasses @@ -14,17 +15,7 @@ namespace ICSharpCode.Reporting.BaseClasses
/// Description of PageInfo.
/// </summary>
///
public interface IPageInfo
{
int PageNumber {get;set;}
int TotalPages {get;set;}
string ReportName {get;set;}
string ReportFileName {get;set;}
string ReportFolder {get;}
DateTime ExecutionTime {get;set;}
// System.Collections.Hashtable ParameterHash {get;set;}
// IDataNavigator IDataNavigator {get;set;}
}
public class PageInfo:IPageInfo

7
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ExportColumnFactory.cs

@ -7,7 +7,9 @@ @@ -7,7 +7,9 @@
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
@ -22,8 +24,9 @@ namespace ICSharpCode.Reporting.Factories @@ -22,8 +24,9 @@ namespace ICSharpCode.Reporting.Factories
{
}
public IExportColumn CreateItem (IReportItem item) {
return item.CreateExportColumn();
public IExportColumn CreateItem (IPrintableObject item) {
var export = item.CreateExportColumn();
return export;
}
}
}

6
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IExportColumn.cs → src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportColumn.cs

@ -7,14 +7,14 @@ @@ -7,14 +7,14 @@
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using ICSharpCode.Reporting.BaseClasses;
namespace ICSharpCode.Reporting.Interfaces
namespace ICSharpCode.Reporting.Interfaces.Export
{
/// <summary>
/// Description of IExportColumn.
/// </summary>
public interface IExportColumn
public interface IExportColumn:IReportObject
{
}
}

23
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IExportContainer.cs

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 12.04.2013
* Time: 20:28
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Interfaces.Export
{
/// <summary>
/// Description of IExportContainer.
/// </summary>
public interface IExportContainer:IExportColumn
{
List<IExportColumn> ExportedItems {get;set;}
}
}

22
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPage.cs

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 11.04.2013
* Time: 19:58
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
namespace ICSharpCode.Reporting.Interfaces.Export
{
/// <summary>
/// Description of IPage.
/// </summary>
public interface IPage:IExportContainer
{
bool IsFirstPage {get;set;}
IPageInfo PageInfo {get;}
}
}

24
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/Export/IPageInfo.cs

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 11.04.2013
* Time: 19:59
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
namespace ICSharpCode.Reporting.Interfaces.Export
{
/// <summary>
/// Description of IPageInfo.
/// </summary>
public interface IPageInfo
{
int PageNumber {get;set;}
int TotalPages {get;set;}
string ReportName {get;set;}
string ReportFileName {get;set;}
string ReportFolder {get;}
}
}

17
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportItem.cs → src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IPrintableObject.cs

@ -8,24 +8,23 @@ @@ -8,24 +8,23 @@
*/
using System;
using System.Drawing;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.Interfaces
{
/// <summary>
/// Description of IPrintObject.
/// </summary>
public interface IReportItem
public interface IReportObject
{
string Name{get;set;}
Size Size {get;set;}
Point Location {get;set;}
// Font Font {get;set;}
//// bool VisibleInReport {get;set;}
// Color BackColor {get;set;}
// Color FrameColor {get;set;}
// int SectionOffset {get;set;}
// bool CanGrow {get;set;}
// bool CanShrink {get;set;}
IExportColumn CreateExportColumn();
}
public interface IPrintableObject:IReportObject {
IExportColumn CreateExportColumn();
}
}

12
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/ISection.cs → src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportContainer.cs

@ -1,22 +1,24 @@ @@ -1,22 +1,24 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 08.04.2013
* Time: 19:50
* Date: 16.04.2013
* Time: 19:53
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.Items;
namespace ICSharpCode.Reporting.Interfaces
{
/// <summary>
/// Description of ISection.
/// Description of IReportContainer.
/// </summary>
public interface ISection:IReportItem
public interface IReportContainer :IReportObject
{
List<ReportItem> Items {get;}
List<IPrintableObject> Items {get;set;}
IExportContainer CreateExportColumn();
}
}

1
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportCreator.cs

@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.Interfaces
{

10
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Interfaces/IReportModel.cs

@ -19,15 +19,19 @@ namespace ICSharpCode.Reporting.Interfaces @@ -19,15 +19,19 @@ namespace ICSharpCode.Reporting.Interfaces
{
ReportSettings ReportSettings {get;set;}
List<BaseSection> SectionCollection {get;}
/*
ISection ReportHeader {get;}
ISection PageHeader {get;}
ISection DetailSection {get;}
ISection PageFooter {get;}
ISection ReportFooter {get;}
/*
GlobalEnums.PushPullModel DataModel {get;}
*/
IReportContainer ReportHeader {get;}
IReportContainer PageHeader {get;}
IReportContainer DetailSection {get;}
IReportContainer PageFooter {get;}
IReportContainer ReportFooter {get;}
}
}

15
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs

@ -9,28 +9,27 @@ @@ -9,28 +9,27 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Items
{
/// <summary>
/// Description of BaseSection.
/// </summary>
public class BaseSection:ReportItem,ISection
public class BaseSection:ReportContainer,IReportContainer
{
#region Constructors
public BaseSection()
{
Console.WriteLine("---------- baseSection -------");
Items = new List<ReportItem>();
Items = new List<IPrintableObject>();
}
public BaseSection (string sectionName)
{
base.Name = sectionName;
public BaseSection (string name) {
Name = name;
}
public List<ReportItem> Items {get;private set;}
#endregion
}
}

11
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs

@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
using System;
using System.Drawing;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Items
@ -16,12 +17,12 @@ namespace ICSharpCode.Reporting.Items @@ -16,12 +17,12 @@ namespace ICSharpCode.Reporting.Items
/// <summary>
/// Description of BaseTextItem.
/// </summary>
public interface ITextItem:IReportItem
public interface ITextItem:IPrintableObject
{
Font Font {get;set;}
}
public class BaseTextItem:ReportItem,ITextItem
public class BaseTextItem:PrintableItem,ITextItem
{
public BaseTextItem(){
}
@ -30,7 +31,11 @@ namespace ICSharpCode.Reporting.Items @@ -30,7 +31,11 @@ namespace ICSharpCode.Reporting.Items
public override IExportColumn CreateExportColumn()
{
return new ExportText();
var ex = new ExportText();
ex.Name = Name;
ex.Location = Location;
ex.Size = Size;
return ex;
}
}
}

23
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 06.04.2013
* Time: 20:15
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.Items
{
public class PrintableItem : ReportItem,IPrintableObject
{
public virtual IExportColumn CreateExportColumn()
{
return null;
}
}
}

40
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportContainer.cs

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 16.04.2013
* Time: 19:51
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.Items
{
/// <summary>
/// Description of ReportContainer.
/// </summary>
public class ReportContainer:ReportItem,IReportContainer
{
public ReportContainer()
{
}
public List<IPrintableObject> Items {get;set;}
public IExportContainer CreateExportColumn()
{
return new ExportContainer(){
Name = this.Name,
Size = this.Size,
Location = this.Location
};
}
}
}

27
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportItem.cs

@ -9,27 +9,32 @@ @@ -9,27 +9,32 @@
using System;
using System.Drawing;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.Items
{
/// <summary>
/// Description of ReportItem.
/// </summary>
public class ReportItem:IReportItem
public class ReportItem : IReportObject
{
public ReportItem()
{
}
public string Name { get; set; }
public Point Location { get; set; }
public Size Size { get; set; }
public string Name {get;set;}
public Point Location {get;set;}
public Size Size {get;set;}
public virtual IExportColumn CreateExportColumn() {
return null;
}
}
}

13
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportModel.cs

@ -22,15 +22,12 @@ namespace ICSharpCode.Reporting.Items @@ -22,15 +22,12 @@ namespace ICSharpCode.Reporting.Items
public ReportModel() {
SectionCollection = new List<BaseSection>();
// foreach (GlobalEnums.ReportSection sec in Enum.GetValues(typeof(GlobalEnums.ReportSection))) {
// SectionCollection.Add (SectionFactory.Create(sec.ToString()));
// }
}
#region Sections
public ISection ReportHeader
public IReportContainer ReportHeader
{
get {
return (BaseSection)SectionCollection[0];
@ -38,7 +35,7 @@ namespace ICSharpCode.Reporting.Items @@ -38,7 +35,7 @@ namespace ICSharpCode.Reporting.Items
}
public ISection PageHeader
public IReportContainer PageHeader
{
get {
return (BaseSection)SectionCollection[1];
@ -46,7 +43,7 @@ namespace ICSharpCode.Reporting.Items @@ -46,7 +43,7 @@ namespace ICSharpCode.Reporting.Items
}
public ISection DetailSection
public IReportContainer DetailSection
{
get {
return (BaseSection)SectionCollection[2];
@ -54,14 +51,14 @@ namespace ICSharpCode.Reporting.Items @@ -54,14 +51,14 @@ namespace ICSharpCode.Reporting.Items
}
public ISection PageFooter
public IReportContainer PageFooter
{
get {
return (BaseSection)SectionCollection[3];
}
}
public ISection ReportFooter
public IReportContainer ReportFooter
{
get {
return (BaseSection)SectionCollection[4];

18
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs

@ -92,6 +92,24 @@ namespace ICSharpCode.Reporting.Items @@ -92,6 +92,24 @@ namespace ICSharpCode.Reporting.Items
}
}
// [Category("Page Settings")]
public int BottomMargin {get;set;}
// [Category("Page Settings")]
public int TopMargin {get;set;}
// [Category("Page Settings")]
public int LeftMargin {get;set;}
// [Category("Page Settings")]
public int RightMargin {get;set;}
private Size pageSize;
public Size PageSize {

4
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/BasePageBuilder.cs

@ -12,6 +12,7 @@ using System.Drawing; @@ -12,6 +12,7 @@ using System.Drawing;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.PageBuilder
{
@ -34,7 +35,7 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -34,7 +35,7 @@ namespace ICSharpCode.Reporting.PageBuilder
protected IPage InitNewPage(){
var pi = CreatePageInfo();
return new Page(pi);
return new Page(pi,ReportModel.ReportSettings.PageSize);
}
IPageInfo CreatePageInfo()
@ -43,7 +44,6 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -43,7 +44,6 @@ namespace ICSharpCode.Reporting.PageBuilder
pi.PageNumber = Pages.Count +1;
pi.ReportName = ReportModel.ReportSettings.ReportName;
pi.ReportFileName = ReportModel.ReportSettings.FileName;
// pi.ReportName = ReportModel.ReportSettings.ReportName;
return pi;
}

53
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/ContainerConverter.cs

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 08.04.2013
* Time: 19:49
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using ICSharpCode.Reporting.Factories;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.PageBuilder.Converter
{
/// <summary>
/// Description of SectionConverter.
/// </summary>
internal class ContainerConverter
{
private ExportColumnFactory factory;
public ContainerConverter(IReportContainer container,Point currentLocation )
{
Container = container;
CurrentLocation = currentLocation;
factory = new ExportColumnFactory();
}
public IExportContainer Convert() {
Console.WriteLine("Convert section for location {0}",CurrentLocation);
var exportContainer = (ExportContainer)Container.CreateExportColumn();
exportContainer.Location = CurrentLocation;
var itemsList = new List<IExportColumn>();
foreach (var element in Container.Items) {
var item = factory.CreateItem(element);
itemsList.Add(item);
}
exportContainer.ExportedItems.AddRange(itemsList);
return exportContainer;
}
internal IReportContainer Container {get; private set;}
internal Point CurrentLocation {get; private set;}
}
}

47
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/SectionConverter.cs

@ -1,47 +0,0 @@ @@ -1,47 +0,0 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 08.04.2013
* Time: 19:49
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using ICSharpCode.Reporting.Factories;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.PageBuilder.Converter
{
/// <summary>
/// Description of SectionConverter.
/// </summary>
internal class SectionConverter
{
private Point currentPoint;
private ExportColumnFactory factory;
public SectionConverter(ISection section,Point currentPoint )
{
Section = section;
this.currentPoint = currentPoint;
factory = new ExportColumnFactory();
}
public List<IExportColumn> Convert(){
var l = new List<IExportColumn>();
foreach (var element in Section.Items) {
var item = factory.CreateItem(element);
l.Add(item);
}
return l;
}
public ISection Section {get; private set;}
}
}

11
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/BaseExportColumn.cs → src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportColumn.cs

@ -7,15 +7,24 @@ @@ -7,15 +7,24 @@
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns
{
/// <summary>
/// Description of BaseExportColumn.
/// </summary>
public class BaseExportColumn:IExportColumn
public class ExportColumn:IExportColumn
{
public string Name {get;set;}
public Size Size {get;set;}
public Point Location {get;set;}
}
}

28
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportContainer.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 12.04.2013
* Time: 20:27
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using ICSharpCode.Reporting.Interfaces.Export;
namespace ICSharpCode.Reporting.PageBuilder.ExportColumns
{
/// <summary>
/// Description of BaseExportContainer.
/// </summary>
public class ExportContainer:ExportColumn,IExportContainer
{
public ExportContainer()
{
ExportedItems = new List<IExportColumn>();
}
public List<IExportColumn> ExportedItems {get;set;}
}
}

3
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/ExportColumns/ExportText.cs

@ -13,10 +13,11 @@ namespace ICSharpCode.Reporting.PageBuilder.ExportColumns @@ -13,10 +13,11 @@ namespace ICSharpCode.Reporting.PageBuilder.ExportColumns
/// <summary>
/// Description of ExportText.
/// </summary>
public class ExportText:BaseExportColumn
public class ExportText:ExportColumn
{
public ExportText()
{
}
}
}

64
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/FormPageBuilder.cs

@ -10,7 +10,9 @@ using System; @@ -10,7 +10,9 @@ using System;
using System.Drawing;
using ICSharpCode.Reporting.BaseClasses;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder.Converter;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
namespace ICSharpCode.Reporting.PageBuilder
{
@ -38,21 +40,71 @@ namespace ICSharpCode.Reporting.PageBuilder @@ -38,21 +40,71 @@ namespace ICSharpCode.Reporting.PageBuilder
void BuildReportHeader()
{
if (Pages.Count == 0) {
CurrentLocation = new Point(10,10);
var sc = new SectionConverter(ReportModel.ReportHeader,base.CurrentLocation);
var itemsList = sc.Convert();
CurrentPage.Items.AddRange(itemsList);
var sc = new ContainerConverter(ReportModel.ReportHeader,CurrentLocation);
var header =sc.Convert();
CurrentPage.ExportedItems.Add(header);
var r = new Rectangle(header.Location.X,header.Location.Y,header.Size.Width,header.Size.Height);
CurrentLocation = new Point (ReportModel.ReportSettings.LeftMargin,r.Bottom + 10);
}
}
void BuildPageHeader()
{
var sc = new ContainerConverter(ReportModel.PageHeader,CurrentLocation);
var header =sc.Convert();
CurrentPage.ExportedItems.Add(header);
}
void BuilDetail()
{
Console.WriteLine("Build DetailSection {0} - {1} - {2}",ReportModel.ReportSettings.PageSize.Width,ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.RightMargin);
}
void BuildPageFooter()
{
Console.WriteLine("Build PageFooter {0} - {1}",ReportModel.ReportSettings.PageSize.Height,ReportModel.ReportSettings.BottomMargin);
CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin,
ReportModel.ReportSettings.PageSize.Height - ReportModel.ReportSettings.BottomMargin - ReportModel.PageFooter.Size.Height);
var sc = new ContainerConverter(ReportModel.PageFooter,CurrentLocation);
var header =sc.Convert();
CurrentPage.ExportedItems.Add(header);
}
void WritePages()
{
CurrentPage = base.InitNewPage();
CurrentLocation = new Point(ReportModel.ReportSettings.LeftMargin,ReportModel.ReportSettings.TopMargin);
this.BuildReportHeader();
BuildPageHeader();
BuilDetail();
BuildPageFooter();
base.AddPage(CurrentPage);
var x = ReportModel;
Console.WriteLine("<{0}> Pages created",Pages.Count);
foreach (var page in Pages) {
ShowPage(page);
}
}
void ShowPage( IExportContainer container)
{
foreach (var item in container.ExportedItems) {
if (item is IExportContainer) {
Console.WriteLine("Container: {0}- {1} - {2}",item.Name,item.Location,item.Size);
ShowPage(item as IExportContainer);
} else {
Console.WriteLine("\tItem {0} -relativ location <{1}> - {2}",item.Name,item.Location,item.Size);
}
}
}
}
}

1
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/ICSharpCode.Reporting.Test.csproj

@ -63,6 +63,7 @@ @@ -63,6 +63,7 @@
<Compile Include="src\Model\ReportSettingsFixture.cs" />
<Compile Include="src\Model\Report_TwoItemsFixture.cs" />
<Compile Include="src\PageBuilder\BaseConvertFixture.cs" />
<Compile Include="src\PageBuilder\ContainerConverterFixture.cs" />
<Compile Include="src\PageBuilder\PageBuilderFixture.cs" />
<Compile Include="src\Properties\AssemblyInfo.cs" />
<Compile Include="src\TestHelper.cs" />

14
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/BaseConvertFixture.cs

@ -25,18 +25,26 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -25,18 +25,26 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
public void CurrentPageContainOneItem() {
reportCreator.BuildExportList();
var page = reportCreator.Pages[0];
Assert.That(page.Items.Count, Is.EqualTo(1));
Assert.That(page.ExportedItems.Count, Is.EqualTo(3));
}
[Test]
public void PageItemIsBaseExportColumn() {
public void PageItemIsBaseExportContainer() {
reportCreator.BuildExportList();
var page = reportCreator.Pages[0];
Assert.That(page.Items[0],Is.InstanceOf(typeof(ExportText)));
Assert.That(page.ExportedItems[0],Is.InstanceOf(typeof(ExportContainer)));
}
[Test]
public void ExportContainerContainsExportText() {
reportCreator.BuildExportList();
var page = reportCreator.Pages[0];
var firstItem = (ExportContainer)page.ExportedItems[0];
var result = firstItem.ExportedItems[0];
Assert.That(result,Is.InstanceOf(typeof(ExportText)));
}
[SetUp]
public void LoadFromStream()
{

74
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/ContainerConverterFixture.cs

@ -0,0 +1,74 @@ @@ -0,0 +1,74 @@
/*
* Created by SharpDevelop.
* User: Peter Forstmeier
* Date: 17.04.2013
* Time: 20:14
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.Items;
using ICSharpCode.Reporting.PageBuilder.Converter;
using ICSharpCode.Reporting.PageBuilder.ExportColumns;
using NUnit.Framework;
namespace ICSharpCode.Reporting.Test.PageBuilder
{
[TestFixture]
public class ContainerConverterFixture
{
private IReportContainer container;
[Test]
public void ConverterReturnExportContainer() {
var converter = new ContainerConverter(container,new Point(30,30));
var result = converter.Convert();
Assert.That(result,Is.InstanceOf(typeof(IExportContainer)));
}
[Test]
public void ConverterReturnExportContainerwithTwoItems()
{
var converter = new ContainerConverter(container,new Point(30,30));
var result = converter.Convert();
Assert.That(result.ExportedItems.Count,Is.EqualTo(2));
}
[Test]
public void LocationIsAdjusted() {
var pp = new Point(30,30);
var converter = new ContainerConverter(container,pp);
var result = converter.Convert();
Assert.That(result.Location,Is.EqualTo(pp));
}
[TestFixtureSetUp]
public void Init()
{
container = new BaseSection(){
Size = new Size (720,60),
Location = new Point(50,50),
Name ="Section"
};
var item1 = new BaseTextItem(){
Name = "Item1",
Location = new Point(10,10),
Size = new Size (60,20)
};
var item2 = new BaseTextItem(){
Name = "Item2",
Location = new Point(80,10),
Size = new Size (60,20)
};
container.Items.Add(item1);
container.Items.Add(item2);
}
}
}

27
src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/PageBuilder/PageBuilderFixture.cs

@ -11,6 +11,7 @@ using System.IO; @@ -11,6 +11,7 @@ using System.IO;
using System.Reflection;
using ICSharpCode.Reporting.Interfaces;
using ICSharpCode.Reporting.Interfaces.Export;
using ICSharpCode.Reporting.PageBuilder;
using NUnit.Framework;
@ -30,7 +31,6 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -30,7 +31,6 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
}
#region Pages
[Test]
@ -58,7 +58,6 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -58,7 +58,6 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
public void CurrentPageIsFirstPage() {
reportCreator.BuildExportList();
Assert.That(reportCreator.Pages[0].IsFirstPage,Is.True);
Assert.That(reportCreator.Pages[0].IsFirstPage,Is.True);
}
#endregion
@ -68,8 +67,8 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -68,8 +67,8 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
[Test]
public void PageInfoPageNumberIsOne() {
reportCreator.BuildExportList();
var pi = reportCreator.Pages[0].PageInfo;
Assert.That(pi.PageNumber,Is.EqualTo(1));
var pageInfo = reportCreator.Pages[0].PageInfo;
Assert.That(pageInfo.PageNumber,Is.EqualTo(1));
}
@ -78,6 +77,26 @@ namespace ICSharpCode.Reporting.Test.PageBuilder @@ -78,6 +77,26 @@ namespace ICSharpCode.Reporting.Test.PageBuilder
reportCreator.BuildExportList();
var pi = reportCreator.Pages[0].PageInfo;
Assert.That(pi.ReportName,Is.EqualTo("Report1"));
Console.WriteLine("----------------");
foreach (var page in reportCreator.Pages) {
ShowPage(page);
}
}
void ShowPage( IExportContainer container)
{
foreach (var item in container.ExportedItems) {
if (item is IExportContainer) {
Console.WriteLine("DoContainer {0} - {1} - {2}",item.Name,item.Location,item.Size);
ShowPage(item as IExportContainer);
} else {
Console.WriteLine("\tItem {0} - {1} - {2}",item.Name,item.Location,item.Size);
}
}
}
#endregion

Loading…
Cancel
Save