Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.HiveEngine/3.4/Views/HiveEngineView.cs @ 6006

Last change on this file since 6006 was 6006, checked in by cneumuel, 13 years ago

#1233

  • changed relationship between Job and HiveExperiment. There is no more HiveExperiment.RootJobId, instead there is Job.HiveExperimentId.
  • One HiveExperiment can now have multiple Experiments.
  • TreeView supports multiple root nodes
  • HiveEngine creates a HiveExperiment for each set of jobs, so jobs cannot be without an parent experiment anymore (no more loose jobs)
  • updated ExperimentManager binaries
File size: 3.5 KB
Line 
1using System;
2using HeuristicLab.Core.Views;
3using HeuristicLab.MainForm;
4
5namespace HeuristicLab.HiveEngine.Views {
6  [View("Hive Engine View")]
7  [Content(typeof(HiveEngine), IsDefaultView = true)]
8  public sealed partial class HiveEngineView : ItemView {
9    public new HiveEngine Content {
10      get { return (HiveEngine)base.Content; }
11      set { base.Content = value; }
12    }
13
14    public HiveEngineView() {
15      InitializeComponent();
16    }
17
18    protected override void DeregisterContentEvents() {
19      Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);
20      Content.ExecutionTimeOnHiveChanged -= new EventHandler(Content_ExecutionTimeOnHiveChanged);
21      base.DeregisterContentEvents();
22    }
23
24    protected override void RegisterContentEvents() {
25      base.RegisterContentEvents();
26      Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);
27      Content.ExecutionTimeOnHiveChanged += new EventHandler(Content_ExecutionTimeOnHiveChanged);
28    }
29
30    #region Event Handlers (Content)
31    private void Content_ExecutionStateChanged(object sender, EventArgs e) {
32      if (InvokeRequired) {
33        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
34      } else {
35        executionTimeTextBox.Text = Content.ExecutionTime.ToString();
36      }
37    }
38
39    private void Content_ExecutionTimeOnHiveChanged(object sender, EventArgs e) {
40      if (InvokeRequired) {
41        Invoke(new EventHandler(Content_ExecutionTimeOnHiveChanged), sender, e);
42      } else {
43        executionTimeOnHiveTextBox.Text = Content.ExecutionTimeOnHive.ToString();
44      }
45    }
46    #endregion
47
48    protected override void OnContentChanged() {
49      base.OnContentChanged();
50      if (Content == null) {
51        resourceIdsTextBox.Text = string.Empty;
52        priorityTextBox.Text = string.Empty;
53        executionTimeOnHiveTextBox.Text = string.Empty;
54        useLocalPluginsCheckBox.Checked = false;
55        hiveExperimentListView.Content = null;
56        logView.Content = null;
57      } else {
58        resourceIdsTextBox.Text = Content.ResourceNames;
59        priorityTextBox.Text = Content.Priority.ToString();
60        executionTimeOnHiveTextBox.Text = Content.ExecutionTimeOnHive.ToString();
61        useLocalPluginsCheckBox.Checked = Content.UseLocalPlugins;
62        hiveExperimentListView.Content = Content.HiveExperiments;
63        logView.Content = Content.Log;
64      }
65    }
66
67    protected override void SetEnabledStateOfControls() {
68      base.SetEnabledStateOfControls();
69      // Enable or disable controls based on whether the content is null or the view is set readonly
70      if (Content != null) {
71        resourceIdsTextBox.ReadOnly = this.ReadOnly;
72        priorityTextBox.ReadOnly = this.ReadOnly;
73        useLocalPluginsCheckBox.Enabled = !this.ReadOnly;
74      } else {
75        resourceIdsTextBox.ReadOnly = false;
76        priorityTextBox.ReadOnly = false;
77        useLocalPluginsCheckBox.Enabled = false;
78      }
79    }
80   
81    #region Event Handlers (child controls)
82    private void resourceIdsTextBox_TextChanged(object sender, EventArgs e) {
83      Content.ResourceNames = resourceIdsTextBox.Text;
84    }
85
86    private void priorityTextBox_TextChanged(object sender, EventArgs e) {
87      Content.Priority = int.Parse(priorityTextBox.Text);
88    }
89
90    private void useLocalPluginsCheckBox_CheckedChanged(object sender, EventArgs e) {
91      Content.UseLocalPlugins = useLocalPluginsCheckBox.Checked;
92    }
93    #endregion
94
95
96  }
97}
Note: See TracBrowser for help on using the repository browser.