- Timestamp:
- 03/14/11 16:45:46 (14 years ago)
- Location:
- branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveExperimentView.Designer.cs
r5637 r5675 52 52 this.experimentNamedItemView = new HeuristicLab.Core.Views.NamedItemView(); 53 53 this.viewExperimentButton = new System.Windows.Forms.Button(); 54 this.jobsTabPage = new System.Windows.Forms.TabPage();55 54 this.logTabPage = new System.Windows.Forms.TabPage(); 56 55 this.logView = new HeuristicLab.Core.Views.LogView(); … … 68 67 this.downloadExperimentPanel = new System.Windows.Forms.Panel(); 69 68 this.useLocalPluginsCheckBox = new System.Windows.Forms.CheckBox(); 70 this.jobViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 69 this.jobsTabPage = new System.Windows.Forms.TabPage(); 70 this.jobsTreeView = new HeuristicLab.Clients.Hive.Views.ItemTreeView(); 71 71 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 72 72 this.tabControl.SuspendLayout(); 73 73 this.experimentTabPage.SuspendLayout(); 74 this.jobsTabPage.SuspendLayout();75 74 this.logTabPage.SuspendLayout(); 76 75 this.downloadExperimentPanel.SuspendLayout(); 76 this.jobsTabPage.SuspendLayout(); 77 77 this.SuspendLayout(); 78 78 // … … 161 161 this.viewExperimentButton.Click += new System.EventHandler(this.showExperimentButton_Click); 162 162 // 163 // jobsTabPage164 //165 this.jobsTabPage.Controls.Add(this.jobViewHost);166 this.jobsTabPage.Location = new System.Drawing.Point(4, 22);167 this.jobsTabPage.Name = "jobsTabPage";168 this.jobsTabPage.Size = new System.Drawing.Size(791, 494);169 this.jobsTabPage.TabIndex = 5;170 this.jobsTabPage.Text = "Jobs";171 this.jobsTabPage.UseVisualStyleBackColor = true;172 //173 163 // logTabPage 174 164 // … … 183 173 // logView 184 174 // 185 this.logView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)186 | System.Windows.Forms.AnchorStyles.Left)187 | System.Windows.Forms.AnchorStyles.Right)));188 175 this.logView.Caption = "Log View"; 189 176 this.logView.Content = null; 190 this.logView.Location = new System.Drawing.Point(3, 4); 177 this.logView.Dock = System.Windows.Forms.DockStyle.Fill; 178 this.logView.Location = new System.Drawing.Point(0, 0); 191 179 this.logView.Name = "logView"; 192 180 this.logView.ReadOnly = false; 193 this.logView.Size = new System.Drawing.Size(7 21, 362);181 this.logView.Size = new System.Drawing.Size(791, 494); 194 182 this.logView.TabIndex = 0; 195 183 // … … 343 331 this.useLocalPluginsCheckBox.CheckedChanged += new System.EventHandler(this.useLocalPluginsCheckBox_CheckedChanged); 344 332 // 345 // jobViewHost 346 // 347 this.jobViewHost.Caption = "View"; 348 this.jobViewHost.Content = null; 349 this.jobViewHost.Dock = System.Windows.Forms.DockStyle.Fill; 350 this.jobViewHost.Enabled = false; 351 this.jobViewHost.Location = new System.Drawing.Point(0, 0); 352 this.jobViewHost.Name = "jobViewHost"; 353 this.jobViewHost.ReadOnly = false; 354 this.jobViewHost.Size = new System.Drawing.Size(791, 494); 355 this.jobViewHost.TabIndex = 0; 356 this.jobViewHost.ViewsLabelVisible = true; 357 this.jobViewHost.ViewType = null; 333 // jobsTabPage 334 // 335 this.jobsTabPage.Controls.Add(this.jobsTreeView); 336 this.jobsTabPage.Location = new System.Drawing.Point(4, 22); 337 this.jobsTabPage.Name = "jobsTabPage"; 338 this.jobsTabPage.Size = new System.Drawing.Size(791, 494); 339 this.jobsTabPage.TabIndex = 5; 340 this.jobsTabPage.Text = "Jobs"; 341 this.jobsTabPage.UseVisualStyleBackColor = true; 342 // 343 // jobsTreeView 344 // 345 this.jobsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 346 | System.Windows.Forms.AnchorStyles.Left) 347 | System.Windows.Forms.AnchorStyles.Right))); 348 this.jobsTreeView.Caption = "ItemTree View"; 349 this.jobsTreeView.Content = null; 350 this.jobsTreeView.Location = new System.Drawing.Point(2, 3); 351 this.jobsTreeView.Name = "jobsTreeView"; 352 this.jobsTreeView.ReadOnly = false; 353 this.jobsTreeView.Size = new System.Drawing.Size(786, 488); 354 this.jobsTreeView.TabIndex = 0; 358 355 // 359 356 // HiveExperimentView … … 396 393 this.tabControl.ResumeLayout(false); 397 394 this.experimentTabPage.ResumeLayout(false); 398 this.jobsTabPage.ResumeLayout(false);399 395 this.logTabPage.ResumeLayout(false); 400 396 this.downloadExperimentPanel.ResumeLayout(false); 397 this.jobsTabPage.ResumeLayout(false); 401 398 this.ResumeLayout(false); 402 399 this.PerformLayout(); … … 423 420 private System.Windows.Forms.Button openExperimentButton; 424 421 private System.Windows.Forms.Button newExperimentButton; 425 private System.Windows.Forms.TabPage jobsTabPage;426 422 private System.Windows.Forms.Button downloadExperimentButton; 427 423 private System.Windows.Forms.Panel downloadExperimentPanel; 428 424 private System.Windows.Forms.CheckBox useLocalPluginsCheckBox; 429 private MainForm.WindowsForms.ViewHost jobViewHost; 425 private System.Windows.Forms.TabPage jobsTabPage; 426 private ItemTreeView jobsTreeView; 430 427 431 428 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/HiveExperimentView.cs
r5637 r5675 105 105 this.descriptionTextBox.ReadOnly = Content.ExecutionState != ExecutionState.Prepared; 106 106 this.resourceNamesTextBox.ReadOnly = Content.ExecutionState != ExecutionState.Prepared; 107 this.job ViewHost.ReadOnly = Content.ExecutionState != ExecutionState.Prepared;107 this.jobsTreeView.ReadOnly = Content.ExecutionState != ExecutionState.Prepared; 108 108 this.useLocalPluginsCheckBox.Enabled = Content.ExecutionState == ExecutionState.Prepared; 109 109 … … 189 189 else { 190 190 if (Content != null) { 191 job ViewHost.Content = Content.HiveJob;191 jobsTreeView.Content = Content.HiveJob; 192 192 experimentNamedItemView.Content = Content.GetExperiment(); 193 193 } else { 194 job ViewHost.Content = null;194 jobsTreeView.Content = null; 195 195 experimentNamedItemView.Content = null; 196 196 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/ItemTreeView.cs
r5637 r5675 20 20 #endregion 21 21 22 using System; 22 23 using System.Windows.Forms; 24 using HeuristicLab.Collections; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core.Views; … … 40 42 41 43 protected override void DeregisterContentEvents() { 42 // Deregister your event handlers here 44 foreach (TreeNode node in treeView.Nodes) { 45 DeregisterContentEvents((IItemTree)node.Tag, node); 46 } 43 47 base.DeregisterContentEvents(); 48 } 49 50 private void DeregisterContentEvents(IItemTree item, TreeNode node) { 51 item.ItemsAdded -= new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsAdded); 52 item.ItemsRemoved -= new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsRemoved); 53 item.CollectionReset -= new CollectionItemsChangedEventHandler<IItemTree>(item_CollectionReset); 54 item.ToStringChanged -= new System.EventHandler(item_ToStringChanged); 55 item.ItemImageChanged -= new EventHandler(item_ItemImageChanged); 56 foreach (TreeNode childNode in node.Nodes) { 57 DeregisterContentEvents((IItemTree)childNode.Tag, childNode); 58 } 44 59 } 45 60 46 61 protected override void RegisterContentEvents() { 47 62 base.RegisterContentEvents(); 48 // Register your event handlers here 63 foreach (TreeNode node in treeView.Nodes) { 64 RegisterContentEvents((IItemTree)node.Tag, node); 65 } 66 } 67 68 private void RegisterContentEvents(IItemTree item, TreeNode node) { 69 item.ItemsAdded += new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsAdded); 70 item.ItemsRemoved += new CollectionItemsChangedEventHandler<IItemTree>(item_ItemsRemoved); 71 item.CollectionReset += new CollectionItemsChangedEventHandler<IItemTree>(item_CollectionReset); 72 item.ToStringChanged += new System.EventHandler(item_ToStringChanged); 73 item.ItemImageChanged += new EventHandler(item_ItemImageChanged); 74 foreach (TreeNode childNode in node.Nodes) { 75 RegisterContentEvents((IItemTree)childNode.Tag, childNode); 76 } 49 77 } 50 78 … … 57 85 if (Content == null) { 58 86 // Add code when content has been changed and is null 59 treeView.Nodes.Clear();87 ClearNodes(); 60 88 } else { 61 89 // Add code when content has been changed and is not null 62 treeView.Nodes.Clear(); 63 AddChildNodes(Content, treeView.Nodes); 64 } 65 } 66 67 private void AddChildNodes(IItemTree item, TreeNodeCollection nodes) { 68 var node = CreateTreeViewNode(item); 90 ClearNodes(); 91 AddChildNodes(Content, treeView.Nodes, false); 92 foreach (TreeNode node in treeView.Nodes) { 93 UpdateNodeItemImage(node); 94 } 95 } 96 } 97 98 private void ClearNodes() { 99 treeView.Nodes.Clear(); 100 } 101 102 private void AddChildNodes(IItemTree item, TreeNodeCollection nodes, bool registerEvents) { 103 TreeNode node = CreateTreeViewNode(item); 69 104 nodes.Add(node); 70 var childItems = item.GetChildNodes(); 71 foreach (var childItem in childItems) { 72 AddChildNodes(childItem, node.Nodes); 73 } 105 RebuildImageList(node); 106 RegisterContentEvents(item, node); 107 var childItems = item.GetChildItems(); 108 foreach (var childItem in childItems) { 109 AddChildNodes(childItem, node.Nodes, registerEvents); 110 } 111 node.ExpandAll(); 112 } 113 114 private void RemoveChildNodes(IItemTree item, TreeNodeCollection treeNodeCollection) { 115 int idx = -1; 116 for (int i = 0; i < treeNodeCollection.Count; i++) { 117 if (treeNodeCollection[i].Tag == item) { 118 idx = i; break; 119 } 120 } 121 DeregisterContentEvents(item, treeNodeCollection[idx]); 122 treeNodeCollection.RemoveAt(idx); 123 } 124 125 private void item_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IItemTree> e) { 126 TreeNode node = GetNodeByItem(sender as IItemTree); 127 foreach (IItemTree item in e.Items) { 128 AddChildNodes(item, node.Nodes, true); 129 node.ExpandAll(); 130 UpdateNodeItemImage(node); 131 } 132 } 133 134 private void item_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IItemTree> e) { 135 TreeNode node = GetNodeByItem(sender as IItemTree); 136 foreach (IItemTree item in e.Items) { 137 RemoveChildNodes(item, node.Nodes); 138 } 139 RebuildImageList(); 140 } 141 142 private void item_CollectionReset(object sender, CollectionItemsChangedEventArgs<IItemTree> e) { 143 TreeNode node = GetNodeByItem(sender as IItemTree); 144 foreach (IItemTree item in e.OldItems) { 145 RemoveChildNodes(item, node.Nodes); 146 } 147 RebuildImageList(); 148 foreach (IItemTree item in e.Items) { 149 AddChildNodes(item, node.Nodes, true); 150 } 151 } 152 153 private void item_ToStringChanged(object sender, EventArgs e) { 154 var item = sender as IItemTree; 155 TreeNode node = GetNodeByItem(item); 156 node.Text = item.ToString(); 157 } 158 159 private void item_ItemImageChanged(object sender, EventArgs e) { 160 var item = sender as IItemTree; 161 TreeNode node = GetNodeByItem(item); 162 UpdateNodeItemImage(node); 163 } 164 165 private TreeNode GetNodeByItem(IItemTree item) { 166 TreeNode found = null; 167 foreach (TreeNode node in treeView.Nodes) { 168 found = GetNodeByItem(node, item); 169 if (found != null) 170 return found; 171 } 172 return null; 173 } 174 175 private TreeNode GetNodeByItem(TreeNode node, IItemTree item) { 176 if (node.Tag == item) 177 return node; 178 TreeNode found = null; 179 foreach (TreeNode childNode in node.Nodes) { 180 found = GetNodeByItem(childNode, item); 181 if (found != null) 182 return found; 183 } 184 return null; 74 185 } 75 186 … … 77 188 var node = new TreeNode(item.ToString()); 78 189 node.Tag = item; 79 if (!treeView.ImageList.Images.ContainsKey(item.ItemImage.GetHashCode().ToString())) {80 treeView.ImageList.Images.Add(item.ItemImage.GetHashCode().ToString(), item.ItemImage);81 }82 node.ImageKey = item.ItemImage.GetHashCode().ToString();83 190 return node; 191 } 192 193 private void UpdateNodeItemImage(TreeNode node) { 194 if (node == null) throw new ArgumentNullException(); 195 var item = node.Tag as IItemTree; 196 int i = node.ImageIndex; 197 this.imageList.Images[i] = item == null ? HeuristicLab.Common.Resources.VSImageLibrary.Nothing : item.ItemImage; 198 node.ImageIndex = -1; 199 node.ImageIndex = i; 200 node.SelectedImageIndex = node.ImageIndex; 201 foreach (TreeNode childNode in node.Nodes) { 202 UpdateNodeItemImage(childNode); 203 } 84 204 } 85 205 … … 96 216 #endregion 97 217 98 218 private void RebuildImageList() { 219 treeView.ImageList.Images.Clear(); 220 foreach (TreeNode node in treeView.Nodes) { 221 RebuildImageList(node); 222 } 223 } 224 225 private void RebuildImageList(TreeNode node) { 226 var item = node.Tag as IItemTree; 227 treeView.ImageList.Images.Add(item == null ? HeuristicLab.Common.Resources.VSImageLibrary.Nothing : item.ItemImage); 228 node.ImageIndex = treeView.ImageList.Images.Count - 1; 229 node.SelectedImageIndex = node.ImageIndex; 230 foreach (TreeNode childNode in node.Nodes) { 231 RebuildImageList(childNode); 232 } 233 } 99 234 } 100 235 } -
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Views/3.4/ExperimentManager/ItemTreeView.designer.cs
r5637 r5675 27 27 this.splitContainer = new System.Windows.Forms.SplitContainer(); 28 28 this.treeView = new System.Windows.Forms.TreeView(); 29 this.imageList = new System.Windows.Forms.ImageList(this.components); 30 this.detailsGroupBox = new System.Windows.Forms.GroupBox(); 29 31 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 30 this.imageList = new System.Windows.Forms.ImageList(this.components);31 32 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 32 33 this.splitContainer.Panel1.SuspendLayout(); 33 34 this.splitContainer.Panel2.SuspendLayout(); 34 35 this.splitContainer.SuspendLayout(); 36 this.detailsGroupBox.SuspendLayout(); 35 37 this.SuspendLayout(); 36 38 // … … 38 40 // 39 41 this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; 42 this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; 40 43 this.splitContainer.Location = new System.Drawing.Point(0, 0); 41 44 this.splitContainer.Name = "splitContainer"; … … 47 50 // splitContainer.Panel2 48 51 // 49 this.splitContainer.Panel2.Controls.Add(this. viewHost);50 this.splitContainer.Size = new System.Drawing.Size( 551, 463);51 this.splitContainer.SplitterDistance = 183;52 this.splitContainer.Panel2.Controls.Add(this.detailsGroupBox); 53 this.splitContainer.Size = new System.Drawing.Size(624, 463); 54 this.splitContainer.SplitterDistance = 200; 52 55 this.splitContainer.TabIndex = 0; 53 56 // … … 60 63 this.treeView.Name = "treeView"; 61 64 this.treeView.SelectedImageIndex = 0; 62 this.treeView.Size = new System.Drawing.Size( 183, 463);65 this.treeView.Size = new System.Drawing.Size(200, 463); 63 66 this.treeView.TabIndex = 0; 64 67 this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); 68 // 69 // imageList 70 // 71 this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; 72 this.imageList.ImageSize = new System.Drawing.Size(16, 16); 73 this.imageList.TransparentColor = System.Drawing.Color.Transparent; 74 // 75 // detailsGroupBox 76 // 77 this.detailsGroupBox.Controls.Add(this.viewHost); 78 this.detailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; 79 this.detailsGroupBox.Location = new System.Drawing.Point(0, 0); 80 this.detailsGroupBox.Name = "detailsGroupBox"; 81 this.detailsGroupBox.Size = new System.Drawing.Size(420, 463); 82 this.detailsGroupBox.TabIndex = 1; 83 this.detailsGroupBox.TabStop = false; 84 this.detailsGroupBox.Text = "Details"; 65 85 // 66 86 // viewHost … … 70 90 this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill; 71 91 this.viewHost.Enabled = false; 72 this.viewHost.Location = new System.Drawing.Point( 0, 0);92 this.viewHost.Location = new System.Drawing.Point(3, 16); 73 93 this.viewHost.Name = "viewHost"; 74 94 this.viewHost.ReadOnly = false; 75 this.viewHost.Size = new System.Drawing.Size( 364, 463);95 this.viewHost.Size = new System.Drawing.Size(414, 444); 76 96 this.viewHost.TabIndex = 0; 77 97 this.viewHost.ViewsLabelVisible = true; 78 98 this.viewHost.ViewType = null; 79 //80 // imageList81 //82 this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;83 this.imageList.ImageSize = new System.Drawing.Size(16, 16);84 this.imageList.TransparentColor = System.Drawing.Color.Transparent;85 99 // 86 100 // ItemTreeView … … 89 103 this.Controls.Add(this.splitContainer); 90 104 this.Name = "ItemTreeView"; 91 this.Size = new System.Drawing.Size( 551, 463);105 this.Size = new System.Drawing.Size(624, 463); 92 106 this.splitContainer.Panel1.ResumeLayout(false); 93 107 this.splitContainer.Panel2.ResumeLayout(false); 94 108 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 95 109 this.splitContainer.ResumeLayout(false); 110 this.detailsGroupBox.ResumeLayout(false); 96 111 this.ResumeLayout(false); 97 112 … … 104 119 private MainForm.WindowsForms.ViewHost viewHost; 105 120 private System.Windows.Forms.ImageList imageList; 121 private System.Windows.Forms.GroupBox detailsGroupBox; 106 122 } 107 123 }
Note: See TracChangeset
for help on using the changeset viewer.