Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/19/10 05:37:14 (14 years ago)
Author:
swagner
Message:

Implemented showing of concrete data type in value parameters (#1161)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ConstrainedValueParameterView.cs

    r4068 r4257  
    2323using System.Collections.Generic;
    2424using HeuristicLab.Collections;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Core.Views;
     
    8586        FillValueComboBox();
    8687      } else {
     88        SetDataTypeTextBoxText();
    8789        FillValueComboBox();
    8890        viewHost.ViewType = null;
     
    121123        Invoke(new EventHandler(Content_ValueChanged), sender, e);
    122124      else {
    123         valueComboBox.SelectedIndex = valueComboBoxItems.IndexOf(Content.Value);
     125        SetDataTypeTextBoxText();
     126        valueComboBox.SelectedIndex = valueComboBoxItems.IndexOf(Content != null ? Content.Value : null);
    124127        viewHost.ViewType = null;
    125         viewHost.Content = Content.Value;
     128        viewHost.Content = Content != null ? Content.Value : null;
    126129      }
    127130    }
     
    150153        Content.Value = valueComboBoxItems[valueComboBox.SelectedIndex];
    151154    }
     155
     156    #region Helpers
     157    protected void SetDataTypeTextBoxText() {
     158      if (Content == null) {
     159        dataTypeTextBox.Text = "-";
     160      } else {
     161        if ((Content.Value != null) && (Content.Value.GetType() != Content.DataType))
     162          dataTypeTextBox.Text = Content.DataType.GetPrettyName() + " (" + Content.Value.GetType().GetPrettyName() + ")";
     163        else
     164          dataTypeTextBox.Text = Content.DataType.GetPrettyName();
     165      }
     166    }
     167    #endregion
    152168  }
    153169}
Note: See TracChangeset for help on using the changeset viewer.