Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/25/10 15:06:21 (14 years ago)
Author:
swagner
Message:

Worked on visual appearance of data rows (#925)

Location:
trunk/sources/HeuristicLab.Analysis/3.3
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis/3.3/DataRow.cs

    r3431 r4644  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
     24using System.ComponentModel;
    2225using HeuristicLab.Collections;
    2326using HeuristicLab.Common;
     
    3235  [StorableClass]
    3336  public sealed class DataRow : NamedItem {
    34     [Storable]
     37    private DataRowVisualProperties visualProperties;
     38    public DataRowVisualProperties VisualProperties {
     39      get { return visualProperties; }
     40      set {
     41        if (visualProperties != value) {
     42          if (value == null) throw new ArgumentNullException("VisualProperties");
     43          if (visualProperties != null) visualProperties.PropertyChanged -= new PropertyChangedEventHandler(VisualProperties_PropertyChanged);
     44          visualProperties = value;
     45          visualProperties.PropertyChanged += new PropertyChangedEventHandler(VisualProperties_PropertyChanged);
     46          OnVisualPropertiesChanged();
     47        }
     48      }
     49    }
    3550    private ObservableList<double> values;
    3651    public IObservableList<double> Values {
     
    3853    }
    3954
     55    #region Persistence Properties
     56    [Storable(Name = "VisualProperties")]
     57    private DataRowVisualProperties StorableVisualProperties {
     58      get { return VisualProperties; }
     59      set { VisualProperties = value; }
     60    }
     61    [Storable(Name = "values")]
     62    private IEnumerable<double> StorableValues {
     63      get { return values; }
     64      set { values = new ObservableList<double>(value); }
     65    }
     66    #endregion
     67
    4068    public DataRow()
    4169      : base() {
     70      VisualProperties = new DataRowVisualProperties();
    4271      values = new ObservableList<double>();
    4372    }
    4473    public DataRow(string name)
    4574      : base(name) {
     75      VisualProperties = new DataRowVisualProperties();
    4676      values = new ObservableList<double>();
    4777    }
    4878    public DataRow(string name, string description)
    4979      : base(name, description) {
     80      VisualProperties = new DataRowVisualProperties();
    5081      values = new ObservableList<double>();
    5182    }
     83    public DataRow(string name, string description, DataRowVisualProperties visualProperties)
     84      : base(name, description) {
     85      VisualProperties = visualProperties;
     86      values = new ObservableList<double>();
     87    }
     88    [StorableConstructor]
     89    private DataRow(bool deserializing) { }
     90
     91    // BackwardsCompatibility3.3
     92    #region Backwards compatible code, remove with 3.4
     93    [StorableHook(HookType.AfterDeserialization)]
     94    private void AfterDeserialization() {
     95      if (VisualProperties == null) VisualProperties = new DataRowVisualProperties();
     96    }
     97    #endregion
    5298
    5399    public override IDeepCloneable Clone(Cloner cloner) {
    54100      DataRow clone = new DataRow(Name, Description);
    55101      cloner.RegisterClonedObject(this, clone);
     102      clone.VisualProperties = (DataRowVisualProperties)cloner.Clone(visualProperties);
    56103      clone.values.AddRange(values);
    57104      return clone;
    58105    }
     106
     107    public event EventHandler VisualPropertiesChanged;
     108    private void OnVisualPropertiesChanged() {
     109      EventHandler handler = VisualPropertiesChanged;
     110      if (handler != null) handler(this, EventArgs.Empty);
     111    }
     112
     113    private void VisualProperties_PropertyChanged(object sender, PropertyChangedEventArgs e) {
     114      OnVisualPropertiesChanged();
     115    }
    59116  }
    60117}
  • trunk/sources/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj

    r4641 r4644  
    118118    <Compile Include="Allele.cs" />
    119119    <Compile Include="AlleleFrequency.cs" />
     120    <Compile Include="DataRowVisualProperties.cs" />
    120121    <Compile Include="QualityAnalyzer.cs" />
    121122    <Compile Include="MinAverageMaxValueAnalyzer.cs" />
Note: See TracChangeset for help on using the changeset viewer.