Free cookie consent management tool by TermsFeed Policy Generator

source: branches/ParameterBinding/HeuristicLab.Analysis/3.3/DataRowVisualProperties.cs @ 11458

Last change on this file since 11458 was 4722, checked in by swagner, 14 years ago

Merged cloning refactoring branch back into trunk (#922)

File size: 4.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System.ComponentModel;
23using System.Drawing;
24using HeuristicLab.Common;
25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
26
27namespace HeuristicLab.Analysis {
28  /// <summary>
29  /// Visual properties of a DataRow.
30  /// </summary>
31  [StorableClass]
32  public class DataRowVisualProperties : DeepCloneable, INotifyPropertyChanged {
33    #region ChartType
34    public enum DataRowChartType {
35      Line,
36      Columns,
37      Points,
38      Bars
39    }
40    #endregion
41
42    private DataRowChartType chartType;
43    public DataRowChartType ChartType {
44      get { return chartType; }
45      set {
46        if (chartType != value) {
47          chartType = value;
48          OnPropertyChanged("ChartType");
49        }
50      }
51    }
52    private bool secondYAxis;
53    public bool SecondYAxis {
54      get { return secondYAxis; }
55      set {
56        if (secondYAxis != value) {
57          secondYAxis = value;
58          OnPropertyChanged("SecondYAxis");
59        }
60      }
61    }
62    private Color color;
63    public Color Color {
64      get { return color; }
65      set {
66        if (color != value) {
67          color = value;
68          OnPropertyChanged("Color");
69        }
70      }
71    }
72    private bool startIndexZero;
73    public bool StartIndexZero {
74      get { return startIndexZero; }
75      set {
76        if (startIndexZero != value) {
77          startIndexZero = value;
78          OnPropertyChanged("StartIndexZero");
79        }
80      }
81    }
82
83    #region Persistence Properties
84    [Storable(Name = "ChartType")]
85    private DataRowChartType StorableChartType {
86      get { return chartType; }
87      set { chartType = value; }
88    }
89    [Storable(Name = "SecondYAxis")]
90    private bool StorableSecondYAxis {
91      get { return secondYAxis; }
92      set { secondYAxis = value; }
93    }
94    [Storable(Name = "Color")]
95    private Color StorableColor {
96      get { return color; }
97      set { color = value; }
98    }
99    [Storable(Name = "StartIndexZero")]
100    private bool StorableStartIndexZero {
101      get { return startIndexZero; }
102      set { startIndexZero = value; }
103    }
104    #endregion
105
106    #region Storing & Cloning
107    [StorableConstructor]
108    protected DataRowVisualProperties(bool deserializing) : base() { }
109    protected DataRowVisualProperties(DataRowVisualProperties original, Cloner cloner)
110      : base(original, cloner) {
111      this.chartType = original.chartType;
112      this.secondYAxis = original.secondYAxis;
113      this.color = original.color;
114      this.startIndexZero = original.startIndexZero;
115    }
116    public override IDeepCloneable Clone(Cloner cloner) {
117      return new DataRowVisualProperties(this, cloner);
118    }
119    #endregion
120    public DataRowVisualProperties() {
121      chartType = DataRowChartType.Line;
122      secondYAxis = false;
123      color = Color.Empty;
124      startIndexZero = false;
125    }
126    public DataRowVisualProperties(DataRowChartType chartType, bool secondYAxis, Color color, bool startIndexZero) {
127      this.chartType = chartType;
128      this.secondYAxis = secondYAxis;
129      this.color = color;
130      this.startIndexZero = startIndexZero;
131    }
132
133    public event PropertyChangedEventHandler PropertyChanged;
134    protected virtual void OnPropertyChanged(string propertyName) {
135      PropertyChangedEventHandler handler = PropertyChanged;
136      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
137    }
138  }
139}
Note: See TracBrowser for help on using the repository browser.