Browse Source

Work on ReportExplorer, fixes from FxCop

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1670 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Peter Forstmeier 19 years ago
parent
commit
dc8a0343ec
  1. 1
      src/AddIns/Misc/SharpReport/SharpReport/SharpReportManager.cs
  2. 18
      src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/AbstractCommand/AbstractExplorerCommand.cs
  3. 4
      src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/AbstractCommand/AbstractSharpReportCommand.cs
  4. 35
      src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/ExplorerCommands.cs
  5. 2
      src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/AbstractFieldsNode.cs
  6. 2
      src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ColumnsTreeNode.cs
  7. 12
      src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ExplorerTree.cs
  8. 23
      src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ReportExplorer.cs
  9. 2
      src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/SectionTreeNode.cs
  10. 12
      src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportDisplayBinding.cs
  11. 51
      src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportView.cs

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

@ -206,7 +206,6 @@ namespace SharpReport{ @@ -206,7 +206,6 @@ namespace SharpReport{
private AbstractRenderer BuildStandartRenderer (ReportModel model) {
if (model == null) {
throw new ArgumentNullException("model");
}

18
src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/AbstractCommand/AbstractExplorerCommand.cs

@ -16,17 +16,15 @@ using ICSharpCode.SharpDevelop.Gui; @@ -16,17 +16,15 @@ using ICSharpCode.SharpDevelop.Gui;
namespace SharpReportAddin.Commands{
public abstract class AbstractExplorerCommand : AbstractMenuCommand{
ReportExplorer reportExplorer = null;
ReportExplorer reportExplorer;
protected AbstractExplorerCommand(){
// Type type = typeof(ReportExplorer);
// this.reportExplorer = (SharpReportAddin.ReportExplorer)WorkbenchSingleton.Workbench.GetPad(type).PadContent;
this.reportExplorer = (SharpReportAddin.ReportExplorer)WorkbenchSingleton.Workbench.GetPad(typeof(ReportExplorer)).PadContent;
if (reportExplorer == null) {
throw new NullReferenceException ("AbstractExplorerCommand : No FieldExplorer Pad available");
throw new SharpReportCore.SharpReportException("Explorer");
}
}
/// <summary>
/// <summary>
/// Enabled or disabled the command
/// <remarks> /remarks>
/// </summary>
@ -40,10 +38,16 @@ namespace SharpReportAddin.Commands{ @@ -40,10 +38,16 @@ namespace SharpReportAddin.Commands{
set{}
}
public ReportExplorer ReportExplorer {
protected ReportExplorer ReportExplorer {
get {
return reportExplorer;
}
}
protected PadDescriptor ReportExplorerPad {
get{
return WorkbenchSingleton.Workbench.GetPad(typeof(ReportExplorer));
}
}
}
}

4
src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/AbstractCommand/AbstractSharpReportCommand.cs

@ -22,7 +22,7 @@ using ICSharpCode.SharpDevelop.Gui; @@ -22,7 +22,7 @@ using ICSharpCode.SharpDevelop.Gui;
/// </remarks>
namespace SharpReportAddin.Commands {
public abstract class AbstractSharpReportCommand : AbstractMenuCommand {
SharpReportView view = null;
SharpReportView view;
/// <summary>
/// get a instance of SharpReportView
@ -32,7 +32,7 @@ namespace SharpReportAddin.Commands { @@ -32,7 +32,7 @@ namespace SharpReportAddin.Commands {
try {
view = (SharpReportView)WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent;
if (view == null) {
throw new NullReferenceException ("AbstractSharpCommand : No view available");
throw new SharpReportCore.SharpReportException("No View");
}
} catch (Exception) {
throw;

35
src/AddIns/Misc/SharpReport/SharpReportAddin/Commands/ExplorerCommands.cs

@ -12,7 +12,7 @@ using System; @@ -12,7 +12,7 @@ using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using SharpReportCore;
/// <summary>
/// This class'es handles all the commands used by the
/// <see cref="ReportExplorer"></see>
@ -23,6 +23,39 @@ using ICSharpCode.SharpDevelop.Gui; @@ -23,6 +23,39 @@ using ICSharpCode.SharpDevelop.Gui;
/// </remarks>
namespace SharpReportAddin.Commands {
/// <summary>
/// Fill and BringToFront
/// </summary>
public class ShowAndFillExplorer : AbstractExplorerCommand{
ReportModel reportModel;
public override void Run(){
if (this.reportModel == null) {
throw new ArgumentNullException("reportModel");
}
base.ReportExplorerPad.BringPadToFront();
base.ReportExplorer.ReportModel = this.reportModel;
}
public ReportModel ReportModel {
set {
reportModel = value;
}
}
}
/// <summary>
/// ShutDown Explorer
/// </summary>
public class HideExplorer:AbstractExplorerCommand{
public override void Run(){
WorkbenchSingleton.Workbench.WorkbenchLayout.HidePad(base.ReportExplorerPad);
}
}
/// <summary>
/// Clear and rebuild the ExplorerTree
/// </summary>

2
src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/AbstractFieldsNode.cs

@ -23,7 +23,7 @@ using System.Windows.Forms; @@ -23,7 +23,7 @@ using System.Windows.Forms;
/// </remarks>
namespace SharpReportAddin {
public class AbstractFieldsNode : TreeNode {
internal class AbstractFieldsNode : TreeNode {
private string contextmenuAddinTreePath = String.Empty;

2
src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ColumnsTreeNode.cs

@ -22,7 +22,7 @@ using SharpReportAddin; @@ -22,7 +22,7 @@ using SharpReportAddin;
/// created on - 05.06.2005 18:54:33
/// </remarks>
namespace SharpReportAddin {
public class ColumnsTreeNode : SharpReportAddin.AbstractFieldsNode {
internal class ColumnsTreeNode : SharpReportAddin.AbstractFieldsNode {
ListSortDirection listSortDirection;
public ColumnsTreeNode(string nodeName):this(nodeName,ListSortDirection.Ascending) {

12
src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ExplorerTree.cs

@ -72,7 +72,16 @@ namespace SharpReportAddin{ @@ -72,7 +72,16 @@ namespace SharpReportAddin{
}
}
}
public bool CheckForExist (SectionTreeNode sec,ColumnsTreeNode col) {
public void ClearSortNode() {
this.nodeSorting.Nodes.Clear();
}
public bool IsGroupNode (SectionTreeNode node) {
return (node == this.nodeGrouping);
}
public static bool CheckForExist (SectionTreeNode sec,ColumnsTreeNode col) {
if (sec.Nodes.Count > 0) {
for (int i = 0;i < sec.Nodes.Count ;i++ ) {
if (sec.Nodes[i].Text == col.Text) {
@ -147,7 +156,6 @@ namespace SharpReportAddin{ @@ -147,7 +156,6 @@ namespace SharpReportAddin{
public void CollectModel (ReportModel model) {
UpdateSorting(model);
UpdateGrouping(model);
MessageBox.Show (model.DetailSection.Items.Count.ToString());
}
public void ClearAndFill() {

23
src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/ReportExplorer.cs

@ -31,6 +31,7 @@ namespace SharpReportAddin @@ -31,6 +31,7 @@ namespace SharpReportAddin
/// </summary>
public ReportExplorer():base(){
System.Console.WriteLine("InitExplorer");
this.contentPanel.Controls.Add(this.treeView);
this.treeView.ItemDrag += TreeViewItemDrag;
this.treeView.DragDrop += TreeViewDragDrop;
@ -77,17 +78,23 @@ namespace SharpReportAddin @@ -77,17 +78,23 @@ namespace SharpReportAddin
void TreeViewDragDrop (object sender,DragEventArgs e) {
if(e.Data.GetDataPresent("SharpReportAddin.ColumnsTreeNode", false)){
Point pt = this.treeView.PointToClient (new Point( e.X,e.Y));
SectionTreeNode node = this.treeView.GetNodeAt (pt) as SectionTreeNode;
if (node != null) {
// If we dragdrop to GroupNode, remove all subnods in SortNode
if (this.treeView.IsGroupNode(node)) {
this.treeView.ClearSortNode();
}
ColumnsTreeNode t = (ColumnsTreeNode)e.Data.GetData("SharpReportAddin.ColumnsTreeNode", true);
ColumnsTreeNode dest = new ColumnsTreeNode (t.Text);
// Useless to add a node twice
if (!this.treeView.CheckForExist (node,dest)) {
if (!ExplorerTree.CheckForExist (node,dest)) {
dest.SortDirection = ListSortDirection.Ascending;
dest.ImageIndex = this.treeView.AscendingIcon;
dest.SelectedImageIndex = this.treeView.AscendingIcon;
@ -100,19 +107,7 @@ namespace SharpReportAddin @@ -100,19 +107,7 @@ namespace SharpReportAddin
}
}
// private static bool CheckForExist (SectionTreeNode sec,ColumnsTreeNode col) {
// if (sec.Nodes.Count > 0) {
// for (int i = 0;i < sec.Nodes.Count ;i++ ) {
// if (sec.Nodes[i].Text == col.Text) {
// return true;
// }
// }
// } else {
// return false;
// }
// return false;
// }
#endregion

2
src/AddIns/Misc/SharpReport/SharpReportAddin/FieldsExplorer/SectionTreeNode.cs

@ -20,7 +20,7 @@ using System.Windows.Forms; @@ -20,7 +20,7 @@ using System.Windows.Forms;
/// created on - 05.06.2005 18:40:31
/// </remarks>
namespace SharpReportAddin {
public class SectionTreeNode : SharpReportAddin.AbstractFieldsNode {
internal class SectionTreeNode : SharpReportAddin.AbstractFieldsNode {
public SectionTreeNode(string nodeName) {
this.Text = nodeName;

12
src/AddIns/Misc/SharpReport/SharpReportAddin/SharpReportDisplayBinding.cs

@ -20,8 +20,8 @@ @@ -20,8 +20,8 @@
using System;
using System.Globalization;
using ICSharpCode.Core;
using SharpReportCore;
using SharpReportCore;
using SharpReportAddin.Commands;
/// <summary>
/// Displaybinding for SharpReport
/// </summary>
@ -45,6 +45,10 @@ namespace SharpReportAddin { @@ -45,6 +45,10 @@ namespace SharpReportAddin {
view.UpdateView(true);
view.Selected();
view.ShowReportSettings();
System.Console.WriteLine("Call Command");
ShowAndFillExplorer se = new ShowAndFillExplorer();
se.ReportModel = view.DesignerControl.ReportModel;
se.Run();
return view;
} catch (SharpReportException) {
if (view != null) {
@ -75,7 +79,9 @@ namespace SharpReportAddin { @@ -75,7 +79,9 @@ namespace SharpReportAddin {
if (GlobalValues.IsValidPrinter() == true) {
SharpReportView view = new SharpReportView();
try {
StatusBarService.SetMessage (String.Format("File : {0}",fileName));
StatusBarService.SetMessage (String.Format(CultureInfo.CurrentCulture,
"File : {0}",fileName));
view.Load (fileName);
view.UpdateView (false);

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

@ -150,14 +150,15 @@ namespace SharpReportAddin{ @@ -150,14 +150,15 @@ namespace SharpReportAddin{
if (e.Content is SharpReportView) {
WorkbenchSingleton.Workbench.ViewClosed -= new ViewContentEventHandler(ShutDownView);
}
//Allways hide the pad
PadDescriptor pad =
WorkbenchSingleton.Workbench.GetPad(typeof(ReportExplorer));
if (pad != null) {
WorkbenchSingleton.Workbench.WorkbenchLayout.HidePad(pad);
ClearAndRebuildExplorer cmd = new ClearAndRebuildExplorer();
cmd.Run();
}
HideExplorer he = new HideExplorer();
he.Run();
ClearAndRebuildExplorer cmd = new ClearAndRebuildExplorer();
cmd.Run();
}
@ -239,6 +240,7 @@ namespace SharpReportAddin{ @@ -239,6 +240,7 @@ namespace SharpReportAddin{
private void RunPreview(bool standAlone) {
base.OnSaving(EventArgs.Empty);
this.UpdateModelFromExplorer();
try {
switch (designerControl.ReportModel.DataModel) {
case GlobalEnums.PushPullModelEnum.FormSheet : {
@ -285,7 +287,6 @@ namespace SharpReportAddin{ @@ -285,7 +287,6 @@ namespace SharpReportAddin{
reportManager.ParametersRequest += new EventHandler<SharpReportParametersEventArgs>(OnParametersRequest);
reportManager.ReportPreview (designerControl.ReportModel, standAlone);
}
#endregion
@ -357,10 +358,9 @@ namespace SharpReportAddin{ @@ -357,10 +358,9 @@ namespace SharpReportAddin{
}
//Something was dropped on the designer
private void OnItemDragDrop (object sender,ItemDragDropEventArgs e) {
base.IsDirty = true;
System.Console.WriteLine("View ItemDragDrop");
System.Console.WriteLine("\tcall OnPropertyChanged");
this.OnPropertyChanged (this,new System.ComponentModel.PropertyChangedEventArgs("Item Dragged"));
}
@ -368,13 +368,6 @@ namespace SharpReportAddin{ @@ -368,13 +368,6 @@ namespace SharpReportAddin{
System.ComponentModel.PropertyChangedEventArgs e) {
base.IsDirty = true;
OnObjectSelected (this,EventArgs.Empty);
System.Console.WriteLine("View:ProperytChanged");
PadDescriptor pad =
WorkbenchSingleton.Workbench.GetPad(typeof(ReportExplorer));
if (pad != null) {
System.Console.WriteLine("\tpad is loaded - call üad:RedrawContent");
pad.RedrawContent();
}
}
private void OnModelFileNameChanged (object sender,EventArgs e) {
@ -396,11 +389,13 @@ namespace SharpReportAddin{ @@ -396,11 +389,13 @@ namespace SharpReportAddin{
if (PropertyPad.Grid != null) {
PropertyPad.Grid.SelectedObject = designerControl.ReportControl.SelectedObject;
}
}
}
private void UpdateModelFromExplorer () {
ReportExplorer re = (SharpReportAddin.ReportExplorer)WorkbenchSingleton.Workbench.GetPad(typeof(ReportExplorer)).PadContent;
re.Update(designerControl.ReportModel);
}
#endregion
#region Calls from outside commands
@ -513,9 +508,7 @@ namespace SharpReportAddin{ @@ -513,9 +508,7 @@ namespace SharpReportAddin{
/// <param name="fileName"></param>
public override void Save(string fileName) {
try {
ReportExplorer re = (SharpReportAddin.ReportExplorer)WorkbenchSingleton.Workbench.GetPad(typeof(ReportExplorer)).PadContent;
re.Update(designerControl.ReportModel);
UpdateModelFromExplorer ();
designerControl.ReportModel.ReportSettings.FileName = fileName;
if (FileUtility.IsValidFileName(fileName)) {
@ -573,11 +566,10 @@ namespace SharpReportAddin{ @@ -573,11 +566,10 @@ namespace SharpReportAddin{
}
this.designerControl.ReportModel.ReportSettings.AvailableFieldsCollection = reportManager.AvailableFieldsCollection;
PadDescriptor pad = WorkbenchSingleton.Workbench.GetPad(typeof(ReportExplorer));
ReportExplorer re = (ReportExplorer)pad.PadContent;
pad.BringPadToFront();
re.ReportModel = this.designerControl.ReportModel;
ShowAndFillExplorer se = new ShowAndFillExplorer();
se.ReportModel = this.designerControl.ReportModel;
se.Run();
} catch (Exception e) {
MessageService.ShowError(e,"SharpReportView:Load");
@ -638,7 +630,10 @@ namespace SharpReportAddin{ @@ -638,7 +630,10 @@ namespace SharpReportAddin{
if (this.designerControl != null) {
this.designerControl.Dispose();
}
if (this.tabControl != null) {
this.tabControl.Dispose();
}
if (this.panel != null) {
this.panel.Dispose();
}

Loading…
Cancel
Save