Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/BubbleChart.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/BubbleChart.cs	(revision 1107)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/BubbleChart.cs	(revision 1108)
@@ -31,4 +31,6 @@
 namespace HeuristicLab.CEDMA.Charting {
   public class BubbleChart : Chart {
+    private const string X_JITTER = "__X_JITTER";
+    private const string Y_JITTER = "__Y_JITTER";
     private const double maxXJitterPercent = 0.05;
     private const double maxYJitterPercent = 0.05;
@@ -50,8 +52,8 @@
     private double maxX = double.NegativeInfinity;
     private double maxY = double.NegativeInfinity;
-    private List<Record> records;
+    private List<ResultsEntry> records;
     private Results results;
-    private Dictionary<IPrimitive, Record> primitiveToRecordDictionary;
-    private Dictionary<Record, IPrimitive> recordToPrimitiveDictionary;
+    private Dictionary<IPrimitive, ResultsEntry> primitiveToEntryDictionary;
+    private Dictionary<ResultsEntry, IPrimitive> entryToPrimitiveDictionary;
     private Random random = new Random();
     private Group points;
@@ -59,13 +61,8 @@
     public BubbleChart(Results results, PointD lowerLeft, PointD upperRight)
       : base(lowerLeft, upperRight) {
-      records = new List<Record>();
-      primitiveToRecordDictionary = new Dictionary<IPrimitive, Record>();
-      recordToPrimitiveDictionary = new Dictionary<Record, IPrimitive>();
+      records = new List<ResultsEntry>();
+      primitiveToEntryDictionary = new Dictionary<IPrimitive, ResultsEntry>();
+      entryToPrimitiveDictionary = new Dictionary<ResultsEntry, IPrimitive>();
       this.results = results;
-      foreach(Record r in results.Records) {
-        records.Add(r);
-     }
-      results.OnRecordAdded += new EventHandler<RecordAddedEventArgs>(results_OnRecordAdded);
-      results.Changed += new EventHandler(results_Changed);
     }
 
@@ -75,13 +72,13 @@
     }
 
-    public BubbleChart(ResultList results, double x1, double y1, double x2, double y2)
+    public BubbleChart(Results results, double x1, double y1, double x2, double y2)
       : this(results, new PointD(x1, y1), new PointD(x2, y2)) {
     }
 
-    void results_OnRecordAdded(object sender, RecordAddedEventArgs e) {
-      lock(records) {
-        records.Add(e.Record);
-      }
-    }
+    //void results_OnRecordAdded(object sender, RecordAddedEventArgs e) {
+    //  lock(records) {
+    //    records.Add(e.Record);
+    //  }
+    //}
 
     public void SetBubbleSizeDimension(string dimension, bool inverted) {
@@ -93,7 +90,13 @@
 
     public void ShowXvsY(string xDimension, string yDimension) {
-      if(this.xDimension != xDimension || this.yDimension != yDimension) {
+      if (this.xDimension != xDimension || this.yDimension != yDimension) {
         this.xDimension = xDimension;
         this.yDimension = yDimension;
+
+        foreach (var resultsEntry in results.SelectRows()) {
+          resultsEntry.Set(X_JITTER, random.NextDouble() * 2.0 - 1.0);
+          resultsEntry.Set(Y_JITTER, random.NextDouble() * 2.0 - 1.0);
+          records.Add(resultsEntry);
+        }
         ResetViewSize();
         Repaint();
@@ -110,51 +113,67 @@
 
     private void Repaint() {
-      if(xDimension == null || yDimension == null) return;
-      lock(records) {
-        double maxSize = 1;
-        double minSize = 1;
-        if(sizeDimension != null) {
-          var sizes = records.Select(r => r.Get(sizeDimension)).Where(x => !double.IsInfinity(x) && x != double.MaxValue && x != double.MinValue).OrderBy(x=>x);
+      if (xDimension == null || yDimension == null) return;
+      double maxSize = 1;
+      double minSize = 1;
+      try {
+        if (sizeDimension != null && Results.OrdinalVariables.Contains(sizeDimension)) {
+          var sizes = records
+            .Select(x => Convert.ToDouble(x.Get(sizeDimension)))
+            .Where(size => !double.IsInfinity(size) && size != double.MaxValue && size != double.MinValue)
+            .OrderBy(r => r);
           minSize = sizes.ElementAt((int)(sizes.Count() * 0.1));
           maxSize = sizes.ElementAt((int)(sizes.Count() * 0.9));
         }
-        UpdateEnabled = false;
-        Group.Clear();
-        primitiveToRecordDictionary.Clear();
-        recordToPrimitiveDictionary.Clear();
-        points = new Group(this);
-        Group.Add(new Axis(this, 0, 0, AxisType.Both));
-        UpdateViewSize(0, 0, 5);
-        foreach(Record r in records) {
-          double x = r.Get(xDimension) + r.Get(Record.X_JITTER) * xJitterFactor;
-          double y = r.Get(yDimension) + r.Get(Record.Y_JITTER) * yJitterFactor;
-          int size = CalculateSize(r.Get(sizeDimension), minSize, maxSize);
-
-          if(double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN;
-          if(double.IsInfinity(y) || y == double.MaxValue || y == double.MinValue) y = double.NaN;
-          if(!double.IsNaN(x) && !double.IsNaN(y)) {
-            UpdateViewSize(x, y, size);
-            int alpha = CalculateAlpha(size);
-            Pen pen = new Pen(Color.FromArgb(alpha, r.Selected ? selectionColor : defaultColor));
-            Brush brush = pen.Brush;
-            FixedSizeCircle c = new FixedSizeCircle(this, x, y, size, pen, brush);
-            c.ToolTipText = r.GetToolTipText();
-            points.Add(c);
-            if(!r.Selected) c.IntoBackground();
-            primitiveToRecordDictionary[c] = r;
-            recordToPrimitiveDictionary[r] = c;
-          }
-        }
-        Group.Add(points);
-        UpdateEnabled = true;
-      }
+      }
+      catch (InvalidCastException) {
+        minSize = 1;
+        maxSize = 1;
+      }
+      UpdateEnabled = false;
+      Group.Clear();
+      primitiveToEntryDictionary.Clear();
+      entryToPrimitiveDictionary.Clear();
+      points = new Group(this);
+      Group.Add(new Axis(this, 0, 0, AxisType.Both));
+      UpdateViewSize(0, 0, 5);
+      foreach (ResultsEntry r in records) {
+        double x, y;
+        int size;
+        try {
+          x = Convert.ToDouble(r.Get(xDimension)) + (double)r.Get(X_JITTER) * xJitterFactor;
+          y = Convert.ToDouble(r.Get(yDimension)) + (double)r.Get(Y_JITTER) * yJitterFactor;
+          size = CalculateSize(Convert.ToDouble(r.Get(sizeDimension)), minSize, maxSize);
+        }
+        catch (InvalidCastException) {
+          x = double.NaN;
+          y = double.NaN;
+          size = minBubbleSize;
+        }
+        if (double.IsInfinity(x) || x == double.MaxValue || x == double.MinValue) x = double.NaN;
+        if (double.IsInfinity(y) || y == double.MaxValue || y == double.MinValue) y = double.NaN;
+        if (!double.IsNaN(x) && !double.IsNaN(y)) {
+          UpdateViewSize(x, y, size);
+          int alpha = CalculateAlpha(size);
+          Pen pen = new Pen(Color.FromArgb(alpha, r.Selected ? selectionColor : defaultColor));
+          Brush brush = pen.Brush;
+          FixedSizeCircle c = new FixedSizeCircle(this, x, y, size, pen, brush);
+          c.ToolTipText = r.GetToolTipText();
+          points.Add(c);
+          if (!r.Selected) c.IntoBackground();
+          primitiveToEntryDictionary[c] = r;
+          entryToPrimitiveDictionary[r] = c;
+        }
+      }
+      Group.Add(points);
+      UpdateEnabled = true;
     }
 
     private int CalculateSize(double size, double minSize, double maxSize) {
-      if(double.IsNaN(size) || double.IsInfinity(size) || size == double.MaxValue || size == double.MinValue) return minBubbleSize;
-      if(size > maxSize) size = maxSize;
-      if(size < minSize) size = minSize;
+      if (double.IsNaN(size) || double.IsInfinity(size) || size == double.MaxValue || size == double.MinValue) return minBubbleSize;
+      if (size > maxSize) size = maxSize;
+      if (size < minSize) size = minSize;
+      if (Math.Abs(maxSize - minSize) < 1.0E-10) return minBubbleSize;
       double sizeDifference = ((size - minSize) / (maxSize - minSize) * (maxBubbleSize - minBubbleSize));
-      if(invertSize) return maxBubbleSize - (int)sizeDifference;
+      if (invertSize) return maxBubbleSize - (int)sizeDifference;
       else return minBubbleSize + (int)sizeDifference;
     }
@@ -165,5 +184,5 @@
 
     private void ZoomToViewSize() {
-      if(minX < maxX && minY < maxY) {
+      if (minX < maxX && minY < maxY) {
         // enlarge view by 5% on each side
         double width = maxX - minX;
@@ -178,8 +197,8 @@
 
     private void UpdateViewSize(double x, double y, double size) {
-      if(x - size < minX) minX = x - size;
-      if(x + size > maxX) maxX = x + size;
-      if(y - size < minY) minY = y + size;
-      if(y + size > maxY) maxY = y + size;
+      if (x - size < minX) minX = x - size;
+      if (x + size > maxX) maxX = x + size;
+      if (y - size < minY) minY = y + size;
+      if (y + size > maxY) maxY = y + size;
     }
 
@@ -191,9 +210,9 @@
     }
 
-    internal Record GetRecord(Point point) {
-      Record r = null;
+    internal ResultsEntry GetResultsEntry(Point point) {
+      ResultsEntry r = null;
       IPrimitive p = points.GetPrimitive(TransformPixelToWorld(point));
-      if(p != null) {
-        primitiveToRecordDictionary.TryGetValue(p, out r);
+      if (p != null) {
+        primitiveToEntryDictionary.TryGetValue(p, out r);
       }
       return r;
@@ -202,5 +221,5 @@
 
     public override void MouseDrag(Point start, Point end, MouseButtons button) {
-      if(button == MouseButtons.Left && Mode == ChartMode.Select) {
+      if (button == MouseButtons.Left && Mode == ChartMode.Select) {
         PointD a = TransformPixelToWorld(start);
         PointD b = TransformPixelToWorld(end);
@@ -214,12 +233,12 @@
         primitives.AddRange(points.Primitives);
 
-        foreach(FixedSizeCircle p in primitives) {
-          if(rect.ContainsPoint(p.Point)) {
-            Record r;
-            primitiveToRecordDictionary.TryGetValue(p, out r);
-            if(r != null) r.ToggleSelected();
+        foreach (FixedSizeCircle p in primitives) {
+          if (rect.ContainsPoint(p.Point)) {
+            ResultsEntry r;
+            primitiveToEntryDictionary.TryGetValue(p, out r);
+            if (r != null) r.ToggleSelected();
           }
         }
-        results.FireChanged();
+        // results.FireChanged();
       } else {
         base.MouseDrag(start, end, button);
@@ -228,8 +247,8 @@
 
     public override void MouseClick(Point point, MouseButtons button) {
-      if(button == MouseButtons.Left) {
-        Record r = GetRecord(point);
-        if(r != null) r.ToggleSelected();
-        results.FireChanged();
+      if (button == MouseButtons.Left) {
+        ResultsEntry r = GetResultsEntry(point);
+        if (r != null) r.ToggleSelected();
+        //        results.FireChanged();
       } else {
         base.MouseClick(point, button);
@@ -237,12 +256,12 @@
     }
 
-    public override void MouseDoubleClick(Point point, MouseButtons button) {
-      if(button == MouseButtons.Left) {
-        Record r = GetRecord(point);
-        if(r != null) r.OpenModel();
-      } else {
-        base.MouseDoubleClick(point, button);
-      }
-    }
+    //public override void MouseDoubleClick(Point point, MouseButtons button) {
+    //  if(button == MouseButtons.Left) {
+    //    Record r = GetRecord(point);
+    //    if(r != null) r.OpenModel();
+    //  } else {
+    //    base.MouseDoubleClick(point, button);
+    //  }
+    //}
   }
 }
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/BubbleChartView.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/BubbleChartView.cs	(revision 1107)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/BubbleChartView.cs	(revision 1108)
@@ -12,23 +12,11 @@
 
 namespace HeuristicLab.CEDMA.Charting {
-  public partial class BubbleChartView : ViewBase {
+  public partial class BubbleChartView : ViewBase, IResultsView {
     private Results results;
     private const string CONSTANT_SIZE = "<constant>";
     private Label pleaseSelectAxisLabel = new Label();
 
-    public BubbleChartView(Results results) {
-      this.results = results;
+    public BubbleChartView() {
       InitializeComponent();
-      bubbleChartControl.Chart = new BubbleChart(results, 0, 0, 100, 100);
-      xAxisComboBox.Items.AddRange(results.OrdinalVariableNames);
-      yAxisComboBox.Items.AddRange(results.OrdinalVariableNames);
-      sizeComboBox.Items.Add(CONSTANT_SIZE);
-      sizeComboBox.Items.AddRange(results.VariableNames);
-      sizeComboBox.SelectedItem = sizeComboBox.Items[0];
-      sizeComboBox.Enabled = false;
-      invertCheckbox.Enabled = false;
-      sizeLabel.Enabled = false;
-      yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
-      xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
     }
 
@@ -39,11 +27,4 @@
     private void UpdateChart() {
       if (xAxisComboBox.SelectedItem == null || yAxisComboBox.SelectedItem == null) return;
-      xJitterlabel.Enabled = true;
-      xTrackBar.Enabled = true;
-      yJitterLabel.Enabled = true;
-      yTrackBar.Enabled = true;
-      sizeComboBox.Enabled = true;
-      invertCheckbox.Enabled = true;
-      sizeLabel.Enabled = true;
       bubbleChartControl.Chart.ShowXvsY((string)xAxisComboBox.SelectedItem, (string)yAxisComboBox.SelectedItem);
     }
@@ -64,4 +45,30 @@
       }
     }
+
+    #region IResultsView Members
+
+    public Control Control {
+      get { return this; }
+    }
+
+    string IResultsView.Name {
+      get { return "Bubble chart"; }
+    }
+
+    public void ShowResults(Results results) {
+      this.results = results;
+      bubbleChartControl.Chart = new BubbleChart(results, 0, 0, 100, 100);
+      xAxisComboBox.Items.AddRange(Results.OrdinalVariables);
+      xAxisComboBox.Items.AddRange(Results.CategoricalVariables);
+      yAxisComboBox.Items.AddRange(Results.OrdinalVariables);
+      yAxisComboBox.Items.AddRange(Results.CategoricalVariables);
+      sizeComboBox.Items.Add(CONSTANT_SIZE);
+      sizeComboBox.Items.AddRange(Results.OrdinalVariables);
+      sizeComboBox.SelectedItem = sizeComboBox.Items[0];
+      yAxisComboBox.SelectedItem = yAxisComboBox.Items[0];
+      xAxisComboBox.SelectedItem = xAxisComboBox.Items[0];
+    }
+
+    #endregion
   }
 }
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj	(revision 1107)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj	(revision 1108)
@@ -66,4 +66,17 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="BubbleChart.cs" />
+    <Compile Include="BubbleChartControl.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="BubbleChartControl.Designer.cs">
+      <DependentUpon>BubbleChartControl.cs</DependentUpon>
+    </Compile>
+    <Compile Include="BubbleChartView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="BubbleChartView.Designer.cs">
+      <DependentUpon>BubbleChartView.cs</DependentUpon>
+    </Compile>
     <Compile Include="HeuristicLabCedmaChartingPlugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
@@ -98,12 +111,4 @@
       <Name>HeuristicLab.Data</Name>
     </ProjectReference>
-    <ProjectReference Include="..\HeuristicLab.GP.StructureIdentification\HeuristicLab.GP.StructureIdentification.csproj">
-      <Project>{74223A32-C726-4978-BE78-37113A18373C}</Project>
-      <Name>HeuristicLab.GP.StructureIdentification</Name>
-    </ProjectReference>
-    <ProjectReference Include="..\HeuristicLab.GP\HeuristicLab.GP.csproj">
-      <Project>{1F1CF3ED-374C-4288-995B-93F6B872F571}</Project>
-      <Name>HeuristicLab.GP</Name>
-    </ProjectReference>
     <ProjectReference Include="..\HeuristicLab.Logging\HeuristicLab.Logging.csproj">
       <Project>{4095C92C-5A4C-44BC-9963-5F384CF5CC3F}</Project>
@@ -118,4 +123,12 @@
     <None Include="HeuristicLab.snk" />
     <None Include="Properties\AssemblyInfo.frame" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="BubbleChartControl.resx">
+      <DependentUpon>BubbleChartControl.cs</DependentUpon>
+    </EmbeddedResource>
+    <EmbeddedResource Include="BubbleChartView.resx">
+      <DependentUpon>BubbleChartView.cs</DependentUpon>
+    </EmbeddedResource>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSetView.Designer.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSetView.Designer.cs	(revision 1107)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/DataSetView.Designer.cs	(revision 1108)
@@ -45,53 +45,53 @@
     /// </summary>
     private void InitializeComponent() {
-      this.editorGroupBox = new System.Windows.Forms.GroupBox();
-      this.activateButton = new System.Windows.Forms.Button();
-      this.resultsButton = new System.Windows.Forms.Button();
-      this.SuspendLayout();
-      // 
-      // editorGroupBox
-      // 
-      this.editorGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-                  | System.Windows.Forms.AnchorStyles.Left)
-                  | System.Windows.Forms.AnchorStyles.Right)));
-      this.editorGroupBox.Location = new System.Drawing.Point(0, 3);
-      this.editorGroupBox.Name = "editorGroupBox";
-      this.editorGroupBox.Size = new System.Drawing.Size(274, 119);
-      this.editorGroupBox.TabIndex = 0;
-      this.editorGroupBox.TabStop = false;
-      this.editorGroupBox.Text = "&Editor:";
-      // 
-      // activateButton
-      // 
-      this.activateButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-      this.activateButton.Location = new System.Drawing.Point(3, 128);
-      this.activateButton.Name = "activateButton";
-      this.activateButton.Size = new System.Drawing.Size(75, 23);
-      this.activateButton.TabIndex = 2;
-      this.activateButton.Text = "&Activate";
-      this.activateButton.UseVisualStyleBackColor = true;
-      this.activateButton.Click += new System.EventHandler(this.activateButton_Click);
-      // 
-      // resultsButton
-      // 
-      this.resultsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-      this.resultsButton.Location = new System.Drawing.Point(84, 128);
-      this.resultsButton.Name = "resultsButton";
-      this.resultsButton.Size = new System.Drawing.Size(75, 23);
-      this.resultsButton.TabIndex = 3;
-      this.resultsButton.Text = "Show results";
-      this.resultsButton.UseVisualStyleBackColor = true;
-      this.resultsButton.Click += new System.EventHandler(this.resultsButton_Click);
-      // 
-      // DataSetView
-      // 
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-      this.Controls.Add(this.resultsButton);
-      this.Controls.Add(this.activateButton);
-      this.Controls.Add(this.editorGroupBox);
-      this.Name = "DataSetView";
-      this.Size = new System.Drawing.Size(274, 154);
-      this.ResumeLayout(false);
+        this.editorGroupBox = new System.Windows.Forms.GroupBox();
+        this.activateButton = new System.Windows.Forms.Button();
+        this.resultsButton = new System.Windows.Forms.Button();
+        this.SuspendLayout();
+        // 
+        // editorGroupBox
+        // 
+        this.editorGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                    | System.Windows.Forms.AnchorStyles.Left)
+                    | System.Windows.Forms.AnchorStyles.Right)));
+        this.editorGroupBox.Location = new System.Drawing.Point(0, 3);
+        this.editorGroupBox.Name = "editorGroupBox";
+        this.editorGroupBox.Size = new System.Drawing.Size(274, 119);
+        this.editorGroupBox.TabIndex = 0;
+        this.editorGroupBox.TabStop = false;
+        this.editorGroupBox.Text = "&Editor:";
+        // 
+        // activateButton
+        // 
+        this.activateButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+        this.activateButton.Location = new System.Drawing.Point(3, 128);
+        this.activateButton.Name = "activateButton";
+        this.activateButton.Size = new System.Drawing.Size(75, 23);
+        this.activateButton.TabIndex = 2;
+        this.activateButton.Text = "&Activate";
+        this.activateButton.UseVisualStyleBackColor = true;
+        this.activateButton.Click += new System.EventHandler(this.activateButton_Click);
+        // 
+        // resultsButton
+        // 
+        this.resultsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+        this.resultsButton.Location = new System.Drawing.Point(84, 128);
+        this.resultsButton.Name = "resultsButton";
+        this.resultsButton.Size = new System.Drawing.Size(86, 23);
+        this.resultsButton.TabIndex = 3;
+        this.resultsButton.Text = "Show results";
+        this.resultsButton.UseVisualStyleBackColor = true;
+        this.resultsButton.Click += new System.EventHandler(this.resultsButton_Click);
+        // 
+        // DataSetView
+        // 
+        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+        this.Controls.Add(this.resultsButton);
+        this.Controls.Add(this.activateButton);
+        this.Controls.Add(this.editorGroupBox);
+        this.Name = "DataSetView";
+        this.Size = new System.Drawing.Size(274, 154);
+        this.ResumeLayout(false);
 
     }
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj	(revision 1107)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj	(revision 1108)
@@ -72,4 +72,5 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ResultsEntry.cs" />
     <Compile Include="TableResultsView.cs">
       <SubType>UserControl</SubType>
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/IResultsView.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/IResultsView.cs	(revision 1107)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/IResultsView.cs	(revision 1108)
@@ -33,4 +33,5 @@
   public interface IResultsView {
     Control Control { get; }
+    string Name { get; }
     void ShowResults(Results results);
   }
Index: anches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Record.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Record.cs	(revision 1107)
+++ 	(revision )
@@ -1,115 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using HeuristicLab.Core;
-using System.Collections;
-using HeuristicLab.CEDMA.DB.Interfaces;
-using System.Xml;
-using System.Runtime.Serialization;
-using System.IO;
-using HeuristicLab.PluginInfrastructure;
-
-namespace HeuristicLab.CEDMA.Charting {
-  public class Record {
-    public const string MAPE_TRAINING = "MAPE (training)";
-    public const string MAPE_VALIDATION = "MAPE (validation)";
-    public const string MAPE_TEST = "MAPE (test)";
-    public const string R2_TRAINING = "R2 (training)";
-    public const string R2_VALIDATION = "R2 (validation)";
-    public const string R2_TEST = "R2 (test)";
-    public const string TARGET_VARIABLE = "Target variable";
-    public const string TREE_SIZE = "Tree size";
-    public const string TREE_HEIGHT = "Tree height";
-    public const string SELECTIONPRESSURE = "Selection pressure";
-
-    public const string X_JITTER = "__X_JITTER";
-    public const string Y_JITTER = "__Y_JITTER";
-
-    private Dictionary<string, double> values = new Dictionary<string, double>();
-    private ResultList resultList;
-
-    private bool selected = false;
-    public bool Selected { get { return selected; } }
-
-    private string uri;
-    public string Uri { get { return uri; } }
-    public Record(ResultList resultList, string uri) {
-      this.uri = uri;
-      this.resultList = resultList;
-    }
-
-    public void Set(string name, double value) {
-      values.Add(name, value);
-    }
-
-    public double Get(string name) {
-      if(name == null || !values.ContainsKey(name)) return double.NaN;
-      return values[name];
-    }
-
-    public void ToggleSelected() {
-      selected = !selected;
-    }
-
-    internal string GetToolTipText() {
-      StringBuilder b = new StringBuilder();
-      foreach(KeyValuePair<string, double> v in values) {
-        if(v.Key != X_JITTER && v.Key != Y_JITTER) {
-          b.Append(v.Key).Append(" = ").Append(v.Value).AppendLine();
-        }
-      }
-      return b.ToString();
-    }
-
-    internal void OpenModel() {
-      resultList.OpenModel(this);
-    }
-
-    internal void OpenGeneratingAlgorithm() {
-      resultList.OpenAlgorithm(this);
-    }
-  }
-}
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Results.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Results.cs	(revision 1107)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/Results.cs	(revision 1108)
@@ -63,8 +63,6 @@
     }
 
-    internal IEnumerable<object[]> SelectRows(List<string> columnNames) {
-      if (store == null) yield return null;
-
-      Resource[] columnNamesRes = columnNames.Select(x => new Literal(x)).ToArray();
+    public IEnumerable<ResultsEntry> SelectRows() {
+      if (store == null) yield break;
 
       var results = store.Select(new Statement(dataSetEntity, Ontology.PredicateHasModel, Ontology.AnyEntity))
@@ -78,5 +76,5 @@
               new Entity[] { (Entity)x.Property },
               new Entity[] { Ontology.PredicateModelAttributeName },
-              columnNamesRes)).Select(y =>
+              new Entity[] { Ontology.AnyEntity })).Select(y =>
                 new {
                   Model = x.Subject,
@@ -92,27 +90,26 @@
                  AttributeName = x.AttributeName.Value,
                  AttributeValue = ((Literal)y.Property).Value
-               })).GroupBy(x=>x.Model);
+               })).GroupBy(x => x.Model);
 
 
       Random random = new Random();
       foreach (var row in results) {
+        ResultsEntry entry = new ResultsEntry(row.First().Model);
+        foreach (var attr in row) {
+          entry.Set((string)attr.AttributeName, attr.AttributeValue);
+        }
+        yield return entry;
+      }
+    }
 
-        yield return row.Select(x => x.AttributeValue).ToArray();
-        //if (ss.Length > 0) {
-        //  Record r = new Record(this, ss[0].Subject.Uri);
-        //  r.Set(Record.X_JITTER, random.NextDouble() * 2.0 - 1.0);
-        //  r.Set(Record.Y_JITTER, random.NextDouble() * 2.0 - 1.0);
-        //  foreach (Statement s in ss) {
-        //    string varName;
-        //    predicateToVariableName.TryGetValue(s.Predicate, out varName);
-        //    if (varName != null) {
-        //      if (varName == Record.TREE_HEIGHT || varName == Record.TREE_SIZE || varName == Record.TARGET_VARIABLE) {
-        //        r.Set(varName, (double)(int)((Literal)s.Property).Value);
-        //      } else {
-        //        r.Set(varName, (double)((Literal)s.Property).Value);
-        //      }
-        //    }
-        //  }
-        //}
+    internal IEnumerable<string> SelectModelAttributes() {
+      if (store == null) yield break;
+
+      var attributeNames =
+        store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateModelAttributeName, Ontology.AnyEntity))
+        .Select(s => (string)((Literal)s.Property).Value)
+        .Distinct();
+      foreach (var name in attributeNames) {
+        yield return name;
       }
     }
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsEntry.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsEntry.cs	(revision 1108)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsEntry.cs	(revision 1108)
@@ -0,0 +1,77 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using System.Collections;
+using HeuristicLab.CEDMA.DB.Interfaces;
+using System.Xml;
+using System.Runtime.Serialization;
+using System.IO;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.CEDMA.Core {
+  public class ResultsEntry {
+    private Dictionary<string, object> values = new Dictionary<string, object>();
+
+    private bool selected = false;
+    public bool Selected { get { return selected; } }
+
+    private string uri;
+    public string Uri { get { return uri; } }
+
+    public ResultsEntry(string uri) {
+      this.uri = uri;
+    }
+
+    public void Set(string name, object value) {
+      values.Add(name, value);
+    }
+
+    public object Get(string name) {
+      if (name == null || !values.ContainsKey(name)) return null;
+      return values[name];
+    }
+
+    public void ToggleSelected() {
+      selected = !selected;
+    }
+
+    public string GetToolTipText() {
+      StringBuilder b = new StringBuilder();
+      foreach (KeyValuePair<string, object> v in values) {
+        b.Append(v.Key).Append(" = ").Append(v.Value).AppendLine();
+      }
+      return b.ToString();
+    }
+
+    //internal void OpenModel() {
+    //  resultList.OpenModel(this);
+    //}
+
+    //internal void OpenGeneratingAlgorithm() {
+    //  resultList.OpenAlgorithm(this);
+    //}
+  }
+}
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsViewContainer.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsViewContainer.cs	(revision 1107)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/ResultsViewContainer.cs	(revision 1108)
@@ -18,12 +18,12 @@
       InitializeComponent();
       PopulateViewComboBox();
-      showButton.Enabled = false;
+      showButton.Enabled = viewComboBox.SelectedItem != null;
     }
 
     private void PopulateViewComboBox() {
       DiscoveryService service = new DiscoveryService();
-      Type[] viewTypes = service.GetTypes(typeof(IResultsView));
-      foreach (Type t in viewTypes)
-        viewComboBox.Items.Add(t);
+      IResultsView[] views = service.GetInstances<IResultsView>();
+      viewComboBox.DataSource = views;
+      viewComboBox.ValueMember = "Name";
     }
 
@@ -31,6 +31,5 @@
       viewPanel.Controls.Clear();
       try {
-        Type type = (Type)viewComboBox.SelectedItem;
-        IResultsView view = (IResultsView)Activator.CreateInstance(type);
+        IResultsView view = (IResultsView)viewComboBox.SelectedItem;
         Control control = view.Control;
         viewPanel.Controls.Add(control);
Index: /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/TableResultsView.cs
===================================================================
--- /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/TableResultsView.cs	(revision 1107)
+++ /branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/TableResultsView.cs	(revision 1108)
@@ -21,4 +21,8 @@
     }
 
+    string IResultsView.Name {
+      get { return "Table"; }
+    }
+
     public void ShowResults(Results results) {
       this.results = results;
@@ -29,14 +33,17 @@
       base.UpdateControls();
       if (results == null) return;
-      List<string> columnNames = new List<string>();
-      columnNames.AddRange(Results.CategoricalVariables);
-      columnNames.AddRange(Results.OrdinalVariables);
       dataGridView.Rows.Clear();
       dataGridView.Columns.Clear();
-      foreach (string varName in columnNames) {
-        dataGridView.Columns.Add(varName, varName);
+      List<string> attributeNames = results.SelectModelAttributes().ToList();
+      foreach (var attribute in attributeNames) {
+        dataGridView.Columns.Add(attribute, attribute);
       }
 
-      foreach (object[] row in results.SelectRows(columnNames)) {
+      var entries = results.SelectRows();
+      foreach (var entry in entries) {
+        int rowIndex = dataGridView.Rows.Add();
+        foreach (string attrName in attributeNames) {
+          dataGridView.Rows[rowIndex].Cells[attrName].Value = entry.Get(attrName);
+        }
         dataGridView.Rows.Add(row);
       }
