Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs @ 7615

Last change on this file since 7615 was 7615, checked in by gkronber, 12 years ago

#1081 merged r7462:7609 from trunk into time series branch

File size: 3.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Windows.Forms;
24using HeuristicLab.MainForm;
25using HeuristicLab.MainForm.WindowsForms;
26using HeuristicLab.Optimization.Views;
27
28namespace HeuristicLab.Problems.QuadraticAssignment.Views {
29  [View("Quadratic Assignment Problem View")]
30  [Content(typeof(QuadraticAssignmentProblem), IsDefaultView = true)]
31  public sealed partial class QuadraticAssignmentProblemView : HeuristicOptimizationProblemView {
32    public new QuadraticAssignmentProblem Content {
33      get { return (QuadraticAssignmentProblem)base.Content; }
34      set { base.Content = value; }
35    }
36
37    public QuadraticAssignmentProblemView() {
38      InitializeComponent();
39      Controls.Remove(parameterCollectionView);
40      parameterCollectionView.Dock = DockStyle.Fill;
41      problemTabPage.Controls.Add(parameterCollectionView);
42    }
43
44    protected override void RegisterContentEvents() {
45      base.RegisterContentEvents();
46      Content.DistancesParameter.ValueChanged += new EventHandler(DistanceMatrixParameter_ValueChanged);
47      Content.WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged);
48      Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
49    }
50
51    protected override void DeregisterContentEvents() {
52      Content.DistancesParameter.ValueChanged -= new EventHandler(DistanceMatrixParameter_ValueChanged);
53      Content.WeightsParameter.ValueChanged -= new EventHandler(WeightsParameter_ValueChanged);
54      Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged);
55      base.DeregisterContentEvents();
56    }
57
58    private void DistanceMatrixParameter_ValueChanged(object sender, System.EventArgs e) {
59      qapView.Distances = Content.Distances;
60    }
61
62    private void WeightsParameter_ValueChanged(object sender, System.EventArgs e) {
63      qapView.Weights = Content.Weights;
64    }
65
66    private void BestKnownSolutionParameter_ValueChanged(object sender, System.EventArgs e) {
67      qapView.Assignment = Content.BestKnownSolution;
68    }
69
70    protected override void OnContentChanged() {
71      base.OnContentChanged();
72      if (Content != null) {
73        qapView.Distances = Content.Distances;
74        qapView.Weights = Content.Weights;
75        qapView.Assignment = Content.BestKnownSolution;
76      } else {
77        qapView.Distances = null;
78        qapView.Weights = null;
79        qapView.Assignment = null;
80      }
81    }
82
83    protected override void SetEnabledStateOfControls() {
84      base.SetEnabledStateOfControls();
85    }
86  }
87}
Note: See TracBrowser for help on using the repository browser.