Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4257 for trunk


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

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

Location:
trunk/sources/HeuristicLab.Parameters.Views/3.3
Files:
3 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}
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.cs

    r4068 r4257  
    2222using System;
    2323using System.Windows.Forms;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Core.Views;
     
    8081        valueViewHost.Content = null;
    8182      } else {
     83        SetDataTypeTextBoxText();
    8284        actualNameTextBox.Text = Content.ActualName;
    8385        valueViewHost.ViewType = null;
     
    105107        Invoke(new EventHandler(Content_ValueChanged), sender, e);
    106108      else {
    107         clearValueButton.Enabled = Content.Value != null && !ReadOnly;
     109        SetDataTypeTextBoxText();
     110        clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;
    108111        valueViewHost.ViewType = null;
    109         valueViewHost.Content = Content.Value;
     112        valueViewHost.Content = Content != null ? Content.Value : null;
    110113      }
    111114    }
     
    150153      }
    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}
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs

    r4068 r4257  
    2222using System;
    2323using System.Windows.Forms;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Core.Views;
     
    7980        valueViewHost.Content = null;
    8081      } else {
     82        SetDataTypeTextBoxText();
    8183        clearValueButton.Visible = !(Content is ValueParameter<T>);
    8284        valueViewHost.ViewType = null;
     
    9698        Invoke(new EventHandler(Content_ValueChanged), sender, e);
    9799      else {
    98         clearValueButton.Enabled = Content.Value != null && !ReadOnly;
     100        SetDataTypeTextBoxText();
     101        clearValueButton.Enabled = Content != null && Content.Value != null && !ReadOnly;
    99102        valueViewHost.ViewType = null;
    100         valueViewHost.Content = Content.Value;
     103        valueViewHost.Content = Content != null ? Content.Value : null;
    101104      }
    102105    }
     
    138141      }
    139142    }
     143
     144    #region Helpers
     145    protected void SetDataTypeTextBoxText() {
     146      if (Content == null) {
     147        dataTypeTextBox.Text = "-";
     148      } else {
     149        if ((Content.Value != null) && (Content.Value.GetType() != Content.DataType))
     150          dataTypeTextBox.Text = Content.DataType.GetPrettyName() + " (" + Content.Value.GetType().GetPrettyName() + ")";
     151        else
     152          dataTypeTextBox.Text = Content.DataType.GetPrettyName();
     153      }
     154    }
     155    #endregion
    140156  }
    141157}
Note: See TracChangeset for help on using the changeset viewer.