Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3068


Ignore:
Timestamp:
03/16/10 17:14:35 (15 years ago)
Author:
gkronber
Message:

Worked on multi-select behavior of list views in deployment server interfaces. #891 (Refactor GUI for plugin management)

Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/HeuristicLab.DeploymentService.AdminClient.csproj

    r3045 r3068  
    8787    <Compile Include="LicenseView.Designer.cs">
    8888      <DependentUpon>LicenseView.cs</DependentUpon>
     89    </Compile>
     90    <Compile Include="MultiSelectListView.cs">
     91      <SubType>Component</SubType>
     92    </Compile>
     93    <Compile Include="MultiSelectListView.Designer.cs">
     94      <DependentUpon>MultiSelectListView.cs</DependentUpon>
    8995    </Compile>
    9096    <Compile Include="PluginComparisonView.cs">
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginEditor.Designer.cs

    r3045 r3068  
    2525    private void InitializeComponent() {
    2626      this.components = new System.ComponentModel.Container();
    27       this.listView = new System.Windows.Forms.ListView();
    28       this.nameHeader = new System.Windows.Forms.ColumnHeader();
    29       this.localVersion = new System.Windows.Forms.ColumnHeader();
    30       this.serverVersion = new System.Windows.Forms.ColumnHeader();
    3127      this.imageList = new System.Windows.Forms.ImageList(this.components);
    3228      this.refreshButton = new System.Windows.Forms.Button();
    3329      this.uploadButton = new System.Windows.Forms.Button();
     30      this.listView = new HeuristicLab.DeploymentService.AdminClient.MultiSelectListView();
     31      this.pluginNameHeader = new System.Windows.Forms.ColumnHeader();
     32      this.localVersionHeader = new System.Windows.Forms.ColumnHeader();
     33      this.serverVersionHeader = new System.Windows.Forms.ColumnHeader();
     34      this.descriptionHeader = new System.Windows.Forms.ColumnHeader();
    3435      this.SuspendLayout();
    35       //
    36       // listView
    37       //
    38       this.listView.Activation = System.Windows.Forms.ItemActivation.TwoClick;
    39       this.listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    40                   | System.Windows.Forms.AnchorStyles.Left)
    41                   | System.Windows.Forms.AnchorStyles.Right)));
    42       this.listView.CheckBoxes = true;
    43       this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
    44             this.nameHeader,
    45             this.localVersion,
    46             this.serverVersion});
    47       this.listView.Enabled = false;
    48       this.listView.FullRowSelect = true;
    49       this.listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
    50       this.listView.Location = new System.Drawing.Point(0, 30);
    51       this.listView.Name = "listView";
    52       this.listView.ShowGroups = false;
    53       this.listView.Size = new System.Drawing.Size(536, 446);
    54       this.listView.StateImageList = this.imageList;
    55       this.listView.TabIndex = 0;
    56       this.listView.UseCompatibleStateImageBehavior = false;
    57       this.listView.View = System.Windows.Forms.View.Details;
    58       this.listView.ItemActivate += new System.EventHandler(this.listView_ItemActivate);
    59       this.listView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView_ItemChecked);
    60       //
    61       // nameHeader
    62       //
    63       this.nameHeader.Text = "Name";
    64       this.nameHeader.Width = 188;
    65       //
    66       // localVersion
    67       //
    68       this.localVersion.Text = "Local version";
    69       this.localVersion.Width = 100;
    70       //
    71       // serverVersion
    72       //
    73       this.serverVersion.Text = "Server version";
    74       this.serverVersion.Width = 100;
    7536      //
    7637      // imageList
    7738      //
    78       this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     39      this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
    7940      this.imageList.ImageSize = new System.Drawing.Size(16, 16);
    8041      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
     
    10162      this.uploadButton.Click += new System.EventHandler(this.uploadButton_Click);
    10263      //
    103       // PluginListView
     64      // listView
     65      //
     66      this.listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     67                  | System.Windows.Forms.AnchorStyles.Left)
     68                  | System.Windows.Forms.AnchorStyles.Right)));
     69      this.listView.CheckBoxes = true;
     70      this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     71            this.pluginNameHeader,
     72            this.localVersionHeader,
     73            this.serverVersionHeader,
     74            this.descriptionHeader});
     75      this.listView.Location = new System.Drawing.Point(3, 32);
     76      this.listView.Name = "listView";
     77      this.listView.Size = new System.Drawing.Size(536, 444);
     78      this.listView.StateImageList = this.imageList;
     79      this.listView.SuppressItemCheckedEvents = false;
     80      this.listView.TabIndex = 8;
     81      this.listView.UseCompatibleStateImageBehavior = false;
     82      this.listView.View = System.Windows.Forms.View.Details;
     83      this.listView.ItemActivate += new System.EventHandler(this.listView_ItemActivate);
     84      this.listView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView_ItemChecked);
     85      //
     86      // pluginNameHeader
     87      //
     88      this.pluginNameHeader.Text = "Name";
     89      this.pluginNameHeader.Width = 161;
     90      //
     91      // localVersionHeader
     92      //
     93      this.localVersionHeader.Text = "Local Version";
     94      this.localVersionHeader.Width = 85;
     95      //
     96      // serverVersionHeader
     97      //
     98      this.serverVersionHeader.Text = "Server Version";
     99      this.serverVersionHeader.Width = 91;
     100      //
     101      // descriptionHeader
     102      //
     103      this.descriptionHeader.Text = "Description";
     104      this.descriptionHeader.Width = 194;
     105      //
     106      // PluginEditor
    104107      //
    105108      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    106109      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     110      this.Controls.Add(this.listView);
    107111      this.Controls.Add(this.uploadButton);
    108112      this.Controls.Add(this.refreshButton);
    109       this.Controls.Add(this.listView);
    110       this.Name = "PluginListView";
     113      this.Name = "PluginEditor";
    111114      this.Size = new System.Drawing.Size(539, 508);
    112115      this.ResumeLayout(false);
     
    116119    #endregion
    117120
    118     private System.Windows.Forms.ListView listView;
    119     private System.Windows.Forms.ColumnHeader nameHeader;
    120     private System.Windows.Forms.ColumnHeader localVersion;
    121     private System.Windows.Forms.ColumnHeader serverVersion;
    122121    private System.Windows.Forms.Button refreshButton;
    123122    private System.Windows.Forms.Button uploadButton;
    124123    private System.Windows.Forms.ImageList imageList;
     124    private MultiSelectListView listView;
     125    private System.Windows.Forms.ColumnHeader pluginNameHeader;
     126    private System.Windows.Forms.ColumnHeader localVersionHeader;
     127    private System.Windows.Forms.ColumnHeader serverVersionHeader;
     128    private System.Windows.Forms.ColumnHeader descriptionHeader;
    125129  }
    126130}
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginEditor.cs

    r3045 r3068  
    6161        // refresh the list view with plugins
    6262        listView.Items.Clear();
     63        listView.CheckBoxes = false;
     64        //suppressCheckedEvents = true;
    6365        foreach (var pair in localAndServerPlugins) {
    6466          var item = MakeListViewItem(pair.Key);
    6567          listView.Items.Add(item);
    6668        }
     69        //listView.suppressCheckedEvents = false;
     70        listView.CheckBoxes = true;
    6771        UpdateControlsConnectedState();
    6872      } else {
     
    108112
    109113        foreach (var plugin in IteratePlugins(selectedPlugins)) {
    110          adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin));
     114          adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin));
    111115        }
    112116        e.Cancel = false;
     
    156160    }
    157161
    158     private void listView_ItemChecked(object sender, ItemCheckedEventArgs e) {     
    159       // also check all dependencies
     162    private void listView_ItemChecked(object sender, ItemCheckedEventArgs e) {
     163      List<IPluginDescription> modifiedPlugins = new List<IPluginDescription>();
    160164      if (e.Item.Checked) {
    161         uploadButton.Enabled = true;
    162         var plugin = (IPluginDescription)e.Item.Tag;
    163         foreach (var dep in plugin.Dependencies) {
    164           var depItem = FindItemForPlugin(dep);
    165           if (!depItem.Checked) depItem.Checked = true;
    166         }
    167       } else {
    168         uploadButton.Enabled = (from i in listView.Items.Cast<ListViewItem>()
    169                                 where i.Checked
    170                                 select i).Any();
    171         // also uncheck all dependent plugins
    172         var plugin = (IPluginDescription)e.Item.Tag;
    173         foreach (ListViewItem item in listView.Items) {
    174           var dep = (IPluginDescription)item.Tag;
    175           if (dep.Dependencies.Contains(plugin) && item.Checked) {
    176             item.Checked = false;
     165        foreach (ListViewItem item in listView.SelectedItems) {
     166          var plugin = (IPluginDescription)item.Tag;
     167          // also check all dependencies
     168          modifiedPlugins.Add(plugin);
     169          foreach (var dep in GetAllDependencies(plugin)) {
     170            modifiedPlugins.Add(dep);
    177171          }
    178172        }
    179       }
     173        listView.CheckItems(modifiedPlugins.Select(x => FindItemForPlugin(x)));
     174      } else {
     175        foreach (ListViewItem item in listView.SelectedItems) {
     176          var plugin = (IPluginDescription)item.Tag;
     177          // also uncheck all dependent plugins
     178          modifiedPlugins.Add(plugin);
     179          foreach (var dep in GetAllDependents(plugin)) {
     180            modifiedPlugins.Add(dep);
     181          }
     182        }
     183        listView.UncheckItems(modifiedPlugins.Select(x => FindItemForPlugin(x)));
     184      }
     185      uploadButton.Enabled = (from i in listView.Items.OfType<ListViewItem>()
     186                              where i.Checked
     187                              select i).Any();
    180188    }
    181189    #endregion
    182190
    183191    #region helper methods
     192    private IEnumerable<IPluginDescription> GetAllDependents(IPluginDescription plugin) {
     193      return from p in localAndServerPlugins.Keys
     194             let matchingEntries = from dep in GetAllDependencies(p)
     195                                   where dep.Name == plugin.Name
     196                                   where dep.Version == plugin.Version
     197                                   select dep
     198             where matchingEntries.Any()
     199             select p;
     200    }
     201
     202    private IEnumerable<IPluginDescription> GetAllDependencies(IPluginDescription plugin) {
     203      foreach (var dep in plugin.Dependencies) {
     204        foreach (var recDep in GetAllDependencies(dep)) {
     205          yield return recDep;
     206        }
     207        yield return dep;
     208      }
     209    }
     210
     211    private IEnumerable<IPluginDescription> IteratePlugins(IEnumerable<IPluginDescription> plugins) {
     212      foreach (var plugin in plugins) {
     213        foreach (var dependency in IteratePlugins(plugin.Dependencies)) {
     214          yield return dependency;
     215        }
     216        yield return plugin;
     217      }
     218    }
     219
    184220    private byte[] CreateZipPackage(IPluginDescription plugin) {
    185221      using (MemoryStream stream = new MemoryStream()) {
     
    198234      ListViewItem item;
    199235      if (localAndServerPlugins[plugin] != null) {
    200         item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), localAndServerPlugins[plugin].Version.ToString() });
    201       } else {
    202         item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), string.Empty });
     236        item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(),
     237          localAndServerPlugins[plugin].Version.ToString(), localAndServerPlugins[plugin].Description });
     238      } else {
     239        item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(),
     240          string.Empty, plugin.Description });
    203241      }
    204242      item.Tag = plugin;
     
    217255                         select MakePluginDescription(dep);
    218256      return new PluginDeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies, plugin.ContactName, plugin.ContactEmail, plugin.LicenseText);
    219     }
    220 
    221     private IEnumerable<IPluginDescription> IteratePlugins(IEnumerable<IPluginDescription> plugins) {
    222       foreach (var plugin in plugins) {
    223         foreach (var dependency in IteratePlugins(plugin.Dependencies)) {
    224           yield return dependency;
    225         }
    226         yield return plugin;
    227       }
    228257    }
    229258
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.Designer.cs

    r3045 r3068  
    2929    private void InitializeComponent()
    3030    {
    31       this.listView = new System.Windows.Forms.ListView();
     31      this.listView = new HeuristicLab.DeploymentService.AdminClient.MultiSelectListView();
    3232      this.nameHeader = new System.Windows.Forms.ColumnHeader();
    3333      this.versionHeader = new System.Windows.Forms.ColumnHeader();
     
    4141            this.versionHeader});
    4242      this.listView.Dock = System.Windows.Forms.DockStyle.Fill;
    43       this.listView.FullRowSelect = true;
    4443      this.listView.Location = new System.Drawing.Point(0, 0);
    4544      this.listView.Name = "listView";
    4645      this.listView.Size = new System.Drawing.Size(341, 320);
    47       this.listView.TabIndex = 0;
     46      this.listView.TabIndex = 1;
    4847      this.listView.UseCompatibleStateImageBehavior = false;
    4948      this.listView.View = System.Windows.Forms.View.Details;
     
    7170    #endregion
    7271
    73     private System.Windows.Forms.ListView listView;
     72    private MultiSelectListView listView;
    7473    private System.Windows.Forms.ColumnHeader nameHeader;
    7574    private System.Windows.Forms.ColumnHeader versionHeader;
    76   }
     75
     76  }
    7777}
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.cs

    r3045 r3068  
    1010
    1111namespace HeuristicLab.DeploymentService.AdminClient {
     12  /// <summary>
     13  /// Wraps a ListView and adds functionality to automatically check and uncheck dependencies of plugins.
     14  /// </summary>
    1215  public partial class PluginListView : UserControl {
    1316    public event ItemCheckedEventHandler ItemChecked;
     
    1821      set {
    1922        plugins = value;
     23        checkedPlugins.Clear();
    2024        UpdateControls();
    2125      }
    2226    }
    2327
     28    private List<IPluginDescription> checkedPlugins = new List<IPluginDescription>();
    2429    public IEnumerable<IPluginDescription> CheckedPlugins {
    2530      get {
    26         return from item in listView.Items.OfType<ListViewItem>()
    27                where item.Checked
    28                select item.Tag as IPluginDescription;
     31        return checkedPlugins;
    2932      }
    3033    }
    31 
    32     private bool suppressItemCheckedEvents = false;
    3334
    3435    public PluginListView() {
     
    3738
    3839    public void CheckPlugin(IPluginDescription plugin) {
    39       var items = FindItemsForPlugin(plugin);
    40       if (items.Count() == 0) throw new ArgumentException();
    41       var item = items.Single();
    42       if (!item.Checked) {
    43         suppressItemCheckedEvents = true;
    44         item.Checked = true;
    45         suppressItemCheckedEvents = false;
    46       }
     40      MarkPluginChecked(plugin);
     41      listView.CheckItems(new IPluginDescription[] { plugin }.Select(x => FindItemsForPlugin(x).Single()));
    4742    }
     43
    4844
    4945    private void UpdateControls() {
    5046      if (plugins != null) {
    5147        listView.Items.Clear();
    52         suppressItemCheckedEvents = true;
     48        listView.SuppressItemCheckedEvents = true;
    5349        foreach (var plugin in plugins) {
    5450          listView.Items.Add(CreateListViewItem(plugin));
    5551        }
    56         suppressItemCheckedEvents = false;
     52        listView.SuppressItemCheckedEvents = false;
    5753      }
    5854    }
     
    6056    private ListViewItem CreateListViewItem(IPluginDescription plugin) {
    6157      var item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString() });
     58      item.Checked = (from p in checkedPlugins where p.Name == plugin.Name where p.Version == plugin.Version select p).Any();
    6259      item.Tag = plugin;
    6360      return item;
     
    6562
    6663    private void listView_ItemChecked(object sender, ItemCheckedEventArgs e) {
    67       if (suppressItemCheckedEvents) return;
     64      List<IPluginDescription> modifiedPlugins = new List<IPluginDescription>();
    6865      if (e.Item.Checked) {
    69         // also check all dependencies
    70         suppressItemCheckedEvents = true;
    71         var dependencies = GetAllDependencies(e.Item.Tag as IPluginDescription);
    72         foreach (var dep in dependencies) {
    73           var item = FindItemsForPlugin(dep).Single();
    74           if (!item.Checked) item.Checked = true;
     66        foreach (ListViewItem item in listView.SelectedItems) {
     67          var plugin = (IPluginDescription)item.Tag;
     68          // also check all dependencies
     69          MarkPluginChecked(plugin);
     70          modifiedPlugins.Add(plugin);
     71          foreach (var dep in GetAllDependencies(plugin)) {
     72            MarkPluginChecked(dep);
     73            modifiedPlugins.Add(dep);
     74          }
    7575        }
    76         suppressItemCheckedEvents = false;
     76        listView.CheckItems(modifiedPlugins.Select(x => FindItemsForPlugin(x).Single()));
     77        OnItemChecked(e);
    7778      } else {
    78         // also uncheck all dependencies
    79         suppressItemCheckedEvents = true;
    80         var dependents = GetAllDependents(e.Item.Tag as IPluginDescription);
    81         foreach (var dep in dependents) {
    82           var item = FindItemsForPlugin(dep).Single();
    83           if (item.Checked) item.Checked = false;
     79        foreach (ListViewItem item in listView.SelectedItems) {
     80          var plugin = (IPluginDescription)item.Tag;
     81          // also uncheck all dependent plugins
     82          MarkPluginUnchecked(plugin);
     83          modifiedPlugins.Add(plugin);
     84          foreach (var dep in GetAllDependents(plugin)) {
     85            MarkPluginUnchecked(dep);
     86            modifiedPlugins.Add(dep);
     87          }
     88
    8489        }
    85         suppressItemCheckedEvents = false;
     90        listView.UncheckItems(modifiedPlugins.Select(x => FindItemsForPlugin(x).Single()));
     91        OnItemChecked(e);
    8692      }
    87       OnItemChecked(e);
     93    }
     94
     95    private void MarkPluginChecked(IPluginDescription plugin) {
     96      var matching = from p in checkedPlugins
     97                     where p.Name == plugin.Name
     98                     where p.Version == plugin.Version
     99                     select p;
     100      if (!matching.Any()) checkedPlugins.Add(plugin);
     101    }
     102
     103    private void MarkPluginUnchecked(IPluginDescription plugin) {
     104      checkedPlugins = (from p in checkedPlugins
     105                        where p.Name != plugin.Name ||
     106                              p.Version != plugin.Version
     107                        select p).ToList();
    88108    }
    89109
     
    116136
    117137    private void OnItemChecked(ItemCheckedEventArgs e) {
    118       if (ItemChecked != null && !suppressItemCheckedEvents) ItemChecked(this, e);
     138      if (ItemChecked != null) ItemChecked(this, e);
    119139    }
    120140  }
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.resx

    r2860 r3068  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    121     <value>17, 17</value>
    122   </metadata>
    123120</root>
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/ConnectionSetupView.cs

    r3006 r3068  
    4747        form = new Form();
    4848        form.Name = this.Name;
     49        form.Size = this.Size;
    4950        this.Dock = DockStyle.Fill;
    5051        form.Controls.Add(this);
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/LocalPluginManager.Designer.cs

    r3006 r3068  
    2626      this.components = new System.ComponentModel.Container();
    2727      System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Active Plugins", System.Windows.Forms.HorizontalAlignment.Left);
    28       System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Disabled Plugins", System.Windows.Forms.HorizontalAlignment.Left);
    29       this.localPluginsListView = new System.Windows.Forms.ListView();
    30       this.pluginNameHeader = new System.Windows.Forms.ColumnHeader();
     28      System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Inactive Plugins", System.Windows.Forms.HorizontalAlignment.Left);
     29      this.imageListForLocalItems = new System.Windows.Forms.ImageList(this.components);
     30      this.localPluginsListView = new HeuristicLab.PluginInfrastructure.Advanced.MultiSelectListView();
     31      this.nameHeader = new System.Windows.Forms.ColumnHeader();
    3132      this.versionHeader = new System.Windows.Forms.ColumnHeader();
    32       this.pluginDescriptionHeader = new System.Windows.Forms.ColumnHeader();
    33       this.imageListForLocalItems = new System.Windows.Forms.ImageList(this.components);
     33      this.descriptionHeader = new System.Windows.Forms.ColumnHeader();
    3434      this.SuspendLayout();
     35      //
     36      // imageListForLocalItems
     37      //
     38      this.imageListForLocalItems.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
     39      this.imageListForLocalItems.ImageSize = new System.Drawing.Size(13, 13);
     40      this.imageListForLocalItems.TransparentColor = System.Drawing.Color.Transparent;
    3541      //
    3642      // localPluginsListView
     
    3844      this.localPluginsListView.CheckBoxes = true;
    3945      this.localPluginsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
    40             this.pluginNameHeader,
     46            this.nameHeader,
    4147            this.versionHeader,
    42             this.pluginDescriptionHeader});
     48            this.descriptionHeader});
    4349      this.localPluginsListView.Dock = System.Windows.Forms.DockStyle.Fill;
    44       this.localPluginsListView.FullRowSelect = true;
    4550      listViewGroup1.Header = "Active Plugins";
    4651      listViewGroup1.Name = "activePluginsGroup";
    47       listViewGroup2.Header = "Disabled Plugins";
    48       listViewGroup2.Name = "disabledPluginsGroup";
     52      listViewGroup2.Header = "Inactive Plugins";
     53      listViewGroup2.Name = "inactivePluginsGroup";
    4954      this.localPluginsListView.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] {
    5055            listViewGroup1,
     
    5459      this.localPluginsListView.Size = new System.Drawing.Size(570, 547);
    5560      this.localPluginsListView.StateImageList = this.imageListForLocalItems;
    56       this.localPluginsListView.TabIndex = 8;
     61      this.localPluginsListView.SuppressItemCheckedEvents = false;
     62      this.localPluginsListView.TabIndex = 9;
    5763      this.localPluginsListView.UseCompatibleStateImageBehavior = false;
    5864      this.localPluginsListView.View = System.Windows.Forms.View.Details;
     
    6066      this.localPluginsListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.pluginsListView_ItemChecked);
    6167      //
    62       // pluginNameHeader
     68      // nameHeader
    6369      //
    64       this.pluginNameHeader.Text = "Name";
    65       this.pluginNameHeader.Width = 220;
     70      this.nameHeader.Text = "Name";
     71      this.nameHeader.Width = 155;
    6672      //
    6773      // versionHeader
    6874      //
    6975      this.versionHeader.Text = "Version";
    70       this.versionHeader.Width = 120;
     76      this.versionHeader.Width = 92;
    7177      //
    72       // pluginDescriptionHeader
     78      // descriptionHeader
    7379      //
    74       this.pluginDescriptionHeader.Text = "Description";
    75       this.pluginDescriptionHeader.Width = 243;
    76       //
    77       // imageListForLocalItems
    78       //
    79       this.imageListForLocalItems.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
    80       this.imageListForLocalItems.ImageSize = new System.Drawing.Size(13, 13);
    81       this.imageListForLocalItems.TransparentColor = System.Drawing.Color.Transparent;
     80      this.descriptionHeader.Text = "Description";
     81      this.descriptionHeader.Width = 316;
    8282      //
    8383      // LocalPluginManager
     
    9494    #endregion
    9595
    96     private System.Windows.Forms.ListView localPluginsListView;
    97     private System.Windows.Forms.ColumnHeader pluginNameHeader;
     96    private System.Windows.Forms.ImageList imageListForLocalItems;
     97    private MultiSelectListView localPluginsListView;
     98    private System.Windows.Forms.ColumnHeader nameHeader;
    9899    private System.Windows.Forms.ColumnHeader versionHeader;
    99     private System.Windows.Forms.ColumnHeader pluginDescriptionHeader;
    100     private System.Windows.Forms.ImageList imageListForLocalItems;
     100    private System.Windows.Forms.ColumnHeader descriptionHeader;
    101101  }
    102102}
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/LocalPluginManager.cs

    r3006 r3068  
    5252    private void UpdateControl() {
    5353      ClearPluginList();
     54      localPluginsListView.SuppressItemCheckedEvents = true;
    5455      foreach (var plugin in plugins) {
    5556        var item = CreateListViewItem(plugin);
     
    6162        localPluginsListView.Items.Add(item);
    6263      }
     64      localPluginsListView.SuppressItemCheckedEvents = false;
    6365    }
    6466
     
    7880      // checked items are marked for removal
    7981      if (e.Item.Checked) {
    80         var plugin = (IPluginDescription)e.Item.Tag;
    81         foreach (ListViewItem item in localPluginsListView.Items) {
    82           var dep = (IPluginDescription)item.Tag;
    83           if (!item.Checked && dep.Dependencies.Contains(plugin)) {
    84             item.Checked = true;
     82        List<ListViewItem> modifiedItems = new List<ListViewItem>();
     83        foreach (ListViewItem item in localPluginsListView.SelectedItems) {
     84          var plugin = (IPluginDescription)item.Tag;
     85          modifiedItems.Add(item);
     86          // also uncheck all dependent plugins
     87          foreach (ListViewItem dependentItem in localPluginsListView.Items) {
     88            var dependent = (IPluginDescription)dependentItem.Tag;
     89            if (!dependentItem.Checked && (from dep in dependent.Dependencies
     90                                           where dep.Name == plugin.Name
     91                                           where dep.Version == plugin.Version
     92                                           select dep).Any()) {
     93              modifiedItems.Add(dependentItem);
     94            }
    8595          }
    8696        }
     97        localPluginsListView.CheckItems(modifiedItems);
     98      } else {
     99        List<ListViewItem> modifiedItems = new List<ListViewItem>();
     100        foreach (ListViewItem item in localPluginsListView.SelectedItems) {
     101          var plugin = (IPluginDescription)item.Tag;
     102          modifiedItems.Add(item);
     103        }
     104        localPluginsListView.UncheckItems(modifiedItems);
    87105      }
    88106      OnItemChecked(e);
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/RemotePluginInstaller.Designer.cs

    r2922 r3068  
    2525    private void InitializeComponent() {
    2626      this.components = new System.ComponentModel.Container();
    27       System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Available Products", System.Windows.Forms.HorizontalAlignment.Left);
    28       System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Available Plugins (Most Recent Version)", System.Windows.Forms.HorizontalAlignment.Left);
    29       System.Windows.Forms.ListViewGroup listViewGroup3 = new System.Windows.Forms.ListViewGroup("Available Plugins (All Versions)", System.Windows.Forms.HorizontalAlignment.Left);
    30       this.remotePluginsListView = new System.Windows.Forms.ListView();
    31       this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
    32       this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
    33       this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
     27      System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Products", System.Windows.Forms.HorizontalAlignment.Left);
     28      System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("New Plugins", System.Windows.Forms.HorizontalAlignment.Left);
     29      System.Windows.Forms.ListViewGroup listViewGroup3 = new System.Windows.Forms.ListViewGroup("All Plugins", System.Windows.Forms.HorizontalAlignment.Left);
    3430      this.imageListForRemoteItems = new System.Windows.Forms.ImageList(this.components);
     31      this.remotePluginsListView = new HeuristicLab.PluginInfrastructure.Advanced.MultiSelectListView();
     32      this.nameHeader = new System.Windows.Forms.ColumnHeader();
     33      this.versionHeader = new System.Windows.Forms.ColumnHeader();
     34      this.descriptionHeader = new System.Windows.Forms.ColumnHeader();
    3535      this.SuspendLayout();
     36      //
     37      // imageListForRemoteItems
     38      //
     39      this.imageListForRemoteItems.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
     40      this.imageListForRemoteItems.ImageSize = new System.Drawing.Size(13, 13);
     41      this.imageListForRemoteItems.TransparentColor = System.Drawing.Color.Transparent;
    3642      //
    3743      // remotePluginsListView
     
    3945      this.remotePluginsListView.CheckBoxes = true;
    4046      this.remotePluginsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
    41             this.columnHeader1,
    42             this.columnHeader2,
    43             this.columnHeader3});
     47            this.nameHeader,
     48            this.versionHeader,
     49            this.descriptionHeader});
    4450      this.remotePluginsListView.Dock = System.Windows.Forms.DockStyle.Fill;
    45       this.remotePluginsListView.FullRowSelect = true;
    46       listViewGroup1.Header = "Available Products";
     51      listViewGroup1.Header = "Products";
    4752      listViewGroup1.Name = "productsGroup";
    48       listViewGroup2.Header = "Available Plugins (Most Recent Version)";
     53      listViewGroup2.Header = "New Plugins";
    4954      listViewGroup2.Name = "newPluginsGroup";
    50       listViewGroup3.Header = "Available Plugins (All Versions)";
     55      listViewGroup3.Header = "All Plugins";
    5156      listViewGroup3.Name = "allPluginsGroup";
    5257      this.remotePluginsListView.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] {
     
    5863      this.remotePluginsListView.Size = new System.Drawing.Size(533, 558);
    5964      this.remotePluginsListView.StateImageList = this.imageListForRemoteItems;
    60       this.remotePluginsListView.TabIndex = 10;
     65      this.remotePluginsListView.SuppressItemCheckedEvents = false;
     66      this.remotePluginsListView.TabIndex = 0;
    6167      this.remotePluginsListView.UseCompatibleStateImageBehavior = false;
    6268      this.remotePluginsListView.View = System.Windows.Forms.View.Details;
    6369      this.remotePluginsListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.remotePluginsListView_ItemChecked);
    6470      //
    65       // columnHeader1
     71      // nameHeader
    6672      //
    67       this.columnHeader1.Text = "Name";
    68       this.columnHeader1.Width = 220;
     73      this.nameHeader.Text = "Name";
     74      this.nameHeader.Width = 115;
    6975      //
    70       // columnHeader2
     76      // versionHeader
    7177      //
    72       this.columnHeader2.Text = "Version";
    73       this.columnHeader2.Width = 120;
     78      this.versionHeader.Text = "Version";
     79      this.versionHeader.Width = 161;
    7480      //
    75       // columnHeader3
     81      // descriptionHeader
    7682      //
    77       this.columnHeader3.Text = "Description";
    78       this.columnHeader3.Width = 240;
    79       //
    80       // imageListForRemoteItems
    81       //
    82       this.imageListForRemoteItems.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
    83       this.imageListForRemoteItems.ImageSize = new System.Drawing.Size(13, 13);
    84       this.imageListForRemoteItems.TransparentColor = System.Drawing.Color.Transparent;
     83      this.descriptionHeader.Text = "Description";
     84      this.descriptionHeader.Width = 250;
    8585      //
    8686      // RemotePluginInstaller
     
    9797    #endregion
    9898
    99     private System.Windows.Forms.ListView remotePluginsListView;
    100     private System.Windows.Forms.ColumnHeader columnHeader1;
    101     private System.Windows.Forms.ColumnHeader columnHeader2;
    102     private System.Windows.Forms.ColumnHeader columnHeader3;
    10399    private System.Windows.Forms.ImageList imageListForRemoteItems;
     100    private MultiSelectListView remotePluginsListView;
     101    private System.Windows.Forms.ColumnHeader nameHeader;
     102    private System.Windows.Forms.ColumnHeader versionHeader;
     103    private System.Windows.Forms.ColumnHeader descriptionHeader;
    104104  }
    105105}
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/RemotePluginInstaller.cs

    r2922 r3068  
    7272    private void UpdateControl() {
    7373      ClearListView();
    74 
     74      remotePluginsListView.SuppressItemCheckedEvents = true;
    7575      foreach (var newPlugin in NewPlugins) {
    7676        var item = CreateListViewItem(newPlugin);
     
    9090        remotePluginsListView.Items.Add(item);
    9191      }
     92      remotePluginsListView.SuppressItemCheckedEvents = false;
    9293    }
    9394
     
    111112    #region item checked event handler
    112113    private void remotePluginsListView_ItemChecked(object sender, ItemCheckedEventArgs e) {
    113       // dispatch by check state and type of item (product/plugin)
    114       IPluginDescription plugin = e.Item.Tag as IPluginDescription;
    115       if (plugin != null)
    116         if (e.Item.Checked)
    117           HandlePluginChecked(plugin);
    118         else
    119           HandlePluginUnchecked(plugin);
    120       else {
    121         DeploymentService.ProductDescription product = e.Item.Tag as DeploymentService.ProductDescription;
    122         if (product != null)
     114      foreach (ListViewItem item in remotePluginsListView.SelectedItems) {
     115        // dispatch by check state and type of item (product/plugin)
     116        IPluginDescription plugin = item.Tag as IPluginDescription;
     117        if (plugin != null)
    123118          if (e.Item.Checked)
    124             HandleProductChecked(product);
     119            HandlePluginChecked(plugin);
    125120          else
    126             HandleProductUnchecked(product);
     121            HandlePluginUnchecked(plugin);
     122        else {
     123          DeploymentService.ProductDescription product = item.Tag as DeploymentService.ProductDescription;
     124          if (product != null)
     125            if (e.Item.Checked)
     126              HandleProductChecked(product);
     127            else
     128              HandleProductUnchecked(product);
     129        }
    127130      }
    128131      OnItemChecked(e);
     
    131134    private void HandleProductUnchecked(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription product) {
    132135      // also uncheck the plugins of the product
     136      List<ListViewItem> modifiedItems = new List<ListViewItem>();
     137      modifiedItems.Add(FindItemForProduct(product));
    133138      foreach (var plugin in product.Plugins) {
    134139        var item = FindItemForPlugin(plugin);
    135140        if (item != null && item.Checked)
    136           item.Checked = false;
    137       }
     141          modifiedItems.Add(item);
     142      }
     143      remotePluginsListView.UncheckItems(modifiedItems);
    138144    }
    139145
    140146    private void HandleProductChecked(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription product) {
    141147      // also check all plugins of the product
     148      List<ListViewItem> modifiedItems = new List<ListViewItem>();
     149      modifiedItems.Add(FindItemForProduct(product));
    142150      foreach (var plugin in product.Plugins) {
    143151        var item = FindItemForPlugin(plugin);
    144152        if (item != null && !item.Checked) {
    145           item.Checked = true;
    146         }
    147       }
     153          modifiedItems.Add(item);
     154        }
     155      }
     156      remotePluginsListView.CheckItems(modifiedItems);
    148157    }
    149158
    150159    private void HandlePluginUnchecked(IPluginDescription plugin) {
    151160      // also uncheck all dependent plugins
     161      List<ListViewItem> modifiedItems = new List<ListViewItem>();
     162      modifiedItems.Add(FindItemForPlugin(plugin));
    152163      var dependentPlugins = from otherPlugin in plugins
    153164                             where otherPlugin.Dependencies.Any(dep => dep.Name == plugin.Name && dep.Version == plugin.Version)
     
    156167        var item = FindItemForPlugin(dependentPlugin);
    157168        if (item != null && item.Checked) {
    158           item.Checked = false;
     169          modifiedItems.Add(item);
    159170        }
    160171      }
     
    166177        var item = FindItemForProduct(dependentProduct);
    167178        if (item != null && item.Checked) {
    168           item.Checked = false;
    169         }
    170       }
     179          modifiedItems.Add(item);
     180        }
     181      }
     182      remotePluginsListView.UncheckItems(modifiedItems);
    171183    }
    172184
    173185    private void HandlePluginChecked(IPluginDescription plugin) {
    174186      // also check all dependencies
     187      List<ListViewItem> modifiedItems = new List<ListViewItem>();
     188      modifiedItems.Add(FindItemForPlugin(plugin));
    175189      foreach (var dep in plugin.Dependencies) {
    176190        var item = FindItemForPlugin(dep);
    177191        if (item != null && !item.Checked) {
    178           item.Checked = true;
    179         }
    180       }
     192          modifiedItems.Add(item);
     193        }
     194      }
     195      remotePluginsListView.CheckItems(modifiedItems);
    181196    }
    182197
  • trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj

    r3006 r3068  
    139139    <Compile Include="Advanced\InstallationManagerControl.Designer.cs">
    140140      <DependentUpon>InstallationManagerControl.cs</DependentUpon>
     141    </Compile>
     142    <Compile Include="Advanced\MultiSelectListView.cs">
     143      <SubType>Component</SubType>
     144    </Compile>
     145    <Compile Include="Advanced\MultiSelectListView.Designer.cs">
     146      <DependentUpon>MultiSelectListView.cs</DependentUpon>
    141147    </Compile>
    142148    <Compile Include="Advanced\PluginView.cs">
Note: See TracChangeset for help on using the changeset viewer.