Changeset 6725 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.3
- Timestamp:
- 09/08/11 16:38:28 (13 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.3/Views
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.3/Views/HiveExperimentManagerView.cs
r6373 r6725 68 68 hiveExperimentListView.Content = null; 69 69 } else { 70 hiveExperimentListView.Content = Content. HiveExperiments;70 hiveExperimentListView.Content = Content.Jobs; 71 71 if (Content != null) 72 72 Content.RefreshAsync(new Action<Exception>((Exception ex) => ErrorHandling.ShowErrorDialog(this, "Refresh failed.", ex))); … … 93 93 Invoke(new EventHandler(Content_Refreshed), sender, e); 94 94 } else { 95 hiveExperimentListView.Content = Content. HiveExperiments;95 hiveExperimentListView.Content = Content.Jobs; 96 96 refreshButton.Enabled = true; 97 97 hiveExperimentListView.Enabled = true; … … 106 106 protected override void OnClosing(FormClosingEventArgs e) { 107 107 base.OnClosing(e); 108 if (Content != null && Content. HiveExperiments != null) {109 foreach (var exp in Content. HiveExperiments.OfType<RefreshableHiveExperiment>()) {108 if (Content != null && Content.Jobs != null) { 109 foreach (var exp in Content.Jobs.OfType<RefreshableJob>()) { 110 110 if (exp.RefreshAutomatically) { 111 111 exp.RefreshAutomatically = false; // stop result polling … … 115 115 } 116 116 117 private void HiveExperiments_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<Refreshable HiveExperiment> e) {117 private void HiveExperiments_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<RefreshableJob> e) { 118 118 foreach (var item in e.Items) { 119 119 HiveClient.Delete(item); … … 122 122 123 123 private void Content_HiveExperimentsChanged(object sender, EventArgs e) { 124 Content. HiveExperiments.ItemsRemoved += new CollectionItemsChangedEventHandler<RefreshableHiveExperiment>(HiveExperiments_ItemsRemoved);124 Content.Jobs.ItemsRemoved += new CollectionItemsChangedEventHandler<RefreshableJob>(HiveExperiments_ItemsRemoved); 125 125 } 126 126 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.3/Views/RefreshableHiveExperimentListView.cs
r6479 r6725 28 28 namespace HeuristicLab.Clients.Hive.ExperimentManager.Views { 29 29 [View("HiveExperimentList View")] 30 [Content(typeof(ItemCollection<Refreshable HiveExperiment>), false)]31 public partial class RefreshableHiveExperimentListView : ItemCollectionView<Refreshable HiveExperiment> {30 [Content(typeof(ItemCollection<RefreshableJob>), false)] 31 public partial class RefreshableHiveExperimentListView : ItemCollectionView<RefreshableJob> { 32 32 33 33 public RefreshableHiveExperimentListView() { … … 43 43 } 44 44 45 protected override Refreshable HiveExperimentCreateItem() {46 return new Refreshable HiveExperiment() { IsAllowedPrivileged = HiveClient.Instance.IsAllowedPrivileged };45 protected override RefreshableJob CreateItem() { 46 return new RefreshableJob() { IsAllowedPrivileged = HiveClient.Instance.IsAllowedPrivileged }; 47 47 } 48 48 … … 54 54 } 55 55 56 protected override void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<Refreshable HiveExperiment> e) {56 protected override void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<RefreshableJob> e) { 57 57 base.Content_ItemsAdded(sender, e); 58 58 59 59 } 60 60 61 protected override ListViewItem CreateListViewItem(Refreshable HiveExperimentitem) {61 protected override ListViewItem CreateListViewItem(RefreshableJob item) { 62 62 ListViewItem listViewItem = base.CreateListViewItem(item); 63 63 listViewItem.SubItems.Clear(); 64 listViewItem.SubItems.Insert(0, new ListViewItem.ListViewSubItem(listViewItem, item. HiveExperiment.DateCreated.ToString("dd.MM.yyyy HH:mm")));65 listViewItem.SubItems.Insert(1, new ListViewItem.ListViewSubItem(listViewItem, item. HiveExperiment.Name));66 listViewItem.Group = GetListViewGroup(item. HiveExperiment.OwnerUsername);64 listViewItem.SubItems.Insert(0, new ListViewItem.ListViewSubItem(listViewItem, item.Job.DateCreated.ToString("dd.MM.yyyy HH:mm"))); 65 listViewItem.SubItems.Insert(1, new ListViewItem.ListViewSubItem(listViewItem, item.Job.Name)); 66 listViewItem.Group = GetListViewGroup(item.Job.OwnerUsername); 67 67 return listViewItem; 68 68 } … … 70 70 protected override void UpdateListViewItemText(ListViewItem listViewItem) { 71 71 if (listViewItem == null) throw new ArgumentNullException(); 72 var item = listViewItem.Tag as Refreshable HiveExperiment;73 listViewItem.SubItems[0].Text = item == null ? "null" : item. HiveExperiment.DateCreated.ToString("dd.MM.yyyy HH:mm");74 listViewItem.SubItems[1].Text = item == null ? "null" : item. HiveExperiment.Name;75 listViewItem.Group = GetListViewGroup(item. HiveExperiment.OwnerUsername);72 var item = listViewItem.Tag as RefreshableJob; 73 listViewItem.SubItems[0].Text = item == null ? "null" : item.Job.DateCreated.ToString("dd.MM.yyyy HH:mm"); 74 listViewItem.SubItems[1].Text = item == null ? "null" : item.Job.Name; 75 listViewItem.Group = GetListViewGroup(item.Job.OwnerUsername); 76 76 listViewItem.ToolTipText = item == null ? string.Empty : item.ItemName + ": " + item.ItemDescription; 77 77 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.3/Views/RefreshableHiveExperimentView.Designer.cs
r6479 r6725 339 339 this.isPrivilegedCheckBox.TabIndex = 26; 340 340 this.isPrivilegedCheckBox.Text = "IsPrivileged"; 341 this.toolTip.SetToolTip(this.isPrivilegedCheckBox, "If checked, the jobwill be executed in a privileged sandbox on the slave.");341 this.toolTip.SetToolTip(this.isPrivilegedCheckBox, "If checked, the task will be executed in a privileged sandbox on the slave."); 342 342 this.isPrivilegedCheckBox.UseVisualStyleBackColor = true; 343 343 this.isPrivilegedCheckBox.Validated += new System.EventHandler(this.isPrivilegedCheckBox_Validated); -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.3/Views/RefreshableHiveExperimentView.cs
r6479 r6725 39 39 /// </summary> 40 40 [View("Hive Experiment View")] 41 [Content(typeof(Refreshable HiveExperiment), true)]41 [Content(typeof(RefreshableJob), true)] 42 42 public sealed partial class RefreshableHiveExperimentView : ItemView { 43 43 private ProgressView progressView; 44 44 45 public new Refreshable HiveExperimentContent {46 get { return (Refreshable HiveExperiment)base.Content; }45 public new RefreshableJob Content { 46 get { return (RefreshableJob)base.Content; } 47 47 set { base.Content = value; } 48 48 } … … 58 58 base.RegisterContentEvents(); 59 59 Content.RefreshAutomaticallyChanged += new EventHandler(Content_RefreshAutomaticallyChanged); 60 Content. HiveExperimentChanged += new EventHandler(Content_HiveExperimentChanged);60 Content.JobChanged += new EventHandler(Content_HiveExperimentChanged); 61 61 Content.IsControllableChanged += new EventHandler(Content_IsControllableChanged); 62 62 Content.JobStatisticsChanged += new EventHandler(Content_JobStatisticsChanged); … … 72 72 protected override void DeregisterContentEvents() { 73 73 Content.RefreshAutomaticallyChanged -= new EventHandler(Content_RefreshAutomaticallyChanged); 74 Content. HiveExperimentChanged -= new EventHandler(Content_HiveExperimentChanged);74 Content.JobChanged -= new EventHandler(Content_HiveExperimentChanged); 75 75 Content.IsControllableChanged -= new EventHandler(Content_IsControllableChanged); 76 76 Content.JobStatisticsChanged -= new EventHandler(Content_JobStatisticsChanged); … … 85 85 86 86 private void RegisterHiveExperimentEvents() { 87 Content. HiveExperiment.PropertyChanged += new PropertyChangedEventHandler(HiveExperiment_PropertyChanged);87 Content.Job.PropertyChanged += new PropertyChangedEventHandler(HiveExperiment_PropertyChanged); 88 88 } 89 89 90 90 private void DeregisterHiveExperimentEvents() { 91 Content. HiveExperiment.PropertyChanged -= new PropertyChangedEventHandler(HiveExperiment_PropertyChanged);91 Content.Job.PropertyChanged -= new PropertyChangedEventHandler(HiveExperiment_PropertyChanged); 92 92 } 93 93 94 94 private void RegisterHiveJobEvents() { 95 Content.HiveJobs.ItemsAdded += new CollectionItemsChangedEventHandler<Hive Job>(HiveJobs_ItemsAdded_Removed_Reset);96 Content.HiveJobs.ItemsRemoved += new CollectionItemsChangedEventHandler<Hive Job>(HiveJobs_ItemsAdded_Removed_Reset);97 Content.HiveJobs.CollectionReset += new CollectionItemsChangedEventHandler<Hive Job>(HiveJobs_ItemsAdded_Removed_Reset);95 Content.HiveJobs.ItemsAdded += new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 96 Content.HiveJobs.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 97 Content.HiveJobs.CollectionReset += new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 98 98 } 99 99 private void DeregisterHiveJobEvents() { 100 Content.HiveJobs.ItemsAdded -= new CollectionItemsChangedEventHandler<Hive Job>(HiveJobs_ItemsAdded_Removed_Reset);101 Content.HiveJobs.ItemsRemoved -= new CollectionItemsChangedEventHandler<Hive Job>(HiveJobs_ItemsAdded_Removed_Reset);102 Content.HiveJobs.CollectionReset -= new CollectionItemsChangedEventHandler<Hive Job>(HiveJobs_ItemsAdded_Removed_Reset);100 Content.HiveJobs.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 101 Content.HiveJobs.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 102 Content.HiveJobs.CollectionReset -= new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset); 103 103 } 104 104 … … 114 114 logView.Content = null; 115 115 } else { 116 nameTextBox.Text = Content. HiveExperiment.Name;116 nameTextBox.Text = Content.Job.Name; 117 117 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 118 resourceNamesTextBox.Text = Content. HiveExperiment.ResourceNames;119 isPrivilegedCheckBox.Checked = Content. HiveExperiment.IsPrivileged;118 resourceNamesTextBox.Text = Content.Job.ResourceNames; 119 isPrivilegedCheckBox.Checked = Content.Job.IsPrivileged; 120 120 refreshAutomaticallyCheckBox.Checked = Content.RefreshAutomatically; 121 121 logView.Content = Content.Log; … … 140 140 if (Content != null) { 141 141 bool alreadyUploaded = Content.Id != Guid.Empty; 142 bool jobsLoaded = Content.HiveJobs != null && Content.HiveJobs.All(x => x. Job.Id != Guid.Empty);142 bool jobsLoaded = Content.HiveJobs != null && Content.HiveJobs.All(x => x.Task.Id != Guid.Empty); 143 143 144 144 this.nameTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded; … … 164 164 165 165 #region Content Events 166 private void HiveJobs_ItemsAdded_Removed_Reset(object sender, CollectionItemsChangedEventArgs<Hive Job> e) {167 if (InvokeRequired) 168 Invoke(new CollectionItemsChangedEventHandler<Hive Job>(HiveJobs_ItemsAdded_Removed_Reset), sender, e);166 private void HiveJobs_ItemsAdded_Removed_Reset(object sender, CollectionItemsChangedEventArgs<HiveTask> e) { 167 if (InvokeRequired) 168 Invoke(new CollectionItemsChangedEventHandler<HiveTask>(HiveJobs_ItemsAdded_Removed_Reset), sender, e); 169 169 else { 170 170 SetEnabledStateOfControls(); … … 240 240 241 241 private void Content_HiveExperimentChanged(object sender, EventArgs e) { 242 if (Content. HiveExperiment!= null) {242 if (Content.Job != null) { 243 243 RegisterHiveExperimentEvents(); 244 244 Content_IsProgressingChanged(sender, e); … … 253 253 else { 254 254 if (Content != null) { 255 jobsTextBox.Text = Content. HiveExperiment.JobCount.ToString();256 calculatingTextBox.Text = Content. HiveExperiment.CalculatingCount.ToString();257 finishedTextBox.Text = Content. HiveExperiment.FinishedCount.ToString();255 jobsTextBox.Text = Content.Job.JobCount.ToString(); 256 calculatingTextBox.Text = Content.Job.CalculatingCount.ToString(); 257 finishedTextBox.Text = Content.Job.FinishedCount.ToString(); 258 258 } else { 259 259 jobsTextBox.Text = "0"; … … 283 283 284 284 private void UpdateStateLogList() { 285 if (Content != null && this.Content. HiveExperiment!= null) {285 if (Content != null && this.Content.Job != null) { 286 286 stateLogViewHost.Content = this.Content.StateLogList; 287 287 } else { … … 291 291 292 292 private void HiveExperiment_PropertyChanged(object sender, PropertyChangedEventArgs e) { 293 if(this.Content != null && e.PropertyName == "Id") this.hiveExperimentPermissionListView.HiveExperimentId = this.Content. HiveExperiment.Id;293 if(this.Content != null && e.PropertyName == "Id") this.hiveExperimentPermissionListView.HiveExperimentId = this.Content.Job.Id; 294 294 } 295 295 #endregion … … 308 308 309 309 private void nameTextBox_Validated(object sender, EventArgs e) { 310 if (Content. HiveExperiment.Name != nameTextBox.Text)311 Content. HiveExperiment.Name = nameTextBox.Text;310 if (Content.Job.Name != nameTextBox.Text) 311 Content.Job.Name = nameTextBox.Text; 312 312 } 313 313 314 314 private void resourceNamesTextBox_Validated(object sender, EventArgs e) { 315 if (Content. HiveExperiment.ResourceNames != resourceNamesTextBox.Text)316 Content. HiveExperiment.ResourceNames = resourceNamesTextBox.Text;315 if (Content.Job.ResourceNames != resourceNamesTextBox.Text) 316 Content.Job.ResourceNames = resourceNamesTextBox.Text; 317 317 } 318 318 … … 322 322 323 323 private void isPrivilegedCheckBox_Validated(object sender, EventArgs e) { 324 if (Content != null) Content. HiveExperiment.IsPrivileged = isPrivilegedCheckBox.Checked;324 if (Content != null) Content.Job.IsPrivileged = isPrivilegedCheckBox.Checked; 325 325 } 326 326 327 327 private void refreshButton_Click(object sender, EventArgs e) { 328 var invoker = new Action<Refreshable HiveExperiment>(HiveClient.LoadExperiment);328 var invoker = new Action<RefreshableJob>(HiveClient.LoadExperiment); 329 329 invoker.BeginInvoke(Content, (ar) => { 330 330 try { … … 338 338 339 339 private void refreshPermissionsButton_Click(object sender, EventArgs e) { 340 hiveExperimentPermissionListView.Content = HiveClient.GetHiveExperimentPermissions(this.Content. HiveExperiment.Id);340 hiveExperimentPermissionListView.Content = HiveClient.GetHiveExperimentPermissions(this.Content.Job.Id); 341 341 } 342 342 … … 406 406 var optimizer = obj as IOptimizer; 407 407 if (optimizer != null) { 408 Content.HiveJobs.Add(new OptimizerHive Job(e.Effect.HasFlag(DragDropEffects.Copy) ? (IOptimizer)optimizer.Clone() : optimizer));408 Content.HiveJobs.Add(new OptimizerHiveTask(e.Effect.HasFlag(DragDropEffects.Copy) ? (IOptimizer)optimizer.Clone() : optimizer)); 409 409 } 410 410 }
Note: See TracChangeset
for help on using the changeset viewer.