diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Collections.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Collections.cs index b7726c813c..30d802b636 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Collections.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Collections.cs @@ -17,53 +17,14 @@ using ICSharpCode.Reporting.Items; namespace ICSharpCode.Reporting { - /// - /// Description of Collections. - /// - public class ColumnCollection: Collection{ - - public ColumnCollection() - { - } - - public AbstractColumn Find (string columnName) - { - if (String.IsNullOrEmpty(columnName)) { - throw new ArgumentNullException("columnName"); - } - - return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture)); - } - - - public void AddRange (IEnumerable items) - { - foreach (AbstractColumn item in items){ - this.Add(item); - } - } - - - /// - /// The Culture is used for direct String Comparison - /// - - public static CultureInfo Culture - { - get { return CultureInfo.CurrentCulture;} - } - } - - - - public class SortColumnCollection: ColumnCollection + public class SortColumnCollection: Collection { public SortColumnCollection() { } - public new AbstractColumn Find (string columnName) + public AbstractColumn Find (string columnName) { if (String.IsNullOrEmpty(columnName)) { throw new ArgumentNullException("columnName"); @@ -97,21 +58,4 @@ namespace ICSharpCode.Reporting return this.FirstOrDefault(x => 0 == String.Compare(x.ColumnName,columnName,true,CultureInfo.InvariantCulture)); } } - - - public class ReportItemCollection : Collection - { - - // Trick to get the inner list as List (InnerList always has that type because we only use - // the parameterless constructor on Collection) - - private List InnerList { - get { return (List)base.Items; } - } - - private void Sort(IComparer comparer) - { - InnerList.Sort(comparer); - } - } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/DataContainerConverter.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/DataContainerConverter.cs index 24e7a78009..6232233bc3 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/DataContainerConverter.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/PageBuilder/Converter/DataContainerConverter.cs @@ -53,10 +53,8 @@ namespace ICSharpCode.Reporting.PageBuilder.Converter var position = Point.Empty; do { collectionSource.Fill(Container.Items); -// Console.WriteLine(((BaseDataItem)Container.Items[0]).DBValue); var itemsList = CreateConvertedList(exportContainer,position); exportContainer.ExportedItems.AddRange(itemsList); -// CurrentLocation = new Point(CurrentLocation.X,CurrentLocation.Y + Container.Size.Height); position = new Point(Container.Location.X,position.Y + Container.Size.Height); } while (collectionSource.MoveNext()); diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs index 4dc16950dc..bae05169a8 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/ReportingFactory.cs @@ -30,15 +30,6 @@ namespace ICSharpCode.Reporting { } - public IReportCreator ReportCreator (ReportModel reportModel) { - if (reportModel == null) - throw new ArgumentNullException("reportModel"); - IReportCreator builder = null; - - builder = ReportCreatorFactory.ExporterFactory(reportModel); - return builder; - } - public IReportCreator ReportCreator (Stream stream,Type listType,IEnumerable list) { @@ -49,16 +40,26 @@ namespace ICSharpCode.Reporting } + internal IReportCreator ReportCreator (ReportModel reportModel) { + if (reportModel == null) + throw new ArgumentNullException("reportModel"); + IReportCreator builder = null; + ReportModel = reportModel; + builder = ReportCreatorFactory.ExporterFactory(reportModel); + return builder; + } + + internal IReportCreator ReportCreator (Stream stream) { - IReportModel reportModel = LoadReportModel (stream); + ReportModel = LoadReportModel (stream); IReportCreator builder = null; - builder = ReportCreatorFactory.ExporterFactory(reportModel); + builder = ReportCreatorFactory.ExporterFactory(ReportModel); return builder; } - public ReportModel LoadReportModel (Stream stream) + internal ReportModel LoadReportModel (Stream stream) { var doc = new XmlDocument(); doc.Load(stream); diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/DataSource/CollectionHandlingFixture.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/DataSource/CollectionHandlingFixture.cs index a602011ab8..a5a36869bb 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/DataSource/CollectionHandlingFixture.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/DataSource/CollectionHandlingFixture.cs @@ -12,6 +12,7 @@ using System.Linq; using ICSharpCode.Reporting.BaseClasses; using ICSharpCode.Reporting.DataManager.Listhandling; +using ICSharpCode.Reporting.Interfaces; using ICSharpCode.Reporting.Items; using NUnit.Framework; @@ -62,9 +63,8 @@ namespace ICSharpCode.Reporting.Test.DataSource #region Fill [Test] - [Ignore] public void TypeOfReportItemIsString () { - var ric = new ReportItemCollection(){ + var ric = new System.Collections.Generic.List(){ new BaseDataItem(){ ColumnName = "Lastname" @@ -75,7 +75,7 @@ namespace ICSharpCode.Reporting.Test.DataSource }; var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); collectionSource.Bind(); -// collectionSource.Fill(ric); + collectionSource.Fill(ric); foreach (BaseDataItem element in ric) { Assert.That(element.DataType,Is.EqualTo("System.String")); } @@ -83,9 +83,8 @@ namespace ICSharpCode.Reporting.Test.DataSource [Test] - [Ignore] public void FillReportItemCollection () { - var ric = new ReportItemCollection(){ + var ric = new System.Collections.Generic.List(){ new BaseDataItem(){ ColumnName = "Lastname" @@ -96,7 +95,7 @@ namespace ICSharpCode.Reporting.Test.DataSource }; var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings()); collectionSource.Bind(); -// collectionSource.Fill(ric); + collectionSource.Fill(ric); foreach (BaseDataItem element in ric) { Assert.That(element.DBValue,Is.Not.EqualTo(String.Empty)); } @@ -131,7 +130,6 @@ namespace ICSharpCode.Reporting.Test.DataSource #region Sort - [Test] public void CreateUnsortedIndex() { var collectionSource = new CollectionSource (list,typeof(Contributor),new ReportSettings());