Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6195 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
7 changed files with 224 additions and 32 deletions
@ -0,0 +1,15 @@
@@ -0,0 +1,15 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
|
||||
namespace ICSharpCode.CodeQualityAnalysis.Controls |
||||
{ |
||||
public class DependencyMatrix : Matrix<INode> |
||||
{ |
||||
public override object EvaluateCell(MatrixCell<INode> rowHeader, MatrixCell<INode> columnHeader) |
||||
{ |
||||
return rowHeader.Value == columnHeader.Value; // TODO: Add a new method to INode Uses(INode -> Boolean) or maybe Relatioship(INode -> Relatioship)
|
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
|
||||
namespace ICSharpCode.CodeQualityAnalysis.Controls |
||||
{ |
||||
public class DependencyMatrixControl : MatrixControl<INode> |
||||
{ |
||||
} |
||||
} |
||||
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
|
||||
namespace ICSharpCode.CodeQualityAnalysis.Controls |
||||
{ |
||||
public abstract class Matrix<TValue> |
||||
{ |
||||
public List<MatrixCell<TValue>> HeaderRows { get; set; } |
||||
public List<MatrixCell<TValue>> HeaderColumns { get; set; } |
||||
|
||||
protected Matrix() |
||||
{ |
||||
HeaderRows = new List<MatrixCell<TValue>>(); |
||||
HeaderColumns = new List<MatrixCell<TValue>>(); |
||||
} |
||||
|
||||
public abstract object EvaluateCell(MatrixCell<TValue> rowHeader, MatrixCell<TValue> columnHeader); |
||||
} |
||||
|
||||
public class MatrixCell<TValue> |
||||
{ |
||||
public TValue Value { get; set; } |
||||
|
||||
public MatrixCell(TValue value) |
||||
{ |
||||
Value = value; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,109 @@
@@ -0,0 +1,109 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Windows.Media; |
||||
|
||||
namespace ICSharpCode.CodeQualityAnalysis.Controls |
||||
{ |
||||
public class MatrixControl<TValue> : Grid |
||||
{ |
||||
public Matrix<TValue> Matrix { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// TODO: Needs to be reworked for DataBinding and to XAML
|
||||
/// </summary>
|
||||
public void DrawMatrix() |
||||
{ |
||||
DrawHeaders(); |
||||
|
||||
for (int i = 0; i < Matrix.HeaderRows.Count; i++) { |
||||
RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); |
||||
|
||||
for (int j = 0; j < Matrix.HeaderColumns.Count; j++) { |
||||
ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) }); |
||||
|
||||
var val = Matrix.EvaluateCell(Matrix.HeaderRows[i], Matrix.HeaderColumns[j]); |
||||
|
||||
var label = new Label { Content = val }; |
||||
|
||||
var style = new Style(); |
||||
|
||||
style.Setters.Add(new Setter |
||||
{ |
||||
Property = Grid.RowProperty, |
||||
Value = i + 1 |
||||
}); |
||||
|
||||
style.Setters.Add(new Setter |
||||
{ |
||||
Property = Grid.ColumnProperty, |
||||
Value = j + 1 |
||||
}); |
||||
|
||||
label.Style = style; |
||||
|
||||
Children.Add(label); |
||||
} |
||||
} |
||||
} |
||||
|
||||
protected void DrawHeaders() |
||||
{ |
||||
RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); |
||||
ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) }); |
||||
|
||||
for (int i = 0; i < Matrix.HeaderRows.Count; i++) { |
||||
var label = new Label { Content = Matrix.HeaderRows[i].Value.ToString() }; |
||||
|
||||
var style = new Style(); |
||||
|
||||
style.Setters.Add(new Setter |
||||
{ |
||||
Property = Grid.RowProperty, |
||||
Value = i + 1 |
||||
}); |
||||
|
||||
style.Setters.Add(new Setter |
||||
{ |
||||
Property = Grid.ColumnProperty, |
||||
Value = 0 |
||||
}); |
||||
|
||||
label.Style = style; |
||||
|
||||
Children.Add(label); |
||||
} |
||||
|
||||
for (int i = 0; i < Matrix.HeaderColumns.Count; i++) { |
||||
var label = new Label { Content = Matrix.HeaderColumns[i].Value.ToString() }; |
||||
|
||||
var style = new Style(); |
||||
|
||||
style.Setters.Add(new Setter |
||||
{ |
||||
Property = Grid.RowProperty, |
||||
Value = 0 |
||||
}); |
||||
|
||||
style.Setters.Add(new Setter |
||||
{ |
||||
Property = Grid.ColumnProperty, |
||||
Value = i + 1 |
||||
}); |
||||
|
||||
label.Style = style; |
||||
/*label.RenderTransform = new RotateTransform() // need some tweaking
|
||||
{ |
||||
Angle = -90, |
||||
CenterX = -10, |
||||
CenterY = 40 |
||||
};*/ |
||||
|
||||
Children.Add(label); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue