Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Core.Views/3.3/OperatorSetView.cs @ 2917

Last change on this file since 2917 was 2917, checked in by swagner, 14 years ago

Operator architecture refactoring (#95)

  • implemented reviewers' comments
File size: 1.6 KB
Line 
1using System.Windows.Forms;
2using HeuristicLab.Collections;
3using HeuristicLab.MainForm;
4
5namespace HeuristicLab.Core.Views {
6  [View("OperatorSet View")]
7  [Content(typeof(OperatorSet), true)]
8  [Content(typeof(IObservableSet<IOperator>), false)]
9  public partial class OperatorSetView : ItemSetView<IOperator> {
10    protected TypeSelectorDialog typeSelectorDialog;
11
12    /// <summary>
13    /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
14    /// </summary>
15    public OperatorSetView() {
16      InitializeComponent();
17      Caption = "Operator Set";
18      itemsGroupBox.Text = "&Operators";
19    }
20    /// <summary>
21    /// Initializes a new instance of <see cref="VariablesScopeView"/> with
22    /// the given <paramref name="scope"/>.
23    /// </summary>
24    /// <remarks>Calls <see cref="VariablesScopeView()"/>.</remarks>
25    /// <param name="scope">The scope whose variables should be represented visually.</param>
26    public OperatorSetView(IObservableSet<IOperator> content)
27      : this() {
28      Content = content;
29    }
30
31    protected override IOperator CreateItem() {
32      if (typeSelectorDialog == null) {
33        typeSelectorDialog = new TypeSelectorDialog();
34        typeSelectorDialog.TypeSelector.Caption = "&Available Operators";
35        typeSelectorDialog.TypeSelector.Configure(typeof(IOperator), false, false);
36      }
37
38      if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK)
39        return (IOperator)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
40      else
41        return null;
42    }
43  }
44}
Note: See TracBrowser for help on using the repository browser.