|
|
|
@ -46,26 +46,11 @@ namespace SharpReportAddin { |
|
|
|
private TreeNode nodeFunction; |
|
|
|
private TreeNode nodeFunction; |
|
|
|
private TreeNode nodeParams; |
|
|
|
private TreeNode nodeParams; |
|
|
|
|
|
|
|
|
|
|
|
private ReportSettings reportSettings; |
|
|
|
private ReportModel reportModel; |
|
|
|
private bool isFilled = false; |
|
|
|
private bool isFilled ; |
|
|
|
|
|
|
|
|
|
|
|
#region Publics
|
|
|
|
#region Publics
|
|
|
|
|
|
|
|
|
|
|
|
public void Fill (ReportSettings reportSettings) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (reportSettings == null) { |
|
|
|
|
|
|
|
throw new ArgumentException("FieldsExplorer:Fill 'ReportSettings'"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.reportSettings = reportSettings; |
|
|
|
|
|
|
|
this.Nodes.Clear(); |
|
|
|
|
|
|
|
InitImageList(); |
|
|
|
|
|
|
|
BuildNodes(); |
|
|
|
|
|
|
|
this.FillTree(); |
|
|
|
|
|
|
|
this.ExpandAll(); |
|
|
|
|
|
|
|
isFilled = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///<summary>
|
|
|
|
///<summary>
|
|
|
|
/// Clear the selected Section
|
|
|
|
/// Clear the selected Section
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
@ -83,7 +68,6 @@ namespace SharpReportAddin { |
|
|
|
/// Remove the selected Node from Sorting or Grouping Collection
|
|
|
|
/// Remove the selected Node from Sorting or Grouping Collection
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public void ClearSelectedNode() { |
|
|
|
public void ClearSelectedNode() { |
|
|
|
System.Console.WriteLine("ClearSelectedNode"); |
|
|
|
|
|
|
|
if (this.SelectedNode != null) { |
|
|
|
if (this.SelectedNode != null) { |
|
|
|
TreeNode parent = this.SelectedNode.Parent; |
|
|
|
TreeNode parent = this.SelectedNode.Parent; |
|
|
|
this.SelectedNode.Remove(); |
|
|
|
this.SelectedNode.Remove(); |
|
|
|
@ -96,7 +80,6 @@ namespace SharpReportAddin { |
|
|
|
/// Toggle the SortDirection
|
|
|
|
/// Toggle the SortDirection
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public void ToogleSortDirection () { |
|
|
|
public void ToogleSortDirection () { |
|
|
|
System.Console.WriteLine("Toggle SortDirection"); |
|
|
|
|
|
|
|
if (this.SelectedNode is ColumnsTreeNode) { |
|
|
|
if (this.SelectedNode is ColumnsTreeNode) { |
|
|
|
ColumnsTreeNode cn = (ColumnsTreeNode)this.SelectedNode; |
|
|
|
ColumnsTreeNode cn = (ColumnsTreeNode)this.SelectedNode; |
|
|
|
if (cn.SortDirection == ListSortDirection.Ascending) { |
|
|
|
if (cn.SortDirection == ListSortDirection.Ascending) { |
|
|
|
@ -148,7 +131,6 @@ namespace SharpReportAddin { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void TreeViewDragDrop (object sender,DragEventArgs e) { |
|
|
|
void TreeViewDragDrop (object sender,DragEventArgs e) { |
|
|
|
System.Console.WriteLine("DragDrop"); |
|
|
|
|
|
|
|
if(e.Data.GetDataPresent("SharpReportAddin.ColumnsTreeNode", false)){ |
|
|
|
if(e.Data.GetDataPresent("SharpReportAddin.ColumnsTreeNode", false)){ |
|
|
|
|
|
|
|
|
|
|
|
Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); |
|
|
|
Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); |
|
|
|
@ -168,12 +150,22 @@ namespace SharpReportAddin { |
|
|
|
CheckNode (dest); |
|
|
|
CheckNode (dest); |
|
|
|
node.Nodes.Add(dest); |
|
|
|
node.Nodes.Add(dest); |
|
|
|
NotifyReportView(); |
|
|
|
NotifyReportView(); |
|
|
|
|
|
|
|
this.OnViewSaving(this,EventArgs.Empty); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Fill () { |
|
|
|
|
|
|
|
this.Nodes.Clear(); |
|
|
|
|
|
|
|
InitImageList(); |
|
|
|
|
|
|
|
BuildNodes(); |
|
|
|
|
|
|
|
this.FillTree(); |
|
|
|
|
|
|
|
this.ExpandAll(); |
|
|
|
|
|
|
|
isFilled = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private bool CheckForExist (SectionTreeNode sec,ColumnsTreeNode col) { |
|
|
|
private bool CheckForExist (SectionTreeNode sec,ColumnsTreeNode col) { |
|
|
|
if (sec.Nodes.Count > 0) { |
|
|
|
if (sec.Nodes.Count > 0) { |
|
|
|
for (int i = 0;i < sec.Nodes.Count ;i++ ) { |
|
|
|
for (int i = 0;i < sec.Nodes.Count ;i++ ) { |
|
|
|
@ -228,7 +220,6 @@ namespace SharpReportAddin { |
|
|
|
private void NotifyReportView() { |
|
|
|
private void NotifyReportView() { |
|
|
|
if (this.isFilled) { |
|
|
|
if (this.isFilled) { |
|
|
|
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent is SharpReportView) { |
|
|
|
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent is SharpReportView) { |
|
|
|
System.Console.WriteLine("NotifyReportView"); |
|
|
|
|
|
|
|
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsDirty = true; |
|
|
|
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsDirty = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -240,13 +231,29 @@ namespace SharpReportAddin { |
|
|
|
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null || WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent == null) { |
|
|
|
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null || WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent == null) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving -= OnViewSaving; |
|
|
|
if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent is SharpReportView) { |
|
|
|
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving += OnViewSaving; |
|
|
|
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving -= new EventHandler (OnViewSaving); |
|
|
|
|
|
|
|
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.Saving += new EventHandler (OnViewSaving); |
|
|
|
PadDescriptor pad = WorkbenchSingleton.Workbench.GetPad(typeof(FieldsExplorer)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SharpReportView v = |
|
|
|
|
|
|
|
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent |
|
|
|
|
|
|
|
as SharpReportView; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (v != null) { |
|
|
|
|
|
|
|
this.reportModel = v.ReportManager.BaseDesignControl.ReportModel; |
|
|
|
|
|
|
|
if (this.reportModel != null) { |
|
|
|
|
|
|
|
this.Fill(); |
|
|
|
|
|
|
|
WorkbenchSingleton.Workbench.ShowPad(pad); |
|
|
|
|
|
|
|
pad.BringPadToFront(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
WorkbenchSingleton.Workbench.WorkbenchLayout.HidePad(pad); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception er) { |
|
|
|
|
|
|
|
System.Console.WriteLine("\t{0}",er.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -263,13 +270,13 @@ namespace SharpReportAddin { |
|
|
|
#region Build TreeControl
|
|
|
|
#region Build TreeControl
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateSorting () { |
|
|
|
private void UpdateSorting () { |
|
|
|
this.reportSettings.SortColumnCollection.Clear(); |
|
|
|
this.reportModel.ReportSettings.SortColumnCollection.Clear(); |
|
|
|
if (this.nodeSorting.Nodes.Count > 0) { |
|
|
|
if (this.nodeSorting.Nodes.Count > 0) { |
|
|
|
SortColumn sc; |
|
|
|
SortColumn sc; |
|
|
|
AbstractColumn af; |
|
|
|
AbstractColumn af; |
|
|
|
for (int i = 0;i < this.nodeSorting.Nodes.Count ;i++ ) { |
|
|
|
for (int i = 0;i < this.nodeSorting.Nodes.Count ;i++ ) { |
|
|
|
ColumnsTreeNode cn = (ColumnsTreeNode)this.nodeSorting.Nodes[i]; |
|
|
|
ColumnsTreeNode cn = (ColumnsTreeNode)this.nodeSorting.Nodes[i]; |
|
|
|
af = reportSettings.AvailableFieldsCollection.Find(cn.Text); |
|
|
|
af = this.reportModel.ReportSettings.AvailableFieldsCollection.Find(cn.Text); |
|
|
|
if (af != null) { |
|
|
|
if (af != null) { |
|
|
|
sc = new SortColumn (cn.Text, |
|
|
|
sc = new SortColumn (cn.Text, |
|
|
|
cn.SortDirection, |
|
|
|
cn.SortDirection, |
|
|
|
@ -279,35 +286,35 @@ namespace SharpReportAddin { |
|
|
|
cn.SortDirection, |
|
|
|
cn.SortDirection, |
|
|
|
typeof(System.String)); |
|
|
|
typeof(System.String)); |
|
|
|
} |
|
|
|
} |
|
|
|
reportSettings.SortColumnCollection.Add(sc); |
|
|
|
this.reportModel.ReportSettings.SortColumnCollection.Add(sc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateGrouping () { |
|
|
|
private void UpdateGrouping () { |
|
|
|
reportSettings.GroupColumnsCollection.Clear(); |
|
|
|
this.reportModel.ReportSettings.GroupColumnsCollection.Clear(); |
|
|
|
if (this.nodeGrouping.Nodes.Count > 0) { |
|
|
|
if (this.nodeGrouping.Nodes.Count > 0) { |
|
|
|
GroupColumn gc; |
|
|
|
GroupColumn gc; |
|
|
|
for (int i = 0;i < this.nodeGrouping.Nodes.Count ;i++ ) { |
|
|
|
for (int i = 0;i < this.nodeGrouping.Nodes.Count ;i++ ) { |
|
|
|
ColumnsTreeNode cn = (ColumnsTreeNode)this.nodeGrouping.Nodes[i]; |
|
|
|
ColumnsTreeNode cn = (ColumnsTreeNode)this.nodeGrouping.Nodes[i]; |
|
|
|
gc = new GroupColumn (cn.Text,i,cn.SortDirection); |
|
|
|
gc = new GroupColumn (cn.Text,i,cn.SortDirection); |
|
|
|
reportSettings.GroupColumnsCollection.Add(gc); |
|
|
|
this.reportModel.ReportSettings.GroupColumnsCollection.Add(gc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SetAvailableFields () { |
|
|
|
void SetAvailableFields () { |
|
|
|
try { |
|
|
|
try { |
|
|
|
int avCount = reportSettings.AvailableFieldsCollection.Count; |
|
|
|
int avCount = this.reportModel.ReportSettings.AvailableFieldsCollection.Count; |
|
|
|
for (int i = 0;i < avCount ;i++ ) { |
|
|
|
for (int i = 0;i < avCount ;i++ ) { |
|
|
|
AbstractColumn af = reportSettings.AvailableFieldsCollection[i]; |
|
|
|
AbstractColumn af = this.reportModel.ReportSettings.AvailableFieldsCollection[i]; |
|
|
|
ColumnsTreeNode n = new ColumnsTreeNode(af.ColumnName); |
|
|
|
ColumnsTreeNode n = new ColumnsTreeNode(af.ColumnName); |
|
|
|
n.Tag = this.nodeAvailableFields; |
|
|
|
n.Tag = this.nodeAvailableFields; |
|
|
|
|
|
|
|
|
|
|
|
//we don't like ContextMenu here
|
|
|
|
//we don't like ContextMenu here
|
|
|
|
n.ContextmenuAddinTreePath = ""; |
|
|
|
n.ContextmenuAddinTreePath = ""; |
|
|
|
switch (this.reportSettings.CommandType) { |
|
|
|
switch (this.reportModel.ReportSettings.CommandType) { |
|
|
|
case CommandType.Text:{ |
|
|
|
case CommandType.Text:{ |
|
|
|
n.ImageIndex = 6; |
|
|
|
n.ImageIndex = 6; |
|
|
|
n.SelectedImageIndex = 6; |
|
|
|
n.SelectedImageIndex = 6; |
|
|
|
@ -336,8 +343,8 @@ namespace SharpReportAddin { |
|
|
|
void SetSortFields(){ |
|
|
|
void SetSortFields(){ |
|
|
|
try { |
|
|
|
try { |
|
|
|
ColumnsTreeNode node; |
|
|
|
ColumnsTreeNode node; |
|
|
|
int scCount = reportSettings.SortColumnCollection.Count; |
|
|
|
int scCount = this.reportModel.ReportSettings.SortColumnCollection.Count; |
|
|
|
foreach (SortColumn sc in reportSettings.SortColumnCollection) { |
|
|
|
foreach (SortColumn sc in this.reportModel.ReportSettings.SortColumnCollection) { |
|
|
|
node = new ColumnsTreeNode(sc.ColumnName,sc.SortDirection); |
|
|
|
node = new ColumnsTreeNode(sc.ColumnName,sc.SortDirection); |
|
|
|
if (node.SortDirection == ListSortDirection.Ascending) { |
|
|
|
if (node.SortDirection == ListSortDirection.Ascending) { |
|
|
|
node.ImageIndex = 4; |
|
|
|
node.ImageIndex = 4; |
|
|
|
@ -355,9 +362,9 @@ namespace SharpReportAddin { |
|
|
|
void SetGroupFields(){ |
|
|
|
void SetGroupFields(){ |
|
|
|
try { |
|
|
|
try { |
|
|
|
ColumnsTreeNode node; |
|
|
|
ColumnsTreeNode node; |
|
|
|
int gcCount = reportSettings.GroupColumnsCollection.Count; |
|
|
|
int gcCount = this.reportModel.ReportSettings.GroupColumnsCollection.Count; |
|
|
|
for (int i = 0;i < gcCount ;i++ ) { |
|
|
|
for (int i = 0;i < gcCount ;i++ ) { |
|
|
|
GroupColumn gc = (GroupColumn)reportSettings.GroupColumnsCollection[i]; |
|
|
|
GroupColumn gc = (GroupColumn)this.reportModel.ReportSettings.GroupColumnsCollection[i]; |
|
|
|
node = new ColumnsTreeNode(gc.ColumnName); |
|
|
|
node = new ColumnsTreeNode(gc.ColumnName); |
|
|
|
if (node.SortDirection == ListSortDirection.Ascending) { |
|
|
|
if (node.SortDirection == ListSortDirection.Ascending) { |
|
|
|
node.ImageIndex = 4; |
|
|
|
node.ImageIndex = 4; |
|
|
|
@ -373,43 +380,43 @@ namespace SharpReportAddin { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
void SetParamFields (){ |
|
|
|
void SetParamFields (SharpReportManager reportManager){ |
|
|
|
|
|
|
|
try { |
|
|
|
ColumnsTreeNode node; |
|
|
|
ColumnsTreeNode node; |
|
|
|
int parCount = this.reportModel.ReportSettings.SqlParametersCollection.Count; |
|
|
|
int parCount = reportManager.SqlParametersCollection.Count; |
|
|
|
if (parCount > 0) { |
|
|
|
for (int i = 0;i < parCount ;i++ ) { |
|
|
|
for (int i = 0;i < parCount ;i++ ) { |
|
|
|
SqlParameter par = (SqlParameter)reportManager.SqlParametersCollection[i]; |
|
|
|
SqlParameter par = (SqlParameter)this.reportModel.ReportSettings.SqlParametersCollection[i]; |
|
|
|
node = new ColumnsTreeNode(par.ParameterName); |
|
|
|
node = new ColumnsTreeNode(par.ParameterName); |
|
|
|
node.Tag = par; |
|
|
|
node.Tag = par; |
|
|
|
node.SelectedImageIndex = 9; |
|
|
|
node.SelectedImageIndex = 9; |
|
|
|
node.ImageIndex = 9; |
|
|
|
node.ImageIndex = 9; |
|
|
|
this.nodeParams.Nodes.Add (node); |
|
|
|
this.nodeParams.Nodes.Add (node); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception) { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
void SetFunctions(){ |
|
|
|
void SetFunctions(){ |
|
|
|
try { |
|
|
|
ColumnsTreeNode node; |
|
|
|
|
|
|
|
foreach (ReportSection section in this.reportModel.SectionCollection) { |
|
|
|
} catch (Exception) { |
|
|
|
foreach (BaseReportObject item in section.Items) { |
|
|
|
|
|
|
|
BaseFunction func = item as BaseFunction; |
|
|
|
|
|
|
|
if (func != null) { |
|
|
|
|
|
|
|
node = new ColumnsTreeNode(func.Name); |
|
|
|
|
|
|
|
this.nodeFunction.Nodes.Add(func.FriendlyName); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void FillTree () { |
|
|
|
private void FillTree () { |
|
|
|
if (this.reportSettings != null) { |
|
|
|
this.BeginUpdate(); |
|
|
|
BeginUpdate(); |
|
|
|
SetAvailableFields(); |
|
|
|
SetAvailableFields(); |
|
|
|
SetGroupFields(); |
|
|
|
SetGroupFields(); |
|
|
|
SetSortFields(); |
|
|
|
SetSortFields(); |
|
|
|
SetParamFields (); |
|
|
|
// SetParamFields ();
|
|
|
|
SetFunctions(); |
|
|
|
// SetFunctions();
|
|
|
|
this.EndUpdate(); |
|
|
|
EndUpdate(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
throw new SharpReportException("FiekldsExplorer:FillTree() No valid ReportSettings"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private const int folderClosed = 0; |
|
|
|
private const int folderClosed = 0; |
|
|
|
@ -546,18 +553,19 @@ namespace SharpReportAddin { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FieldsExplorer() { |
|
|
|
public FieldsExplorer() { |
|
|
|
WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += new EventHandler(OnWindowChange); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += OnWindowChange; |
|
|
|
|
|
|
|
|
|
|
|
LabelEdit = true; |
|
|
|
LabelEdit = true; |
|
|
|
AllowDrop = true; |
|
|
|
AllowDrop = true; |
|
|
|
HideSelection = false; |
|
|
|
HideSelection = false; |
|
|
|
Dock = DockStyle.Fill; |
|
|
|
Dock = DockStyle.Fill; |
|
|
|
Scrollable = true; |
|
|
|
Scrollable = true; |
|
|
|
LabelEdit = false; |
|
|
|
LabelEdit = false; |
|
|
|
MouseDown += new System.Windows.Forms.MouseEventHandler(this.TreeMouseDown); |
|
|
|
this.MouseDown += TreeMouseDown; |
|
|
|
this.ItemDrag += new ItemDragEventHandler (TreeViewItemDrag); |
|
|
|
this.ItemDrag += TreeViewItemDrag; |
|
|
|
this.DragDrop += new DragEventHandler (TreeViewDragDrop); |
|
|
|
this.DragDrop += TreeViewDragDrop; |
|
|
|
this.DragOver += new DragEventHandler (TreeViewDragOver); |
|
|
|
this.DragOver += TreeViewDragOver; |
|
|
|
contentPanel.Controls.Add(this); |
|
|
|
contentPanel.Controls.Add(this); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|