Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Core.Views/3.3/OperatorListView.cs @ 2713

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

Adapted HL 3.3 plugins according to changes in MainForm (#857)

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