Changeset 5636 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager
- Timestamp:
- 03/08/11 14:54:17 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager
- Files:
-
- 1 added
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/GanttChart.Designer.cs
r5597 r5636 1 namespace HeuristicLab.Clients.Hive.Views .ExperimentManager{1 namespace HeuristicLab.Clients.Hive.Views { 2 2 partial class GanttChart { 3 3 /// <summary> … … 44 44 series1.ChartArea = "ChartArea1"; 45 45 series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.RangeBar; 46 series1.CustomProperties = "DrawingStyle=Cylinder"; 46 47 series1.IsVisibleInLegend = false; 47 48 series1.Legend = "Legend"; -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/GanttChart.cs
r5597 r5636 2 2 using System.Collections.Generic; 3 3 using System.Drawing; 4 using System.Linq; 4 5 using System.Windows.Forms; 5 6 using System.Windows.Forms.DataVisualization.Charting; 6 7 7 namespace HeuristicLab.Clients.Hive.Views .ExperimentManager{8 namespace HeuristicLab.Clients.Hive.Views { 8 9 public partial class GanttChart : UserControl { 9 10 10 11 private IDictionary<string, Color> categories = new Dictionary<string, Color>(); 12 private IDictionary<string, int> rowNames = new Dictionary<string, int>(); 11 13 12 14 public GanttChart() { … … 19 21 } 20 22 21 public void AddData(int id, string category, DateTime start, DateTime end, string tooltip, bool showLabel = true) { 22 var point = CreateDataPoint(id, start, end, showLabel ? category : string.Empty, categories[category]); 23 public void AddData(string rowName, string category, DateTime start, DateTime end, string tooltip, bool showLabel = true) { 24 AddRowName(rowName); 25 var point = CreateDataPoint(rowNames[rowName], rowName, start, end, showLabel ? category : string.Empty, categories[category]); 23 26 point.ToolTip = tooltip; 24 27 chart.Series[0].Points.Add(point); 25 28 } 26 29 27 private static DataPoint CreateDataPoint(double x, DateTime start, DateTime end, string text, Color color) { 30 private void AddRowName(string rowName) { 31 if (!rowNames.ContainsKey(rowName)) { 32 int nextId = rowNames.Count == 0 ? 1 : rowNames.Values.Max() + 1; 33 rowNames.Add(rowName, nextId); 34 } 35 } 36 37 private static DataPoint CreateDataPoint(double x, string axisLabel, DateTime start, DateTime end, string text, Color color) { 28 38 var point = new DataPoint(x, new double[] { start.ToOADate(), end.ToOADate() }); 29 39 point.Color = color; 30 40 point.Label = text; 41 point.AxisLabel = axisLabel; 31 42 return point; 32 43 } … … 36 47 categories.Clear(); 37 48 chart.Legends[0].CustomItems.Clear(); 49 rowNames.Clear(); 38 50 } 39 51 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveJobView.cs
r5597 r5636 135 135 this.exceptionTextBox.Text = Content.Job.CurrentStateLog.Exception; 136 136 if (Content.OptimizerJob.ComputeInParallel) { 137 this.stateLogViewHost.Content = new ItemList<StateLog ItemList>(138 this.Content.ChildHiveJobs.Select(child => new StateLog ItemList(child.Job.StateLog.Select(x => new StateLogItem(x)))137 this.stateLogViewHost.Content = new ItemList<StateLogList>( 138 this.Content.ChildHiveJobs.Select(child => new StateLogList(child.Job.StateLog) 139 139 )); 140 140 } else { 141 this.stateLogViewHost.Content = new StateLog ItemList(Content.Job.StateLog.Select(x => new StateLogItem(x)));141 this.stateLogViewHost.Content = new StateLogList(Content.Job.StateLog); 142 142 } 143 143 } else { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartListView.cs
r5597 r5636 20 20 #endregion 21 21 22 using System; 22 23 using System.Drawing; 24 using System.Linq; 23 25 using HeuristicLab.Core; 24 26 using HeuristicLab.Core.Views; 25 27 using HeuristicLab.MainForm; 26 using HeuristicLab.Services.Hive.Common.DataTransfer;27 28 28 29 namespace HeuristicLab.Clients.Hive.Views { 29 30 [View("StateLogGanttChartList View")] 30 [Content(typeof(IItemList<StateLog ItemList>), IsDefaultView = true)]31 [Content(typeof(IItemList<StateLogList>), IsDefaultView = true)] 31 32 public sealed partial class StateLogGanttChartListView : ItemView { 32 public new IItemList<StateLog ItemList> Content {33 get { return (IItemList<StateLog ItemList>)base.Content; }33 public new IItemList<StateLogList> Content { 34 get { return (IItemList<StateLogList>)base.Content; } 34 35 set { base.Content = value; } 35 36 } … … 61 62 // Add code when content has been changed and is not null 62 63 ganttChart.Reset(); 63 ganttChart.AddCategory(JobState.Offline.ToString(), Color.Brown); 64 ganttChart.AddCategory(JobState.Waiting.ToString(), Color.Yellow); 65 ganttChart.AddCategory(JobState.Transferring.ToString(), Color.Blue); 66 ganttChart.AddCategory(JobState.Calculating.ToString(), Color.Green); 67 ganttChart.AddCategory(JobState.Finished.ToString(), Color.DarkGreen); 68 ganttChart.AddCategory(JobState.Aborted.ToString(), Color.Orange); 69 ganttChart.AddCategory(JobState.Failed.ToString(), Color.Red); 64 SetupCategories(ganttChart); 65 66 DateTime maxValue = Content.Max(x => x.Max(y => y.DateTime)); 67 var upperLimit = DateTime.FromOADate(Math.Min(DateTime.Now.AddSeconds(10).ToOADate(), maxValue.AddSeconds(10).ToOADate())); 70 68 71 69 for (int i = 0; i < Content.Count; i++) { 72 70 for (int j = 0; j < Content[i].Count - 1; j++) { 73 string tooltip = string.Format("State: {0}\n{1} - {2}", Content[i][j].State, Content[i][j].DateTime, Content[i][j+1].DateTime); 74 if (!string.IsNullOrEmpty(Content[i][j].Exception)) 75 tooltip += "\n" + Content[i][j].Exception; 76 ganttChart.AddData(i + 1, Content[i][j].State.ToString(), Content[i][j].DateTime, Content[i][j + 1].DateTime, tooltip, false); 71 if(Content[i][j].State != JobState.Offline && Content[i][j].State != JobState.Finished) 72 AddData(ganttChart, i.ToString(), Content[i][j], Content[i][j+1], upperLimit); 73 } 74 if(Content[i].Count > 0) { 75 AddData(ganttChart, i.ToString(), Content[i][Content[i].Count - 1], null, upperLimit); 77 76 } 78 77 } … … 80 79 } 81 80 81 public static void SetupCategories(GanttChart ganttChart) { 82 ganttChart.AddCategory(JobState.Offline.ToString(), Color.Gainsboro); 83 ganttChart.AddCategory(JobState.Waiting.ToString(), Color.NavajoWhite); 84 ganttChart.AddCategory(JobState.Transferring.ToString(), Color.CornflowerBlue); 85 ganttChart.AddCategory(JobState.Calculating.ToString(), Color.DarkGreen); 86 ganttChart.AddCategory(JobState.Finished.ToString(), Color.White); 87 ganttChart.AddCategory(JobState.Aborted.ToString(), Color.Orange); 88 ganttChart.AddCategory(JobState.Failed.ToString(), Color.Red); 89 } 90 91 //private void AddData(int i, int j, DateTime upperLimit) { 92 // DateTime until = j < Content[i].Count - 1 ? Content[i][j + 1].DateTime : upperLimit; 93 // TimeSpan duration = until - Content[i][j].DateTime; 94 // string tooltip = string.Format("State: {0}\nDuration: {1}\n{2} - {3}", Content[i][j].State, Content[i][j].DateTime, duration, until); 95 // if (!string.IsNullOrEmpty(Content[i][j].Exception)) 96 // tooltip += "\n" + Content[i][j].Exception; 97 // ganttChart.AddData(i + 1, Content[i][j].State.ToString(), Content[i][j].DateTime, until, tooltip, false); 98 //} 99 100 public static void AddData(GanttChart ganttChart, string name, StateLog from, StateLog to, DateTime upperLimit) { 101 DateTime until = to != null ? to.DateTime : upperLimit; 102 TimeSpan duration = until - from.DateTime; 103 string tooltip = string.Format("State: {0}\nDuration: {1}\n{2} - {3}", from.State, from.DateTime, duration, until); 104 if (!string.IsNullOrEmpty(from.Exception)) 105 tooltip += "\n" + from.Exception; 106 ganttChart.AddData(name, from.State.ToString(), from.DateTime, until, tooltip, false); 107 } 108 82 109 protected override void SetEnabledStateOfControls() { 83 110 base.SetEnabledStateOfControls(); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartListView.designer.cs
r5597 r5636 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.ganttChart = new HeuristicLab.Clients.Hive.Views. ExperimentManager.GanttChart();26 this.ganttChart = new HeuristicLab.Clients.Hive.Views.GanttChart(); 27 27 this.SuspendLayout(); 28 28 // … … 50 50 #endregion 51 51 52 private ExperimentManager.GanttChart ganttChart;52 private GanttChart ganttChart; 53 53 54 54 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartView.cs
r5597 r5636 20 20 #endregion 21 21 22 using System .Drawing;22 using System; 23 23 using HeuristicLab.Core.Views; 24 24 using HeuristicLab.MainForm; 25 using HeuristicLab.Services.Hive.Common.DataTransfer;26 25 27 26 namespace HeuristicLab.Clients.Hive.Views { 28 27 [View("StateLogGanttChart View")] 29 [Content(typeof(StateLog ItemList), IsDefaultView = false)]28 [Content(typeof(StateLogList), IsDefaultView = false)] 30 29 public sealed partial class StateLogGanttChartView : ItemView { 31 public new StateLog ItemList Content {32 get { return (StateLog ItemList)base.Content; }30 public new StateLogList Content { 31 get { return (StateLogList)base.Content; } 33 32 set { base.Content = value; } 34 33 } … … 60 59 // Add code when content has been changed and is not null 61 60 ganttChart.Reset(); 62 ganttChart.AddCategory(JobState.Offline.ToString(), Color.Brown); 63 ganttChart.AddCategory(JobState.Waiting.ToString(), Color.Yellow); 64 ganttChart.AddCategory(JobState.Transferring.ToString(), Color.Blue); 65 ganttChart.AddCategory(JobState.Calculating.ToString(), Color.Green); 66 ganttChart.AddCategory(JobState.Finished.ToString(), Color.DarkGreen); 67 ganttChart.AddCategory(JobState.Aborted.ToString(), Color.Orange); 68 ganttChart.AddCategory(JobState.Failed.ToString(), Color.Red); 61 StateLogGanttChartListView.SetupCategories(ganttChart); 62 var upperLimit = DateTime.Now.AddSeconds(10); 69 63 70 64 for (int i = 0; i < Content.Count-1; i++) { 71 string tooltip = string.Format("State: {0}\n{1} - {2}", Content[i].State, Content[i].DateTime, Content[i + 1].DateTime); 72 if (!string.IsNullOrEmpty(Content[i].Exception)) 73 tooltip += "\n" + Content[i].Exception; 74 ganttChart.AddData(0, Content[i].State.ToString(), Content[i].DateTime, Content[i + 1].DateTime, tooltip); 65 //string tooltip = string.Format("State: {0}\n{1} - {2}", Content[i].State, Content[i].DateTime, Content[i + 1].DateTime); 66 //if (!string.IsNullOrEmpty(Content[i].Exception)) 67 // tooltip += "\n" + Content[i].Exception; 68 //ganttChart.AddData(Content[i].State.ToString(), Content[i].State.ToString(), Content[i].DateTime, Content[i + 1].DateTime, tooltip, false); 69 StateLogGanttChartListView.AddData(ganttChart, i.ToString(), Content[i], Content[i+1], upperLimit); 75 70 } 71 StateLogGanttChartListView.AddData(ganttChart, (Content.Count - 1).ToString(), Content[Content.Count - 1], null, upperLimit); 76 72 } 77 73 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogGanttChartView.designer.cs
r5597 r5636 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.ganttChart = new HeuristicLab.Clients.Hive.Views. ExperimentManager.GanttChart();26 this.ganttChart = new HeuristicLab.Clients.Hive.Views.GanttChart(); 27 27 this.SuspendLayout(); 28 28 // … … 50 50 #endregion 51 51 52 private ExperimentManager.GanttChart ganttChart;52 private GanttChart ganttChart; 53 53 54 54 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogListView.cs
r5597 r5636 25 25 26 26 namespace HeuristicLab.Clients.Hive.Views { 27 [View("StateLog ItemView")]28 [Content(typeof(IItemList<StateLog Item>), false)]29 public partial class StateLogListView : ItemListView<StateLog Item> {27 [View("StateLog View")] 28 [Content(typeof(IItemList<StateLog>), false)] 29 public partial class StateLogListView : ItemListView<StateLog> { 30 30 31 31 public StateLogListView() { … … 34 34 } 35 35 36 protected override StateLog ItemCreateItem() {36 protected override StateLog CreateItem() { 37 37 return null; 38 38 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/StateLogView.cs
r5597 r5636 23 23 using HeuristicLab.Core.Views; 24 24 using HeuristicLab.MainForm; 25 using HeuristicLab.MainForm.WindowsForms; 25 26 26 27 namespace HeuristicLab.Clients.Hive.Views { 27 28 [View("StateLog View")] 28 [Content(typeof(StateLog Item), IsDefaultView = false)]29 [Content(typeof(StateLog), IsDefaultView = false)] 29 30 public sealed partial class StateLogView : ItemView { 30 public new StateLog ItemContent {31 get { return (StateLog Item)base.Content; }31 public new StateLog Content { 32 get { return (StateLog)base.Content; } 32 33 set { base.Content = value; } 33 34 }
Note: See TracChangeset
for help on using the changeset viewer.