Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/15/09 15:12:22 (15 years ago)
Author:
aleitner
Message:

updated job-detail panel (#452)

File:
1 edited

Legend:

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

    r1126 r1136  
    4040    public event closeForm closeFormEvent;
    4141
    42     ResponseList<ClientGroup> clients = null;
    43     ResponseList<ClientInfo> clientInfo = null;
    44     ResponseList<Job> jobs = null;
    45     ResponseList<UserGroup> userGroups = null;
    46     ResponseList<User> usersList = null;
    47     ListView lvClientDetails = null;
    48 
    49     Job currentJob = null;
    50     ClientInfo currentClient = null;
    51     User currentUser = null;
     42    #region private variables
     43    private ResponseList<ClientGroup> clients = null;
     44    private ResponseList<ClientInfo> clientInfo = null;
     45    private ResponseList<Job> jobs = null;
     46    private ResponseList<UserGroup> userGroups = null;
     47    private ResponseList<User> usersList = null;
     48
     49    private Job currentJob = null;
     50    private ClientInfo currentClient = null;
     51    private User currentUser = null;
     52    private int idxCurrentJob = 0;
     53    private int idxCurrentClient = 0;
     54    private int idxCurrentUser = 0;
     55    private bool flagJob = false;
     56    private bool flagClient = false;
     57    private bool flagUser = false;
     58
     59    private ToolTip tt = new ToolTip();
     60    #endregion
    5261
    5362    public HiveServerManagementConsole() {
     
    5665      AddJobs();
    5766      AddUsers();
    58 
    59       timerSyncronize.Tick += new EventHandler(TickSync);
    6067      timerSyncronize.Start();
    6168    }
    6269
     70    /// <summary>
     71    /// event on Ticker
     72    /// </summary>
     73    /// <param name="obj"></param>
     74    /// <param name="e"></param>
    6375    private void TickSync(object obj, EventArgs e) {
    6476      AddClients();
     
    6779    }
    6880
     81    /// <summary>
     82    /// Adds clients to ListView and TreeView
     83    /// </summary>
    6984    private void AddClients() {
    7085      try {
     
    96111        }
    97112        lvClientControl.Groups.Add(lvunsorted);
     113        if (flagClient) {
     114          ClientClicked();
     115        }
    98116      }
    99117      catch (Exception ex) {
     
    103121    }
    104122
     123    /// <summary>
     124    /// Adds jobs to ListView and TreeView
     125    /// </summary>
    105126    private void AddJobs() {
    106127      try {
     
    137158        lvJobControl.Groups.Add(lvJobFinished);
    138159        lvJobControl.Groups.Add(lvJobPending);
     160        if (flagJob) {
     161          JobClicked();
     162        }
    139163      }
    140164      catch (Exception ex) {
     
    144168    }
    145169
     170    /// <summary>
     171    /// Adds users to ListView and TreeView
     172    /// </summary>
    146173    private void AddUsers() {
    147174      try {
     
    175202        }
    176203        lvUserControl.Groups.Add(lvunsorted);
     204        if (flagUser) {
     205          UserClicked();
     206        }
    177207      }
    178208      catch (Exception ex) {
     
    182212    }
    183213
     214    /// <summary>
     215    /// if one client is clicked, a panel is opened with the details
     216    /// </summary>
     217    private void ClientClicked() {
     218      currentClient = clientInfo.List[idxCurrentClient];
     219      scClientControl.Panel2.Controls.Clear();
     220      scClientControl.Panel2.Controls.Add(plClientDetails);
     221      pbClientControl.Image = ilClientControl.Images[0];
     222      lblClientName.Text = currentClient.Name;
     223      lblLogin.Text = currentClient.Login.ToString();
     224    }
     225
     226    /// <summary>
     227    /// if one job is clicked, a panel is opened with the details
     228    /// </summary>
     229    private void JobClicked() {
     230      int yPos = 0;
     231      currentJob = jobs.List[idxCurrentJob];
     232      scJobControl.Panel2.Controls.Clear();
     233      scJobControl.Panel2.Controls.Add(plJobDetails);
     234      pbJobControl.Image = ilJobControl.Images[0];
     235      lblJobName.Text = currentJob.Id.ToString();
     236      progressJob.Value = (int)(currentJob.Percentage * 100);
     237      yPos = progressJob.Location.Y;
     238      yPos += 20;
     239      lblProgress.Location = new Point(
     240        lblProgress.Location.X, yPos);
     241      lblProgress.Text = (int)(currentJob.Percentage * 100) + "% calculated";
     242      yPos += 20;
     243      lblUserCreatedJob.Location = new Point(
     244        lblUserCreatedJob.Location.X, yPos);
     245      lblUserCreatedJob.Text = /* currentJob.User.Name + */ " created Job";
     246      yPos += 20;
     247      lblJobCreated.Location = new Point(
     248        lblJobCreated.Location.X, yPos);
     249      lblJobCreated.Text = "Created at "/* + currentJob.User.CreatedJob + */;
     250      if (currentJob.ParentJob != null) {
     251        yPos += 20;
     252        lblParentJob.Location = new Point(
     253          lblParentJob.Location.X, yPos);
     254        lblParentJob.Text = currentJob.ParentJob.Id + " is parent job";
     255      }
     256      yPos += 20;
     257      lblPriorityJob.Location = new Point(
     258        lblPriorityJob.Location.X, yPos);
     259      lblPriorityJob.Text = "Priority of job is " /* + currentJob.Priority */;
     260      if (currentJob.Client != null) {
     261        yPos += 20;
     262        lblClientCalculating.Location = new Point(
     263          lblClientCalculating.Location.X, yPos);
     264        lblClientCalculating.Text = currentJob.Client.Name + " calculated Job";
     265        yPos += 20;
     266        lblJobCalculationBegin.Location = new Point(
     267          lblJobCalculationBegin.Location.X, yPos);
     268        lblJobCalculationBegin.Text = "Startet calculation at " /* + currentJob.User.CalculationBegin */;
     269        yPos += 20;
     270        lblJobCalculationEnd.Location = new Point(
     271          lblJobCalculationEnd.Location.X, yPos);
     272        lblJobCalculationEnd.Text = "Calculation endet at " /* + currentJob.User.CalculationEnd */;
     273      }
     274    }
     275
     276    /// <summary>
     277    /// if one user is clicked, a panel is opened with the details
     278    /// </summary>
     279    private void UserClicked() {
     280      currentUser = usersList.List[idxCurrentUser];
     281      scUserControl.Panel2.Controls.Clear();
     282      scUserControl.Panel2.Controls.Add(plUserDetails);
     283      pbUserControl.Image = ilUserControl.Images[0];
     284      lblUserName.Text = currentUser.Id.ToString();
     285    }
     286
     287    #region Eventhandler
    184288    /// <summary>
    185289    /// Send event to Login-GUI when closing
     
    205309    }
    206310
    207     private void JobToolStripMenuItem1_Click(object sender, EventArgs e) {
     311    private void AddJob_Click(object sender, EventArgs e) {
    208312      AddJobForm newForm = new AddJobForm();
    209313      newForm.Show();
    210314    }
    211315
    212     private void UserToolStripMenuItem1_Click(object sender, EventArgs e) {
     316    private void AddUser_Click(object sender, EventArgs e) {
    213317      AddUserForm newForm = new AddUserForm("User", false);
    214318      newForm.Show();
    215319    }
    216320
    217     private void GroupToolStripMenuItem2_Click(object sender, EventArgs e) {
     321    private void AddUserGroup_Click(object sender, EventArgs e) {
    218322      AddUserForm newForm = new AddUserForm("User", true);
    219323      newForm.Show();
    220 
    221324    }
    222325
    223326    private void OnLVClientClicked(object sender, EventArgs e) {
    224       currentClient = clientInfo.List[lvClientControl.SelectedItems[0].Index];
     327      idxCurrentClient = lvClientControl.SelectedItems[0].Index;
     328      flagClient = true;
    225329      ClientClicked();
    226330    }
    227331
    228     private void OnTVClientClicked(object sender, EventArgs e) {
    229      // currentClient = clientInfo.List[tvClientControl.SelectedNode.Index];
    230      // ClientClicked();
    231     }
    232 
    233     private void ClientClicked() {
    234       scClientControl.Panel2.Controls.Clear();
    235       scClientControl.Panel2.Controls.Add(plClientDetails);
    236       pbClientControl.Image = ilClientControl.Images[0];
    237       lblClientName.Text = currentClient.Name;
    238       lblLogin.Text = currentClient.Login.ToString();
     332    private void OnLVJobControlClicked(object sender, EventArgs e) {
     333      idxCurrentJob = lvJobControl.SelectedItems[0].Index;
     334      flagJob = true;
     335      JobClicked();
     336    }
     337
     338    private void OnLVUserControlClicked(object sender, EventArgs e) {
     339      idxCurrentUser = lvUserControl.SelectedItems[0].Index;
     340      flagUser = true;
     341      UserClicked();
    239342    }
    240343
     
    242345      scClientControl.Panel2.Controls.Clear();
    243346      scClientControl.Panel2.Controls.Add(lvClientControl);
    244     }
    245 
    246     private void OnLVJobControlClicked(object sender, EventArgs e) {
    247       currentJob = jobs.List[lvJobControl.SelectedItems[0].Index];
    248       JobClicked();
    249 
    250     }
    251     private void JobClicked() {
    252       scJobControl.Panel2.Controls.Clear();
    253       scJobControl.Panel2.Controls.Add(plJobDetails);
    254       pbJobControl.Image = ilJobControl.Images[0];
    255       lblJobName.Text = currentJob.Id.ToString();
    256       progressJob.Value = (int)(currentJob.Percentage * 100);
    257       lblProgress.Text = (int)(currentJob.Percentage * 100) + "% calculated";
    258       lblUserCreatedJob.Text = /* currentJob.User.Name + */ " created Job";
    259       lblJobCreated.Text = "Created at "/* + currentJob.User.CreatedJob + */;
    260       if (currentJob.ParentJob != null)   
    261         lblParentJob.Text = currentJob.ParentJob.Id + " is parent job";
    262       lblPriorityJob.Text = "Priority of job is " /* + currentJob.Priority */;
    263       if (currentJob.Client != null) {
    264         lblClientCalculating.Text = currentJob.Client.Name + " calculated Job";
    265       lblJobCalculationBegin.Text = "Startet calculation at " /* + currentJob.User.CalculationBegin */;
    266       lblJobCalculationEnd.Text = "Calculation endet at " /* + currentJob.User.CalculationEnd */;
    267       }
    268     }
    269 
     347      flagClient = false;
     348    }
     349 
    270350    private void btnJobDetailClose_Click(object sender, EventArgs e) {
    271351      scJobControl.Panel2.Controls.Clear();
    272352      scJobControl.Panel2.Controls.Add(lvJobControl);
    273     }
    274 
    275     private void OnLVUserControlClicked(object sender, EventArgs e) {
    276       currentUser = usersList.List[lvUserControl.SelectedItems[0].Index];
    277       UserClicked();
    278     }
    279 
    280     private void UserClicked() {
    281       scUserControl.Panel2.Controls.Clear();
    282       scUserControl.Panel2.Controls.Add(plUserDetails);
    283       pbUserControl.Image = ilUserControl.Images[0];
    284       lblUserName.Text = currentUser.Id.ToString();
     353      flagJob = false;
    285354    }
    286355
     
    288357      scUserControl.Panel2.Controls.Clear();
    289358      scUserControl.Panel2.Controls.Add(lvUserControl);
    290     }
    291 
    292     ToolTip tt = new ToolTip();
     359      flagUser = false;
     360    }
     361
    293362    private void lvJobControl_MouseMove(object sender, MouseEventArgs e) {
    294363      if ((lvJobControl.GetItemAt(e.X, e.Y) != null) &&
     
    297366      }
    298367    }
    299 
     368    #endregion
    300369  }
    301370}
Note: See TracChangeset for help on using the changeset viewer.