Changeset 6479 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager
- Timestamp:
- 06/27/11 15:20:23 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/MenuItems/ExperimentManagerMenuItem.cs
r6373 r6479 27 27 public class ExperimentManagerMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 28 28 public override string Name { 29 get { return "&Experiment Manager (dev)"; }29 get { return "&Experiment Manager"; } 30 30 } 31 31 public override IEnumerable<string> Structure { -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/HiveExperimentPermissionView.Designer.cs
r6463 r6479 61 61 this.usernameTextBox.TabIndex = 3; 62 62 this.usernameTextBox.Validated += new System.EventHandler(this.usernameTextBox_Validated); 63 this.usernameTextBox.Validating += new System.ComponentModel.CancelEventHandler(usernameTextBox_Validating); 63 64 // 64 65 // permissionComboBox … … 73 74 this.permissionComboBox.TabIndex = 4; 74 75 this.permissionComboBox.Validated += new System.EventHandler(this.permissionComboBox_Validated); 76 this.permissionComboBox.Validating += new System.ComponentModel.CancelEventHandler(permissionComboBox_Validating); 75 77 // 76 78 // HiveExperimentPermissionView … … 92 94 93 95 } 94 95 96 #endregion 96 97 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/HiveExperimentPermissionView.cs
r6465 r6479 20 20 #endregion 21 21 22 using System.ComponentModel; 22 23 using HeuristicLab.Clients.Hive.Views; 23 24 using HeuristicLab.MainForm; … … 62 63 63 64 #region Child Control Events 64 private void usernameTextBox_Validated(object sender, System.EventArgs e) { 65 66 private void usernameTextBox_Validating(object sender, CancelEventArgs e) { 65 67 Content.GrantedUserName = usernameTextBox.Text; 66 68 } 69 private void usernameTextBox_Validated(object sender, System.EventArgs e) { 70 71 } 67 72 73 private void permissionComboBox_Validating(object sender, CancelEventArgs e) { 74 Content.Permission = (Permission)permissionComboBox.SelectedItem; 75 } 68 76 private void permissionComboBox_Validated(object sender, System.EventArgs e) { 69 Content.Permission = (Permission)permissionComboBox.SelectedItem;77 70 78 } 71 79 #endregion -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentListView.cs
r6465 r6479 39 39 this.itemsListView.HeaderStyle = ColumnHeaderStyle.Clickable; 40 40 this.itemsListView.FullRowSelect = true; 41 this.itemsListView.Sorting = SortOrder.Ascending; 42 this.itemsListView.Sort(); 41 43 } 42 44 43 45 protected override RefreshableHiveExperiment CreateItem() { 44 return new RefreshableHiveExperiment() ;46 return new RefreshableHiveExperiment() { IsAllowedPrivileged = HiveClient.Instance.IsAllowedPrivileged }; 45 47 } 46 48 … … 52 54 } 53 55 56 protected override void Content_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<RefreshableHiveExperiment> e) { 57 base.Content_ItemsAdded(sender, e); 58 59 } 60 54 61 protected override ListViewItem CreateListViewItem(RefreshableHiveExperiment item) { 55 62 ListViewItem listViewItem = base.CreateListViewItem(item); … … 59 66 listViewItem.Group = GetListViewGroup(item.HiveExperiment.OwnerUsername); 60 67 return listViewItem; 68 } 69 70 protected override void UpdateListViewItemText(ListViewItem listViewItem) { 71 if (listViewItem == null) throw new ArgumentNullException(); 72 var item = listViewItem.Tag as RefreshableHiveExperiment; 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); 76 listViewItem.ToolTipText = item == null ? string.Empty : item.ItemName + ": " + item.ItemDescription; 61 77 } 62 78 -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentView.Designer.cs
r6463 r6479 55 55 this.stateLogViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 56 56 this.sharingTabPage = new System.Windows.Forms.TabPage(); 57 this.refreshPermissionsButton = new System.Windows.Forms.Button(); 57 58 this.hiveExperimentPermissionListView = new HeuristicLab.Clients.Hive.ExperimentManager.Views.HiveExperimentPermissionListView(); 58 59 this.logTabPage = new System.Windows.Forms.TabPage(); … … 79 80 this.calculatingLabel = new System.Windows.Forms.Label(); 80 81 this.jobsLabel = new System.Windows.Forms.Label(); 81 this.refreshPermissionsButton = new System.Windows.Forms.Button();82 82 this.tabControl.SuspendLayout(); 83 83 this.jobsTabPage.SuspendLayout(); … … 102 102 this.tabControl.Size = new System.Drawing.Size(717, 452); 103 103 this.tabControl.TabIndex = 4; 104 this.tabControl.SelectedIndexChanged += new System.EventHandler(this.tabControl_SelectedIndexChanged); 104 105 // 105 106 // jobsTabPage … … 165 166 this.sharingTabPage.UseVisualStyleBackColor = true; 166 167 // 168 // refreshPermissionsButton 169 // 170 this.refreshPermissionsButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshPermissionsButton.Image"))); 171 this.refreshPermissionsButton.Location = new System.Drawing.Point(3, 3); 172 this.refreshPermissionsButton.Name = "refreshPermissionsButton"; 173 this.refreshPermissionsButton.Size = new System.Drawing.Size(24, 24); 174 this.refreshPermissionsButton.TabIndex = 23; 175 this.toolTip.SetToolTip(this.refreshPermissionsButton, "Refresh Data"); 176 this.refreshPermissionsButton.UseVisualStyleBackColor = true; 177 this.refreshPermissionsButton.Click += new System.EventHandler(this.refreshPermissionsButton_Click); 178 // 167 179 // hiveExperimentPermissionListView 168 180 // … … 172 184 this.hiveExperimentPermissionListView.Caption = "HiveExperimentPermissionList View"; 173 185 this.hiveExperimentPermissionListView.Content = null; 186 this.hiveExperimentPermissionListView.HiveExperimentId = new System.Guid("00000000-0000-0000-0000-000000000000"); 174 187 this.hiveExperimentPermissionListView.Location = new System.Drawing.Point(3, 33); 175 188 this.hiveExperimentPermissionListView.Name = "hiveExperimentPermissionListView"; … … 410 423 this.jobsLabel.TabIndex = 0; 411 424 this.jobsLabel.Text = "Jobs:"; 412 //413 // refreshPermissionsButton414 //415 this.refreshPermissionsButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshPermissionsButton.Image")));416 this.refreshPermissionsButton.Location = new System.Drawing.Point(3, 3);417 this.refreshPermissionsButton.Name = "refreshPermissionsButton";418 this.refreshPermissionsButton.Size = new System.Drawing.Size(24, 24);419 this.refreshPermissionsButton.TabIndex = 23;420 this.toolTip.SetToolTip(this.refreshPermissionsButton, "Refresh Data");421 this.refreshPermissionsButton.UseVisualStyleBackColor = true;422 this.refreshPermissionsButton.Click += new System.EventHandler(this.refreshPermissionsButton_Click);423 425 // 424 426 // RefreshableHiveExperimentView -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.ExperimentManager/3.4/Views/RefreshableHiveExperimentView.cs
r6463 r6479 63 63 Content.ExceptionOccured += new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured); 64 64 Content.StateLogListChanged += new EventHandler(Content_StateLogListChanged); 65 Content.IsProgressingChanged += new EventHandler(Content_IsProgressingChanged); 66 Content.HiveJobsChanged += new EventHandler(Content_HiveJobChanged); 67 Content.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged); 68 Content.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged); 69 Content.IsAllowedPrivilegedChanged += new EventHandler(Content_IsAllowedPrivilegedChanged); 65 70 } 66 71 … … 72 77 Content.ExceptionOccured -= new EventHandler<EventArgs<Exception>>(Content_ExceptionOccured); 73 78 Content.StateLogListChanged -= new EventHandler(Content_StateLogListChanged); 79 Content.IsProgressingChanged -= new EventHandler(Content_IsProgressingChanged); 80 Content.HiveJobsChanged -= new EventHandler(Content_HiveJobChanged); 81 Content.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged); 82 Content.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged); 74 83 base.DeregisterContentEvents(); 75 84 } 76 85 77 86 private void RegisterHiveExperimentEvents() { 78 Content.HiveExperiment.ExecutionStateChanged += new EventHandler(Content_ExecutionStateChanged);79 Content.HiveExperiment.ExecutionTimeChanged += new EventHandler(Content_ExecutionTimeChanged);80 Content.HiveExperiment.HiveJobsChanged += new EventHandler(Content_HiveJobChanged);81 Content.HiveExperiment.IsProgressingChanged += new EventHandler(Content_IsProgressingChanged);82 87 Content.HiveExperiment.PropertyChanged += new PropertyChangedEventHandler(HiveExperiment_PropertyChanged); 83 88 } 84 89 85 90 private void DeregisterHiveExperimentEvents() { 86 Content.HiveExperiment.ExecutionStateChanged -= new EventHandler(Content_ExecutionStateChanged);87 Content.HiveExperiment.ExecutionTimeChanged -= new EventHandler(Content_ExecutionTimeChanged);88 Content.HiveExperiment.HiveJobsChanged -= new EventHandler(Content_HiveJobChanged);89 Content.HiveExperiment.IsProgressingChanged -= new EventHandler(Content_IsProgressingChanged);90 91 Content.HiveExperiment.PropertyChanged -= new PropertyChangedEventHandler(HiveExperiment_PropertyChanged); 91 92 } 92 93 93 94 private void RegisterHiveJobEvents() { 94 Content.Hive Experiment.HiveJobs.ItemsAdded += new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);95 Content.Hive Experiment.HiveJobs.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);96 Content.Hive Experiment.HiveJobs.CollectionReset += new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);95 Content.HiveJobs.ItemsAdded += new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 96 Content.HiveJobs.ItemsRemoved += new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 97 Content.HiveJobs.CollectionReset += new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 97 98 } 98 99 private void DeregisterHiveJobEvents() { 99 Content.Hive Experiment.HiveJobs.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);100 Content.Hive Experiment.HiveJobs.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);101 Content.Hive Experiment.HiveJobs.CollectionReset -= new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset);100 Content.HiveJobs.ItemsAdded -= new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 101 Content.HiveJobs.ItemsRemoved -= new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 102 Content.HiveJobs.CollectionReset -= new CollectionItemsChangedEventHandler<HiveJob>(HiveJobs_ItemsAdded_Removed_Reset); 102 103 } 103 104 … … 114 115 } else { 115 116 nameTextBox.Text = Content.HiveExperiment.Name; 116 executionTimeTextBox.Text = Content. HiveExperiment.ExecutionTime.ToString();117 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 117 118 resourceNamesTextBox.Text = Content.HiveExperiment.ResourceNames; 118 119 isPrivilegedCheckBox.Checked = Content.HiveExperiment.IsPrivileged; … … 139 140 if (Content != null) { 140 141 bool alreadyUploaded = Content.Id != Guid.Empty; 141 bool jobsLoaded = Content.HiveExperiment.HiveJobs != null && Content.HiveExperiment.HiveJobs.All(x => x.Job.Id != Guid.Empty); 142 143 this.nameTextBox.ReadOnly = !Content.IsControllable || Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 144 this.resourceNamesTextBox.ReadOnly = !Content.IsControllable || Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 145 this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 146 147 this.isPrivilegedCheckBox.Enabled = Content.IsControllable && !(Content.HiveExperiment.ExecutionState != ExecutionState.Prepared || alreadyUploaded); // TODO: check if user has the rights to do this 148 this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && Content.HiveExperiment.ExecutionState == ExecutionState.Started; 149 this.refreshButton.Enabled = Content.IsControllable && alreadyUploaded; 150 this.Locked = !Content.IsControllable || Content.HiveExperiment.ExecutionState == ExecutionState.Started; 151 142 bool jobsLoaded = Content.HiveJobs != null && Content.HiveJobs.All(x => x.Job.Id != Guid.Empty); 143 144 this.nameTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 145 this.resourceNamesTextBox.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 146 this.jobsTreeView.ReadOnly = !Content.IsControllable || Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded; 147 148 this.isPrivilegedCheckBox.Enabled = Content.IsAllowedPrivileged && Content.IsControllable && !(Content.ExecutionState != ExecutionState.Prepared || alreadyUploaded); // TODO: check if user has the rights to do this 149 this.refreshAutomaticallyCheckBox.Enabled = Content.IsControllable && alreadyUploaded && jobsLoaded && Content.ExecutionState == ExecutionState.Started; 150 this.refreshButton.Enabled = Content.IsDownloadable && alreadyUploaded; 151 this.Locked = !Content.IsControllable || Content.ExecutionState == ExecutionState.Started; 152 152 } 153 153 SetEnabledStateOfExecutableButtons(); 154 tabControl_SelectedIndexChanged(this, EventArgs.Empty); // ensure sharing tabpage is disabled 154 155 } 155 156 … … 214 215 Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e); 215 216 else 216 executionTimeTextBox.Text = Content. HiveExperiment.ExecutionTime.ToString();217 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 217 218 } 218 219 private void Content_RefreshAutomaticallyChanged(object sender, EventArgs e) { … … 228 229 Invoke(new EventHandler(Content_HiveJobChanged), sender, e); 229 230 else { 230 if (Content != null && Content.Hive Experiment.HiveJobs != null) {231 jobsTreeView.Content = Content.Hive Experiment.HiveJobs;231 if (Content != null && Content.HiveJobs != null) { 232 jobsTreeView.Content = Content.HiveJobs; 232 233 RegisterHiveJobEvents(); 233 234 } else { … … 263 264 } 264 265 private void Content_ExceptionOccured(object sender, EventArgs<Exception> e) { 265 if (Content.IsControllable) { 266 // show error dialog only if Controllable (otherwise it should continue trying without an error dialog (e.g. HiveEngine)) 267 ErrorHandling.ShowErrorDialog(this, e.Value); 268 } 266 // don't show exception, it is logged anyway 269 267 } 270 268 private void Content_StateLogListChanged(object sender, EventArgs e) { … … 275 273 } 276 274 } 275 private void Content_IsAllowedPrivilegedChanged(object sender, EventArgs e) { 276 if (InvokeRequired) 277 Invoke(new EventHandler(Content_IsAllowedPrivilegedChanged), sender, e); 278 else { 279 SetEnabledStateOfControls(); 280 } 281 } 282 277 283 278 284 private void UpdateStateLogList() { 279 285 if (Content != null && this.Content.HiveExperiment != null) { 280 stateLogViewHost.Content = this.Content. HiveExperiment.StateLogList;286 stateLogViewHost.Content = this.Content.StateLogList; 281 287 } else { 282 288 stateLogViewHost.Content = null; … … 294 300 } 295 301 private void pauseButton_Click(object sender, EventArgs e) { 296 HiveClient.PauseExperiment(Content .HiveExperiment);302 HiveClient.PauseExperiment(Content); 297 303 } 298 304 private void stopButton_Click(object sender, EventArgs e) { 299 HiveClient.StopExperiment(Content .HiveExperiment);305 HiveClient.StopExperiment(Content); 300 306 } 301 307 private void resetButton_Click(object sender, EventArgs e) { } … … 320 326 321 327 private void refreshButton_Click(object sender, EventArgs e) { 322 var invoker = new Action< HiveExperiment>(HiveClient.LoadExperiment);323 invoker.BeginInvoke(Content .HiveExperiment, (ar) => {328 var invoker = new Action<RefreshableHiveExperiment>(HiveClient.LoadExperiment); 329 invoker.BeginInvoke(Content, (ar) => { 324 330 try { 325 331 invoker.EndInvoke(ar); … … 343 349 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 344 350 } else { 345 startButton.Enabled = Content.IsControllable && Content.Hive Experiment.HiveJobs != null && Content.HiveExperiment.HiveJobs.Count > 0 && Content.HiveExperiment.ExecutionState == ExecutionState.Prepared;346 pauseButton.Enabled = Content.IsControllable && Content. HiveExperiment.ExecutionState == ExecutionState.Started;347 stopButton.Enabled = Content.IsControllable && Content. HiveExperiment.ExecutionState == ExecutionState.Started;351 startButton.Enabled = Content.IsControllable && Content.HiveJobs != null && Content.HiveJobs.Count > 0 && Content.ExecutionState == ExecutionState.Prepared; 352 pauseButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started; 353 stopButton.Enabled = Content.IsControllable && Content.ExecutionState == ExecutionState.Started; 348 354 resetButton.Enabled = false; 349 355 } … … 356 362 Invoke(new EventHandler(Content_IsProgressingChanged), sender, e); 357 363 } else { 358 if (Content != null && Content. HiveExperiment.IsProgressing) {364 if (Content != null && Content.IsProgressing) { 359 365 SetProgressView(); 360 366 } else { … … 366 372 private void SetProgressView() { 367 373 if (progressView == null) { 368 progressView = new ProgressView(this, Content. HiveExperiment.Progress);369 } 370 progressView.Progress = Content. HiveExperiment.Progress;374 progressView = new ProgressView(this, Content.Progress); 375 } 376 progressView.Progress = Content.Progress; 371 377 } 372 378 … … 389 395 var obj = e.Data.GetData(Constants.DragDropDataFormat); 390 396 if (obj is IOptimizer) { 391 e.Effect = DragDropEffects.Copy; 397 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 398 else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy; 392 399 } 393 400 } … … 399 406 var optimizer = obj as IOptimizer; 400 407 if (optimizer != null) { 401 Content.Hive Experiment.HiveJobs.Add(new OptimizerHiveJob(optimizer));408 Content.HiveJobs.Add(new OptimizerHiveJob(e.Effect.HasFlag(DragDropEffects.Copy) ? (IOptimizer)optimizer.Clone() : optimizer)); 402 409 } 403 410 } 404 411 } 405 412 #endregion 413 414 private void tabControl_SelectedIndexChanged(object sender, EventArgs e) { 415 if (tabControl.SelectedTab == sharingTabPage) { 416 if (!Content.IsSharable) { 417 MessageBox.Show("Unable to load tab. You have insufficient access privileges."); 418 tabControl.SelectedTab = jobsTabPage; 419 } 420 } 421 } 406 422 } 407 423 }
Note: See TracChangeset
for help on using the changeset viewer.