Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/14 14:48:13 (11 years ago)
Author:
pfleck
Message:
  • merged trunk
Location:
branches/DataPreprocessing
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing

  • branches/DataPreprocessing/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.Designer.cs

    r10000 r10538  
    6060      this.SuspendLayout();
    6161      //
    62       // problemInstanceSplitContainer
    63       //
    64       this.problemInstanceSplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
    65       this.problemInstanceSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
    66       //
    6762      // problemInstanceSplitContainer.Panel2
    6863      //
    6964      this.problemInstanceSplitContainer.Panel2.Controls.Add(this.problemTabControl);
    70       //
    71       // ProblemInstanceConsumerViewHost
    72       //
    73       this.problemInstanceProviderViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
    74       this.problemInstanceProviderViewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    75       this.problemInstanceProviderViewHost.Location = new System.Drawing.Point(0, 0);
    76       this.problemInstanceProviderViewHost.Size = new System.Drawing.Size(511, 26);
    7765      //
    7866      // parameterCollectionView
  • branches/DataPreprocessing/HeuristicLab.Problems.Scheduling.Views/3.3/JobShopSchedulingProblemView.cs

    r9456 r10538  
    2020#endregion
    2121
     22using System;
    2223using System.Windows.Forms;
     24using HeuristicLab.Collections;
     25using HeuristicLab.Encodings.ScheduleEncoding;
    2326using HeuristicLab.MainForm;
    2427using HeuristicLab.Optimization.Views;
     
    4346    protected override void OnContentChanged() {
    4447      base.OnContentChanged();
    45       if (Content == null) {
    46         ganttChart.Reset();
    47       } else {
    48         FillGanttChart(Content);
     48      FillGanttChart();
     49    }
     50
     51    protected override void DeregisterContentEvents() {
     52      Content.JobDataParameter.ValueChanged -= JobDataParameterOnValueChanged;
     53      Content.JobData.ItemsAdded -= JobsOnChanged;
     54      Content.JobData.ItemsRemoved -= JobsOnChanged;
     55      Content.JobData.ItemsReplaced -= JobsOnChanged;
     56      Content.JobData.CollectionReset -= JobsOnChanged;
     57      foreach (var job in Content.JobData) {
     58        job.TasksChanged -= JobOnTasksChanged;
     59      }
     60      base.DeregisterContentEvents();
     61    }
     62    protected override void RegisterContentEvents() {
     63      base.RegisterContentEvents();
     64      Content.JobDataParameter.ValueChanged += JobDataParameterOnValueChanged;
     65      Content.JobData.ItemsAdded += JobsOnChanged;
     66      Content.JobData.ItemsRemoved += JobsOnChanged;
     67      Content.JobData.ItemsReplaced += JobsOnChanged;
     68      Content.JobData.CollectionReset += JobsOnChanged;
     69      foreach (var job in Content.JobData) {
     70        job.TasksChanged += JobOnTasksChanged;
    4971      }
    5072    }
    5173
    52     private void FillGanttChart(JobShopSchedulingProblem content) {
     74    private void JobsOnChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<Job>> e) {
     75      foreach (var job in e.OldItems)
     76        job.Value.TasksChanged -= JobOnTasksChanged;
     77      foreach (var job in e.Items)
     78        job.Value.TasksChanged += JobOnTasksChanged;
     79      FillGanttChart();
     80    }
     81
     82    private void JobDataParameterOnValueChanged(object sender, EventArgs e) {
     83      Content.JobData.ItemsAdded += JobsOnChanged;
     84      Content.JobData.ItemsRemoved += JobsOnChanged;
     85      Content.JobData.ItemsReplaced += JobsOnChanged;
     86      Content.JobData.CollectionReset += JobsOnChanged;
     87      foreach (var job in Content.JobData) {
     88        job.TasksChanged += JobOnTasksChanged;
     89      }
     90      FillGanttChart();
     91    }
     92
     93    private void JobOnTasksChanged(object sender, EventArgs e) {
     94      FillGanttChart();
     95    }
     96
     97    private void FillGanttChart() {
    5398      ganttChart.Reset();
     99      if (Content == null) return;
    54100      int jobCount = 0;
    55       foreach (var j in content.JobData) {
     101      foreach (var j in Content.JobData) {
    56102        double lastEndTime = 0;
    57         foreach (var t in content.JobData[jobCount].Tasks) {
     103        foreach (var t in Content.JobData[jobCount].Tasks) {
    58104          int categoryNr = t.JobNr;
    59105          string categoryName = "Job" + categoryNr;
     
    63109            lastEndTime + 1,
    64110            lastEndTime + t.Duration,
    65             "Job" + t.JobNr + " - " + "Task#" + t.TaskNr.ToString());
     111            "Job" + t.JobNr + " - " + "Task#" + t.TaskNr);
    66112          lastEndTime += t.Duration;
    67113        }
Note: See TracChangeset for help on using the changeset viewer.