Last change
on this file since 5231 was
5110,
checked in by cneumuel, 14 years ago
|
#1215
- optional parameter values now can be null
- problem type can now be set specifically
- values are constrained to the encoding of the Problem
- moved repetitions parameter to MetaOptimizationProblem
|
File size:
1.5 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Data;
|
---|
5 | using System.Drawing;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using HeuristicLab.Core.Views;
|
---|
9 | using HeuristicLab.Core;
|
---|
10 | using HeuristicLab.MainForm;
|
---|
11 | using System.Windows.Forms;
|
---|
12 | using HeuristicLab.PluginInfrastructure;
|
---|
13 |
|
---|
14 | namespace HeuristicLab.Problems.MetaOptimization.Views {
|
---|
15 | [View("Constrained Item List View")]
|
---|
16 | [Content(typeof(ConstrainedItemList<>), IsDefaultView = true)]
|
---|
17 | public sealed partial class ConstrainedItemListView<T> : ItemListView<T> where T : class, IItem {
|
---|
18 | public new ConstrainedItemList<T> Content {
|
---|
19 | get { return (ConstrainedItemList<T>)base.Content; }
|
---|
20 | set { base.Content = value; }
|
---|
21 | }
|
---|
22 |
|
---|
23 | public ConstrainedItemListView() {
|
---|
24 | InitializeComponent();
|
---|
25 | }
|
---|
26 |
|
---|
27 | protected override T CreateItem() {
|
---|
28 | if (typeSelectorDialog == null) {
|
---|
29 | typeSelectorDialog = new TypeSelectorDialog();
|
---|
30 | typeSelectorDialog.Caption = "Select Item";
|
---|
31 | typeSelectorDialog.TypeSelector.Caption = "Available Items";
|
---|
32 | typeSelectorDialog.TypeSelector.Configure(Content.Type, false, true);
|
---|
33 | }
|
---|
34 |
|
---|
35 | if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
|
---|
36 | try {
|
---|
37 | return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
|
---|
38 | }
|
---|
39 | catch (Exception ex) {
|
---|
40 | ErrorHandling.ShowErrorDialog(this, ex);
|
---|
41 | }
|
---|
42 | }
|
---|
43 | return null;
|
---|
44 | }
|
---|
45 | }
|
---|
46 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.