Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/25/11 17:18:58 (13 years ago)
Author:
swagner
Message:

Moved description from textbox to icon in NamedItemView and adapted all derived views (#1416)

File:
1 edited

Legend:

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

    r5445 r5832  
    3333  [Content(typeof(INamedItem), false)]
    3434  public partial class NamedItemView : ItemView {
     35    private readonly string nl = Environment.NewLine;
     36    private const string infoLabelToolTipSuffix = "Double-click to open description editor.";
     37
    3538    public new INamedItem Content {
    3639      get { return (INamedItem)base.Content; }
     
    5962      if (Content == null) {
    6063        nameTextBox.Text = string.Empty;
    61         descriptionTextBox.Text = string.Empty;
    62         toolTip.SetToolTip(descriptionTextBox, string.Empty);
     64        toolTip.SetToolTip(infoLabel, string.Empty);
    6365        if (ViewAttribute.HasViewAttribute(this.GetType()))
    6466          this.Caption = ViewAttribute.GetViewName(this.GetType());
     
    6769      } else {
    6870        nameTextBox.Text = Content.Name;
    69         descriptionTextBox.Text = Content.Description;
    70         toolTip.SetToolTip(descriptionTextBox, Content.Description);
     71        toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + nl + nl + infoLabelToolTipSuffix);
    7172        Caption = Content.Name;
    7273      }
     
    7778      if (Content == null) {
    7879        nameTextBox.Enabled = false;
    79         descriptionTextBox.Enabled = false;
     80        infoLabel.Enabled = false;
    8081      } else {
    8182        nameTextBox.Enabled = true;
    82         nameTextBox.ReadOnly = ReadOnly || !Content.CanChangeName; ;
    83         descriptionTextBox.Enabled = true;
    84         descriptionTextBox.ReadOnly = ReadOnly || !Content.CanChangeDescription;
     83        nameTextBox.ReadOnly = ReadOnly || !Content.CanChangeName;
     84        infoLabel.Enabled = true;
    8585      }
    8686    }
     
    9898        Invoke(new EventHandler(Content_DescriptionChanged), sender, e);
    9999      else {
    100         descriptionTextBox.Text = Content.Description;
    101         toolTip.SetToolTip(descriptionTextBox, Content.Description);
     100        toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + nl + nl + infoLabelToolTipSuffix);
    102101      }
    103102    }
     
    131130      }
    132131    }
    133     protected virtual void descriptionTextBox_Validated(object sender, EventArgs e) {
    134       if (Content.CanChangeDescription)
    135         Content.Description = descriptionTextBox.Text;
    136     }
    137 
    138     protected void descriptionTextBox_DoubleClick(object sender, EventArgs e) {
    139       using (TextDialog dialog = new TextDialog("Description of " + Content.Name, descriptionTextBox.Text, ReadOnly || !Content.CanChangeDescription)) {
     132    protected virtual void infoLabel_DoubleClick(object sender, EventArgs e) {
     133      using (TextDialog dialog = new TextDialog("Description of " + Content.Name, Content.Description, ReadOnly || !Content.CanChangeDescription)) {
    140134        if (dialog.ShowDialog(this) == DialogResult.OK)
    141135          Content.Description = dialog.Content;
Note: See TracChangeset for help on using the changeset viewer.