Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/04/10 14:20:10 (14 years ago)
Author:
mkommend
Message:

added ConstraintCollectionView (ticket #996)

Location:
trunk/sources/HeuristicLab.Core.Views/3.3
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/ConstraintCollectionView.Designer.cs

    r3601 r3604  
    11namespace HeuristicLab.Core.Views {
    2   partial class ParameterCollectionView {
     2  partial class ConstraintCollectionView {
    33    /// <summary>
    44    /// Required designer variable.
  • trunk/sources/HeuristicLab.Core.Views/3.3/ConstraintCollectionView.cs

    r3601 r3604  
    2626
    2727namespace HeuristicLab.Core.Views {
    28   [View("ParameterCollection View")]
    29   [Content(typeof(ParameterCollection), true)]
    30   [Content(typeof(IKeyedItemCollection<string, IParameter>), false)]
    31   public partial class ParameterCollectionView : NamedItemCollectionView<IParameter> {
     28  [View("ConstraintCollection View")]
     29  [Content(typeof(ConstraintCollection), true)]
     30  [Content(typeof(IItemCollection<IConstraint>), false)]
     31  public partial class ConstraintCollectionView : ItemCollectionView<IConstraint> {
    3232    protected CreateParameterDialog createParameterDialog;
    3333    /// <summary>
    3434    /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
    3535    /// </summary>
    36     public ParameterCollectionView() {
     36    public ConstraintCollectionView() {
    3737      InitializeComponent();
    38       Caption = "ParameterCollection";
    39       itemsGroupBox.Text = "Parameters";
     38      Caption = "ConstraintCollection";
     39      itemsGroupBox.Text = "Constraints";
    4040    }
    4141
    42     protected override IParameter CreateItem() {
    43       if (createParameterDialog == null) createParameterDialog = new CreateParameterDialog();
     42    protected override IConstraint CreateItem() {
     43      if (typeSelectorDialog == null) {
     44        typeSelectorDialog = new TypeSelectorDialog();
     45        typeSelectorDialog.Caption = "Select Operator";
     46        typeSelectorDialog.TypeSelector.Caption = "Available Operators";
     47        typeSelectorDialog.TypeSelector.Configure(typeof(IConstraint), false, true);
     48      }
    4449
    45       if (createParameterDialog.ShowDialog(this) == DialogResult.OK) {
    46         IParameter param = createParameterDialog.Parameter;
    47         if ((param != null) && Content.ContainsKey(param.Name))
    48           param = (IParameter)Activator.CreateInstance(param.GetType(), GetUniqueName(param.Name), param.Description);
    49         return param;
     50      if (typeSelectorDialog.ShowDialog(this) == DialogResult.OK) {
     51        try {
     52          return (IConstraint)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
     53        }
     54        catch (Exception ex) {
     55          Auxiliary.ShowErrorMessageBox(ex);
     56        }
    5057      }
    5158      return null;
  • trunk/sources/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj

    r3566 r3604  
    105105      <DependentUpon>CheckedItemListView.cs</DependentUpon>
    106106    </Compile>
     107    <Compile Include="ConstraintCollectionView.cs">
     108      <SubType>UserControl</SubType>
     109    </Compile>
     110    <Compile Include="ConstraintCollectionView.Designer.cs">
     111      <DependentUpon>ConstraintCollectionView.cs</DependentUpon>
     112    </Compile>
    107113    <Compile Include="LogView.cs">
    108114      <SubType>UserControl</SubType>
Note: See TracChangeset for help on using the changeset viewer.