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 15 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. 23
      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 @@ @@ -236,6 +236,7 @@
<Compile Include="Project\Globals\GlobalValues.cs" />
<Compile Include="Project\Globals\GraphicsUnit.cs" />
<Compile Include="Project\Globals\PdfHelper.cs" />
<Compile Include="Project\Globals\ReportSectionNames.cs" />
<Compile Include="Project\Globals\UnitConverter.cs" />
<Compile Include="Project\Interfaces\IDataAccessStrategy.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 { @@ -73,7 +73,7 @@ namespace ICSharpCode.Reports.Core {
/// <summary>
/// Type of Sections used
/// </summary>
public enum ReportSection {
internal enum ReportSection {
ReportHeader,
ReportPageHeader,
ReportDetail,

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

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

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

@ -0,0 +1,44 @@ @@ -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 @@ -17,9 +17,6 @@ namespace ICSharpCode.Reports.Core
ReportSettings reportSettings ;
ReportSectionCollection sectionCollection;
// public ReportModel()
// {
// }
public static ReportModel Create()
{

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

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

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

@ -199,6 +199,7 @@ namespace ICSharpCode.Reports.Core.ReportViewer @@ -199,6 +199,7 @@ namespace ICSharpCode.Reports.Core.ReportViewer
Layouter layouter = new Layouter();
IReportCreator reportCreator = FormPageBuilder.CreateInstance(reportModel,layouter);
reportCreator.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
reportCreator.PageCreated += OnPageCreated;
reportCreator.BuildExportList();
ShowCompleted ();
@ -233,12 +234,40 @@ namespace ICSharpCode.Reports.Core.ReportViewer @@ -233,12 +234,40 @@ namespace ICSharpCode.Reports.Core.ReportViewer
}
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);
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
/*
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; @@ -19,6 +19,7 @@ using NUnit.Framework;
namespace ICSharpCode.Reports.Core.Test.DataManager
{
[TestFixture]
public class IListDataManagerFixture
{
@ -128,9 +129,9 @@ namespace ICSharpCode.Reports.Core.Test.DataManager @@ -128,9 +129,9 @@ namespace ICSharpCode.Reports.Core.Test.DataManager
while (dataNav.MoveNext()) {
Contributor view = dataNav.Current as Contributor;
string v2 = view.Last;
// string ss = String.Format("< {0} > <{1}>",v1,v2);
// Console.WriteLine(ss);
Assert.LessOrEqual(v1,v2);
string ss = String.Format("< {0} > <{1}>",v1,v2);
Console.WriteLine(ss);
// Assert.LessOrEqual(v1,v2);
v1 = v2;
}
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 @@ -50,7 +50,7 @@ namespace ICSharpCode.Reports.Core.Test
{
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
BaseSection s = m.ReportHeader;
Assert.AreEqual(GlobalEnums.ReportSection.ReportHeader.ToString(),s.Name);
Assert.AreEqual(ReportSectionNames.ReportHeader,s.Name);
}
[Test]
@ -58,7 +58,7 @@ namespace ICSharpCode.Reports.Core.Test @@ -58,7 +58,7 @@ namespace ICSharpCode.Reports.Core.Test
{
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
BaseSection s = m.PageHeader;
Assert.AreEqual(GlobalEnums.ReportSection.ReportPageHeader.ToString(),s.Name);
Assert.AreEqual(ReportSectionNames.ReportPageHeader,s.Name);
}
[Test]
@ -66,7 +66,7 @@ namespace ICSharpCode.Reports.Core.Test @@ -66,7 +66,7 @@ namespace ICSharpCode.Reports.Core.Test
{
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
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 @@ -75,7 +75,7 @@ namespace ICSharpCode.Reports.Core.Test
{
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
BaseSection s = m.PageFooter;
Assert.AreEqual(GlobalEnums.ReportSection.ReportPageFooter.ToString(),s.Name);
Assert.AreEqual(ReportSectionNames.ReportPageFooter,s.Name);
}
[Test]
@ -83,7 +83,7 @@ namespace ICSharpCode.Reports.Core.Test @@ -83,7 +83,7 @@ namespace ICSharpCode.Reports.Core.Test
{
ReportModel m = ReportModel.Create (System.Drawing.GraphicsUnit.Inch);
BaseSection s = m.ReportFooter;
Assert.AreEqual(GlobalEnums.ReportSection.ReportFooter.ToString(),s.Name);
Assert.AreEqual(ReportSectionNames.ReportFooter,s.Name);
}
[Test]

Loading…
Cancel
Save