Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Breadcrumbs/HeuristicLab.Core.Views/3.3/ItemListView.cs @ 11549

Last change on this file since 11549 was 10103, checked in by jkarder, 11 years ago

#2116:

  • fixed issues within the outermost control detection
  • fixed visible property assignment of the breadcrumb control in ViewHost
File size: 22.9 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections;
24using System.Collections.Generic;
25using System.Drawing;
26using System.Linq;
27using System.Windows.Forms;
28using HeuristicLab.Collections;
29using HeuristicLab.Common;
30using HeuristicLab.MainForm;
31using HeuristicLab.MainForm.WindowsForms;
32using HeuristicLab.PluginInfrastructure;
33
34namespace HeuristicLab.Core.Views {
35  [View("ItemList View")]
36  [Content(typeof(ItemList<>), true)]
37  [Content(typeof(IItemList<>), false)]
38  public partial class ItemListView<T> : ItemView where T : class, IItem {
39    protected Dictionary<T, List<ListViewItem>> itemListViewItemMapping;
40    protected TypeSelectorDialog typeSelectorDialog;
41    protected bool validDragOperation;
42
43    public new IItemList<T> Content {
44      get { return (IItemList<T>)base.Content; }
45      set { base.Content = value; }
46    }
47
48    public ListView ItemsListView {
49      get { return itemsListView; }
50    }
51
52    public ItemListView() {
53      InitializeComponent();
54      itemListViewItemMapping = new Dictionary<T, List<ListViewItem>>();
55    }
56
57    protected override void Dispose(bool disposing) {
58      if (disposing) {
59        if (typeSelectorDialog != null) typeSelectorDialog.Dispose();
60        if (components != null) components.Dispose();
61      }
62      base.Dispose(disposing);
63    }
64
65    protected override void DeregisterContentEvents() {
66      Content.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsAdded);
67      Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsRemoved);
68      Content.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsReplaced);
69      Content.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsMoved);
70      Content.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_CollectionReset);
71      foreach (T item in itemListViewItemMapping.Keys) {
72        DeregisterItemEvents(item);
73      }
74      base.DeregisterContentEvents();
75    }
76    protected override void RegisterContentEvents() {
77      base.RegisterContentEvents();
78      Content.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsAdded);
79      Content.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsRemoved);
80      Content.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsReplaced);
81      Content.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsMoved);
82      Content.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_CollectionReset);
83    }
84    protected virtual void DeregisterItemEvents(T item) {
85      item.ItemImageChanged -= new EventHandler(Item_ItemImageChanged);
86      item.ToStringChanged -= new EventHandler(Item_ToStringChanged);
87    }
88    protected virtual void RegisterItemEvents(T item) {
89      item.ItemImageChanged += new EventHandler(Item_ItemImageChanged);
90      item.ToStringChanged += new EventHandler(Item_ToStringChanged);
91    }
92
93    protected override void OnContentChanged() {
94      base.OnContentChanged();
95
96      int selectedIndex = -1;
97      if (itemsListView.SelectedItems.Count == 1) selectedIndex = itemsListView.SelectedIndices[0];
98
99      itemsListView.Items.Clear();
100      itemListViewItemMapping.Clear();
101      RebuildImageList();
102      viewHost.Content = null;
103      if (Content != null) {
104        foreach (T item in Content)
105          AddListViewItem(CreateListViewItem(item));
106        AdjustListViewColumnSizes();
107        if ((selectedIndex != -1) && (selectedIndex < itemsListView.Items.Count))
108          itemsListView.Items[selectedIndex].Selected = true;
109      }
110      SetEnabledStateOfControls();
111    }
112
113    protected override void SetEnabledStateOfControls() {
114      base.SetEnabledStateOfControls();
115      if (Content == null) {
116        addButton.Enabled = false;
117        moveUpButton.Enabled = false;
118        moveDownButton.Enabled = false;
119        removeButton.Enabled = false;
120        itemsListView.Enabled = false;
121        detailsGroupBox.Enabled = false;
122      } else {
123        addButton.Enabled = !Content.IsReadOnly && !ReadOnly;
124        moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
125                               itemsListView.SelectedIndices[0] != 0 &&
126                               !Content.IsReadOnly && !ReadOnly;
127        moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
128                                 itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 &&
129                                 !Content.IsReadOnly && !ReadOnly;
130        removeButton.Enabled = itemsListView.SelectedItems.Count > 0 &&
131                               !Content.IsReadOnly && !ReadOnly;
132        itemsListView.Enabled = true;
133        detailsGroupBox.Enabled = itemsListView.SelectedItems.Count == 1;
134      }
135    }
136
137    protected virtual T CreateItem() {
138      if (typeSelectorDialog == null) {
139        typeSelectorDialog = new TypeSelectorDialog();
140        typeSelectorDialog.Caption = "Select Item";
141        typeSelectorDialog.TypeSelector.Caption = "Available Items";
142        typeSelectorDialog.TypeSelector.Configure(typeof(T), false, true);
143      }
144
145      if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
146        try {
147          return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
148        } catch (Exception ex) {
149          ErrorHandling.ShowErrorDialog(this, ex);
150        }
151      }
152      return null;
153    }
154    protected virtual ListViewItem CreateListViewItem(T item) {
155      ListViewItem listViewItem = new ListViewItem();
156      if (item == null) {
157        listViewItem.Text = "null";
158        itemsListView.SmallImageList.Images.Add(HeuristicLab.Common.Resources.VSImageLibrary.Nothing);
159        listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
160      } else {
161        listViewItem.Text = item.ToString();
162        listViewItem.ToolTipText = item.ItemName + ": " + item.ItemDescription;
163        itemsListView.SmallImageList.Images.Add(item.ItemImage);
164        listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
165        listViewItem.Tag = item;
166      }
167      return listViewItem;
168    }
169    protected virtual void AddListViewItem(ListViewItem listViewItem) {
170      if (listViewItem == null) throw new ArgumentNullException();
171      T item = (listViewItem.Tag as T);
172      itemsListView.Items.Add(listViewItem);
173      if (item != null) {
174        if (!itemListViewItemMapping.ContainsKey(item)) {
175          RegisterItemEvents(item);
176          itemListViewItemMapping.Add(item, new List<ListViewItem>());
177        }
178        itemListViewItemMapping[item].Add(listViewItem);
179      }
180    }
181    protected virtual void InsertListViewItem(int index, ListViewItem listViewItem) {
182      if (listViewItem == null) throw new ArgumentNullException();
183      T item = (listViewItem.Tag as T);
184      itemsListView.Items.Insert(index, listViewItem);
185      if (item != null) {
186        if (!itemListViewItemMapping.ContainsKey(item)) {
187          RegisterItemEvents(item);
188          itemListViewItemMapping.Add(item, new List<ListViewItem>());
189        }
190        itemListViewItemMapping[item].Add(listViewItem);
191      }
192    }
193    protected virtual void RemoveListViewItem(ListViewItem listViewItem) {
194      if (listViewItem == null) throw new ArgumentNullException();
195      T item = (listViewItem.Tag as T);
196      if (item != null) {
197        itemListViewItemMapping[item].Remove(listViewItem);
198        if (itemListViewItemMapping[item].Count == 0) {
199          itemListViewItemMapping.Remove(item);
200          DeregisterItemEvents(item);
201        }
202      }
203      listViewItem.Remove();
204    }
205    protected virtual void UpdateListViewItemImage(ListViewItem listViewItem) {
206      if (listViewItem == null) throw new ArgumentNullException();
207      T item = listViewItem.Tag as T;
208      int i = listViewItem.ImageIndex;
209      itemsListView.SmallImageList.Images[i] = item == null ? HeuristicLab.Common.Resources.VSImageLibrary.Nothing : item.ItemImage;
210      listViewItem.ImageIndex = -1;
211      listViewItem.ImageIndex = i;
212    }
213    protected virtual void UpdateListViewItemText(ListViewItem listViewItem) {
214      if (listViewItem == null) throw new ArgumentNullException();
215      T item = listViewItem.Tag as T;
216      listViewItem.Text = item == null ? "null" : item.ToString();
217      listViewItem.ToolTipText = item == null ? string.Empty : item.ItemName + ": " + item.ItemDescription;
218    }
219    protected virtual IEnumerable<ListViewItem> GetListViewItemsForItem(T item) {
220      if (item == null) {
221        List<ListViewItem> listViewItems = new List<ListViewItem>();
222        foreach (ListViewItem listViewItem in itemsListView.Items) {
223          if (listViewItem.Tag == null) listViewItems.Add(listViewItem);
224        }
225        return listViewItems;
226      } else {
227        List<ListViewItem> listViewItems = null;
228        itemListViewItemMapping.TryGetValue(item, out listViewItems);
229        return listViewItems == null ? Enumerable.Empty<ListViewItem>() : listViewItems;
230      }
231    }
232
233    #region ListView Events
234    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
235      moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
236                             itemsListView.SelectedIndices[0] != 0 &&
237                             (Content != null) && !Content.IsReadOnly && !ReadOnly;
238      moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
239                               itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 &&
240                               (Content != null) && !Content.IsReadOnly && !ReadOnly;
241      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 &&
242                             (Content != null) && !Content.IsReadOnly && !ReadOnly;
243      AdjustListViewColumnSizes();
244      if (itemsListView.SelectedItems.Count == 1) {
245        var item = (T)itemsListView.SelectedItems[0].Tag;
246        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
247        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this, true);
248        if (outermostViewHost != null && outermostViewHost.HotlinkingEnabled) {
249          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
250          outermostViewHost.ActiveView.Locked = Locked;
251        } else {
252          if (showDetailsCheckBox.Checked) {
253            detailsGroupBox.Enabled = true;
254            viewHost.Content = item;
255          } else {
256            viewHost.Content = null;
257            detailsGroupBox.Enabled = false;
258          }
259        }
260      }
261    }
262
263    protected virtual void itemsListView_KeyDown(object sender, KeyEventArgs e) {
264      if (e.KeyCode == Keys.Delete) {
265        if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
266          foreach (ListViewItem item in itemsListView.SelectedItems)
267            Content.RemoveAt(item.Index);
268        }
269      }
270    }
271
272    protected virtual void itemsListView_DoubleClick(object sender, EventArgs e) {
273      if (itemsListView.SelectedItems.Count == 1) {
274        var item = (T)itemsListView.SelectedItems[0].Tag;
275        var mainForm = MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();
276        var outermostViewHost = mainForm.ShowContentInOutermostViewHost(item, this);
277        if (outermostViewHost != null) {
278          outermostViewHost.ActiveView.ReadOnly = ReadOnly;
279          outermostViewHost.ActiveView.Locked = Locked;
280        }
281      }
282    }
283
284    protected virtual void itemsListView_ItemDrag(object sender, ItemDragEventArgs e) {
285      if (!Locked) {
286        List<T> items = new List<T>();
287        foreach (ListViewItem listViewItem in itemsListView.SelectedItems) {
288          T item = listViewItem.Tag as T;
289          if (item != null) items.Add(item);
290        }
291
292        if (items.Count > 0) {
293          DataObject data = new DataObject();
294          if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]);
295          else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items);
296          if (Content.IsReadOnly || ReadOnly) {
297            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
298          } else {
299            DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link | DragDropEffects.Move);
300            if ((result & DragDropEffects.Move) == DragDropEffects.Move) {
301              foreach (ListViewItem listViewItem in itemsListView.SelectedItems.Cast<ListViewItem>().ToArray()) {
302                if (listViewItem.Tag != null) Content.RemoveAt(listViewItem.Index);
303              }
304            }
305          }
306        }
307      }
308    }
309    protected virtual void itemsListView_DragEnter(object sender, DragEventArgs e) {
310      validDragOperation = false;
311      if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) {
312        validDragOperation = true;
313      } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) {
314        validDragOperation = true;
315        IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
316        foreach (object item in items)
317          validDragOperation = validDragOperation && (item is T);
318      }
319    }
320    protected virtual void itemsListView_DragOver(object sender, DragEventArgs e) {
321      e.Effect = DragDropEffects.None;
322      if (validDragOperation) {
323        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
324        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
325        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
326        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
327        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
328      }
329    }
330    protected virtual void itemsListView_DragDrop(object sender, DragEventArgs e) {
331      if (e.Effect != DragDropEffects.None) {
332        Point p = itemsListView.PointToClient(new Point(e.X, e.Y));
333        ListViewItem listViewItem = itemsListView.GetItemAt(p.X, p.Y);
334
335        if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) {
336          T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
337          if (listViewItem != null) Content.Insert(listViewItem.Index, e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
338          else Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
339        } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
340          IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>();
341          if (e.Effect.HasFlag(DragDropEffects.Copy)) {
342            Cloner cloner = new Cloner();
343            items = items.Select(x => cloner.Clone(x));
344          }
345          foreach (T item in items) {
346            if (listViewItem != null) Content.Insert(listViewItem.Index, item);
347            else Content.Add(item);
348          }
349        }
350      }
351    }
352    #endregion
353
354    #region Button Events
355    protected virtual void addButton_Click(object sender, EventArgs e) {
356      T item = CreateItem();
357      if (item != null)
358        Content.Add(item);
359    }
360    protected virtual void moveUpButton_Click(object sender, EventArgs e) {
361      if (itemsListView.SelectedItems.Count == 1) {
362        int index = itemsListView.SelectedIndices[0];
363        Content.Reverse(index - 1, 2);
364        itemsListView.Items[index].Selected = false;
365        itemsListView.Items[index - 1].Selected = true;
366      }
367    }
368    protected virtual void moveDownButton_Click(object sender, EventArgs e) {
369      if (itemsListView.SelectedItems.Count == 1) {
370        int index = itemsListView.SelectedIndices[0];
371        Content.Reverse(index, 2);
372        itemsListView.Items[index].Selected = false;
373        itemsListView.Items[index + 1].Selected = true;
374      }
375    }
376    protected virtual void removeButton_Click(object sender, EventArgs e) {
377      if (itemsListView.SelectedItems.Count > 0) {
378        foreach (ListViewItem item in itemsListView.SelectedItems)
379          Content.RemoveAt(item.Index);
380      }
381    }
382    #endregion
383
384    #region CheckBox Events
385    protected virtual void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
386      if (showDetailsCheckBox.Checked) {
387        splitContainer.Panel2Collapsed = false;
388        detailsGroupBox.Enabled = itemsListView.SelectedItems.Count == 1;
389        viewHost.Content = itemsListView.SelectedItems.Count == 1 ? (T)itemsListView.SelectedItems[0].Tag : null;
390      } else {
391        splitContainer.Panel2Collapsed = true;
392        viewHost.Content = null;
393      }
394    }
395    #endregion
396
397    #region Content Events
398    protected virtual void Content_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
399      if (InvokeRequired)
400        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsAdded), sender, e);
401      else {
402        foreach (IndexedItem<T> item in e.Items)
403          InsertListViewItem(item.Index, CreateListViewItem(item.Value));
404        AdjustListViewColumnSizes();
405      }
406    }
407    protected virtual void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
408      if (InvokeRequired)
409        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsRemoved), sender, e);
410      else {
411        List<ListViewItem> listViewItems = new List<ListViewItem>();
412        foreach (IndexedItem<T> item in e.Items)
413          listViewItems.Add(itemsListView.Items[item.Index]);
414        foreach (ListViewItem listViewItem in listViewItems)
415          RemoveListViewItem(listViewItem);
416        RebuildImageList();
417      }
418    }
419    protected virtual void Content_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
420      if (InvokeRequired)
421        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsReplaced), sender, e);
422      else {
423        int[] selected = new int[itemsListView.SelectedIndices.Count];
424        itemsListView.SelectedIndices.CopyTo(selected, 0);
425
426        List<ListViewItem> listViewItems = new List<ListViewItem>();
427        foreach (IndexedItem<T> item in e.OldItems)
428          listViewItems.Add(itemsListView.Items[item.Index]);
429        foreach (ListViewItem listViewItem in listViewItems)
430          RemoveListViewItem(listViewItem);
431        RebuildImageList();
432
433        foreach (IndexedItem<T> item in e.Items)
434          InsertListViewItem(item.Index, CreateListViewItem(item.Value));
435        AdjustListViewColumnSizes();
436
437        for (int i = 0; i < selected.Length; i++)
438          itemsListView.Items[selected[i]].Selected = true;
439      }
440    }
441    protected virtual void Content_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
442      if (InvokeRequired)
443        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_ItemsMoved), sender, e);
444      else {
445        foreach (IndexedItem<T> item in e.Items) {
446          ListViewItem listViewItem = itemsListView.Items[item.Index];
447          if (listViewItem.Tag != null)
448            itemListViewItemMapping[(T)listViewItem.Tag].Remove(listViewItem);
449          listViewItem.Tag = item.Value;
450          if (listViewItem.Tag != null)
451            itemListViewItemMapping[item.Value].Add(listViewItem);
452          UpdateListViewItemImage(listViewItem);
453          UpdateListViewItemText(listViewItem);
454        }
455      }
456    }
457    protected virtual void Content_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<T>> e) {
458      if (InvokeRequired)
459        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<T>>(Content_CollectionReset), sender, e);
460      else {
461        List<ListViewItem> listViewItems = new List<ListViewItem>();
462        foreach (IndexedItem<T> item in e.OldItems)
463          listViewItems.Add(itemsListView.Items[item.Index]);
464        foreach (ListViewItem listViewItem in listViewItems)
465          RemoveListViewItem(listViewItem);
466        RebuildImageList();
467
468        foreach (IndexedItem<T> item in e.Items)
469          InsertListViewItem(item.Index, CreateListViewItem(item.Value));
470        AdjustListViewColumnSizes();
471      }
472    }
473    #endregion
474
475    #region Item Events
476    protected virtual void Item_ItemImageChanged(object sender, EventArgs e) {
477      if (InvokeRequired)
478        Invoke(new EventHandler(Item_ItemImageChanged), sender, e);
479      else {
480        T item = (T)sender;
481        foreach (ListViewItem listViewItem in GetListViewItemsForItem(item))
482          UpdateListViewItemImage(listViewItem);
483      }
484    }
485    protected virtual void Item_ToStringChanged(object sender, EventArgs e) {
486      if (InvokeRequired)
487        Invoke(new EventHandler(Item_ToStringChanged), sender, e);
488      else {
489        T item = (T)sender;
490        foreach (ListViewItem listViewItem in GetListViewItemsForItem(item))
491          UpdateListViewItemText(listViewItem);
492        AdjustListViewColumnSizes();
493      }
494    }
495    #endregion
496
497    #region Helpers
498    protected virtual void AdjustListViewColumnSizes() {
499      if (itemsListView.Items.Count > 0) {
500        for (int i = 0; i < itemsListView.Columns.Count; i++)
501          itemsListView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
502      }
503    }
504    protected virtual void RebuildImageList() {
505      itemsListView.SmallImageList.Images.Clear();
506      foreach (ListViewItem listViewItem in itemsListView.Items) {
507        T item = listViewItem.Tag as T;
508        itemsListView.SmallImageList.Images.Add(item == null ? HeuristicLab.Common.Resources.VSImageLibrary.Nothing : item.ItemImage);
509        listViewItem.ImageIndex = itemsListView.SmallImageList.Images.Count - 1;
510      }
511    }
512    #endregion
513  }
514}
Note: See TracBrowser for help on using the repository browser.