Changeset 1645


Ignore:
Timestamp:
04/23/09 17:55:47 (12 years ago)
Author:
aleitner
Message:

refactored AddClients with recursive calls of groups (#600)

Location:
trunk/sources/HeuristicLab.Hive.Server.Console/3.2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.Designer.cs

    r1628 r1645  
    3131      this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    3232      this.jobToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     33      this.ilLargeImgClient = new System.Windows.Forms.ImageList(this.components);
    3334      this.ilLargeImgJob = new System.Windows.Forms.ImageList(this.components);
    34       this.ilLargeImgClient = new System.Windows.Forms.ImageList(this.components);
    3535      this.plClientDetails = new System.Windows.Forms.Panel();
    3636      this.lblState = new System.Windows.Forms.Label();
     
    8181      this.smallIconsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    8282      this.listToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     83      this.ilSmallImgClient = new System.Windows.Forms.ImageList(this.components);
    8384      this.ilSmallImgJob = new System.Windows.Forms.ImageList(this.components);
    84       this.ilSmallImgClient = new System.Windows.Forms.ImageList(this.components);
     85      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
     86      this.tvClientControl = new System.Windows.Forms.TreeView();
     87      this.splitContainer2 = new System.Windows.Forms.SplitContainer();
     88      this.tvJobControl = new System.Windows.Forms.TreeView();
    8589      this.menuStrip1.SuspendLayout();
    8690      this.plClientDetails.SuspendLayout();
     
    101105      this.scClientControl.SuspendLayout();
    102106      this.tcManagementConsole.SuspendLayout();
     107      this.splitContainer1.Panel1.SuspendLayout();
     108      this.splitContainer1.Panel2.SuspendLayout();
     109      this.splitContainer1.SuspendLayout();
     110      this.splitContainer2.Panel1.SuspendLayout();
     111      this.splitContainer2.Panel2.SuspendLayout();
     112      this.splitContainer2.SuspendLayout();
    103113      this.SuspendLayout();
    104114      //
     
    126136      //
    127137      this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
    128       this.closeToolStripMenuItem.Size = new System.Drawing.Size(111, 22);
     138      this.closeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
    129139      this.closeToolStripMenuItem.Text = "Close";
    130140      this.closeToolStripMenuItem.Click += new System.EventHandler(this.Close_Click);
     
    145155      this.jobToolStripMenuItem.Click += new System.EventHandler(this.AddJob_Click);
    146156      //
     157      // ilLargeImgClient
     158      //
     159      this.ilLargeImgClient.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilLargeImgClient.ImageStream")));
     160      this.ilLargeImgClient.TransparentColor = System.Drawing.Color.Transparent;
     161      this.ilLargeImgClient.Images.SetKeyName(0, "monitor-green.png");
     162      this.ilLargeImgClient.Images.SetKeyName(1, "monitor-orange.png");
     163      this.ilLargeImgClient.Images.SetKeyName(2, "monitor-red.png");
     164      this.ilLargeImgClient.Images.SetKeyName(3, "monitor-gray.png");
     165      //
    147166      // ilLargeImgJob
    148167      //
    149168      this.ilLargeImgJob.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilLargeImgJob.ImageStream")));
    150169      this.ilLargeImgJob.TransparentColor = System.Drawing.Color.Transparent;
    151       this.ilLargeImgJob.Images.SetKeyName(0, "monitor-green.png");
    152       this.ilLargeImgJob.Images.SetKeyName(1, "monitor-orange.png");
    153       this.ilLargeImgJob.Images.SetKeyName(2, "monitor-red.png");
    154       this.ilLargeImgJob.Images.SetKeyName(3, "monitor-gray.png");
    155       //
    156       // ilLargeImgClient
    157       //
    158       this.ilLargeImgClient.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilLargeImgClient.ImageStream")));
    159       this.ilLargeImgClient.TransparentColor = System.Drawing.Color.Transparent;
    160       this.ilLargeImgClient.Images.SetKeyName(0, "PlayHS.png");
     170      this.ilLargeImgJob.Images.SetKeyName(0, "PlayHS.png");
    161171      //
    162172      // plClientDetails
     
    433443      //
    434444      this.treeView2.Dock = System.Windows.Forms.DockStyle.Fill;
    435       this.treeView2.LineColor = System.Drawing.Color.Empty;
    436445      this.treeView2.Location = new System.Drawing.Point(0, 0);
    437446      this.treeView2.Name = "treeView2";
     
    482491      // scJobControl.Panel1
    483492      //
    484       this.scJobControl.Panel1.Controls.Add(this.lvJobControl);
     493      this.scJobControl.Panel1.Controls.Add(this.splitContainer2);
    485494      //
    486495      // scJobControl.Panel2
     
    496505      this.lvJobControl.ContextMenuStrip = this.contextMenuJob;
    497506      this.lvJobControl.Dock = System.Windows.Forms.DockStyle.Fill;
    498       this.lvJobControl.LargeImageList = this.ilLargeImgJob;
     507      this.lvJobControl.LargeImageList = this.ilLargeImgClient;
    499508      this.lvJobControl.Location = new System.Drawing.Point(0, 0);
    500509      this.lvJobControl.MultiSelect = false;
    501510      this.lvJobControl.Name = "lvJobControl";
    502       this.lvJobControl.Size = new System.Drawing.Size(454, 386);
    503       this.lvJobControl.SmallImageList = this.ilSmallImgJob;
     511      this.lvJobControl.Size = new System.Drawing.Size(299, 386);
     512      this.lvJobControl.SmallImageList = this.ilSmallImgClient;
    504513      this.lvJobControl.TabIndex = 0;
    505514      this.lvJobControl.UseCompatibleStateImageBehavior = false;
     
    548557      // scClientControl.Panel1
    549558      //
    550       this.scClientControl.Panel1.Controls.Add(this.lvClientControl);
     559      this.scClientControl.Panel1.Controls.Add(this.splitContainer1);
    551560      //
    552561      // scClientControl.Panel2
     
    562571      this.lvClientControl.Dock = System.Windows.Forms.DockStyle.Fill;
    563572      this.lvClientControl.ImeMode = System.Windows.Forms.ImeMode.Off;
    564       this.lvClientControl.LargeImageList = this.ilLargeImgClient;
     573      this.lvClientControl.LargeImageList = this.ilLargeImgJob;
    565574      this.lvClientControl.Location = new System.Drawing.Point(0, 0);
    566575      this.lvClientControl.MultiSelect = false;
    567576      this.lvClientControl.Name = "lvClientControl";
    568       this.lvClientControl.Size = new System.Drawing.Size(454, 386);
    569       this.lvClientControl.SmallImageList = this.ilSmallImgClient;
     577      this.lvClientControl.Size = new System.Drawing.Size(299, 386);
     578      this.lvClientControl.SmallImageList = this.ilSmallImgJob;
    570579      this.lvClientControl.TabIndex = 0;
    571580      this.lvClientControl.UseCompatibleStateImageBehavior = false;
     
    626635      this.listToolStripMenuItem.Click += new System.EventHandler(this.listToolStripMenuItem_Click);
    627636      //
     637      // ilSmallImgClient
     638      //
     639      this.ilSmallImgClient.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilSmallImgClient.ImageStream")));
     640      this.ilSmallImgClient.TransparentColor = System.Drawing.Color.Transparent;
     641      this.ilSmallImgClient.Images.SetKeyName(0, "monitor-green.png");
     642      this.ilSmallImgClient.Images.SetKeyName(1, "monitor-orange.png");
     643      this.ilSmallImgClient.Images.SetKeyName(2, "monitor-red.png");
     644      this.ilSmallImgClient.Images.SetKeyName(3, "monitor-gray.png");
     645      //
    628646      // ilSmallImgJob
    629647      //
    630648      this.ilSmallImgJob.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilSmallImgJob.ImageStream")));
    631649      this.ilSmallImgJob.TransparentColor = System.Drawing.Color.Transparent;
    632       this.ilSmallImgJob.Images.SetKeyName(0, "monitor-green.png");
    633       this.ilSmallImgJob.Images.SetKeyName(1, "monitor-orange.png");
    634       this.ilSmallImgJob.Images.SetKeyName(2, "monitor-red.png");
    635       this.ilSmallImgJob.Images.SetKeyName(3, "monitor-gray.png");
    636       //
    637       // ilSmallImgClient
    638       //
    639       this.ilSmallImgClient.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("ilSmallImgClient.ImageStream")));
    640       this.ilSmallImgClient.TransparentColor = System.Drawing.Color.Transparent;
    641       this.ilSmallImgClient.Images.SetKeyName(0, "PlayHS.png");
     650      this.ilSmallImgJob.Images.SetKeyName(0, "PlayHS.png");
     651      //
     652      // splitContainer1
     653      //
     654      this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
     655      this.splitContainer1.Location = new System.Drawing.Point(0, 0);
     656      this.splitContainer1.Name = "splitContainer1";
     657      //
     658      // splitContainer1.Panel1
     659      //
     660      this.splitContainer1.Panel1.Controls.Add(this.tvClientControl);
     661      //
     662      // splitContainer1.Panel2
     663      //
     664      this.splitContainer1.Panel2.Controls.Add(this.lvClientControl);
     665      this.splitContainer1.Size = new System.Drawing.Size(454, 386);
     666      this.splitContainer1.SplitterDistance = 151;
     667      this.splitContainer1.TabIndex = 0;
     668      //
     669      // tvClientControl
     670      //
     671      this.tvClientControl.Dock = System.Windows.Forms.DockStyle.Fill;
     672      this.tvClientControl.Location = new System.Drawing.Point(0, 0);
     673      this.tvClientControl.Name = "tvClientControl";
     674      this.tvClientControl.Size = new System.Drawing.Size(151, 386);
     675      this.tvClientControl.TabIndex = 0;
     676      //
     677      // splitContainer2
     678      //
     679      this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
     680      this.splitContainer2.Location = new System.Drawing.Point(0, 0);
     681      this.splitContainer2.Name = "splitContainer2";
     682      //
     683      // splitContainer2.Panel1
     684      //
     685      this.splitContainer2.Panel1.Controls.Add(this.tvJobControl);
     686      //
     687      // splitContainer2.Panel2
     688      //
     689      this.splitContainer2.Panel2.Controls.Add(this.lvJobControl);
     690      this.splitContainer2.Size = new System.Drawing.Size(454, 386);
     691      this.splitContainer2.SplitterDistance = 151;
     692      this.splitContainer2.TabIndex = 0;
     693      //
     694      // tvJobControl
     695      //
     696      this.tvJobControl.Dock = System.Windows.Forms.DockStyle.Fill;
     697      this.tvJobControl.Location = new System.Drawing.Point(0, 0);
     698      this.tvJobControl.Name = "tvJobControl";
     699      this.tvJobControl.Size = new System.Drawing.Size(151, 386);
     700      this.tvJobControl.TabIndex = 0;
    642701      //
    643702      // HiveServerManagementConsole
     
    674733      this.scClientControl.ResumeLayout(false);
    675734      this.tcManagementConsole.ResumeLayout(false);
     735      this.splitContainer1.Panel1.ResumeLayout(false);
     736      this.splitContainer1.Panel2.ResumeLayout(false);
     737      this.splitContainer1.ResumeLayout(false);
     738      this.splitContainer2.Panel1.ResumeLayout(false);
     739      this.splitContainer2.Panel2.ResumeLayout(false);
     740      this.splitContainer2.ResumeLayout(false);
    676741      this.ResumeLayout(false);
    677742      this.PerformLayout();
     
    686751    private System.Windows.Forms.TreeView treeView2;
    687752    private System.Windows.Forms.ListView listView2;
    688     private System.Windows.Forms.ImageList ilLargeImgJob;
     753    private System.Windows.Forms.ImageList ilLargeImgClient;
    689754    private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
    690755    private System.Windows.Forms.ToolStripMenuItem jobToolStripMenuItem;
    691756    private System.Windows.Forms.Timer timerSyncronize;
    692     private System.Windows.Forms.ImageList ilLargeImgClient;
     757    private System.Windows.Forms.ImageList ilLargeImgJob;
    693758    private System.Windows.Forms.Panel plClientDetails;
    694759    private System.Windows.Forms.PictureBox pbClientControl;
     
    736801    private System.Windows.Forms.ToolStripMenuItem smallIconsToolStripMenuItem;
    737802    private System.Windows.Forms.ToolStripMenuItem listToolStripMenuItem;
     803    private System.Windows.Forms.ImageList ilSmallImgClient;
    738804    private System.Windows.Forms.ImageList ilSmallImgJob;
    739     private System.Windows.Forms.ImageList ilSmallImgClient;
     805    private System.Windows.Forms.SplitContainer splitContainer1;
     806    private System.Windows.Forms.TreeView tvClientControl;
     807    private System.Windows.Forms.SplitContainer splitContainer2;
     808    private System.Windows.Forms.TreeView tvJobControl;
    740809  }
    741810}
  • trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.cs

    r1628 r1645  
    3434namespace HeuristicLab.Hive.Server.ServerConsole {
    3535
     36  /// <summary>
     37  /// if form is closed the loginform gets an information
     38  /// </summary>
     39  /// <param name="cf"></param>
     40  /// <param name="error"></param>
    3641  public delegate void closeForm(bool cf, bool error);
    3742
     
    4550    private ResponseList<Job> jobs = null;
    4651
     52    //TODO delete
    4753    private Dictionary<Guid, ListViewGroup> clientObjects;
    4854    private Dictionary<Guid, ListViewItem> clientInfoObjects;
     
    5157    private Job currentJob = null;
    5258    private ClientInfo currentClient = null;
     59
     60    //TODO delete
    5361    private string nameCurrentJob = "";
    5462    private string nameCurrentClient = "";
     
    5967
    6068    private ToolTip tt = new ToolTip();
     69
     70    private IClientManager ClientManager {
     71      get {
     72        return ServiceLocator.GetClientManager();
     73      }
     74
     75    }
    6176    #endregion
    6277
     
    89104
    90105    private Guid ConvertStringToGuid(string stringGuid) {
    91       Guid guid = Guid.Empty;
    92       return (Guid)TypeDescriptor.GetConverter(guid).ConvertFrom(stringGuid);
     106      return new Guid(stringGuid);
    93107    }
    94108
     
    100114        IJobManager jobManager = ServiceLocator.GetJobManager();
    101115        if (lvJobControl.SelectedItems.Count == 1) {
    102           jobManager.AbortJob(ConvertStringToGuid(lvJobControl.SelectedItems[0].Text));
     116          jobManager.AbortJob(((Job)(lvJobControl.SelectedItems[0].Tag)).Id);
    103117        }
    104118      };
    105119
     120      //adding context menu items for jobs
    106121      menuItemGetSnapshot.Click += (s, e) => {
    107122        IJobManager jobManager = ServiceLocator.GetJobManager();
    108123        if (lvJobControl.SelectedItems.Count == 1) {
    109           jobManager.RequestSnapshot(ConvertStringToGuid(lvJobControl.SelectedItems[0].Text));
     124          jobManager.RequestSnapshot(((Job)(lvJobControl.SelectedItems[0].Tag)).Id);
    110125        }
    111126      };
     
    119134      ListViewHitTestInfo hitTestInfo = lvJobControl.HitTest(e.Location);
    120135      if (e.Button == MouseButtons.Right && hitTestInfo.Item != null && lvJobControl.SelectedItems.Count == 1) {
    121         Guid selectedJobGuid = ConvertStringToGuid(lvJobControl.SelectedItems[0].Text);
    122         Job selectedJob = jobs.List.FirstOrDefault(x => x.Id == selectedJobGuid);
     136        Job selectedJob = (Job)lvJobControl.SelectedItems[0].Tag;
    123137
    124138        if (selectedJob != null && selectedJob.State == State.calculating) {
    125         lvJobControl.ContextMenuStrip.Items.Add(menuItemAbortJob);
    126         lvJobControl.ContextMenuStrip.Items.Add(menuItemGetSnapshot);
    127         }
    128       }
    129        lvJobControl.ContextMenuStrip.Show(new Point(e.X, e.Y));
    130     }
    131 
    132     /// <summary>
    133     /// Adds clients to ListView and TreeView
    134     /// </summary>
     139          lvJobControl.ContextMenuStrip.Items.Add(menuItemAbortJob);
     140          lvJobControl.ContextMenuStrip.Items.Add(menuItemGetSnapshot);
     141        }
     142      }
     143      lvJobControl.ContextMenuStrip.Show(new Point(e.X, e.Y));
     144    }
     145
     146    ///// <summary>
     147    ///// Adds clients to ListView and TreeView
     148    ///// </summary>
     149    //private void AddClients() {
     150    //  try {
     151    //    clientObjects = new Dictionary<Guid, ListViewGroup>();
     152    //    clientInfoObjects = new Dictionary<Guid, ListViewItem>();
     153
     154    //    clients = ClientManager.GetAllClientGroups();
     155
     156    //    List<Guid> inGroup = new List<Guid>();
     157    //    foreach (ClientGroup cg in clients.List) {
     158    //      TreeNode tn = new TreeNode(cg.Name);
     159    //      tn.Tag = cg;
     160    //      tvClientControl.Nodes.Add(tn);
     161
     162    //      ListViewGroup lvg = new ListViewGroup(cg.Name, HorizontalAlignment.Left);
     163                             
     164    //      foreach (ClientInfo ci in cg.Resources) {
     165    //        ListViewItem item = null;
     166    //        if ((ci.State == State.offline) || (ci.State == State.nullState)) {
     167    //          item = new ListViewItem(ci.Name, 3, lvg);
     168    //        } else {
     169    //          int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);
     170    //          int usage = 0;
     171    //          if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
     172    //            usage = 0;
     173    //          } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
     174    //            usage = 1;
     175    //          } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
     176    //            usage = 2;
     177    //          }
     178
     179    //          item = new ListViewItem(ci.Name, usage, lvg);
     180    //        }
     181    //        item.Tag = ci.Id;
     182    //        lvClientControl.Items.Add(item);
     183    //        clientInfoObjects.Add(ci.Id, item);
     184    //        inGroup.Add(ci.Id);
     185
     186    //      }
     187    //      lvClientControl.BeginUpdate();
     188    //      lvClientControl.Groups.Add(lvg);
     189    //      lvClientControl.EndUpdate();
     190    //      clientObjects.Add(cg.Id, lvg);
     191    //    } // Groups
     192
     193    //    clientInfo = ClientManager.GetAllClients();
     194    //    ListViewGroup lvunsorted = new ListViewGroup("no group", HorizontalAlignment.Left);
     195    //    foreach (ClientInfo ci in clientInfo.List) {
     196    //      bool help = false;
     197    //      foreach (Guid client in inGroup) {
     198    //        if (client == ci.Id) {
     199    //          help = true;
     200    //          break;
     201    //        }
     202    //      }
     203    //      if (!help) {
     204    //        ListViewItem item = null;
     205    //        if ((ci.State == State.offline) || (ci.State == State.nullState)) {
     206    //          item = new ListViewItem(ci.Name, 3, lvunsorted);
     207    //        } else {
     208    //          int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);
     209    //          int usage = 0;
     210    //          if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
     211    //            usage = 0;
     212    //          } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
     213    //            usage = 1;
     214    //          } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
     215    //            usage = 2;
     216    //          }
     217    //          item = new ListViewItem(ci.Name, usage, lvunsorted);
     218    //        }
     219    //        item.Tag = ci.Id;
     220    //        lvClientControl.Items.Add(item);
     221    //      }
     222    //    }
     223    //    lvClientControl.BeginUpdate();
     224    //    lvClientControl.Groups.Add(lvunsorted);
     225    //    lvClientControl.EndUpdate();
     226    //    if (flagClient) {
     227    //      ClientClicked();
     228    //    }
     229    //  }
     230    //  catch (Exception ex) {
     231    //    closeFormEvent(true, true);
     232    //    this.Close();
     233    //  }
     234    //}
     235
    135236    private void AddClients() {
    136       try {
    137         clientObjects = new Dictionary<Guid, ListViewGroup>();
    138         clientInfoObjects = new Dictionary<Guid, ListViewItem>();
    139         IClientManager clientManager =
    140           ServiceLocator.GetClientManager();
    141 
    142         clients = clientManager.GetAllClientGroups();
    143         lvClientControl.Items.Clear();
    144         List<Guid> inGroup = new List<Guid>();
     237        clients = ClientManager.GetAllClientGroups();
     238
    145239        foreach (ClientGroup cg in clients.List) {
    146           ListViewGroup lvg = new ListViewGroup(cg.Name, HorizontalAlignment.Left);
    147           foreach (ClientInfo ci in cg.Resources) {
    148             ListViewItem item = null;
    149             if ((ci.State == State.offline) || (ci.State == State.nullState)) {
    150               item = new ListViewItem(ci.Name, 3, lvg);
    151             } else {
    152               int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);
    153               int usage = 0;
    154               if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
    155                 usage = 0;
    156               } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
    157                 usage = 1;
    158               } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
    159                 usage = 2;
    160               }
    161 
    162               item = new ListViewItem(ci.Name, usage, lvg);
    163             }
    164             item.Tag = ci.Id;
    165             lvClientControl.Items.Add(item);
    166             clientInfoObjects.Add(ci.Id, item);
    167             inGroup.Add(ci.Id);
    168 
    169           }
    170           lvClientControl.BeginUpdate();
    171           lvClientControl.Groups.Add(lvg);
    172           lvClientControl.EndUpdate();
    173           clientObjects.Add(cg.Id, lvg);
    174         } // Groups
    175 
    176         clientInfo = clientManager.GetAllClients();
    177         ListViewGroup lvunsorted = new ListViewGroup("no group", HorizontalAlignment.Left);
    178         foreach (ClientInfo ci in clientInfo.List) {
    179           bool help = false;
    180           foreach (Guid client in inGroup) {
    181             if (client == ci.Id) {
    182               help = true;
    183               break;
    184             }
    185           }
    186           if (!help) {
    187             ListViewItem item = null;
    188             if ((ci.State == State.offline) || (ci.State == State.nullState)) {
    189               item = new ListViewItem(ci.Name, 3, lvunsorted);
    190             } else {
    191               int percentageUsage = CapacityRam(ci.NrOfCores, ci.NrOfFreeCores);
    192               int usage = 0;
    193               if ((percentageUsage >= 0) && (percentageUsage <= 25)) {
    194                 usage = 0;
    195               } else if ((percentageUsage > 25) && (percentageUsage <= 75)) {
    196                 usage = 1;
    197               } else if ((percentageUsage > 75) && (percentageUsage <= 100)) {
    198                 usage = 2;
    199               }
    200               item = new ListViewItem(ci.Name, usage, lvunsorted);
    201             }
    202             item.Tag = ci.Id;
    203             lvClientControl.Items.Add(item);
    204           }
    205         }
    206         lvClientControl.BeginUpdate();
    207         lvClientControl.Groups.Add(lvunsorted);
    208         lvClientControl.EndUpdate();
    209         if (flagClient) {
    210           ClientClicked();
    211         }
    212       }
    213       catch (Exception ex) {
    214         closeFormEvent(true, true);
    215         this.Close();
    216       }
     240          AddClientOrGroup(cg, null);
     241        }
     242    }
     243
     244    private void AddClientOrGroup(ClientGroup clientGroup, TreeNode currentNode) {
     245      currentNode = CreateTreeNode(clientGroup, currentNode);
     246      ListViewGroup lvg = new ListViewGroup(clientGroup.Name, HorizontalAlignment.Left);
     247
     248      foreach (Resource resource in clientGroup.Resources) {
     249        if (resource is ClientInfo) {
     250          ListViewItem lvi = new ListViewItem(resource.Name, 0, lvg);
     251          lvi.Tag = resource as ClientInfo;
     252          // has to be added to lvClientControl, not group
     253          lvClientControl.Items.Add(lvi);
     254        } else if (resource is ClientGroup) {
     255          AddClientOrGroup(resource as ClientGroup, currentNode);
     256        }
     257      }
     258      if (lvg.Items.Count > 0) {
     259        lvClientControl.Groups.Add(lvg);
     260      }
     261    }
     262
     263    private TreeNode CreateTreeNode(ClientGroup clientGroup, TreeNode currentNode) {
     264       TreeNode tn;
     265      if(string.IsNullOrEmpty(clientGroup.Name)) {
     266         tn = new TreeNode("No group");
     267      } else {
     268         tn = new TreeNode(clientGroup.Name);
     269      }
     270      tn.Tag = clientGroup;
     271      if (currentNode == null) {
     272        tvClientControl.Nodes.Add(tn);
     273      } else {
     274        currentNode.Nodes.Add(tn);
     275      }
     276      return tn;
    217277    }
    218278
     
    243303          if (job.State == State.calculating) {
    244304            ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobCalculating);
     305            lvi.Tag = job;
    245306            jobObjects.Add(job.Id, lvi);
    246307
     
    250311          } else if (job.State == State.finished) {
    251312            ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobFinished);
     313            lvi.Tag = job;
    252314            jobObjects.Add(job.Id, lvi);
    253315            //lvJobControl.Items.Add(lvi);
    254316          } else if (job.State == State.offline) {
    255317            ListViewItem lvi = new ListViewItem(job.Id.ToString(), 0, lvJobPending);
     318            lvi.Tag = job;
    256319            jobObjects.Add(job.Id, lvi);
    257320            //lvJobControl.Items.Add(lvi);
     
    298361        }
    299362      }
    300       pbClientControl.Image = ilLargeImgJob.Images[usage];
     363      pbClientControl.Image = ilLargeImgClient.Images[usage];
    301364      lblClientName.Text = currentClient.Name;
    302365      lblLogin.Text = currentClient.Login.ToString();
     
    316379      lvSnapshots.Enabled = true;
    317380      currentJob = jobs.List[i];
    318       pbJobControl.Image = ilLargeImgClient.Images[0];
     381      pbJobControl.Image = ilLargeImgJob.Images[0];
    319382      lblJobName.Text = currentJob.Id.ToString();
    320383      progressJob.Value = (int)(currentJob.Percentage * 100);
  • trunk/sources/HeuristicLab.Hive.Server.Console/3.2/HiveServerManagementConsole.resx

    r1628 r1645  
    121121    <value>32, 12</value>
    122122  </metadata>
    123   <metadata name="ilLargeImgJob.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     123  <metadata name="ilLargeImgClient.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124124    <value>129, 12</value>
    125125  </metadata>
    126   <data name="ilLargeImgJob.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
     126  <data name="ilLargeImgClient.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
    127127    <value>
    128128        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
     
    231231</value>
    232232  </data>
    233   <metadata name="ilLargeImgClient.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     233  <metadata name="ilLargeImgJob.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    234234    <value>228, 11</value>
    235235  </metadata>
    236   <data name="ilLargeImgClient.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
     236  <data name="ilLargeImgJob.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
    237237    <value>
    238238        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
     
    289289    <value>462, 9</value>
    290290  </metadata>
    291   <metadata name="updaterWoker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    292     <value>388, 41</value>
    293   </metadata>
     291  <metadata name="ilSmallImgJob.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     292    <value>137, 50</value>
     293  </metadata>
     294  <data name="ilSmallImgJob.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
     295    <value>
     296        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
     297        LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
     298        ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC0
     299        BwAAAk1TRnQBSQFMAwEBAAEFAQABBAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
     300        AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
     301        AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
     302        AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm
     303        AwABmQMAAcwCAAEzAwACMwIAATMBZgIAATMBmQIAATMBzAIAATMB/wIAAWYDAAFmATMCAAJmAgABZgGZ
     304        AgABZgHMAgABZgH/AgABmQMAAZkBMwIAAZkBZgIAApkCAAGZAcwCAAGZAf8CAAHMAwABzAEzAgABzAFm
     305        AgABzAGZAgACzAIAAcwB/wIAAf8BZgIAAf8BmQIAAf8BzAEAATMB/wIAAf8BAAEzAQABMwEAAWYBAAEz
     306        AQABmQEAATMBAAHMAQABMwEAAf8BAAH/ATMCAAMzAQACMwFmAQACMwGZAQACMwHMAQACMwH/AQABMwFm
     307        AgABMwFmATMBAAEzAmYBAAEzAWYBmQEAATMBZgHMAQABMwFmAf8BAAEzAZkCAAEzAZkBMwEAATMBmQFm
     308        AQABMwKZAQABMwGZAcwBAAEzAZkB/wEAATMBzAIAATMBzAEzAQABMwHMAWYBAAEzAcwBmQEAATMCzAEA
     309        ATMBzAH/AQABMwH/ATMBAAEzAf8BZgEAATMB/wGZAQABMwH/AcwBAAEzAv8BAAFmAwABZgEAATMBAAFm
     310        AQABZgEAAWYBAAGZAQABZgEAAcwBAAFmAQAB/wEAAWYBMwIAAWYCMwEAAWYBMwFmAQABZgEzAZkBAAFm
     311        ATMBzAEAAWYBMwH/AQACZgIAAmYBMwEAA2YBAAJmAZkBAAJmAcwBAAFmAZkCAAFmAZkBMwEAAWYBmQFm
     312        AQABZgKZAQABZgGZAcwBAAFmAZkB/wEAAWYBzAIAAWYBzAEzAQABZgHMAZkBAAFmAswBAAFmAcwB/wEA
     313        AWYB/wIAAWYB/wEzAQABZgH/AZkBAAFmAf8BzAEAAcwBAAH/AQAB/wEAAcwBAAKZAgABmQEzAZkBAAGZ
     314        AQABmQEAAZkBAAHMAQABmQMAAZkCMwEAAZkBAAFmAQABmQEzAcwBAAGZAQAB/wEAAZkBZgIAAZkBZgEz
     315        AQABmQEzAWYBAAGZAWYBmQEAAZkBZgHMAQABmQEzAf8BAAKZATMBAAKZAWYBAAOZAQACmQHMAQACmQH/
     316        AQABmQHMAgABmQHMATMBAAFmAcwBZgEAAZkBzAGZAQABmQLMAQABmQHMAf8BAAGZAf8CAAGZAf8BMwEA
     317        AZkBzAFmAQABmQH/AZkBAAGZAf8BzAEAAZkC/wEAAcwDAAGZAQABMwEAAcwBAAFmAQABzAEAAZkBAAHM
     318        AQABzAEAAZkBMwIAAcwCMwEAAcwBMwFmAQABzAEzAZkBAAHMATMBzAEAAcwBMwH/AQABzAFmAgABzAFm
     319        ATMBAAGZAmYBAAHMAWYBmQEAAcwBZgHMAQABmQFmAf8BAAHMAZkCAAHMAZkBMwEAAcwBmQFmAQABzAKZ
     320        AQABzAGZAcwBAAHMAZkB/wEAAswCAALMATMBAALMAWYBAALMAZkBAAPMAQACzAH/AQABzAH/AgABzAH/
     321        ATMBAAGZAf8BZgEAAcwB/wGZAQABzAH/AcwBAAHMAv8BAAHMAQABMwEAAf8BAAFmAQAB/wEAAZkBAAHM
     322        ATMCAAH/AjMBAAH/ATMBZgEAAf8BMwGZAQAB/wEzAcwBAAH/ATMB/wEAAf8BZgIAAf8BZgEzAQABzAJm
     323        AQAB/wFmAZkBAAH/AWYBzAEAAcwBZgH/AQAB/wGZAgAB/wGZATMBAAH/AZkBZgEAAf8CmQEAAf8BmQHM
     324        AQAB/wGZAf8BAAH/AcwCAAH/AcwBMwEAAf8BzAFmAQAB/wHMAZkBAAH/AswBAAH/AcwB/wEAAv8BMwEA
     325        AcwB/wFmAQAC/wGZAQAC/wHMAQACZgH/AQABZgH/AWYBAAFmAv8BAAH/AmYBAAH/AWYB/wEAAv8BZgEA
     326        ASEBAAGlAQADXwEAA3cBAAOGAQADlgEAA8sBAAOyAQAD1wEAA90BAAPjAQAD6gEAA/EBAAP4AQAB8AH7
     327        Af8BAAGkAqABAAOAAwAB/wIAAf8DAAL/AQAB/wMAAf8BAAH/AQAC/wIAA/+GAAGhPwABJwGhPgABKAEn
     328        AaE9AAJJAScBoTwAAUkBTwFJAScBoTsAAUkBcgFPAUkBJwGhOgABTwGXAXIBTwFJASgBoTkAAU8ClwFy
     329        AUkBpzoAAVABlwEIAUkBpzsAAXIBCAFJAac8AAFyAUkBpz0AAXIBpz4AAad6AAFCAU0BPgcAAT4DAAEo
     330        AwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAC/wYAAv8GAAH7Af8GAAH5Af8GAAH4Af8GAAH4AX8GAAH4
     331        AT8GAAH4AR8GAAH4AQ8GAAH4AR8GAAH4AT8GAAH4AX8GAAH4Af8GAAH5Af8GAAH7Af8GAAL/BgAL
     332</value>
     333  </data>
    294334  <metadata name="contextMenuJob.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    295335    <value>252, 44</value>
    296336  </metadata>
    297   <metadata name="ilSmallImgJob.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     337  <metadata name="ilSmallImgClient.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    298338    <value>17, 50</value>
    299339  </metadata>
    300   <data name="ilSmallImgJob.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
     340  <data name="ilSmallImgClient.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
    301341    <value>
    302342        AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
     
    359399</value>
    360400  </data>
    361   <metadata name="ilSmallImgClient.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    362     <value>137, 50</value>
    363   </metadata>
    364   <data name="ilSmallImgClient.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
    365     <value>
    366         AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
    367         LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
    368         ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAC0
    369         BwAAAk1TRnQBSQFMAwEBAAEFAQABBAEAARABAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
    370         AUADAAEQAwABAQEAAQgGAAEEGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEA
    371         AfABygGmAQABMwUAATMBAAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEA
    372         AYABfAH/AQACUAH/AQABkwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFm
    373         AwABmQMAAcwCAAEzAwACMwIAATMBZgIAATMBmQIAATMBzAIAATMB/wIAAWYDAAFmATMCAAJmAgABZgGZ
    374         AgABZgHMAgABZgH/AgABmQMAAZkBMwIAAZkBZgIAApkCAAGZAcwCAAGZAf8CAAHMAwABzAEzAgABzAFm
    375         AgABzAGZAgACzAIAAcwB/wIAAf8BZgIAAf8BmQIAAf8BzAEAATMB/wIAAf8BAAEzAQABMwEAAWYBAAEz
    376         AQABmQEAATMBAAHMAQABMwEAAf8BAAH/ATMCAAMzAQACMwFmAQACMwGZAQACMwHMAQACMwH/AQABMwFm
    377         AgABMwFmATMBAAEzAmYBAAEzAWYBmQEAATMBZgHMAQABMwFmAf8BAAEzAZkCAAEzAZkBMwEAATMBmQFm
    378         AQABMwKZAQABMwGZAcwBAAEzAZkB/wEAATMBzAIAATMBzAEzAQABMwHMAWYBAAEzAcwBmQEAATMCzAEA
    379         ATMBzAH/AQABMwH/ATMBAAEzAf8BZgEAATMB/wGZAQABMwH/AcwBAAEzAv8BAAFmAwABZgEAATMBAAFm
    380         AQABZgEAAWYBAAGZAQABZgEAAcwBAAFmAQAB/wEAAWYBMwIAAWYCMwEAAWYBMwFmAQABZgEzAZkBAAFm
    381         ATMBzAEAAWYBMwH/AQACZgIAAmYBMwEAA2YBAAJmAZkBAAJmAcwBAAFmAZkCAAFmAZkBMwEAAWYBmQFm
    382         AQABZgKZAQABZgGZAcwBAAFmAZkB/wEAAWYBzAIAAWYBzAEzAQABZgHMAZkBAAFmAswBAAFmAcwB/wEA
    383         AWYB/wIAAWYB/wEzAQABZgH/AZkBAAFmAf8BzAEAAcwBAAH/AQAB/wEAAcwBAAKZAgABmQEzAZkBAAGZ
    384         AQABmQEAAZkBAAHMAQABmQMAAZkCMwEAAZkBAAFmAQABmQEzAcwBAAGZAQAB/wEAAZkBZgIAAZkBZgEz
    385         AQABmQEzAWYBAAGZAWYBmQEAAZkBZgHMAQABmQEzAf8BAAKZATMBAAKZAWYBAAOZAQACmQHMAQACmQH/
    386         AQABmQHMAgABmQHMATMBAAFmAcwBZgEAAZkBzAGZAQABmQLMAQABmQHMAf8BAAGZAf8CAAGZAf8BMwEA
    387         AZkBzAFmAQABmQH/AZkBAAGZAf8BzAEAAZkC/wEAAcwDAAGZAQABMwEAAcwBAAFmAQABzAEAAZkBAAHM
    388         AQABzAEAAZkBMwIAAcwCMwEAAcwBMwFmAQABzAEzAZkBAAHMATMBzAEAAcwBMwH/AQABzAFmAgABzAFm
    389         ATMBAAGZAmYBAAHMAWYBmQEAAcwBZgHMAQABmQFmAf8BAAHMAZkCAAHMAZkBMwEAAcwBmQFmAQABzAKZ
    390         AQABzAGZAcwBAAHMAZkB/wEAAswCAALMATMBAALMAWYBAALMAZkBAAPMAQACzAH/AQABzAH/AgABzAH/
    391         ATMBAAGZAf8BZgEAAcwB/wGZAQABzAH/AcwBAAHMAv8BAAHMAQABMwEAAf8BAAFmAQAB/wEAAZkBAAHM
    392         ATMCAAH/AjMBAAH/ATMBZgEAAf8BMwGZAQAB/wEzAcwBAAH/ATMB/wEAAf8BZgIAAf8BZgEzAQABzAJm
    393         AQAB/wFmAZkBAAH/AWYBzAEAAcwBZgH/AQAB/wGZAgAB/wGZATMBAAH/AZkBZgEAAf8CmQEAAf8BmQHM
    394         AQAB/wGZAf8BAAH/AcwCAAH/AcwBMwEAAf8BzAFmAQAB/wHMAZkBAAH/AswBAAH/AcwB/wEAAv8BMwEA
    395         AcwB/wFmAQAC/wGZAQAC/wHMAQACZgH/AQABZgH/AWYBAAFmAv8BAAH/AmYBAAH/AWYB/wEAAv8BZgEA
    396         ASEBAAGlAQADXwEAA3cBAAOGAQADlgEAA8sBAAOyAQAD1wEAA90BAAPjAQAD6gEAA/EBAAP4AQAB8AH7
    397         Af8BAAGkAqABAAOAAwAB/wIAAf8DAAL/AQAB/wMAAf8BAAH/AQAC/wIAA/+GAAGhPwABJwGhPgABKAEn
    398         AaE9AAJJAScBoTwAAUkBTwFJAScBoTsAAUkBcgFPAUkBJwGhOgABTwGXAXIBTwFJASgBoTkAAU8ClwFy
    399         AUkBpzoAAVABlwEIAUkBpzsAAXIBCAFJAac8AAFyAUkBpz0AAXIBpz4AAad6AAFCAU0BPgcAAT4DAAEo
    400         AwABQAMAARADAAEBAQABAQUAAYAXAAP/AQAC/wYAAv8GAAH7Af8GAAH5Af8GAAH4Af8GAAH4AX8GAAH4
    401         AT8GAAH4AR8GAAH4AQ8GAAH4AR8GAAH4AT8GAAH4AX8GAAH4Af8GAAH5Af8GAAH7Af8GAAL/BgAL
    402 </value>
    403   </data>
     401  <metadata name="updaterWoker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     402    <value>388, 41</value>
     403  </metadata>
    404404</root>
Note: See TracChangeset for help on using the changeset viewer.