Browse Source

Added IDataNavigator.cs, small changes in DataHandling and formatting

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1239 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 20 years ago
parent
commit
215cdb9a72
  1. 32
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs
  2. 24
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs
  3. 56
      src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataContainer.cs
  4. 42
      src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataNavigator.cs
  5. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
  6. 7
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs
  7. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj

32
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs

@ -98,6 +98,12 @@ namespace SharpReportCore { @@ -98,6 +98,12 @@ namespace SharpReportCore {
}
public void DataBind() {
CheckReportColumns();
this.dataViewStrategy.Bind();
}
#endregion
void InitDataManager (ReportSettings reportSettings,object dataSource) {
@ -300,27 +306,26 @@ namespace SharpReportCore { @@ -300,27 +306,26 @@ namespace SharpReportCore {
}
#region SharpReportCore.IDataContainer interface implementation
public object DataSource {
get {
return this.dataSource;
}
}
/*
public int CurrentRow {
get {
return this.dataViewStrategy.CurrentRow;
}
}
*/
/*
public int Count {
get {
return this.dataViewStrategy.Count;
}
}
*/
/*
public bool HasMoreData {
get {
if (this.dataViewStrategy.CurrentRow < this.dataViewStrategy.Count ){
@ -331,12 +336,8 @@ namespace SharpReportCore { @@ -331,12 +336,8 @@ namespace SharpReportCore {
}
}
*/
public bool DataBind() {
CheckReportColumns();
this.dataViewStrategy.Bind();
return true;
}
// public void Skip() {
// this.dataViewStrategy.CurrentRow ++;
@ -382,7 +383,7 @@ namespace SharpReportCore { @@ -382,7 +383,7 @@ namespace SharpReportCore {
throw new NotImplementedException();
}
}
#endregion
// Nur zum testen
public DataNavigator GetNavigator {
@ -391,14 +392,14 @@ namespace SharpReportCore { @@ -391,14 +392,14 @@ namespace SharpReportCore {
}
}
#region System.Collections.IEnumerator interface implementation
/*
public object Current {
get {
throw new NotImplementedException();
}
}
*/
// public void Reset() {
// this.dataViewStrategy.Reset();
// }
@ -408,7 +409,6 @@ namespace SharpReportCore { @@ -408,7 +409,6 @@ namespace SharpReportCore {
// }
#endregion
public bool IsGrouped {
get {

24
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataNavigator.cs

@ -15,9 +15,11 @@ namespace SharpReportCore @@ -15,9 +15,11 @@ namespace SharpReportCore
/// Description of DataNavigator.
/// </summary>
public class DataNavigator{
public class DataNavigator :IDataNavigator{
IDataViewStrategy store;
public event EventHandler <ListChangedEventArgs> ListChanged;
public DataNavigator(IDataViewStrategy store){
this.store = store;
this.store.ListChanged += new EventHandler<ListChangedEventArgs> (OnListChanged);
@ -35,6 +37,18 @@ namespace SharpReportCore @@ -35,6 +37,18 @@ namespace SharpReportCore
}
}
public bool HasMoreData {
get {
if (this.CurrentRow < this.Count ){
return true;
} else {
return false;
}
}
}
/// <summary>
/// Indicate's if the current <see cref="GroupSeperator"></see> has ChildRows
/// </summary>
@ -45,11 +59,11 @@ namespace SharpReportCore @@ -45,11 +59,11 @@ namespace SharpReportCore
}
public int CurrentRow {
get {return store.CurrentRow;}
get {return this.store.CurrentRow;}
}
public int Count {
get {return store.Count;}
get {return this.store.Count;}
}
public bool MoveNext () {
@ -57,12 +71,12 @@ namespace SharpReportCore @@ -57,12 +71,12 @@ namespace SharpReportCore
}
public void Reset() {
store.Reset();
this.store.Reset();
}
public object Current {
get {
return store.Current;
return this.store.Current;
}
}
}

56
src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataContainer.cs

@ -1,56 +0,0 @@ @@ -1,56 +0,0 @@
/*
* Created by SharpDevelop.
* User: Forstmeier Peter
* Date: 08.10.2005
* Time: 17:03
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
namespace SharpReportCore {
public interface IDataContainer {
/// <summary>
/// Setup the Databinding, return true if databinding was ok
/// </summary>
bool DataBind();
// /// <summary>
// /// Move to next row
// /// </summary>
// /// <returns></returns>
// void Skip();
/// <summary>
/// reste Datasource,move to position 0
/// </summary>
void Reset ();
// /// <summary>
// /// Reads one row of data and fill the
// /// <see cref="ReportItemCollection"></see>
// void FetchData (ReportItemCollection collection);
int Count {
get;
}
/// <summary>
/// Get the Position in List
/// </summary>
int CurrentRow {
get;
}
/// <summary>
/// Returns true when there are more Data to Read, false if we are on the end
/// or the list is empty
/// </summary>
bool HasMoreData {
get;
}
/// <summary>
/// Set/read a valid FilterString, <see cref="System.Datat.DataView"></see>
/// </summary>
string Filter {
get;set;
}
}
}

42
src/AddIns/Misc/SharpReport/SharpReportCore/Interfaces/IDataNavigator.cs

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
/*
* Created by SharpDevelop.
* User: Forstmeier Peter
* Date: 08.10.2005
* Time: 17:03
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections;
using System.ComponentModel;
namespace SharpReportCore {
public interface IDataNavigator {
void Fill (ReportItemCollection collection);
bool MoveNext () ;
void Reset();
bool HasMoreData {
get;
}
bool HasChilds {
get;
}
int CurrentRow {
get;
}
int Count {
get;
}
object Current {
get;
}
event EventHandler <ListChangedEventArgs> ListChanged;
}
}

2
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs

@ -222,6 +222,8 @@ namespace SharpReportCore { @@ -222,6 +222,8 @@ namespace SharpReportCore {
if (!String.IsNullOrEmpty(baseDataItem.FormatString)) {
rpea.FormatedValue = defaultFormatter.FormatItem (baseDataItem);
System.Console.WriteLine("\tFormated Value = {0}",rpea.FormatedValue);
} else {
rpea.FormatedValue = rpea.ValueToFormat;
}
}
}

7
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs

@ -125,13 +125,14 @@ namespace SharpReportCore { @@ -125,13 +125,14 @@ namespace SharpReportCore {
// DebugRectangle (e,detailRect);
// no loop if there is no data
if (! base.DataManager.HasMoreData ) {
System.Console.WriteLine("Navi hasMore {0}",this.dataNavigator.HasMoreData);
if (! this.dataNavigator.HasMoreData ) {
e.PrintPageEventArgs.HasMorePages = false;
return;
}
while (dataNavigator.MoveNext()) {
dataNavigator.Fill (base.CurrentSection.Items);
while (this.dataNavigator.MoveNext()) {
this.dataNavigator.Fill (base.CurrentSection.Items);
base.RenderSection (section,e);
section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * base.Gap;

2
src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportCore.csproj

@ -80,7 +80,6 @@ @@ -80,7 +80,6 @@
<Compile Include="Globals\GlobalEnums.cs" />
<Compile Include="Globals\GlobalValues.cs" />
<Compile Include="Interfaces\IBaseRenderer.cs" />
<Compile Include="Interfaces\IDataContainer.cs" />
<Compile Include="Interfaces\IDataViewStrategy.cs" />
<Compile Include="Interfaces\IItemRenderer.cs" />
<Compile Include="Interfaces\IOutputStrategy.cs" />
@ -131,6 +130,7 @@ @@ -131,6 +130,7 @@
<Compile Include="Exceptions\MissingSectionException.cs" />
<Compile Include="Printing\AbstractDataRenderer.cs" />
<Compile Include="DataManager\DataNavigator.cs" />
<Compile Include="Interfaces\IDataNavigator.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="BaseItems" />

Loading…
Cancel
Save