Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Core.Views/3.3/OperatorCollectionView.cs @ 2958

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

Operator architecture refactoring (#95)

  • implemented reviewers' comments on version r2917.
File size: 1.7 KB
RevLine 
[2818]1using System.Windows.Forms;
2using HeuristicLab.Collections;
[2655]3using HeuristicLab.MainForm;
4
5namespace HeuristicLab.Core.Views {
[2917]6  [View("OperatorCollection View")]
[2655]7  [Content(typeof(OperatorCollection), true)]
[2727]8  [Content(typeof(IObservableCollection<IOperator>), false)]
[2655]9  public partial class OperatorCollectionView : ItemCollectionView<IOperator> {
[2676]10    protected TypeSelectorDialog typeSelectorDialog;
[2655]11
12    /// <summary>
13    /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
14    /// </summary>
15    public OperatorCollectionView() {
16      InitializeComponent();
17      Caption = "Operator Collection";
[2924]18      itemsGroupBox.Text = "Operators";
[2655]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>
[2727]26    public OperatorCollectionView(IObservableCollection<IOperator> content)
[2655]27      : this() {
[2727]28      Content = content;
[2655]29    }
30
31    protected override IOperator CreateItem() {
32      if (typeSelectorDialog == null) {
33        typeSelectorDialog = new TypeSelectorDialog();
[2924]34        typeSelectorDialog.TypeSelector.Caption = "Available Operators";
[2655]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.