Browse Source

Cleanup

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1026 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 20 years ago
parent
commit
2ad3f0278d
  1. 20
      src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs
  2. 3
      src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs
  3. 44
      src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs
  4. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs
  5. 7
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/DataManager.cs
  6. 2
      src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/SqlQueryChecker.cs
  7. 3
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/AbstractRenderer.cs
  8. 12
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/RenderDataReport.cs
  9. 12
      src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs
  10. 4
      src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs
  11. 14
      src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs

20
src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs

@ -116,7 +116,6 @@ namespace SharpReport{ @@ -116,7 +116,6 @@ namespace SharpReport{
if (base.ConnectionObject == null) {
base.ConnectionObject = this.BuildConnectionObject(model.ReportSettings);
}
System.Console.WriteLine("BuildRenderer ok");
return base.AbstractRenderer(model);
}
@ -319,15 +318,18 @@ namespace SharpReport{ @@ -319,15 +318,18 @@ namespace SharpReport{
#endregion
#region Preview
public AbstractRenderer GetRenderer (ReportModel model) {
System.Console.WriteLine("Manager.GetRenderer");
if (model == null) {
throw new ArgumentException("SharpReportManager:GetRenderer 'ReportModel'");
}
return this.BuildRenderer (model);
}
#region Preview
/// <summary>
/// Run Preview with Designer
/// </summary>
@ -335,8 +337,9 @@ namespace SharpReport{ @@ -335,8 +337,9 @@ namespace SharpReport{
/// <param name="showInUserControl"></param>
public void ReportPreview (ReportModel model,bool showInUserControl) {
try {
System.Console.WriteLine("--------------------");
System.Console.WriteLine("");
System.Console.WriteLine("Manager:ReportPreview");
System.Console.WriteLine("");
AbstractRenderer abstr = this.BuildRenderer (model);
if (abstr != null) {
@ -358,9 +361,9 @@ namespace SharpReport{ @@ -358,9 +361,9 @@ namespace SharpReport{
DataTable dataTable,
bool showInUserControl) {
try {
System.Console.WriteLine("PreviewPushData with {0} Rows in Table",dataTable.Rows.Count);
AbstractRenderer abstr = base.SetupPushDataRenderer(model,dataTable);
try {
if (abstr != null) {
if (abstr.Cancel == false) {
if (showInUserControl){
@ -370,11 +373,6 @@ namespace SharpReport{ @@ -370,11 +373,6 @@ namespace SharpReport{
}
}
}
} catch (Exception e) {
MessageBox.Show("bb " + e.Message);
}
} catch (Exception) {
throw;

3
src/AddIns/Misc/SharpReport/SharpReport/Visitors/LoadReportVisitor.cs

@ -111,12 +111,9 @@ namespace SharpReport.Visitors { @@ -111,12 +111,9 @@ namespace SharpReport.Visitors {
try {
rpt = designableFactory.Create(ctrlElem.GetAttribute("type"));
BaseReportItem br = (BaseReportItem)rpt;
// br.SuspendLayout();
br.Parent = baseSection;
baseSection.Items.Add (rpt);
XmlHelper.BuildControl (xmlFormReader,ctrlElem,br);
// br.Visible = true;
// br.ResumeLayout();
}
catch (Exception ) {
string s = String.Format ("Unable to create <{0}>",ctrlElem.GetAttribute("type").ToString());

44
src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs

@ -201,21 +201,27 @@ namespace SharpReportAddin{ @@ -201,21 +201,27 @@ namespace SharpReportAddin{
#region Preview handling
private void RunPreview() {
private void RunPreview(bool standAlone) {
base.OnSaving(EventArgs.Empty);
System.Console.WriteLine("View:RunPreview {0}",designerControl.ReportModel.ReportSettings.DataModel);
System.Console.WriteLine("View:RunPreview for <{0}>",designerControl.ReportModel.ReportSettings.DataModel);
try {
switch (designerControl.ReportModel.ReportSettings.DataModel) {
case GlobalEnums.enmPushPullModel.FormSheet : {
PreviewStandartReport();
System.Console.WriteLine("\tFormSheet");
PreviewStandartReport(standAlone);
break;
}
case GlobalEnums.enmPushPullModel.PullData:{
PreviewStandartReport();
System.Console.WriteLine("\tPullData");
PreviewStandartReport(standAlone);
break;
}
case GlobalEnums.enmPushPullModel.PushData:{
PreviewPushReport ();
System.Console.WriteLine("\tPushData");
PreviewPushReport (standAlone);
break;
}
default:
@ -230,7 +236,8 @@ namespace SharpReportAddin{ @@ -230,7 +236,8 @@ namespace SharpReportAddin{
private void PreviewPushReport (){
private void PreviewPushReport (bool standAlone){
System.Console.WriteLine("View:PreviewPushDataReport");
try {
using (OpenFileDialog openFileDialog = new OpenFileDialog()){
openFileDialog.Filter = GlobalValues.XsdFileFilter;
@ -243,7 +250,7 @@ namespace SharpReportAddin{ @@ -243,7 +250,7 @@ namespace SharpReportAddin{
ds.ReadXml (openFileDialog.FileName);
reportManager.ReportPreviewPushData(designerControl.ReportModel,
ds.Tables[0],
true);
standAlone);
}
}
}
@ -253,14 +260,14 @@ namespace SharpReportAddin{ @@ -253,14 +260,14 @@ namespace SharpReportAddin{
}
private void PreviewStandartReport(){
System.Console.WriteLine("View:PreviewStadartreport");
private void PreviewStandartReport(bool standAlone){
System.Console.WriteLine("View:PreviewStandartReport");
reportManager.NoData -= new SharpReportEventHandler (OnNoDataForReport);
reportManager.NoData += new SharpReportEventHandler (OnNoDataForReport);
reportManager.ParametersRequest -= new SharpReportParametersEventHandler (OnParametersRequest);
reportManager.ParametersRequest += new SharpReportParametersEventHandler (OnParametersRequest);
reportManager.ReportPreview (designerControl.ReportModel, true);
reportManager.ReportPreview (designerControl.ReportModel, standAlone);
}
@ -302,6 +309,8 @@ namespace SharpReportAddin{ @@ -302,6 +309,8 @@ namespace SharpReportAddin{
private void OnTabPageChanged (object sender, EventArgs e) {
string name = Path.GetFileName (base.FileName);
base.TitleName = name + "[" + tabControl.SelectedTab.Text + "]";
System.Console.WriteLine("");
System.Console.WriteLine("!! OnTabPageChange !!");
switch (tabControl.SelectedIndex) {
case 0 :
break;
@ -310,7 +319,7 @@ namespace SharpReportAddin{ @@ -310,7 +319,7 @@ namespace SharpReportAddin{
if (tabControl.SelectedTab.Controls.Count == 0 ){
tabControl.SelectedTab.Controls.Add(reportManager.PreviewControl);
}
RunPreview();
RunPreview(true);
this.previewPage.Visible = true;
break;
default:
@ -378,8 +387,11 @@ namespace SharpReportAddin{ @@ -378,8 +387,11 @@ namespace SharpReportAddin{
reportManager.ParametersRequest -= new SharpReportParametersEventHandler (OnParametersRequest);
reportManager.ParametersRequest += new SharpReportParametersEventHandler (OnParametersRequest);
base.OnSaving(EventArgs.Empty);
reportManager.ReportPreview (designerControl.ReportModel,
false);
System.Console.WriteLine("");
System.Console.WriteLine("!! OnPreviewClick !!");
// reportManager.ReportPreview (designerControl.ReportModel,
// false);
this.RunPreview(false);
}
@ -548,6 +560,12 @@ namespace SharpReportAddin{ @@ -548,6 +560,12 @@ namespace SharpReportAddin{
#region ICSharpCode.SharpDevelop.Gui.IPrintable interface implementation
public System.Drawing.Printing.PrintDocument PrintDocument {
get {
System.Console.WriteLine("");
System.Console.WriteLine("!! PrintDocument !!");
if (this.designerControl.ReportModel.ReportSettings.DataModel == GlobalEnums.enmPushPullModel.PushData) {
MessageService.ShowMessage("PushModel currently not supported");
}
AbstractRenderer renderer = reportManager.GetRenderer(this.designerControl.ReportModel);
return renderer.ReportDocument;
}

2
src/AddIns/Misc/SharpReport/SharpReportCore/BaseSettings.cs

@ -35,7 +35,7 @@ using System.Xml.Serialization; @@ -35,7 +35,7 @@ using System.Xml.Serialization;
namespace SharpReportCore {
public class BaseSettings : object {
private const string defaultReportName = "SharpReport1";
// private const string defaultFileName = "SharpReport1.srd";
private string reportName;
private string fileName;

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

@ -79,6 +79,7 @@ namespace SharpReportCore { @@ -79,6 +79,7 @@ namespace SharpReportCore {
public DataManager(DataTable dataSource, ReportSettings reportSettings){
try {
System.Console.WriteLine("DataManager (table,model");
CheckAndSetReportSettings(reportSettings);
CheckAndSetSource(dataSource);
this.dataViewStrategy = new TableStrategy((DataTable)this.dataSource,
@ -130,10 +131,14 @@ namespace SharpReportCore { @@ -130,10 +131,14 @@ namespace SharpReportCore {
if (settings == null) {
throw new ArgumentNullException("DataManager:ReportSettings");
}
System.Console.WriteLine("CheckAndSetReportSettings");
try {
System.Console.WriteLine("\t {0}",settings.DataModel.ToString());
if (settings.DataModel != GlobalEnums.enmPushPullModel.PushData) {
SqlQueryCkecker check = new SqlQueryCkecker();
check.Check(settings.CommandText);
}
} catch (Exception e) {
MessageBox.Show (e.Message);
throw e;

2
src/AddIns/Misc/SharpReport/SharpReportCore/DataManager/SqlQueryChecker.cs

@ -27,6 +27,7 @@ namespace SharpReportCore @@ -27,6 +27,7 @@ namespace SharpReportCore
}
public void Check (string queryString) {
if (queryString != "") {
this.queryString = queryString.ToUpper(CultureInfo.CurrentCulture);
if (this.queryString.IndexOf (this.UPDATE) > -1) {
@ -40,6 +41,7 @@ namespace SharpReportCore @@ -40,6 +41,7 @@ namespace SharpReportCore
}
}
}
private void Invalid (string invalidArgument) {
string str = String.Format("{0} {1}",invalidArgument,this.noValidMessage);

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

@ -54,8 +54,7 @@ namespace SharpReportCore { @@ -54,8 +54,7 @@ namespace SharpReportCore {
public AbstractRenderer(ReportModel model){
System.Console.WriteLine("");
System.Console.WriteLine("\t\t ABSTRACT RENDERER");
// System.Console.WriteLine("\tConstructor of ABstractRenderer");
this.reportSettings = model.ReportSettings;
this.sections = model.SectionCollection;
Init();

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

@ -60,7 +60,7 @@ namespace SharpReportCore { @@ -60,7 +60,7 @@ namespace SharpReportCore {
}
protected override void ReportBegin(object sender, ReportPageEventArgs e) {
System.Console.WriteLine("\t\tRenderDataReport:ReportBegin");
System.Console.WriteLine("\tRenderDataReport:ReportBegin");
base.ReportBegin (sender,e);
//allways reset the dataManager before printing
if (this.dataManager != null) {
@ -180,15 +180,7 @@ namespace SharpReportCore { @@ -180,15 +180,7 @@ namespace SharpReportCore {
return "RenderDataReport";
}
#endregion
public DataManager DatManager {
// public DataContainer DataContainer {
get {
return dataManager;
}
set {
dataManager = value;
}
}
}
}

12
src/AddIns/Misc/SharpReport/SharpReportCore/Printing/ReportDocument.cs

@ -36,7 +36,7 @@ namespace SharpReportCore { @@ -36,7 +36,7 @@ namespace SharpReportCore {
public ReportDocument():base() {
System.Console.WriteLine("ReportDocument COnstructor");
System.Console.WriteLine("ReportDocument Constructor");
base.BeginPrint += new PrintEventHandler (ReportDocumentBeginPrint);
base.PrintPage += new PrintPageEventHandler (ReportDocumentPrintPage);
@ -46,7 +46,7 @@ namespace SharpReportCore { @@ -46,7 +46,7 @@ namespace SharpReportCore {
}
void GeneratePage (SharpReportCore.ReportPageEventArgs page) {
System.Console.WriteLine("GeneratePage");
System.Console.WriteLine("\tGeneratePage");
if (PrintPageBegin != null) {
PrintPageBegin (this,page);
}
@ -74,19 +74,19 @@ namespace SharpReportCore { @@ -74,19 +74,19 @@ namespace SharpReportCore {
#region events
//this events are also used by PrintPreviewControl
public void ReportDocumentBeginPrint (object sender,PrintEventArgs e) {
System.Console.WriteLine("\tReportDocumentBeginPrint");
System.Console.WriteLine("\tReportDocument BeginPrint");
pageNr = 0;
}
public void ReportDocumentQueryPage (object sender, QueryPageSettingsEventArgs e) {
System.Console.WriteLine("\tReportDocumentQueryPage");
// System.Console.WriteLine("\tReportDocument QueryPage");
if (QueryPage != null) {
QueryPage (this,e);
}
}
public void ReportDocumentPrintPage (object sender, PrintPageEventArgs e) {
System.Console.WriteLine("\tReportDocumentPrintPage");
// System.Console.WriteLine("\tReportDocument PrintPage");
pageNr ++;
ReportPageEventArgs pea = new ReportPageEventArgs (e,pageNr,false,new PointF (0,0));
@ -110,7 +110,7 @@ namespace SharpReportCore { @@ -110,7 +110,7 @@ namespace SharpReportCore {
}
public void ReportDocumentEndPrint (object sender,PrintEventArgs e) {
System.Console.WriteLine("\tReportDocumentEndPrint");
// System.Console.WriteLine("\tReportDocument EndPrint");
pageNr = 0;
if (ReportEnd != null) {
ReportEnd (this,null);

4
src/AddIns/Misc/SharpReport/SharpReportCore/ReportModel.cs

@ -52,6 +52,10 @@ namespace SharpReportCore { @@ -52,6 +52,10 @@ namespace SharpReportCore {
reportSettings.GraphicsUnit = graphicsUnit;
}
#region ReportType
##endregion
#region SharpReport.DelegatesInterfaces.IModel interface implementation
public void Accept(IModelVisitor visitor) {
visitor.Visit (this);

14
src/AddIns/Misc/SharpReport/SharpReportCore/SharpReportEngine.cs

@ -234,18 +234,24 @@ namespace SharpReportCore { @@ -234,18 +234,24 @@ namespace SharpReportCore {
protected SharpReportCore.AbstractRenderer SetupPushDataRenderer (ReportModel model,
DataTable dataTable) {
System.Console.WriteLine("SetupPushDataRenderer with {0}",dataTable.Rows.Count);
if (model.ReportSettings.ReportType != GlobalEnums.enmReportType.DataReport) {
throw new ArgumentException("PrepareForPushDataReport No valid ReportModel");
throw new ArgumentException("SetupPushDataRenderer <No valid ReportModel>");
}
if (model.ReportSettings.DataModel != GlobalEnums.enmPushPullModel.PushData) {
throw new ArgumentException("PrepareForPushDataReport No valid ReportType");
throw new ArgumentException("SetupPushDataRenderer <No valid ReportType>");
}
AbstractRenderer abstr = null;
DataManager dataManager = new DataManager (dataTable,model.ReportSettings);
dataManager.DataBind();
System.Console.WriteLine("\tDataManager ok = {0}",(dataManager != null));
if (dataManager != null) {
dataManager.DataBind();
if (dataManager.DataSource != null) {
abstr = new RendererFactory().Create (model,dataManager);
}
return abstr;
}
return null;

Loading…
Cancel
Save