Changeset 3561
- Timestamp:
- 04/30/10 04:53:40 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs
r3533 r3561 222 222 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsAdded), sender, e); 223 223 else { 224 DataRow row = valuesRowsTable[(IObservableList<double>)sender]; 225 foreach (IndexedItem<double> item in e.Items) { 226 var value = item.Value; 227 if (IsInvalidValue(item.Value)) { 228 DataPoint point = new DataPoint(); 229 point.IsEmpty = true; 230 chart.Series[row.Name].Points.Insert(item.Index, point); 231 } else { 232 chart.Series[row.Name].Points.InsertY(item.Index, value); 224 DataRow row = null; 225 valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row); 226 if (row != null) { 227 foreach (IndexedItem<double> item in e.Items) { 228 var value = item.Value; 229 if (IsInvalidValue(item.Value)) { 230 DataPoint point = new DataPoint(); 231 point.IsEmpty = true; 232 chart.Series[row.Name].Points.Insert(item.Index, point); 233 } else { 234 chart.Series[row.Name].Points.InsertY(item.Index, value); 235 } 233 236 } 234 237 } … … 239 242 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsRemoved), sender, e); 240 243 else { 241 DataRow row = valuesRowsTable[(IObservableList<double>)sender]; 242 List<DataPoint> points = new List<DataPoint>(); 243 foreach (IndexedItem<double> item in e.Items) 244 points.Add(chart.Series[row.Name].Points[item.Index]); 245 foreach (DataPoint point in points) 246 chart.Series[row.Name].Points.Remove(point); 244 DataRow row = null; 245 valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row); 246 if (row != null) { 247 List<DataPoint> points = new List<DataPoint>(); 248 foreach (IndexedItem<double> item in e.Items) 249 points.Add(chart.Series[row.Name].Points[item.Index]); 250 foreach (DataPoint point in points) 251 chart.Series[row.Name].Points.Remove(point); 252 } 247 253 } 248 254 } … … 251 257 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsReplaced), sender, e); 252 258 else { 253 DataRow row = valuesRowsTable[(IObservableList<double>)sender]; 254 foreach (IndexedItem<double> item in e.Items) { 255 if (IsInvalidValue(item.Value)) 256 chart.Series[row.Name].Points[item.Index].IsEmpty = true; 257 else { 258 chart.Series[row.Name].Points[item.Index].YValues = new double[] { item.Value }; 259 chart.Series[row.Name].Points[item.Index].IsEmpty = false; 259 DataRow row = null; 260 valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row); 261 if (row != null) { 262 foreach (IndexedItem<double> item in e.Items) { 263 if (IsInvalidValue(item.Value)) 264 chart.Series[row.Name].Points[item.Index].IsEmpty = true; 265 else { 266 chart.Series[row.Name].Points[item.Index].YValues = new double[] { item.Value }; 267 chart.Series[row.Name].Points[item.Index].IsEmpty = false; 268 } 260 269 } 261 270 } … … 266 275 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_ItemsMoved), sender, e); 267 276 else { 268 DataRow row = valuesRowsTable[(IObservableList<double>)sender]; 269 foreach (IndexedItem<double> item in e.Items) { 270 if (IsInvalidValue(item.Value)) 271 chart.Series[row.Name].Points[item.Index].IsEmpty = true; 272 else { 273 chart.Series[row.Name].Points[item.Index].YValues = new double[] { item.Value }; 274 chart.Series[row.Name].Points[item.Index].IsEmpty = false; 277 DataRow row = null; 278 valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row); 279 if (row != null) { 280 foreach (IndexedItem<double> item in e.Items) { 281 if (IsInvalidValue(item.Value)) 282 chart.Series[row.Name].Points[item.Index].IsEmpty = true; 283 else { 284 chart.Series[row.Name].Points[item.Index].YValues = new double[] { item.Value }; 285 chart.Series[row.Name].Points[item.Index].IsEmpty = false; 286 } 275 287 } 276 288 } … … 282 294 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<double>>(Values_CollectionReset), sender, e); 283 295 else { 284 DataRow row = valuesRowsTable[(IObservableList<double>)sender]; 285 chart.Series[row.Name].Points.Clear(); 286 foreach (IndexedItem<double> item in e.Items) { 287 if (IsInvalidValue(item.Value)) 288 chart.Series[row.Name].Points[item.Index].IsEmpty = true; 289 else { 290 chart.Series[row.Name].Points[item.Index].YValues = new double[] { item.Value }; 291 chart.Series[row.Name].Points[item.Index].IsEmpty = false; 296 DataRow row = null; 297 valuesRowsTable.TryGetValue((IObservableList<double>)sender, out row); 298 if (row != null) { 299 chart.Series[row.Name].Points.Clear(); 300 foreach (IndexedItem<double> item in e.Items) { 301 if (IsInvalidValue(item.Value)) 302 chart.Series[row.Name].Points[item.Index].IsEmpty = true; 303 else { 304 chart.Series[row.Name].Points[item.Index].YValues = new double[] { item.Value }; 305 chart.Series[row.Name].Points[item.Index].IsEmpty = false; 306 } 292 307 } 293 308 } -
trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemCollectionView.cs
r3393 r3561 79 79 } 80 80 protected override IEnumerable<ListViewItem> GetListViewItemsForItem(T item) { 81 return new ListViewItem[] { listViewItemDictionary[item] }; 81 ListViewItem listViewItem = null; 82 listViewItemDictionary.TryGetValue(item, out listViewItem); 83 if (listViewItem != null) return new ListViewItem[] { listViewItem }; 84 else return new ListViewItem[0]; 82 85 } 83 86 -
trunk/sources/HeuristicLab.Core.Views/3.3/ScopeView.cs
r3528 r3561 186 186 else { 187 187 IScope scope = (IScope)sender; 188 scopeNodeTable[scope].Text = scope.Name; 188 TreeNode node = null; 189 scopeNodeTable.TryGetValue(scope, out node); 190 if (node != null) node.Text = scope.Name; 189 191 } 190 192 } … … 193 195 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsAdded), sender, e); 194 196 else { 195 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 196 TreeNode parentNode = scopeNodeTable[parentScope]; 197 scopesTreeView.BeginUpdate(); 198 if (parentNode.IsExpanded) { 199 foreach (IndexedItem<IScope> item in e.Items) { 200 TreeNode node = CreateTreeNode(item.Value); 201 parentNode.Nodes.Insert(item.Index, node); 202 } 203 } else if (parentNode.Nodes.Count == 0) { 204 parentNode.Nodes.Add(new TreeNode()); 205 } 206 scopesTreeView.EndUpdate(); 197 IScope parentScope = null; 198 subScopesScopeTable.TryGetValue((ScopeList)sender, out parentScope); 199 if (parentScope != null) { 200 TreeNode parentNode = null; 201 scopeNodeTable.TryGetValue(parentScope, out parentNode); 202 if (parentNode != null) { 203 scopesTreeView.BeginUpdate(); 204 if (parentNode.IsExpanded) { 205 foreach (IndexedItem<IScope> item in e.Items) { 206 TreeNode node = CreateTreeNode(item.Value); 207 parentNode.Nodes.Insert(item.Index, node); 208 } 209 } else if (parentNode.Nodes.Count == 0) { 210 parentNode.Nodes.Add(new TreeNode()); 211 } 212 scopesTreeView.EndUpdate(); 213 } 214 } 207 215 } 208 216 } … … 211 219 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsRemoved), sender, e); 212 220 else { 213 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 214 TreeNode parentNode = scopeNodeTable[parentScope]; 215 scopesTreeView.BeginUpdate(); 216 if (parentNode.IsExpanded) { 217 foreach (IndexedItem<IScope> item in e.Items) { 218 TreeNode node = scopeNodeTable[item.Value]; 219 ClearTreeNode(node); 220 node.Remove(); 221 } 222 } else if (parentScope.SubScopes.Count == 0) { 223 parentNode.Nodes.Clear(); 224 } 225 scopesTreeView.EndUpdate(); 221 IScope parentScope = null; 222 subScopesScopeTable.TryGetValue((ScopeList)sender, out parentScope); 223 if (parentScope != null) { 224 TreeNode parentNode = null; 225 scopeNodeTable.TryGetValue(parentScope, out parentNode); 226 if (parentNode != null) { 227 scopesTreeView.BeginUpdate(); 228 if (parentNode.IsExpanded) { 229 foreach (IndexedItem<IScope> item in e.Items) { 230 TreeNode node = scopeNodeTable[item.Value]; 231 ClearTreeNode(node); 232 node.Remove(); 233 } 234 } else if (parentScope.SubScopes.Count == 0) { 235 parentNode.Nodes.Clear(); 236 } 237 scopesTreeView.EndUpdate(); 238 } 239 } 226 240 } 227 241 } … … 230 244 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsReplaced), sender, e); 231 245 else { 232 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 233 TreeNode parentNode = scopeNodeTable[parentScope]; 234 scopesTreeView.BeginUpdate(); 235 if (parentNode.IsExpanded) { 236 foreach (IndexedItem<IScope> item in e.Items) { 237 TreeNode node = parentNode.Nodes[item.Index]; 238 ClearTreeNode(node); 239 node.Remove(); 240 node = CreateTreeNode(item.Value); 241 parentNode.Nodes.Insert(item.Index, node); 242 } 243 scopesTreeView.EndUpdate(); 246 IScope parentScope = null; 247 subScopesScopeTable.TryGetValue((ScopeList)sender, out parentScope); 248 if (parentScope != null) { 249 TreeNode parentNode = null; 250 scopeNodeTable.TryGetValue(parentScope, out parentNode); 251 if (parentNode != null) { 252 scopesTreeView.BeginUpdate(); 253 if (parentNode.IsExpanded) { 254 foreach (IndexedItem<IScope> item in e.Items) { 255 TreeNode node = parentNode.Nodes[item.Index]; 256 ClearTreeNode(node); 257 node.Remove(); 258 node = CreateTreeNode(item.Value); 259 parentNode.Nodes.Insert(item.Index, node); 260 } 261 scopesTreeView.EndUpdate(); 262 } 263 } 244 264 } 245 265 } … … 249 269 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_ItemsMoved), sender, e); 250 270 else { 251 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 252 TreeNode parentNode = scopeNodeTable[parentScope]; 253 scopesTreeView.BeginUpdate(); 254 if (parentNode.IsExpanded) { 255 parentNode.Nodes.Clear(); 256 foreach (IndexedItem<IScope> item in e.Items) 257 parentNode.Nodes.Insert(item.Index, scopeNodeTable[item.Value]); 258 } 259 scopesTreeView.EndUpdate(); 271 IScope parentScope = null; 272 subScopesScopeTable.TryGetValue((ScopeList)sender, out parentScope); 273 if (parentScope != null) { 274 TreeNode parentNode = null; 275 scopeNodeTable.TryGetValue(parentScope, out parentNode); 276 if (parentNode != null) { 277 scopesTreeView.BeginUpdate(); 278 if (parentNode.IsExpanded) { 279 parentNode.Nodes.Clear(); 280 foreach (IndexedItem<IScope> item in e.Items) 281 parentNode.Nodes.Insert(item.Index, scopeNodeTable[item.Value]); 282 } 283 scopesTreeView.EndUpdate(); 284 } 285 } 260 286 } 261 287 } … … 264 290 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<IScope>>(SubScopes_CollectionReset), sender, e); 265 291 else { 266 IScope parentScope = subScopesScopeTable[(ScopeList)sender]; 267 TreeNode parentNode = scopeNodeTable[parentScope]; 268 scopesTreeView.BeginUpdate(); 269 if (parentNode.IsExpanded) { 270 foreach (TreeNode node in parentNode.Nodes) 271 ClearTreeNode(node); 272 parentNode.Nodes.Clear(); 273 foreach (IndexedItem<IScope> item in e.Items) { 274 TreeNode node = CreateTreeNode(item.Value); 275 parentNode.Nodes.Insert(item.Index, node); 276 } 277 } else { 278 parentNode.Nodes.Clear(); 279 if (parentScope.SubScopes.Count > 0) 280 parentNode.Nodes.Add(new TreeNode()); 281 } 282 scopesTreeView.EndUpdate(); 292 IScope parentScope = null; 293 subScopesScopeTable.TryGetValue((ScopeList)sender, out parentScope); 294 if (parentScope != null) { 295 TreeNode parentNode = null; 296 scopeNodeTable.TryGetValue(parentScope, out parentNode); 297 if (parentNode != null) { 298 scopesTreeView.BeginUpdate(); 299 if (parentNode.IsExpanded) { 300 foreach (TreeNode node in parentNode.Nodes) 301 ClearTreeNode(node); 302 parentNode.Nodes.Clear(); 303 foreach (IndexedItem<IScope> item in e.Items) { 304 TreeNode node = CreateTreeNode(item.Value); 305 parentNode.Nodes.Insert(item.Index, node); 306 } 307 } else { 308 parentNode.Nodes.Clear(); 309 if (parentScope.SubScopes.Count > 0) 310 parentNode.Nodes.Add(new TreeNode()); 311 } 312 scopesTreeView.EndUpdate(); 313 } 314 } 283 315 } 284 316 }
Note: See TracChangeset
for help on using the changeset viewer.