#region License Information
/* HeuristicLab
* Copyright (C) 2002-2019 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 .
*/
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using HeuristicLab.Collections;
using HeuristicLab.Common;
using HeuristicLab.Core;
using HEAL.Attic;
namespace HeuristicLab.Analysis {
[Item("Gantt Data", "Data of a Gantt visualization")]
[StorableType("5EF715EE-23B7-416D-85D0-28C61F81C55D")]
public class GanttData : NamedItem {
[Storable]
private NamedItemCollection rows;
public NamedItemCollection Rows { get { return rows; } }
[Storable]
private ObservableDictionary categoryColors;
public ObservableDictionary CategoryColors { get { return categoryColors; } }
[StorableConstructor]
protected GanttData(StorableConstructorFlag _) : base(_) { }
protected GanttData(GanttData original, Cloner cloner)
: base(original, cloner) {
rows = cloner.Clone(original.rows);
categoryColors = new ObservableDictionary(original.categoryColors);
}
public GanttData() : this("Gantt Data", "Data of a Gantt visualization") { }
public GanttData(string name) : this(name, string.Empty) { }
public GanttData(string name, string description) : base(name, description) {
rows = new NamedItemCollection();
categoryColors = new ObservableDictionary();
}
public GanttData(IEnumerable rows) : this("Gantt Data", rows) { }
public GanttData(string name, IEnumerable rows) : this(name, string.Empty, rows) { }
public GanttData(string name, string description, IEnumerable rows) : base(name, description) {
this.rows = new NamedItemCollection(rows);
categoryColors = new ObservableDictionary();
}
public override IDeepCloneable Clone(Cloner cloner) {
return new GanttData(this, cloner);
}
}
[Item("Gantt Row", "Row of a Gantt chart")]
[StorableType("DDAA9C4C-CE19-4E0D-9AB2-02F8CDF2B8D4")]
public class GanttRow : NamedItem {
[Storable]
private ItemList items;
public ItemList Items { get { return items; } }
[StorableConstructor]
protected GanttRow(StorableConstructorFlag _) : base(_) { }
protected GanttRow(GanttRow original, Cloner cloner)
: base(original, cloner) {
items = cloner.Clone(original.items);
}
public GanttRow() : this("Gantt Row", "Row of a Gantt chart") { }
public GanttRow(string name) : this(name, string.Empty) { }
public GanttRow(string name, string description) : base(name, description) {
items = new ItemList();
}
public GanttRow(IEnumerable items) : this("Gantt Row", items) { }
public GanttRow(string name, IEnumerable items) : this(name, string.Empty, items) { }
public GanttRow(string name, string description, IEnumerable items) : base(name, description) {
this.items = new ItemList(items);
}
public override IDeepCloneable Clone(Cloner cloner) {
return new GanttRow(this, cloner);
}
}
[Item("Gantt Item", "Item of a Gantt chart row")]
[StorableType("E2CEFEAE-AEA4-4F1D-94D5-D7AA784982F5")]
public class GanttItem : Item, INotifyPropertyChanged {
[Storable]
private DateTime startDate;
public DateTime StartDate {
get { return startDate; }
set {
if (startDate == value) return;
startDate = value;
OnPropertyChanged("StartDate");
}
}
[Storable]
private DateTime endDate;
public DateTime EndDate {
get { return endDate; }
set {
if (endDate == value) return;
endDate = value;
OnPropertyChanged("EndDate");
}
}
[Storable]
private string toolTip;
public string ToolTip {
get { return toolTip; }
set {
if (toolTip == value) return;
toolTip = value;
OnPropertyChanged("ToolTip");
}
}
[Storable]
private string category;
public string Category {
get { return category; }
set {
if (category == value) return;
category = value;
OnPropertyChanged("Category");
}
}
[Storable]
private bool showLabel;
public bool ShowLabel {
get { return showLabel; }
set {
if (showLabel == value) return;
showLabel = value;
OnPropertyChanged("ShowLabel");
}
}
[StorableConstructor]
protected GanttItem(StorableConstructorFlag _) : base(_) { }
protected GanttItem(GanttItem original, Cloner cloner)
: base(original, cloner) {
startDate = original.startDate;
endDate = original.endDate;
toolTip = original.toolTip;
category = original.category;
showLabel = original.showLabel;
}
public GanttItem() : this(DateTime.Now, DateTime.Now) { }
public GanttItem(DateTime start, DateTime end) {
startDate = start;
endDate = end;
toolTip = string.Empty;
category = string.Empty;
showLabel = false;
}
public override IDeepCloneable Clone(Cloner cloner) {
return new GanttItem(this, cloner);
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName) {
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}