[5563] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[7259] | 3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[5563] | 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 |
|
---|
[5641] | 22 | using System;
|
---|
[5563] | 23 | using System.Windows.Forms;
|
---|
| 24 | using HeuristicLab.MainForm;
|
---|
| 25 | using HeuristicLab.MainForm.WindowsForms;
|
---|
[7558] | 26 | using HeuristicLab.Optimization.Views;
|
---|
[5563] | 27 |
|
---|
| 28 | namespace HeuristicLab.Problems.QuadraticAssignment.Views {
|
---|
| 29 | [View("Quadratic Assignment Problem View")]
|
---|
| 30 | [Content(typeof(QuadraticAssignmentProblem), IsDefaultView = true)]
|
---|
[7641] | 31 | public sealed partial class QuadraticAssignmentProblemView : ProblemView {
|
---|
[5563] | 32 | public new QuadraticAssignmentProblem Content {
|
---|
| 33 | get { return (QuadraticAssignmentProblem)base.Content; }
|
---|
| 34 | set { base.Content = value; }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public QuadraticAssignmentProblemView() {
|
---|
| 38 | InitializeComponent();
|
---|
[5641] | 39 | Controls.Remove(parameterCollectionView);
|
---|
| 40 | parameterCollectionView.Dock = DockStyle.Fill;
|
---|
| 41 | problemTabPage.Controls.Add(parameterCollectionView);
|
---|
[5563] | 42 | }
|
---|
| 43 |
|
---|
[5641] | 44 | protected override void RegisterContentEvents() {
|
---|
| 45 | base.RegisterContentEvents();
|
---|
[5838] | 46 | Content.DistancesParameter.ValueChanged += new EventHandler(DistanceMatrixParameter_ValueChanged);
|
---|
[5641] | 47 | Content.WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged);
|
---|
| 48 | Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged);
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | protected override void DeregisterContentEvents() {
|
---|
[5838] | 52 | Content.DistancesParameter.ValueChanged -= new EventHandler(DistanceMatrixParameter_ValueChanged);
|
---|
[5641] | 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) {
|
---|
[5838] | 59 | qapView.Distances = Content.Distances;
|
---|
[5641] | 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 |
|
---|
[5563] | 70 | protected override void OnContentChanged() {
|
---|
| 71 | base.OnContentChanged();
|
---|
| 72 | if (Content != null) {
|
---|
[5838] | 73 | qapView.Distances = Content.Distances;
|
---|
[5641] | 74 | qapView.Weights = Content.Weights;
|
---|
| 75 | qapView.Assignment = Content.BestKnownSolution;
|
---|
| 76 | } else {
|
---|
| 77 | qapView.Distances = null;
|
---|
| 78 | qapView.Weights = null;
|
---|
| 79 | qapView.Assignment = null;
|
---|
[5563] | 80 | }
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | protected override void SetEnabledStateOfControls() {
|
---|
| 84 | base.SetEnabledStateOfControls();
|
---|
| 85 | }
|
---|
| 86 | }
|
---|
[6952] | 87 | }
|
---|