source: branches/2839_HiveProjectManagement/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/EqualityComparisonFilterView.cs @ 16057

Last change on this file since 16057 was 16057, checked in by jkarder, 15 months ago

#2839:

File size: 2.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2018 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.Windows.Forms;
23using HeuristicLab.MainForm;
24using HeuristicLab.MainForm.WindowsForms;
25
26namespace HeuristicLab.Clients.OKB.Query {
27  [View("EqualityComparisonFilter View")]
28  public partial class EqualityComparisonFilterView : FilterView {
29    public new EqualityComparisonFilter Content {
30      get { return (EqualityComparisonFilter)base.Content; }
31      set { base.Content = value; }
32    }
33
34    public EqualityComparisonFilterView() {
35      InitializeComponent();
36    }
37
38    protected override void OnContentChanged() {
39      base.OnContentChanged();
40      comparisonComboBox.SelectedIndex = -1;
41      if (Content != null) {
42        if (Content.Comparison == EqualityComparison.Equal)
43          comparisonComboBox.SelectedItem = "=";
44        else if (Content.Comparison == EqualityComparison.NotEqual)
45          comparisonComboBox.SelectedItem = "<>";
46      }
47    }
48
49    protected override void SetEnabledStateOfControls() {
50      base.SetEnabledStateOfControls();
51      comparisonComboBox.Enabled = Content != null && !ReadOnly;
52    }
53
54    private void comparisonComboBox_SelectedIndexChanged(object sender, System.EventArgs e) {
55      if (Content != null) {
56        if (comparisonComboBox.SelectedItem.ToString() == "=")
57          Content.Comparison = EqualityComparison.Equal;
58        else if (comparisonComboBox.SelectedItem.ToString() == "<>")
59          Content.Comparison = EqualityComparison.NotEqual;
60      }
61    }
62  }
63}
Note: See TracBrowser for help on using the repository browser.