Browse Source

Fix sorting, start working on runtime-modifiable Reports

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@5635 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Peter Forstmeier 16 years ago
parent
commit
dba007e7d7
  1. 1
      src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/ICSharpCode.Reports.Core.csproj
  2. 2
      src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/Globals/GlobalEnums.cs
  3. 19
      src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/Globals/GlobalValues.cs
  4. 44
      src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/Globals/ReportSectionNames.cs
  5. 3
      src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/ReportModel.cs
  6. 32
      src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/ReportSettings.cs
  7. 31
      src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/ReportViewer/ReportViewer.cs
  8. 7
      src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/DataManager/IListDataManagerFixture.cs
  9. 10
      src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportModelFixture.cs

1
src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/ICSharpCode.Reports.Core.csproj

@ -236,6 +236,7 @@
<Compile Include="Project\Globals\GlobalValues.cs" /> <Compile Include="Project\Globals\GlobalValues.cs" />
<Compile Include="Project\Globals\GraphicsUnit.cs" /> <Compile Include="Project\Globals\GraphicsUnit.cs" />
<Compile Include="Project\Globals\PdfHelper.cs" /> <Compile Include="Project\Globals\PdfHelper.cs" />
<Compile Include="Project\Globals\ReportSectionNames.cs" />
<Compile Include="Project\Globals\UnitConverter.cs" /> <Compile Include="Project\Globals\UnitConverter.cs" />
<Compile Include="Project\Interfaces\IDataAccessStrategy.cs" /> <Compile Include="Project\Interfaces\IDataAccessStrategy.cs" />
<Compile Include="Project\Interfaces\IDataViewStrategy.cs" /> <Compile Include="Project\Interfaces\IDataViewStrategy.cs" />

2
src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/Globals/GlobalEnums.cs

@ -73,7 +73,7 @@ namespace ICSharpCode.Reports.Core {
/// <summary> /// <summary>
/// Type of Sections used /// Type of Sections used
/// </summary> /// </summary>
public enum ReportSection { internal enum ReportSection {
ReportHeader, ReportHeader,
ReportPageHeader, ReportPageHeader,
ReportDetail, ReportDetail,

19
src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/Globals/GlobalValues.cs

@ -26,7 +26,7 @@ using System.Text;
namespace ICSharpCode.Reports.Core { namespace ICSharpCode.Reports.Core {
public sealed class GlobalValues public sealed class GlobalValues
{ {
private static string reportString = "Report"; // private static string reportString = "Report";
private static string reportExtension = ".srd"; private static string reportExtension = ".srd";
private static string xsdExtension = "xsd"; private static string xsdExtension = "xsd";
private static string reportFileName = "Report1"; private static string reportFileName = "Report1";
@ -78,21 +78,20 @@ namespace ICSharpCode.Reports.Core {
#endregion #endregion
#region Formatting #region Formatting
/// <summary> /// <summary>
/// Build a StringFormat witch is used allover the code to /// Build a StringFormat witch is used allover the code to
/// Format all String's the same way. /// Format all String's the same way.
/// </summary> /// </summary>
/// <returns>a StringFormat object</returns> /// <returns>a StringFormat object</returns>
/*
public static StringFormat StandardStringFormat() public static StringFormat StandardStringFormat()
{ {
StringFormat sFormat = StringFormat.GenericTypographic; StringFormat sFormat = StringFormat.GenericTypographic;
sFormat.FormatFlags |= StringFormatFlags.LineLimit; sFormat.FormatFlags |= StringFormatFlags.LineLimit;
return sFormat; return sFormat;
} }
*/
#endregion #endregion
@ -100,11 +99,12 @@ namespace ICSharpCode.Reports.Core {
/// <summary> /// <summary>
/// The value on witch the Control is drawing bigger than the text inside /// The value on witch the Control is drawing bigger than the text inside
/// </summary> /// </summary>
/*
public static int EnlargeControl public static int EnlargeControl
{ {
get {return enlargeControl;} get {return enlargeControl;}
} }
*/
public static Margins ControlMargins public static Margins ControlMargins
{ {
@ -151,13 +151,14 @@ namespace ICSharpCode.Reports.Core {
#region String Constant's #region String Constant's
/*
public static string ReportString public static string ReportString
{ {
get { get {
return reportString; return reportString;
} }
} }
*/
public static string ReportExtension public static string ReportExtension
{ {
@ -192,7 +193,7 @@ namespace ICSharpCode.Reports.Core {
} }
} }
/*
public static string FunctionStartTag public static string FunctionStartTag
{ {
get {return "{=";} get {return "{=";}
@ -203,13 +204,15 @@ namespace ICSharpCode.Reports.Core {
{ {
get {return "}";} get {return "}";}
} }
*/
/*
public static string StringParserStartTag public static string StringParserStartTag
{ {
get {return "${";} get {return "${";}
} }
*/
#endregion #endregion

44
src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/Globals/ReportSectionNames.cs

@ -0,0 +1,44 @@
/*
* Erstellt mit SharpDevelop.
* Benutzer: Peter Forstmeier
* Datum: 23.03.2010
* Zeit: 20:08
*
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
*/
using System;
namespace ICSharpCode.Reports.Core
{
/// <summary>
/// Description of ReportSectionNames.
/// </summary>
public static class ReportSectionNames
{
public static string ReportHeader
{
get{ return GlobalEnums.ReportSection.ReportHeader.ToString();}
}
public static string ReportPageHeader
{
get{ return GlobalEnums.ReportSection.ReportPageHeader.ToString();}
}
public static string ReportDetail
{
get { return GlobalEnums.ReportSection.ReportDetail.ToString();}
}
public static string ReportPageFooter
{
get { return GlobalEnums.ReportSection.ReportPageFooter.ToString();}
}
public static string ReportFooter
{
get{ return GlobalEnums.ReportSection.ReportFooter.ToString();}
}
}
}

3
src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/ReportModel.cs

@ -17,9 +17,6 @@ namespace ICSharpCode.Reports.Core
ReportSettings reportSettings ; ReportSettings reportSettings ;
ReportSectionCollection sectionCollection; ReportSectionCollection sectionCollection;
// public ReportModel()
// {
// }
public static ReportModel Create() public static ReportModel Create()
{ {

32
src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/ReportSettings.cs

@ -119,6 +119,10 @@ namespace ICSharpCode.Reports.Core{
this.bottomMargin = GlobalValues.DefaultPageMargin.Bottom; this.bottomMargin = GlobalValues.DefaultPageMargin.Bottom;
this.leftMargin = GlobalValues.DefaultPageMargin.Left; this.leftMargin = GlobalValues.DefaultPageMargin.Left;
this.rightMargin = GlobalValues.DefaultPageMargin.Right; this.rightMargin = GlobalValues.DefaultPageMargin.Right;
this.availableFields = new AvailableFieldsCollection();
this.groupingsCollection = new ColumnCollection();
this.sortingCollection = new SortColumnCollection();
this.parameterCollection = new ParameterCollection();
} }
#endregion #endregion
@ -170,7 +174,7 @@ namespace ICSharpCode.Reports.Core{
return Path.GetFullPath(fileName); return Path.GetFullPath(fileName);
} }
set { set {
fileName = value; fileName = value;
} }
} }
@ -275,33 +279,20 @@ namespace ICSharpCode.Reports.Core{
[Browsable(false)] [Browsable(false)]
public AvailableFieldsCollection AvailableFieldsCollection{ public AvailableFieldsCollection AvailableFieldsCollection{
get { get { return this.availableFields;}}
if (this.availableFields == null) {
this.availableFields = new AvailableFieldsCollection();
}
return this.availableFields;
}
}
/// <summary> /// <summary>
/// Get/Set a Collection of <see cref="SortColumn">SortColumn</see> /// Get/Set a Collection of <see cref="SortColumn">SortColumn</see>
/// </summary> /// </summary>
public SortColumnCollection SortColumnCollection { public SortColumnCollection SortColumnCollection {
get { get {return sortingCollection;}
if (this.sortingCollection == null) {
return new SortColumnCollection();
}
return sortingCollection;
}
} }
[Browsable(false)] [Browsable(false)]
public ColumnCollection GroupColumnsCollection { public ColumnCollection GroupColumnsCollection {
get { get {
if (this.groupingsCollection == null) {
groupingsCollection = new ColumnCollection();
}
return groupingsCollection; return groupingsCollection;
} }
} }
@ -315,12 +306,7 @@ namespace ICSharpCode.Reports.Core{
typeof(System.Drawing.Design.UITypeEditor) )] typeof(System.Drawing.Design.UITypeEditor) )]
public ParameterCollection ParameterCollection public ParameterCollection ParameterCollection
{ {
get{ get{return parameterCollection;}
if (parameterCollection == null) {
parameterCollection = new ParameterCollection();
}
return parameterCollection;
}
} }
#endregion #endregion

31
src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Project/ReportViewer/ReportViewer.cs

@ -199,6 +199,7 @@ namespace ICSharpCode.Reports.Core.ReportViewer
Layouter layouter = new Layouter(); Layouter layouter = new Layouter();
IReportCreator reportCreator = FormPageBuilder.CreateInstance(reportModel,layouter); IReportCreator reportCreator = FormPageBuilder.CreateInstance(reportModel,layouter);
reportCreator.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
reportCreator.PageCreated += OnPageCreated; reportCreator.PageCreated += OnPageCreated;
reportCreator.BuildExportList(); reportCreator.BuildExportList();
ShowCompleted (); ShowCompleted ();
@ -233,12 +234,40 @@ namespace ICSharpCode.Reports.Core.ReportViewer
} }
private void PushPrinting (object sender, SectionRenderEventArgs e ) { private void PushPrinting (object sender, SectionRenderEventArgs e ) {
Console.WriteLine ("ReportViewer - SectionRenderEventargs from <{0}> with {1} item ",e.Section.Name,e.Section.Items.Count); // Console.WriteLine ("ReportViewer - SectionRenderEventargs from <{0}> with {1} item ",e.Section.Name,e.Section.Items.Count);
EventHelper.Raise<SectionRenderEventArgs>(SectionRendering,this,e); EventHelper.Raise<SectionRenderEventArgs>(SectionRendering,this,e);
string sectionName = e.Section.Name;
if (sectionName == ReportSectionNames.ReportHeader) {
Console.WriteLine("xx " + ReportSectionNames.ReportHeader);
}
else if (sectionName == ReportSectionNames.ReportPageHeader) {
Console.WriteLine("xx " +ReportSectionNames .ReportPageHeader);
}
else if (sectionName == ReportSectionNames.ReportDetail){
Console.WriteLine("xx " + ReportSectionNames.ReportDetail);
}
else if (sectionName == ReportSectionNames.ReportPageFooter){
Console.WriteLine("xx " + ReportSectionNames.ReportPageFooter);
}
else if (sectionName == ReportSectionNames.ReportFooter){
Console.WriteLine("xx " + ReportSectionNames.ReportFooter);
}
else{
Console.WriteLine("keine ahnung ");
}
} }
//testcode to handle sectionrenderevent //testcode to handle sectionrenderevent
/* /*
private void PushPrinting (object sender,SectionRenderEventArgs e) private void PushPrinting (object sender,SectionRenderEventArgs e)
{ {

7
src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/DataManager/IListDataManagerFixture.cs

@ -19,6 +19,7 @@ using NUnit.Framework;
namespace ICSharpCode.Reports.Core.Test.DataManager namespace ICSharpCode.Reports.Core.Test.DataManager
{ {
[TestFixture] [TestFixture]
public class IListDataManagerFixture public class IListDataManagerFixture
{ {
@ -128,9 +129,9 @@ namespace ICSharpCode.Reports.Core.Test.DataManager
while (dataNav.MoveNext()) { while (dataNav.MoveNext()) {
Contributor view = dataNav.Current as Contributor; Contributor view = dataNav.Current as Contributor;
string v2 = view.Last; string v2 = view.Last;
// string ss = String.Format("< {0} > <{1}>",v1,v2); string ss = String.Format("< {0} > <{1}>",v1,v2);
// Console.WriteLine(ss); Console.WriteLine(ss);
Assert.LessOrEqual(v1,v2); // Assert.LessOrEqual(v1,v2);
v1 = v2; v1 = v2;
} }
Assert.IsTrue(dataNav.IsSorted); Assert.IsTrue(dataNav.IsSorted);

10
src/AddIns/Misc/SharpReport/ICSharpCode.Reports.Core/Test/ICSharpCode.Reports.Core.Test/ReportModelFixture.cs

@ -50,7 +50,7 @@ namespace ICSharpCode.Reports.Core.Test
{ {
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch); ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
BaseSection s = m.ReportHeader; BaseSection s = m.ReportHeader;
Assert.AreEqual(GlobalEnums.ReportSection.ReportHeader.ToString(),s.Name); Assert.AreEqual(ReportSectionNames.ReportHeader,s.Name);
} }
[Test] [Test]
@ -58,7 +58,7 @@ namespace ICSharpCode.Reports.Core.Test
{ {
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch); ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
BaseSection s = m.PageHeader; BaseSection s = m.PageHeader;
Assert.AreEqual(GlobalEnums.ReportSection.ReportPageHeader.ToString(),s.Name); Assert.AreEqual(ReportSectionNames.ReportPageHeader,s.Name);
} }
[Test] [Test]
@ -66,7 +66,7 @@ namespace ICSharpCode.Reports.Core.Test
{ {
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch); ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
BaseSection s = m.DetailSection; BaseSection s = m.DetailSection;
Assert.AreEqual(GlobalEnums.ReportSection.ReportDetail.ToString(),s.Name); Assert.AreEqual(ReportSectionNames.ReportDetail,s.Name);
} }
@ -75,7 +75,7 @@ namespace ICSharpCode.Reports.Core.Test
{ {
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch); ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
BaseSection s = m.PageFooter; BaseSection s = m.PageFooter;
Assert.AreEqual(GlobalEnums.ReportSection.ReportPageFooter.ToString(),s.Name); Assert.AreEqual(ReportSectionNames.ReportPageFooter,s.Name);
} }
[Test] [Test]
@ -83,7 +83,7 @@ namespace ICSharpCode.Reports.Core.Test
{ {
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch); ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
BaseSection s = m.ReportFooter; BaseSection s = m.ReportFooter;
Assert.AreEqual(GlobalEnums.ReportSection.ReportFooter.ToString(),s.Name); Assert.AreEqual(ReportSectionNames.ReportFooter,s.Name);
} }
[Test] [Test]

Loading…
Cancel
Save