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. 30
      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

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

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

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

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

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

@ -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 @@
/*
* 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 {
if (!String.IsNullOrEmpty(baseDataItem.FormatString)) { if (!String.IsNullOrEmpty(baseDataItem.FormatString)) {
rpea.FormatedValue = defaultFormatter.FormatItem (baseDataItem); rpea.FormatedValue = defaultFormatter.FormatItem (baseDataItem);
System.Console.WriteLine("\tFormated Value = {0}",rpea.FormatedValue); 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 {
// DebugRectangle (e,detailRect); // DebugRectangle (e,detailRect);
// no loop if there is no data // 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; e.PrintPageEventArgs.HasMorePages = false;
return; return;
} }
while (dataNavigator.MoveNext()) { while (this.dataNavigator.MoveNext()) {
dataNavigator.Fill (base.CurrentSection.Items); this.dataNavigator.Fill (base.CurrentSection.Items);
base.RenderSection (section,e); base.RenderSection (section,e);
section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * base.Gap; section.SectionOffset = section.SectionOffset + section.Size.Height + 2 * base.Gap;

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

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

Loading…
Cancel
Save