Browse Source

Commit before refactoring of PositionedGraphNode: from flat list to tree of properties.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4369 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Martin Koníček 17 years ago
parent
commit
766110e934
  1. 9
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml.cs
  2. 21
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/Layout/NestedNodeViewModel.cs
  3. 38
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/Layout/PositionedNodeProperty.cs
  4. 19
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/Layout/PropertyNodeViewModel.cs
  5. 20
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/ObjectGraph/ObjectGraphProperty.cs
  6. 26
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/TreeModel/PropertyNode.cs
  7. 4
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/VisualizerWPFWindow.xaml.cs

9
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml.cs

@ -21,6 +21,15 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing @@ -21,6 +21,15 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing
/// </summary>
public partial class PositionedGraphNodeControl : UserControl
{
/// <summary>
/// Occurs when a <see cref="PositionedNodeProperty"/> is expanded.
/// </summary>
public event EventHandler<PositionedPropertyEventArgs> PropertyExpanded;
/// <summary>
/// Occurs when a <see cref="PositionedNodeProperty"/> is collaped.
/// </summary>
public event EventHandler<PositionedPropertyEventArgs> PropertyCollapsed;
public PositionedGraphNodeControl()
{
InitializeComponent();

21
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/Layout/NestedNodeViewModel.cs

@ -9,10 +9,29 @@ using System; @@ -9,10 +9,29 @@ using System;
namespace Debugger.AddIn.Visualizers.Graph.Layout
{
/// <summary>
/// Description of TreeNodeViewModel.
/// ViewModel base for node in tree of properties, to be bound to View (ie. PositionedGraphNodeControl).
/// </summary>
public class NestedNodeViewModel
{
public string Name { get; set; }
public string Text { get; set; }
/// <summary>
/// Is this expandable node?
/// </summary>
public bool IsNested { get; set; }
/// <summary>
/// Does this node have any children?
/// </summary>
public bool HasChildren { get; set; }
// if we bound this ViewModel to a TreeView, this would not be needed,
// it is added "artificially", to support PositionedGraphNodeControl
public bool IsExpanded { get; set; }
private List<NestedNodeViewModel> children = new List<NestedNodeViewModel>();
public List<NestedNodeViewModel> Children { get { return _children; } }
public NestedNodeViewModel()
{
}

38
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/Layout/PositionedNodeProperty.cs

@ -11,7 +11,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -11,7 +11,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// <summary>
/// <see cref="ObjectProperty"/> with outgoing <see cref="PositionedEdge"/>.
/// </summary>
public class PositionedNodeProperty
public class PositionedNodeProperty : IEvaluate
{
/// <summary>
/// Creates new PositionedNodeProperty.
@ -19,10 +19,18 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -19,10 +19,18 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// <param name="objectProperty">Underlying <see cref="ObjectProperty"/></param>
public PositionedNodeProperty(ObjectGraphProperty objectProperty, PositionedGraphNode containingNode)
{
this.objectProperty = objectProperty;
if (containingNode == null)
throw new ArgumentNullException("containingNode");
if (objectProperty == null)
throw new ArgumentNullException("objectProperty");
this.objectGraphProperty = objectProperty;
this.containingNode = containingNode;
}
/// <summary>
/// Is this property expanded?
/// </summary>
public bool IsExpanded { get; set; }
/// <summary>
@ -31,13 +39,13 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -31,13 +39,13 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
public PositionedEdge Edge { get; set; }
private ObjectGraphProperty objectProperty;
private ObjectGraphProperty objectGraphProperty;
/// <summary>
/// Underlying <see cref="ObjectProperty"/>.
/// </summary>
public ObjectGraphProperty ObjectProperty
public ObjectGraphProperty ObjectGraphProperty
{
get { return this.objectProperty; }
get { return this.objectGraphProperty; }
}
private PositionedGraphNode containingNode;
@ -52,26 +60,36 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout @@ -52,26 +60,36 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout
/// <summary>
/// e.g. "Age"
/// </summary>
public string Name { get { return this.objectProperty.Name; } }
public string Name { get { return this.objectGraphProperty.Name; } }
/// <summary>
/// e.g. "19"
/// </summary>
public string Value { get { return this.objectProperty.Value; } }
public string Value { get { return this.objectGraphProperty.Value; } }
/// <summary>
/// Full Debugger expression used to obtain value of this property.
/// </summary>
public Debugger.Expressions.Expression Expression { get { return this.objectProperty.Expression; } }
public Debugger.Expressions.Expression Expression { get { return this.objectGraphProperty.Expression; } }
/// <summary>
/// Is this property of atomic type? (int, string, etc.)
/// </summary>
public bool IsAtomic { get { return this.objectProperty.IsAtomic; } }
public bool IsAtomic { get { return this.objectGraphProperty.IsAtomic; } }
/// <summary>
/// Is the value of this property null?
/// </summary>
public bool IsNull { get { return this.objectProperty.IsNull; } }
public bool IsNull { get { return this.objectGraphProperty.IsNull; } }
public bool IsEvaluated
{
get { return this.objectGraphProperty.IsEvaluated; }
}
public void Evaluate()
{
this.objectGraphProperty.Evaluate();
}
}
}

19
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/Layout/PropertyNodeViewModel.cs

@ -9,12 +9,25 @@ using System; @@ -9,12 +9,25 @@ using System;
namespace Debugger.AddIn.Visualizers.Graph.Layout
{
/// <summary>
/// Description of PropertyNodeViewModel.
/// ViewModel for property node in tree of properties, to be bound to View (PositionedGraphNodeControl).
/// </summary>
public class PropertyNodeViewModel : NestedNodeViewModel
public class PropertyNodeViewModel : NestedNodeViewModel, IEvaluate
{
public PropertyNodeViewModel()
PositionedNodeProperty positionedProperty;
public PropertyNodeViewModel(PositionedNodeProperty positionedNodeProperty)
{
this.positionedProperty = positionedNodeProperty;
}
public bool IsEvaluated
{
get { return this.positionedProperty.IsEvaluated; }
}
public void Evaluate()
{
this.positionedProperty.Evaluate();
}
}
}

20
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/ObjectGraph/ObjectGraphProperty.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
// <owner name="Martin Koníček" email="martin.konicek@gmail.com"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Services;
using System;
using System.Collections.Generic;
using System.Text;
@ -12,12 +13,29 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -12,12 +13,29 @@ namespace Debugger.AddIn.Visualizers.Graph
{
/// <summary>
/// ObjectProperty used in ObjectGraph. Has TargetNode.
/// Support on-demand evaluation of Value property.
/// </summary>
public class ObjectGraphProperty : ObjectProperty
public class ObjectGraphProperty : ObjectProperty, IEvaluate
{
/// <summary>
/// Node that this property points to. Can be null. Always null if <see cref="IsAtomic"/> is true.
/// </summary>
public ObjectGraphNode TargetNode { get; set; }
bool evaluateCalled = false;
public bool IsEvaluated
{
get { return this.evaluateCalled; }
}
public void Evaluate()
{
if (this.Expression == null)
{
throw new DebuggerVisualizerException("Cannot evaluate property with missing Expression");
}
this.Value = this.Expression.Evaluate(WindowsDebugger.CurrentProcess).InvokeToString();
this.evaluateCalled = true;
}
}
}

26
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/TreeModel/PropertyNode.cs

@ -10,9 +10,9 @@ using System; @@ -10,9 +10,9 @@ using System;
namespace Debugger.AddIn.Visualizers.Graph
{
/// <summary>
/// Node containing ObjectGraphProperty, with lazy evaluation.
/// Node containing ObjectGraphProperty.
/// </summary>
public class PropertyNode : AbstractNode, IEvaluate
public class PropertyNode : AbstractNode
{
public PropertyNode(ObjectGraphProperty objectGraphProperty)
{
@ -27,27 +27,5 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -27,27 +27,5 @@ namespace Debugger.AddIn.Visualizers.Graph
{
get { return this.property; }
}
#region IEvaluate members
bool evaluateCalled = false;
public bool IsEvaluated
{
get { return this.evaluateCalled; }
}
public void Evaluate()
{
if (this.Property.Expression == null)
{
throw new DebuggerVisualizerException("Cannot evaluate property with missing Expression");
}
this.Property.Value =
this.Property.Expression.Evaluate(WindowsDebugger.CurrentProcess).InvokeToString();
this.evaluateCalled = true;
}
#endregion
}
}

4
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Visualizers/Graph/VisualizerWPFWindow.xaml.cs

@ -153,7 +153,7 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -153,7 +153,7 @@ namespace Debugger.AddIn.Visualizers.Graph
// add edge (+ possibly nodes) to underlying object graph (no need to rebuild)
// TODO can add more nodes if they are expanded - now this adds always one node
e.Property.ObjectProperty.TargetNode = this.objectGraphBuilder.ObtainNodeForExpression(e.Property.Expression);
e.Property.ObjectGraphProperty.TargetNode = this.objectGraphBuilder.ObtainNodeForExpression(e.Property.Expression);
layoutGraph(this.objectGraph);
}
@ -163,7 +163,7 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -163,7 +163,7 @@ namespace Debugger.AddIn.Visualizers.Graph
expandedNodes.SetCollapsed(e.Property.Expression.Code);
// just remove edge from underlying object graph (no need to rebuild)
e.Property.ObjectProperty.TargetNode = null;
e.Property.ObjectGraphProperty.TargetNode = null;
layoutGraph(this.objectGraph);
}
}

Loading…
Cancel
Save