Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4332 for trunk


Ignore:
Timestamp:
08/27/10 03:10:17 (14 years ago)
Author:
swagner
Message:

Enabled users to choose whether a parameter should be collected in each run or not (#1113)

Location:
trunk/sources
Files:
1 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IValueParameter.cs

    r2852 r4332  
    2525  public interface IValueParameter : IParameter {
    2626    IItem Value { get; set; }
     27    bool GetsCollected { get; set; }
    2728    event EventHandler ValueChanged;
     29    event EventHandler GetsCollectedChanged;
    2830  }
    2931
  • trunk/sources/HeuristicLab.Core/3.3/ParameterizedNamedItem.cs

    r4068 r4332  
    8686    public virtual void CollectParameterValues(IDictionary<string, IItem> values) {
    8787      foreach (IValueParameter param in parameters.OfType<IValueParameter>()) {
    88         values.Add(param.Name, param.Value);
     88        if (param.GetsCollected && param.Value != null) values.Add(param.Name, param.Value);
    8989        if (param.Value is IParameterizedItem) {
    9090          Dictionary<string, IItem> children = new Dictionary<string, IItem>();
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ConstrainedValueParameterView.Designer.cs

    r3281 r4332  
    4646    private void InitializeComponent() {
    4747      this.valueGroupBox = new System.Windows.Forms.GroupBox();
     48      this.showInRunCheckBox = new System.Windows.Forms.CheckBox();
    4849      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    4950      this.valueComboBox = new System.Windows.Forms.ComboBox();
     
    5152      this.valueGroupBox.SuspendLayout();
    5253      this.SuspendLayout();
    53       //
    54       // dataTypeLabel
    55       //
    56       this.dataTypeLabel.Location = new System.Drawing.Point(3, 55);
    5754      //
    5855      // dataTypeTextBox
     
    7875                  | System.Windows.Forms.AnchorStyles.Left)
    7976                  | System.Windows.Forms.AnchorStyles.Right)));
     77      this.valueGroupBox.Controls.Add(this.showInRunCheckBox);
    8078      this.valueGroupBox.Controls.Add(this.viewHost);
    8179      this.valueGroupBox.Controls.Add(this.valueComboBox);
     
    8785      this.valueGroupBox.Text = "Value";
    8886      //
     87      // showInRunCheckBox
     88      //
     89      this.showInRunCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     90      this.showInRunCheckBox.AutoSize = true;
     91      this.showInRunCheckBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     92      this.showInRunCheckBox.Checked = true;
     93      this.showInRunCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
     94      this.showInRunCheckBox.Location = new System.Drawing.Point(290, 21);
     95      this.showInRunCheckBox.Name = "showInRunCheckBox";
     96      this.showInRunCheckBox.Size = new System.Drawing.Size(90, 17);
     97      this.showInRunCheckBox.TabIndex = 1;
     98      this.showInRunCheckBox.Text = "&Show in Run:";
     99      this.toolTip.SetToolTip(this.showInRunCheckBox, "Check to show the value of this parameter in each run.");
     100      this.showInRunCheckBox.UseVisualStyleBackColor = true;
     101      this.showInRunCheckBox.CheckedChanged += new System.EventHandler(this.showInRunCheckBox_CheckedChanged);
     102      //
    89103      // viewHost
    90104      //
     
    92106                  | System.Windows.Forms.AnchorStyles.Left)
    93107                  | System.Windows.Forms.AnchorStyles.Right)));
     108      this.viewHost.Caption = "View";
    94109      this.viewHost.Content = null;
    95110      this.viewHost.Location = new System.Drawing.Point(6, 46);
    96111      this.viewHost.Name = "viewHost";
     112      this.viewHost.ReadOnly = false;
    97113      this.viewHost.Size = new System.Drawing.Size(374, 185);
    98       this.viewHost.TabIndex = 0;
     114      this.viewHost.TabIndex = 2;
    99115      this.viewHost.ViewType = null;
    100116      //
     
    107123      this.valueComboBox.Location = new System.Drawing.Point(6, 19);
    108124      this.valueComboBox.Name = "valueComboBox";
    109       this.valueComboBox.Size = new System.Drawing.Size(374, 21);
    110       this.valueComboBox.TabIndex = 1;
     125      this.valueComboBox.Size = new System.Drawing.Size(278, 21);
     126      this.valueComboBox.TabIndex = 0;
    111127      this.toolTip.SetToolTip(this.valueComboBox, "Selected Value");
    112128      this.valueComboBox.SelectedIndexChanged += new System.EventHandler(this.valueComboBox_SelectedIndexChanged);
     
    128144      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    129145      this.valueGroupBox.ResumeLayout(false);
     146      this.valueGroupBox.PerformLayout();
    130147      this.ResumeLayout(false);
    131148      this.PerformLayout();
     
    138155    protected HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
    139156    protected System.Windows.Forms.ComboBox valueComboBox;
     157    protected System.Windows.Forms.CheckBox showInRunCheckBox;
    140158  }
    141159}
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ConstrainedValueParameterView.cs

    r4257 r4332  
    6161    /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
    6262    protected override void DeregisterContentEvents() {
     63      Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged);
    6364      Content.ValidValues.ItemsAdded -= new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsAdded);
    6465      Content.ValidValues.ItemsRemoved -= new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved);
     
    7475    protected override void RegisterContentEvents() {
    7576      base.RegisterContentEvents();
     77      Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged);
    7678      Content.ValidValues.ItemsAdded += new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsAdded);
    7779      Content.ValidValues.ItemsRemoved += new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved);
     
    8385      base.OnContentChanged();
    8486      if (Content == null) {
     87        showInRunCheckBox.Checked = false;
    8588        viewHost.Content = null;
    8689        FillValueComboBox();
     
    8891        SetDataTypeTextBoxText();
    8992        FillValueComboBox();
     93        showInRunCheckBox.Checked = Content.GetsCollected;
    9094        viewHost.ViewType = null;
    9195        viewHost.Content = Content.Value;
     
    97101      valueGroupBox.Enabled = Content != null;
    98102      valueComboBox.Enabled = (valueComboBox.Items.Count > 0) && !ReadOnly;
     103      showInRunCheckBox.Enabled = Content != null && !ReadOnly;
    99104    }
    100105
    101     private void FillValueComboBox() {
     106    protected virtual void FillValueComboBox() {
    102107      valueComboBox.SelectedIndexChanged -= new EventHandler(valueComboBox_SelectedIndexChanged);
    103108      valueComboBoxItems.Clear();
     
    119124
    120125    #region Content Events
    121     private void Content_ValueChanged(object sender, EventArgs e) {
     126    protected virtual void Content_ValueChanged(object sender, EventArgs e) {
    122127      if (InvokeRequired)
    123128        Invoke(new EventHandler(Content_ValueChanged), sender, e);
     
    129134      }
    130135    }
    131     private void ValidValues_ItemsAdded(object sender, CollectionItemsChangedEventArgs<T> e) {
     136    protected virtual void ValidValues_ItemsAdded(object sender, CollectionItemsChangedEventArgs<T> e) {
    132137      if (InvokeRequired)
    133138        Invoke(new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsAdded), sender, e);
     
    135140        FillValueComboBox();
    136141    }
    137     private void ValidValues_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<T> e) {
     142    protected virtual void ValidValues_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<T> e) {
    138143      if (InvokeRequired)
    139144        Invoke(new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved), sender, e);
     
    141146        FillValueComboBox();
    142147    }
    143     private void ValidValues_CollectionReset(object sender, CollectionItemsChangedEventArgs<T> e) {
     148    protected virtual void ValidValues_CollectionReset(object sender, CollectionItemsChangedEventArgs<T> e) {
    144149      if (InvokeRequired)
    145150        Invoke(new CollectionItemsChangedEventHandler<T>(ValidValues_CollectionReset), sender, e);
     
    147152        FillValueComboBox();
    148153    }
     154    protected virtual void Content_GetsCollectedChanged(object sender, EventArgs e) {
     155      if (InvokeRequired)
     156        Invoke(new EventHandler(Content_GetsCollectedChanged), sender, e);
     157      else
     158        showInRunCheckBox.Checked = Content != null && Content.GetsCollected;
     159    }
    149160    #endregion
    150161
    151     private void valueComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     162    protected virtual void valueComboBox_SelectedIndexChanged(object sender, EventArgs e) {
    152163      if (valueComboBox.SelectedIndex >= 0)
    153164        Content.Value = valueComboBoxItems[valueComboBox.SelectedIndex];
     165    }
     166    protected virtual void showInRunCheckBox_CheckedChanged(object sender, EventArgs e) {
     167      if (Content != null) Content.GetsCollected = showInRunCheckBox.Checked;
    154168    }
    155169
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/HeuristicLab.Parameters.Views-3.3.csproj

    r4065 r4332  
    9494  </PropertyGroup>
    9595  <ItemGroup>
     96    <Reference Include="HeuristicLab.Data-3.3">
     97      <HintPath>..\..\HeuristicLab.Data\3.3\bin\Debug\HeuristicLab.Data-3.3.dll</HintPath>
     98    </Reference>
     99    <Reference Include="HeuristicLab.Data.Views-3.3">
     100      <HintPath>..\..\HeuristicLab.Data.Views\3.3\bin\Debug\HeuristicLab.Data.Views-3.3.dll</HintPath>
     101    </Reference>
     102    <Reference Include="HeuristicLab.Optimization-3.3">
     103      <HintPath>..\..\HeuristicLab.Optimization\3.3\bin\Debug\HeuristicLab.Optimization-3.3.dll</HintPath>
     104    </Reference>
    96105    <Reference Include="System" />
    97106    <Reference Include="System.Core">
     
    100109    <Reference Include="System.Drawing" />
    101110    <Reference Include="System.Windows.Forms" />
     111    <Reference Include="System.Windows.Forms.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
    102112    <Reference Include="System.Xml.Linq">
    103113      <RequiredTargetFramework>3.5</RequiredTargetFramework>
     
    182192      <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project>
    183193      <Name>HeuristicLab.MainForm-3.3</Name>
     194    </ProjectReference>
     195    <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj">
     196      <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project>
     197      <Name>HeuristicLab.Optimization.Views-3.3</Name>
    184198    </ProjectReference>
    185199    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.Designer.cs

    r4011 r4332  
    4747    private void InitializeComponent() {
    4848      this.valueGroupBox = new System.Windows.Forms.GroupBox();
     49      this.showInRunCheckBox = new System.Windows.Forms.CheckBox();
    4950      this.valueViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5051      this.clearValueButton = new System.Windows.Forms.Button();
     
    9091                  | System.Windows.Forms.AnchorStyles.Left)
    9192                  | System.Windows.Forms.AnchorStyles.Right)));
     93      this.valueGroupBox.Controls.Add(this.showInRunCheckBox);
    9294      this.valueGroupBox.Controls.Add(this.valueViewHost);
    9395      this.valueGroupBox.Controls.Add(this.clearValueButton);
     
    100102      this.valueGroupBox.Text = "Value";
    101103      //
    102       // viewHost
     104      // showInRunCheckBox
     105      //
     106      this.showInRunCheckBox.AutoSize = true;
     107      this.showInRunCheckBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     108      this.showInRunCheckBox.Checked = true;
     109      this.showInRunCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
     110      this.showInRunCheckBox.Location = new System.Drawing.Point(66, 24);
     111      this.showInRunCheckBox.Name = "showInRunCheckBox";
     112      this.showInRunCheckBox.Size = new System.Drawing.Size(90, 17);
     113      this.showInRunCheckBox.TabIndex = 2;
     114      this.showInRunCheckBox.Text = "&Show in Run:";
     115      this.toolTip.SetToolTip(this.showInRunCheckBox, "Check to show the value of this parameter in each run.");
     116      this.showInRunCheckBox.UseVisualStyleBackColor = true;
     117      this.showInRunCheckBox.CheckedChanged += new System.EventHandler(this.showInRunCheckBox_CheckedChanged);
     118      //
     119      // valueViewHost
    103120      //
    104121      this.valueViewHost.AllowDrop = true;
    105       this.valueViewHost.Content = null;
    106122      this.valueViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    107123                  | System.Windows.Forms.AnchorStyles.Left)
    108124                  | System.Windows.Forms.AnchorStyles.Right)));
     125      this.valueViewHost.Caption = "View";
     126      this.valueViewHost.Content = null;
    109127      this.valueViewHost.Location = new System.Drawing.Point(6, 49);
    110128      this.valueViewHost.Name = "valueViewHost";
     129      this.valueViewHost.ReadOnly = false;
    111130      this.valueViewHost.Size = new System.Drawing.Size(374, 156);
    112       this.valueViewHost.TabIndex = 0;
     131      this.valueViewHost.TabIndex = 3;
    113132      this.valueViewHost.ViewType = null;
    114       this.valueViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.valueViewHostPanel_DragEnterOver);
    115133      this.valueViewHost.DragDrop += new System.Windows.Forms.DragEventHandler(this.valueViewHost_DragDrop);
    116134      this.valueViewHost.DragEnter += new System.Windows.Forms.DragEventHandler(this.valueViewHostPanel_DragEnterOver);
     135      this.valueViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.valueViewHostPanel_DragEnterOver);
    117136      //
    118137      // clearValueButton
     
    178197      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    179198      this.valueGroupBox.ResumeLayout(false);
     199      this.valueGroupBox.PerformLayout();
    180200      this.ResumeLayout(false);
    181201      this.PerformLayout();
     
    191211    protected System.Windows.Forms.TextBox actualNameTextBox;
    192212    protected System.Windows.Forms.Label actualNameLabel;
     213    protected System.Windows.Forms.CheckBox showInRunCheckBox;
    193214  }
    194215}
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.cs

    r4257 r4332  
    6161    protected override void DeregisterContentEvents() {
    6262      Content.ActualNameChanged -= new EventHandler(Content_ActualNameChanged);
     63      Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged);
    6364      Content.ValueChanged -= new EventHandler(Content_ValueChanged);
    6465      base.DeregisterContentEvents();
     
    7273      base.RegisterContentEvents();
    7374      Content.ActualNameChanged += new EventHandler(Content_ActualNameChanged);
     75      Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged);
    7476      Content.ValueChanged += new EventHandler(Content_ValueChanged);
    7577    }
     
    7981      if (Content == null) {
    8082        actualNameTextBox.Text = "-";
     83        showInRunCheckBox.Checked = false;
    8184        valueViewHost.Content = null;
    8285      } else {
    8386        SetDataTypeTextBoxText();
    8487        actualNameTextBox.Text = Content.ActualName;
     88        showInRunCheckBox.Checked = Content.GetsCollected;
    8589        valueViewHost.ViewType = null;
    8690        valueViewHost.Content = Content.Value;
     
    9498      setValueButton.Enabled = Content != null && !ReadOnly;
    9599      clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;
     100      showInRunCheckBox.Enabled = Content != null && !ReadOnly;
    96101      valueGroupBox.Enabled = Content != null;
    97102    }
     
    112117        valueViewHost.Content = Content != null ? Content.Value : null;
    113118      }
     119    }
     120    protected virtual void Content_GetsCollectedChanged(object sender, EventArgs e) {
     121      if (InvokeRequired)
     122        Invoke(new EventHandler(Content_GetsCollectedChanged), sender, e);
     123      else
     124        showInRunCheckBox.Checked = Content != null && Content.GetsCollected;
    114125    }
    115126
     
    134145    protected virtual void clearValueButton_Click(object sender, EventArgs e) {
    135146      Content.Value = null;
     147    }
     148    protected virtual void showInRunCheckBox_CheckedChanged(object sender, EventArgs e) {
     149      if (Content != null) Content.GetsCollected = showInRunCheckBox.Checked;
    136150    }
    137151    protected virtual void valueViewHostPanel_DragEnterOver(object sender, DragEventArgs e) {
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.Designer.cs

    r4011 r4332  
    4747    private void InitializeComponent() {
    4848      this.valueGroupBox = new System.Windows.Forms.GroupBox();
     49      this.showInRunCheckBox = new System.Windows.Forms.CheckBox();
    4950      this.valueViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5051      this.clearValueButton = new System.Windows.Forms.Button();
     
    7677                  | System.Windows.Forms.AnchorStyles.Left)
    7778                  | System.Windows.Forms.AnchorStyles.Right)));
     79      this.valueGroupBox.Controls.Add(this.showInRunCheckBox);
    7880      this.valueGroupBox.Controls.Add(this.valueViewHost);
    7981      this.valueGroupBox.Controls.Add(this.clearValueButton);
     
    8688      this.valueGroupBox.Text = "Value";
    8789      //
    88       // viewHost
     90      // showInRunCheckBox
     91      //
     92      this.showInRunCheckBox.AutoSize = true;
     93      this.showInRunCheckBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     94      this.showInRunCheckBox.Checked = true;
     95      this.showInRunCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
     96      this.showInRunCheckBox.Location = new System.Drawing.Point(66, 24);
     97      this.showInRunCheckBox.Name = "showInRunCheckBox";
     98      this.showInRunCheckBox.Size = new System.Drawing.Size(90, 17);
     99      this.showInRunCheckBox.TabIndex = 2;
     100      this.showInRunCheckBox.Text = "&Show in Run:";
     101      this.toolTip.SetToolTip(this.showInRunCheckBox, "Check to show the value of this parameter in each run.");
     102      this.showInRunCheckBox.UseVisualStyleBackColor = true;
     103      this.showInRunCheckBox.CheckedChanged += new System.EventHandler(this.showInRunCheckBox_CheckedChanged);
     104      //
     105      // valueViewHost
    89106      //
    90107      this.valueViewHost.AllowDrop = true;
    91       this.valueViewHost.Content = null;
    92108      this.valueViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    93109                  | System.Windows.Forms.AnchorStyles.Left)
    94110                  | System.Windows.Forms.AnchorStyles.Right)));
     111      this.valueViewHost.Caption = "View";
     112      this.valueViewHost.Content = null;
    95113      this.valueViewHost.Location = new System.Drawing.Point(6, 49);
    96       this.valueViewHost.Name = "viewHost";
     114      this.valueViewHost.Name = "valueViewHost";
     115      this.valueViewHost.ReadOnly = false;
    97116      this.valueViewHost.Size = new System.Drawing.Size(374, 182);
    98       this.valueViewHost.TabIndex = 0;
     117      this.valueViewHost.TabIndex = 3;
    99118      this.valueViewHost.ViewType = null;
    100       this.valueViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.valueViewHost_DragEnterOver);
    101119      this.valueViewHost.DragDrop += new System.Windows.Forms.DragEventHandler(this.valueViewHost_DragDrop);
    102120      this.valueViewHost.DragEnter += new System.Windows.Forms.DragEventHandler(this.valueViewHost_DragEnterOver);
     121      this.valueViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.valueViewHost_DragEnterOver);
    103122      //
    104123      // clearValueButton
     
    112131      this.toolTip.SetToolTip(this.clearValueButton, "Clear Value");
    113132      this.clearValueButton.UseVisualStyleBackColor = true;
    114       this.clearValueButton.Click += new System.EventHandler(this.setValueButton_Click);
     133      this.clearValueButton.Click += new System.EventHandler(this.clearValueButton_Click);
    115134      //
    116135      // setValueButton
     
    123142      this.toolTip.SetToolTip(this.setValueButton, "Set Value");
    124143      this.setValueButton.UseVisualStyleBackColor = true;
    125       this.setValueButton.Click += new System.EventHandler(this.changeValueButton_Click);
     144      this.setValueButton.Click += new System.EventHandler(this.setValueButton_Click);
    126145      //
    127146      // ValueParameterView
     
    141160      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    142161      this.valueGroupBox.ResumeLayout(false);
     162      this.valueGroupBox.PerformLayout();
    143163      this.ResumeLayout(false);
    144164      this.PerformLayout();
     
    152172    protected System.Windows.Forms.Button setValueButton;
    153173    protected System.Windows.Forms.Button clearValueButton;
     174    protected System.Windows.Forms.CheckBox showInRunCheckBox;
    154175  }
    155176}
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs

    r4257 r4332  
    6161    /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
    6262    protected override void DeregisterContentEvents() {
     63      Content.GetsCollectedChanged -= new EventHandler(Content_GetsCollectedChanged);
    6364      Content.ValueChanged -= new EventHandler(Content_ValueChanged);
    6465      base.DeregisterContentEvents();
     
    7172    protected override void RegisterContentEvents() {
    7273      base.RegisterContentEvents();
     74      Content.GetsCollectedChanged += new EventHandler(Content_GetsCollectedChanged);
    7375      Content.ValueChanged += new EventHandler(Content_ValueChanged);
    7476    }
     
    7779      base.OnContentChanged();
    7880      if (Content == null) {
    79         clearValueButton.Visible = true;
     81        showInRunCheckBox.Checked = false;
    8082        valueViewHost.Content = null;
    8183      } else {
    8284        SetDataTypeTextBoxText();
    83         clearValueButton.Visible = !(Content is ValueParameter<T>);
     85        showInRunCheckBox.Checked = Content.GetsCollected;
    8486        valueViewHost.ViewType = null;
    8587        valueViewHost.Content = Content.Value;
     
    9092      base.SetEnabledStateOfControls();
    9193      setValueButton.Enabled = Content != null && !ReadOnly;
    92       clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;
     94      clearValueButton.Enabled = Content != null && Content.Value != null && !(Content is ValueParameter<T>) && !ReadOnly;
     95      showInRunCheckBox.Enabled = Content != null && !ReadOnly;
    9396      valueGroupBox.Enabled = Content != null;
    9497    }
     
    99102      else {
    100103        SetDataTypeTextBoxText();
    101         clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;
     104        clearValueButton.Enabled = Content != null && Content.Value != null && !(Content is ValueParameter<T>) && !ReadOnly;
    102105        valueViewHost.ViewType = null;
    103106        valueViewHost.Content = Content != null ? Content.Value : null;
    104107      }
    105108    }
     109    protected virtual void Content_GetsCollectedChanged(object sender, EventArgs e) {
     110      if (InvokeRequired)
     111        Invoke(new EventHandler(Content_GetsCollectedChanged), sender, e);
     112      else
     113        showInRunCheckBox.Checked = Content != null && Content.GetsCollected;
     114    }
    106115
    107     protected virtual void changeValueButton_Click(object sender, EventArgs e) {
     116    protected virtual void setValueButton_Click(object sender, EventArgs e) {
    108117      if (typeSelectorDialog == null) {
    109118        typeSelectorDialog = new TypeSelectorDialog();
     
    120129      }
    121130    }
    122     protected virtual void setValueButton_Click(object sender, EventArgs e) {
     131    protected virtual void clearValueButton_Click(object sender, EventArgs e) {
    123132      Content.Value = null;
     133    }
     134    protected virtual void showInRunCheckBox_CheckedChanged(object sender, EventArgs e) {
     135      if (Content != null) Content.GetsCollected = showInRunCheckBox.Checked;
    124136    }
    125137    protected virtual void valueViewHost_DragEnterOver(object sender, DragEventArgs e) {
  • trunk/sources/HeuristicLab.Parameters/3.3/ConstrainedValueParameter.cs

    r4068 r4332  
    4343    public ConstrainedValueParameter() : base() { }
    4444    public ConstrainedValueParameter(string name) : base(name) { }
     45    public ConstrainedValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    4546    public ConstrainedValueParameter(string name, ItemSet<T> validValues) : base(name, validValues) { }
     47    public ConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected) : base(name, validValues, getsCollected) { }
    4648    public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value) : base(name, validValues, value) { }
     49    public ConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected) : base(name, validValues, value, getsCollected) { }
    4750    public ConstrainedValueParameter(string name, string description) : base(name, description) { }
     51    public ConstrainedValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    4852    public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues) : base(name, description, validValues) { }
     53    public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected) : base(name, description, validValues, getsCollected) { }
    4954    public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value) : base(name, description, validValues, value) { }
     55    public ConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected) : base(name, description, validValues, value, getsCollected) { }
     56    [StorableConstructor]
     57    protected ConstrainedValueParameter(bool deserializing) : base(deserializing) { }
    5058
    5159    protected override void ValidValues_ItemsAdded(object sender, CollectionItemsChangedEventArgs<T> e) {
  • trunk/sources/HeuristicLab.Parameters/3.3/LookupParameter.cs

    r3822 r4332  
    173173
    174174    public event EventHandler ActualNameChanged;
    175     private void OnActualNameChanged() {
    176       if (ActualNameChanged != null)
    177         ActualNameChanged(this, EventArgs.Empty);
     175    protected virtual void OnActualNameChanged() {
     176      EventHandler handler = ActualNameChanged;
     177      if (handler != null) handler(this, EventArgs.Empty);
    178178      OnToStringChanged();
    179179    }
  • trunk/sources/HeuristicLab.Parameters/3.3/OperatorParameter.cs

    r4068 r4332  
    3030  [StorableClass]
    3131  public class OperatorParameter : OptionalValueParameter<IOperator> {
    32     public OperatorParameter()
    33       : base("Anonymous") {
    34     }
    35     public OperatorParameter(string name)
    36       : base(name) {
    37     }
    38     public OperatorParameter(string name, IOperator value)
    39       : base(name, value) {
    40       Value = value;
    41     }
    42     public OperatorParameter(string name, string description)
    43       : base(name, description) {
    44     }
    45     public OperatorParameter(string name, string description, IOperator value)
    46       : base(name, description, value) {
    47       Value = value;
    48     }
     32    public OperatorParameter() : base("Anonymous") { }
     33    public OperatorParameter(string name) : base(name) { }
     34    public OperatorParameter(string name, bool getsCollected) : base(name, getsCollected) { }
     35    public OperatorParameter(string name, IOperator value) : base(name, value) { }
     36    public OperatorParameter(string name, IOperator value, bool getsCollected) : base(name, value, getsCollected) { }
     37    public OperatorParameter(string name, string description) : base(name, description) { }
     38    public OperatorParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
     39    public OperatorParameter(string name, string description, IOperator value) : base(name, description, value) { }
     40    public OperatorParameter(string name, string description, IOperator value, bool getsCollected) : base(name, description, value, getsCollected) { }
     41    [StorableConstructor]
     42    protected OperatorParameter(bool deserializing) : base(deserializing) { }
    4943  }
    5044}
  • trunk/sources/HeuristicLab.Parameters/3.3/OptionalConstrainedValueParameter.cs

    r3822 r4332  
    6161      }
    6262    }
    63 
    6463    IItem IValueParameter.Value {
    6564      get { return Value; }
     
    7574    }
    7675
     76    [Storable(DefaultValue = true)]
     77    private bool getsCollected;
     78    public bool GetsCollected {
     79      get { return getsCollected; }
     80      set {
     81        if (value != getsCollected) {
     82          getsCollected = value;
     83          OnGetsCollectedChanged();
     84        }
     85      }
     86    }
     87
     88    #region Constructors
    7789    public OptionalConstrainedValueParameter()
    7890      : base("Anonymous", typeof(T)) {
    7991      this.validValues = new ItemSet<T>();
     92      this.getsCollected = true;
    8093      Initialize();
    8194    }
     
    8396      : base(name, typeof(T)) {
    8497      this.validValues = new ItemSet<T>();
     98      this.getsCollected = true;
     99      Initialize();
     100    }
     101    public OptionalConstrainedValueParameter(string name, bool getsCollected)
     102      : base(name, typeof(T)) {
     103      this.validValues = new ItemSet<T>();
     104      this.getsCollected = getsCollected;
    85105      Initialize();
    86106    }
     
    88108      : base(name, typeof(T)) {
    89109      this.validValues = validValues;
     110      this.getsCollected = true;
     111      Initialize();
     112    }
     113    public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, bool getsCollected)
     114      : base(name, typeof(T)) {
     115      this.validValues = validValues;
     116      this.getsCollected = getsCollected;
    90117      Initialize();
    91118    }
     
    94121      this.validValues = validValues;
    95122      this.value = value;
     123      this.getsCollected = true;
     124      Initialize();
     125    }
     126    public OptionalConstrainedValueParameter(string name, ItemSet<T> validValues, T value, bool getsCollected)
     127      : base(name, typeof(T)) {
     128      this.validValues = validValues;
     129      this.value = value;
     130      this.getsCollected = getsCollected;
    96131      Initialize();
    97132    }
     
    99134      : base(name, description, typeof(T)) {
    100135      this.validValues = new ItemSet<T>();
     136      this.getsCollected = true;
     137      Initialize();
     138    }
     139    public OptionalConstrainedValueParameter(string name, string description, bool getsCollected)
     140      : base(name, description, typeof(T)) {
     141      this.validValues = new ItemSet<T>();
     142      this.getsCollected = getsCollected;
    101143      Initialize();
    102144    }
     
    104146      : base(name, description, typeof(T)) {
    105147      this.validValues = validValues;
     148      this.getsCollected = true;
     149      Initialize();
     150    }
     151    public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, bool getsCollected)
     152      : base(name, description, typeof(T)) {
     153      this.validValues = validValues;
     154      this.getsCollected = getsCollected;
    106155      Initialize();
    107156    }
     
    110159      this.validValues = validValues;
    111160      this.value = value;
     161      this.getsCollected = true;
     162      Initialize();
     163    }
     164    public OptionalConstrainedValueParameter(string name, string description, ItemSet<T> validValues, T value, bool getsCollected)
     165      : base(name, description, typeof(T)) {
     166      this.validValues = validValues;
     167      this.value = value;
     168      this.getsCollected = getsCollected;
    112169      Initialize();
    113170    }
    114171    [StorableConstructor]
    115172    protected OptionalConstrainedValueParameter(bool deserializing) : base(deserializing) { }
     173    #endregion
    116174
    117175    [StorableHook(HookType.AfterDeserialization)]
     
    125183      clone.validValues = (ItemSet<T>)cloner.Clone(validValues);
    126184      clone.value = (T)cloner.Clone(value);
     185      clone.getsCollected = getsCollected;
    127186      clone.Initialize();
    128187      return clone;
     
    142201    public event EventHandler ValueChanged;
    143202    protected virtual void OnValueChanged() {
    144       if (ValueChanged != null)
    145         ValueChanged(this, EventArgs.Empty);
     203      EventHandler handler = ValueChanged;
     204      if (handler != null) handler(this, EventArgs.Empty);
    146205      OnItemImageChanged();
    147206      OnToStringChanged();
     207    }
     208    public event EventHandler GetsCollectedChanged;
     209    protected virtual void OnGetsCollectedChanged() {
     210      EventHandler handler = GetsCollectedChanged;
     211      if (handler != null) handler(this, EventArgs.Empty);
    148212    }
    149213
  • trunk/sources/HeuristicLab.Parameters/3.3/OptionalValueParameter.cs

    r3822 r4332  
    6666    }
    6767
     68    [Storable(DefaultValue = true)]
     69    private bool getsCollected;
     70    public bool GetsCollected {
     71      get { return getsCollected; }
     72      set {
     73        if (value != getsCollected) {
     74          getsCollected = value;
     75          OnGetsCollectedChanged();
     76        }
     77      }
     78    }
     79
     80    #region Constructors
    6881    public OptionalValueParameter()
    6982      : base("Anonymous", typeof(T)) {
     83      this.getsCollected = true;
    7084    }
    7185    public OptionalValueParameter(string name)
    7286      : base(name, typeof(T)) {
     87      this.getsCollected = true;
     88    }
     89    public OptionalValueParameter(string name, bool getsCollected)
     90      : base(name, typeof(T)) {
     91      this.getsCollected = getsCollected;
    7392    }
    7493    public OptionalValueParameter(string name, T value)
    7594      : base(name, typeof(T)) {
    7695      this.value = value;
     96      this.getsCollected = true;
     97      Initialize();
     98    }
     99    public OptionalValueParameter(string name, T value, bool getsCollected)
     100      : base(name, typeof(T)) {
     101      this.value = value;
     102      this.getsCollected = getsCollected;
    77103      Initialize();
    78104    }
    79105    public OptionalValueParameter(string name, string description)
    80106      : base(name, description, typeof(T)) {
     107      this.getsCollected = true;
     108    }
     109    public OptionalValueParameter(string name, string description, bool getsCollected)
     110      : base(name, description, typeof(T)) {
     111      this.getsCollected = getsCollected;
    81112    }
    82113    public OptionalValueParameter(string name, string description, T value)
    83114      : base(name, description, typeof(T)) {
    84115      this.value = value;
     116      this.getsCollected = true;
     117      Initialize();
     118    }
     119    public OptionalValueParameter(string name, string description, T value, bool getsCollected)
     120      : base(name, description, typeof(T)) {
     121      this.value = value;
     122      this.getsCollected = getsCollected;
    85123      Initialize();
    86124    }
    87125    [StorableConstructor]
    88126    protected OptionalValueParameter(bool deserializing) : base(deserializing) { }
     127    #endregion
    89128
    90129    [StorableHook(HookType.AfterDeserialization)]
     
    96135      OptionalValueParameter<T> clone = (OptionalValueParameter<T>)base.Clone(cloner);
    97136      clone.value = (T)cloner.Clone(value);
     137      clone.getsCollected = getsCollected;
    98138      clone.Initialize();
    99139      return clone;
     
    112152
    113153    public event EventHandler ValueChanged;
    114     private void OnValueChanged() {
    115       if (ValueChanged != null)
    116         ValueChanged(this, EventArgs.Empty);
     154    protected virtual void OnValueChanged() {
     155      EventHandler handler = ValueChanged;
     156      if (handler != null) handler(this, EventArgs.Empty);
    117157      OnItemImageChanged();
    118158      OnToStringChanged();
     159    }
     160    public event EventHandler GetsCollectedChanged;
     161    protected virtual void OnGetsCollectedChanged() {
     162      EventHandler handler = GetsCollectedChanged;
     163      if (handler != null) handler(this, EventArgs.Empty);
    119164    }
    120165
  • trunk/sources/HeuristicLab.Parameters/3.3/ScopeParameter.cs

    r4068 r4332  
    4444      : base(name, description, typeof(IScope)) {
    4545    }
     46    [StorableConstructor]
     47    protected ScopeParameter(bool deserializing) : base(deserializing) { }
    4648
    4749    public override string ToString() {
  • trunk/sources/HeuristicLab.Parameters/3.3/ValueLookupParameter.cs

    r3822 r4332  
    6666    }
    6767
     68    [Storable(DefaultValue = true)]
     69    private bool getsCollected;
     70    public bool GetsCollected {
     71      get { return getsCollected; }
     72      set {
     73        if (value != getsCollected) {
     74          getsCollected = value;
     75          OnGetsCollectedChanged();
     76        }
     77      }
     78    }
     79
     80    #region Constructors
    6881    public ValueLookupParameter()
    6982      : base() {
     83      this.getsCollected = true;
    7084    }
    7185    public ValueLookupParameter(string name)
    7286      : base(name) {
     87      this.getsCollected = true;
     88    }
     89    public ValueLookupParameter(string name, bool getsCollected)
     90      : base(name) {
     91      this.getsCollected = getsCollected;
    7392    }
    7493    public ValueLookupParameter(string name, T value)
    7594      : base(name) {
    7695      this.value = value;
     96      this.getsCollected = true;
     97      Initialize();
     98    }
     99    public ValueLookupParameter(string name, T value, bool getsCollected)
     100      : base(name) {
     101      this.value = value;
     102      this.getsCollected = getsCollected;
    77103      Initialize();
    78104    }
    79105    public ValueLookupParameter(string name, string description)
    80106      : base(name, description) {
     107      this.getsCollected = true;
     108    }
     109    public ValueLookupParameter(string name, string description, bool getsCollected)
     110      : base(name, description) {
     111      this.getsCollected = getsCollected;
    81112    }
    82113    public ValueLookupParameter(string name, string description, T value)
    83114      : base(name, description) {
    84115      this.value = value;
     116      this.getsCollected = true;
     117      Initialize();
     118    }
     119    public ValueLookupParameter(string name, string description, T value, bool getsCollected)
     120      : base(name, description) {
     121      this.value = value;
     122      this.getsCollected = getsCollected;
    85123      Initialize();
    86124    }
    87125    public ValueLookupParameter(string name, string description, string actualName)
    88126      : base(name, description, actualName) {
     127      this.getsCollected = true;
     128    }
     129    public ValueLookupParameter(string name, string description, string actualName, bool getsCollected)
     130      : base(name, description, actualName) {
     131      this.getsCollected = getsCollected;
    89132    }
    90133    [StorableConstructor]
    91134    protected ValueLookupParameter(bool deserializing) : base(deserializing) { }
     135    #endregion
    92136
    93137    [StorableHook(HookType.AfterDeserialization)]
     
    99143      ValueLookupParameter<T> clone = (ValueLookupParameter<T>)base.Clone(cloner);
    100144      clone.value = (T)cloner.Clone(value);
     145      clone.getsCollected = getsCollected;
    101146      clone.Initialize();
    102147      return clone;
     
    113158
    114159    public event EventHandler ValueChanged;
    115     private void OnValueChanged() {
    116       if (ValueChanged != null)
    117         ValueChanged(this, EventArgs.Empty);
     160    protected virtual void OnValueChanged() {
     161      EventHandler handler = ValueChanged;
     162      if (handler != null) handler(this, EventArgs.Empty);
    118163      OnItemImageChanged();
    119164      OnToStringChanged();
     165    }
     166    public event EventHandler GetsCollectedChanged;
     167    protected virtual void OnGetsCollectedChanged() {
     168      EventHandler handler = GetsCollectedChanged;
     169      if (handler != null) handler(this, EventArgs.Empty);
    120170    }
    121171
  • trunk/sources/HeuristicLab.Parameters/3.3/ValueParameter.cs

    r4068 r4332  
    4141    public ValueParameter() : base() { }
    4242    public ValueParameter(string name) : base(name) { }
     43    public ValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }
    4344    public ValueParameter(string name, T value) : base(name, value) { }
     45    public ValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { }
    4446    public ValueParameter(string name, string description) : base(name, description) { }
     47    public ValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }
    4548    public ValueParameter(string name, string description, T value) : base(name, description, value) { }
     49    public ValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { }
     50    [StorableConstructor]
     51    protected ValueParameter(bool deserializing) : base(deserializing) { }
    4652  }
    4753}
Note: See TracChangeset for help on using the changeset viewer.