Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3350 for trunk/sources


Ignore:
Timestamp:
04/15/10 01:34:27 (14 years ago)
Author:
mkommend
Message:

implemented first version of View.ReadOnly and adapted some views to the new mechanism (ticket #973)

Location:
trunk/sources
Files:
17 edited

Legend:

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

    r3341 r3350  
    6969      Caption = "Item Collection";
    7070      while (itemsListView.Items.Count > 0) RemoveListViewItem(itemsListView.Items[0]);
    71       itemsListView.Enabled = false;
    72       detailsGroupBox.Enabled = false;
    7371      viewHost.Content = null;
    74       addButton.Enabled = false;
    75       sortAscendingButton.Enabled = false;
    76       sortDescendingButton.Enabled = false;
    77       removeButton.Enabled = false;
    78 
    7972      if (Content != null) {
    8073        Caption += " (" + Content.GetType().Name + ")";
    81         itemsListView.Enabled = true;
    82         addButton.Enabled = !Content.IsReadOnly;
    8374        foreach (T item in Content)
    8475          AddListViewItem(CreateListViewItem(item));
     76        SortItemsListView(SortOrder.Ascending);
     77      }
     78      SetEnableStateOfControls();
     79    }
     80
     81    protected override void OnReadOnlyChanged() {
     82      base.OnReadOnlyChanged();
     83      SetEnableStateOfControls();
     84    }
     85    private void SetEnableStateOfControls() {
     86      if (Content == null) {
     87        itemsListView.Enabled = false;
     88        detailsGroupBox.Enabled = false;
    8589        sortAscendingButton.Enabled = itemsListView.Items.Count > 0;
    8690        sortDescendingButton.Enabled = itemsListView.Items.Count > 0;
    87         SortItemsListView(SortOrder.Ascending);
     91        viewHost.Enabled = false;
     92        addButton.Enabled = false;
     93        removeButton.Enabled = false;
     94      } else {
     95        itemsListView.Enabled = true;
     96        detailsGroupBox.Enabled = true;
     97        sortAscendingButton.Enabled = true;
     98        sortDescendingButton.Enabled = true;
     99        viewHost.Enabled = true;
     100        viewHost.ReadOnly = ReadOnly;
     101        addButton.Enabled = !ReadOnly;
     102        removeButton.Enabled = !ReadOnly;
    88103      }
    89104    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemView.cs

    r2917 r3350  
    6666        Caption = "NamedItem";
    6767        nameTextBox.Text = "-";
    68         nameTextBox.Enabled = false;
    6968        descriptionTextBox.Text = "";
    70         descriptionTextBox.Enabled = false;
    7169        toolTip.SetToolTip(descriptionTextBox, string.Empty);
    7270      } else {
    7371        Caption = Content.Name + " (" + Content.GetType().Name + ")";
    7472        nameTextBox.Text = Content.Name;
    75         nameTextBox.ReadOnly = !Content.CanChangeName;
     73        descriptionTextBox.Text = Content.Description;
     74        toolTip.SetToolTip(descriptionTextBox, Content.Description);
     75      }
     76      SetEnableStateOfControls();
     77    }
     78
     79    protected override void OnReadOnlyChanged() {
     80      base.OnReadOnlyChanged();
     81      SetEnableStateOfControls();
     82    }
     83    private void SetEnableStateOfControls() {
     84      if (Content == null) {
     85        nameTextBox.Enabled = false;
     86        descriptionTextBox.Enabled = false;
     87      } else {
    7688        nameTextBox.Enabled = true;
    77         descriptionTextBox.Text = Content.Description;
    78         descriptionTextBox.ReadOnly = !Content.CanChangeDescription;
     89        nameTextBox.ReadOnly = ReadOnly || !Content.CanChangeName; ;
    7990        descriptionTextBox.Enabled = true;
    80         toolTip.SetToolTip(descriptionTextBox, Content.Description);
     91        descriptionTextBox.ReadOnly = ReadOnly || !Content.CanChangeDescription;
    8192      }
    8293    }
  • trunk/sources/HeuristicLab.Data.Views/3.3/BoolValueView.cs

    r3317 r3350  
    5858        Caption = "BoolValue View";
    5959        valueCheckBox.Checked = false;
    60         valueCheckBox.Enabled = false;
    6160      } else {
    6261        Caption = Content.ToString() + " (" + Content.GetType().Name + ")";
    6362        valueCheckBox.Checked = Content.Value;
    64         valueCheckBox.Enabled = !Content.ReadOnlyView;
    6563      }
     64      SetEnableStateOfControls();
     65    }
     66
     67    protected override void OnReadOnlyChanged() {
     68      base.OnReadOnlyChanged();
     69      SetEnableStateOfControls();
     70    }
     71    private void SetEnableStateOfControls() {
     72      if (Content == null) valueCheckBox.Enabled = false;
     73      else valueCheckBox.Enabled = !ReadOnly;
    6674    }
    6775
  • trunk/sources/HeuristicLab.Data.Views/3.3/ComparisonView.cs

    r3317 r3350  
    6262        Caption = Content.ToString() + " (" + Content.GetType().Name + ")";
    6363        valueComboBox.SelectedItem = Content.Value;
    64         valueComboBox.Enabled = !Content.ReadOnlyView;
    6564      }
     65      SetEnableStateOfControls();
     66    }
     67    protected override void OnReadOnlyChanged() {
     68      base.OnReadOnlyChanged();
     69      SetEnableStateOfControls();
     70    }
     71    private void SetEnableStateOfControls() {
     72      if (Content == null) valueComboBox.Enabled = false;
     73      else valueComboBox.Enabled = !ReadOnly;
    6674    }
    6775
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs

    r3317 r3350  
    5454    }
    5555
    56 
    5756    protected override void RegisterContentEvents() {
    5857      base.RegisterContentEvents();
     
    6665        Caption = "StringConvertibleArray View";
    6766        lengthTextBox.Text = "";
    68         lengthTextBox.Enabled = false;
    6967        dataGridView.Rows.Clear();
    7068        dataGridView.Columns.Clear();
    71         dataGridView.Enabled = false;
    7269      } else {
    7370        Caption = "StringConvertibleArray (" + Content.GetType().Name + ")";
    7471        UpdateData();
     72      }
     73      SetEnableStateOfControls();
     74    }
     75    protected override void OnReadOnlyChanged() {
     76      base.OnReadOnlyChanged();
     77      SetEnableStateOfControls();
     78    }
     79    private void SetEnableStateOfControls() {
     80      if (Content == null) {
     81        lengthTextBox.Enabled = false;
     82        dataGridView.Enabled = false;
     83      } else {
     84        lengthTextBox.Enabled = true;
     85        dataGridView.Enabled = true;
     86        lengthTextBox.ReadOnly = ReadOnly;
     87        dataGridView.ReadOnly = ReadOnly;
    7588      }
    7689    }
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r3346 r3350  
    8282        Caption = "StringConvertibleMatrix View";
    8383        rowsTextBox.Text = "";
    84         rowsTextBox.Enabled = false;
    8584        columnsTextBox.Text = "";
    86         columnsTextBox.Enabled = false;
    8785        dataGridView.Rows.Clear();
    8886        dataGridView.Columns.Clear();
    89         dataGridView.Enabled = false;
    9087        virtualRowIndizes = new int[0];
    9188      } else {
    9289        Caption = "StringConvertibleMatrix (" + Content.GetType().Name + ")";
    93         UpdateReadOnlyControls();
    9490        UpdateData();
     91      }
     92      SetEnableStateOfControls();
     93    }
     94    protected override void OnReadOnlyChanged() {
     95      base.OnReadOnlyChanged();
     96      SetEnableStateOfControls();
     97    }
     98    private void SetEnableStateOfControls() {
     99      if (Content == null) {
     100        rowsTextBox.Enabled = false;
     101        columnsTextBox.Enabled = false;
     102        dataGridView.Enabled = false;
     103      } else {
     104        rowsTextBox.Enabled = true;
     105        columnsTextBox.Enabled = true;
     106        dataGridView.Enabled = true;
     107        rowsTextBox.ReadOnly = ReadOnly;
     108        columnsTextBox.ReadOnly = ReadOnly;
     109        dataGridView.ReadOnly = ReadOnly;
    95110      }
    96111    }
     
    338353
    339354        foreach (KeyValuePair<int, SortOrder> pair in sortedIndizes.Where(p => p.Value != SortOrder.None)) {
    340             string1 = matrix.GetValue(x, pair.Key);
    341             string2 = matrix.GetValue(y, pair.Key);
    342             if (double.TryParse(string1, out double1) && double.TryParse(string2, out double2))
    343               result = double1.CompareTo(double2);
    344             else if (DateTime.TryParse(string1, out dateTime1) && DateTime.TryParse(string2, out dateTime2))
    345               result = dateTime1.CompareTo(dateTime2);
    346             else {
    347               if (string1 != null)
    348                 result = string1.CompareTo(string2);
    349               else if (string2 != null)
    350                 result = string2.CompareTo(string1) * -1;
    351             }
    352             if (pair.Value == SortOrder.Descending)
    353               result *= -1;
    354             if (result != 0)
    355               return result;
     355          string1 = matrix.GetValue(x, pair.Key);
     356          string2 = matrix.GetValue(y, pair.Key);
     357          if (double.TryParse(string1, out double1) && double.TryParse(string2, out double2))
     358            result = double1.CompareTo(double2);
     359          else if (DateTime.TryParse(string1, out dateTime1) && DateTime.TryParse(string2, out dateTime2))
     360            result = dateTime1.CompareTo(dateTime2);
     361          else {
     362            if (string1 != null)
     363              result = string1.CompareTo(string2);
     364            else if (string2 != null)
     365              result = string2.CompareTo(string1) * -1;
     366          }
     367          if (pair.Value == SortOrder.Descending)
     368            result *= -1;
     369          if (result != 0)
     370            return result;
    356371        }
    357372        return result;
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleValueView.cs

    r3317 r3350  
    6161        Caption = "StringConvertibleValue View";
    6262        valueTextBox.Text = string.Empty;
    63         valueTextBox.Enabled = false;
    6463      } else {
    6564        Caption = Content.GetValue() + " (" + Content.GetType().Name + ")";
    6665        valueTextBox.Text = Content.GetValue();
    67         valueTextBox.ReadOnly = Content.ReadOnlyView;
     66      }
     67      SetEnableStateOfControls();
     68    }
     69    protected override void OnReadOnlyChanged() {
     70      base.OnReadOnlyChanged();
     71      SetEnableStateOfControls();
     72    }
     73    private void SetEnableStateOfControls() {
     74      if (Content == null) valueTextBox.Enabled = false;
     75      else {
    6876        valueTextBox.Enabled = true;
     77        valueTextBox.ReadOnly = ReadOnly;
    6978      }
    7079    }
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/View.cs

    r3301 r3350  
    3131      this.isShown = false;
    3232      this.closeReason = CloseReason.None;
    33     }
    34 
    35     private string myCaption;
     33      this.readOnly = false;
     34    }
     35
     36    public View(bool readOnly)
     37      : this() {
     38      this.readOnly = readOnly;
     39    }
     40
     41    private string caption;
    3642    public string Caption {
    37       get { return myCaption; }
     43      get { return caption; }
    3844      set {
    3945        if (InvokeRequired) {
     
    4147          Invoke(action, value);
    4248        } else {
    43           if (value != myCaption) {
    44             myCaption = value;
     49          if (value != caption) {
     50            caption = value;
    4551            OnCaptionChanged();
     52          }
     53        }
     54      }
     55    }
     56
     57    private bool readOnly;
     58    public virtual bool ReadOnly {
     59      get { return this.readOnly; }
     60       set {
     61        if (InvokeRequired) {
     62          Action<bool> action = delegate(bool b) { this.ReadOnly = b; };
     63          Invoke(action, value);
     64        } else {
     65          if (value != readOnly) {
     66            readOnly = value;
     67            OnReadOnlyChanged();
    4668          }
    4769        }
     
    95117    public event EventHandler CaptionChanged;
    96118    protected virtual void OnCaptionChanged() {
    97       if (CaptionChanged != null)
    98         CaptionChanged(this, EventArgs.Empty);
    99     }
    100 
     119      if (InvokeRequired)
     120        Invoke((MethodInvoker)OnCaptionChanged);
     121      else {
     122        EventHandler handler = CaptionChanged;
     123        if (handler != null)
     124          handler(this, EventArgs.Empty);
     125      }
     126    }
     127    public event EventHandler ReadOnlyChanged;
     128    protected virtual void OnReadOnlyChanged() {
     129      if (InvokeRequired)
     130        Invoke((MethodInvoker)OnReadOnlyChanged);
     131      else {
     132        EventHandler handler = ReadOnlyChanged;
     133        if (handler != null)
     134          handler(this, EventArgs.Empty);
     135        foreach (Control control in this.Controls) {
     136          IView view = control as IView;
     137          if (view != null)
     138            view.ReadOnly = this.readOnly;
     139          ViewHost viewHost = control as ViewHost;
     140          if (viewHost != null)
     141            viewHost.ReadOnly = this.readOnly;
     142        }
     143      }
     144    }
    101145    public event EventHandler Changed;
    102146    protected virtual void OnChanged() {
    103147      if (InvokeRequired)
    104148        Invoke((MethodInvoker)OnChanged);
    105       else if (Changed != null)
    106         Changed(this, EventArgs.Empty);
     149      else {
     150        EventHandler handler = Changed;
     151        if (handler != null)
     152          handler(this, EventArgs.Empty);
     153      }
    107154    }
    108155
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ViewHost.cs

    r3281 r3350  
    2828namespace HeuristicLab.MainForm.WindowsForms {
    2929  public sealed partial class ViewHost : UserControl {
     30    private Dictionary<Type, IView> cachedViews;
     31    public ViewHost() {
     32      InitializeComponent();
     33      viewType = null;
     34      content = null;
     35      cachedViews = new Dictionary<Type, IView>();
     36      Initialize();
     37    }
     38    public ViewHost(bool readOnly)
     39      : this() {
     40      this.ReadOnly = readOnly;
     41    }
     42
    3043    private Type viewType;
    3144    public Type ViewType {
     
    4962          content = value;
    5063          viewContextMenuStrip.Item = content;
     64          cachedViews.Clear();
    5165          Initialize();
    5266        }
     
    5973        this.SuspendRepaint();
    6074        base.Enabled = value;
     75        this.viewsLabel.Enabled = value;
    6176        this.ResumeRepaint(true);
    6277      }
    6378    }
     79    private bool readOnly;
     80    public bool ReadOnly {
     81      get { return this.readOnly; }
     82      set {
     83        if (InvokeRequired) {
     84          Action<bool> action = delegate(bool b) { this.ReadOnly = b; };
     85          Invoke(action, value);
     86        } else {
     87          if (value != readOnly) {
     88            readOnly = value;
     89            OnReadOnlyChanged();
     90          }
     91        }
     92      }
     93    }
    6494
    65     public ViewHost() {
    66       InitializeComponent();
    67       viewType = null;
    68       content = null;
    69       Initialize();
     95    public event EventHandler ReadOnlyChanged;
     96    private void OnReadOnlyChanged() {
     97      if (InvokeRequired)
     98        Invoke((MethodInvoker)OnReadOnlyChanged);
     99      else {
     100        EventHandler handler = ReadOnlyChanged;
     101        if (handler != null)
     102          handler(this, EventArgs.Empty);
     103        foreach (IView view in cachedViews.Values)
     104          view.ReadOnly = this.readOnly;
     105      }
    70106    }
    71107
    72108    private void Initialize() {
    73109      viewsLabel.Visible = false;
    74       viewsLabel.Enabled = false;
    75       viewContextMenuStrip.Enabled = false;
    76       messageLabel.Visible = false;
    77 
    78110      viewPanel.Visible = false;
    79111      if (viewPanel.Controls.Count > 0) viewPanel.Controls[0].Dispose();
     
    81113
    82114      if (Content != null) {
    83         if (viewContextMenuStrip.Items.Count == 0) {
     115        if (viewContextMenuStrip.Items.Count == 0)
    84116          messageLabel.Visible = true;
    85         } else {
     117         else
    86118          viewsLabel.Visible = true;
    87           viewsLabel.Enabled = viewContextMenuStrip.Items.Count > 1;
    88           viewContextMenuStrip.Enabled = viewContextMenuStrip.Items.Count > 1; ;
    89         }
    90119
    91120        if (!ViewCanShowContent(viewType, Content)) {
     
    110139
    111140      UpdateActiveMenuItem();
    112       Control view = (Control)MainFormManager.CreateView(viewType, Content);
    113       viewPanel.Tag = view;
     141      cachedViews.Clear();
     142      Control view = (Control)MainFormManager.CreateView(viewType, Content,ReadOnly);
     143      cachedViews.Add(viewType, ((IView)view));
    114144      view.Dock = DockStyle.Fill;
    115145      viewPanel.Controls.Add(view);
     
    138168
    139169    private void viewsLabel_DoubleClick(object sender, EventArgs e) {
    140       MainFormManager.CreateView(viewType, Content).Show();
     170      MainFormManager.CreateView(viewType, Content,ReadOnly).Show();
    141171    }
    142172
  • trunk/sources/HeuristicLab.MainForm/3.2/Interfaces/IView.cs

    r2790 r3350  
    3030    bool IsShown { get; }
    3131    string Caption { get; set; }
     32    bool ReadOnly { get; set; }
     33    event EventHandler ReadOnlyChanged;
    3234    event EventHandler CaptionChanged;
    3335    event EventHandler Changed;
  • trunk/sources/HeuristicLab.MainForm/3.2/MainFormManager.cs

    r3278 r3350  
    148148      return (IView)Activator.CreateInstance(t, content);
    149149    }
     150    public static IView CreateDefaultView(object content, bool readOnly) {
     151      IView view = CreateDefaultView(content);
     152      if (view != null)
     153        view.ReadOnly = readOnly;
     154      return null;
     155    }
    150156
    151157    public static IView CreateView(Type viewType) {
     
    156162
    157163      return (IView)Activator.CreateInstance(viewType);
     164    }
     165    public static IView CreateView(Type viewType, bool readOnly) {
     166      IView view = CreateView(viewType);
     167      view.ReadOnly = readOnly;
     168      return view;
    158169    }
    159170
     
    166177
    167178      return (IView)Activator.CreateInstance(view, content);
     179    }
     180    public static IView CreateView(Type viewType, object content, bool readOnly) {
     181      IView view = CreateView(viewType, content);
     182      view.ReadOnly = readOnly;
     183      return view;
    168184    }
    169185
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultCollectionView.cs

    r3274 r3350  
    3030  [Content(typeof(IObservableKeyedCollection<string, IResult>), false)]
    3131  public partial class ResultCollectionView : NamedItemCollectionView<IResult> {
     32    public override bool ReadOnly {
     33      get { return base.ReadOnly; }
     34      set { /*not needed because results are always readonly */}
     35    }
    3236    /// <summary>
    3337    /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
     
    3741      Caption = "ResultCollection";
    3842      itemsGroupBox.Text = "Results";
     43      base.ReadOnly = true;
    3944    }
    4045    /// <summary>
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ResultView.cs

    r3226 r3350  
    4444    }
    4545
     46    public override bool ReadOnly {
     47      get { return base.ReadOnly; }
     48      set { /*not needed because results are always readonly */}
     49    }
     50
    4651    /// <summary>
    4752    /// Initializes a new instance of <see cref="VariableView"/> with caption "Variable".
     
    5055      InitializeComponent();
    5156      Caption = "Result";
     57      base.ReadOnly = true;
    5258    }
    5359    /// <summary>
     
    8490        Caption = "Result";
    8591        dataTypeTextBox.Text = "-";
    86         dataTypeTextBox.Enabled = false;
    87         valueGroupBox.Enabled = false;
    8892        viewHost.Content = null;
    8993      } else {
    9094        Caption = Content.Name + " (" + Content.GetType().Name + ")";
    9195        dataTypeTextBox.Text = Content.DataType.GetPrettyName();
     96        viewHost.ViewType = null;
     97        viewHost.Content = Content.Value;
     98      }
     99      SetEnableStateOfControls();
     100    }
     101    protected override void OnReadOnlyChanged() {
     102      base.OnReadOnlyChanged();
     103      SetEnableStateOfControls();
     104    }
     105    private void SetEnableStateOfControls() {
     106      if (Content == null) {
     107        dataTypeTextBox.Enabled = false;
     108        valueGroupBox.Enabled = false;
     109        viewHost.Enabled = false;
     110      } else {
    92111        dataTypeTextBox.Enabled = true;
    93112        valueGroupBox.Enabled = true;
    94         viewHost.ViewType = null;
    95         viewHost.Content = Content.Value;
     113        viewHost.Enabled = true;
     114        viewHost.ReadOnly = ReadOnly;
    96115      }
    97116    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r3349 r3350  
    4343      Caption = "Run Collection Bubble Chart";
    4444      this.categoricalMapping = new Dictionary<int, Dictionary<object, double>>();
     45      base.ReadOnly = true;
    4546    }
    4647
     
    5354      get { return (RunCollection)base.Content; }
    5455      set { base.Content = value; }
     56    }
     57    public override bool ReadOnly {
     58      get { return base.ReadOnly; }
     59      set { /*not needed because results are always readonly */}
    5560    }
    5661
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionTabularView.cs

    r3347 r3350  
    4040      Caption = "Run Collection";
    4141      this.dataGridView.RowHeaderMouseDoubleClick += new DataGridViewCellMouseEventHandler(dataGridView_RowHeaderMouseDoubleClick);
     42      base.ReadOnly = true;
    4243    }
    4344
     
    4546      : this() {
    4647      Content = content;
     48    }
     49
     50    public override bool ReadOnly {
     51      get { return base.ReadOnly; }
     52      set { /*not needed because results are always readonly */}
    4753    }
    4854
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3341 r3350  
    4545      InitializeComponent();
    4646      Caption = "Run Collection";
     47      base.ReadOnly = true;
    4748    }
    4849
     
    5051      : this() {
    5152      Content = content;
     53    }
     54    public override bool ReadOnly {
     55      get { return base.ReadOnly; }
     56      set { /*not needed because results are always readonly */}
    5257    }
    5358
     
    6974      Caption = "Run Collection";
    7075      while (itemsListView.Items.Count > 0) RemoveListViewItem(itemsListView.Items[0]);
    71       itemsListView.Enabled = false;
    72       detailsGroupBox.Enabled = false;
    7376      viewHost.Content = null;
    74       removeButton.Enabled = false;
    7577
    7678      if (Content != null) {
    7779        Caption += " (" + Content.GetType().Name + ")";
    78         itemsListView.Enabled = true;
    7980        foreach (IRun item in Content)
    8081          AddListViewItem(CreateListViewItem(item));
     82      }
     83      SetEnableStateOfControls();
     84    }
     85
     86    protected override void OnReadOnlyChanged() {
     87      base.OnReadOnlyChanged();
     88      SetEnableStateOfControls();
     89    }
     90    private void SetEnableStateOfControls() {
     91      if (Content == null) {
     92        itemsListView.Enabled = false;
     93        detailsGroupBox.Enabled = false;
     94        viewHost.Enabled = false;
     95        removeButton.Enabled = false;
     96      } else {
     97        itemsListView.Enabled = true;
     98        detailsGroupBox.Enabled = true;
     99        removeButton.Enabled = true;
     100        viewHost.Enabled = true;
     101        viewHost.ReadOnly = ReadOnly;
    81102      }
    82103    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r3341 r3350  
    4343    }
    4444
     45    public override bool ReadOnly {
     46      get { return base.ReadOnly; }
     47      set { /*not needed because results are always readonly */}
     48    }
     49
    4550    /// <summary>
    4651    /// Initializes a new instance of <see cref="VariableView"/> with caption "Variable".
     
    4954      InitializeComponent();
    5055      Caption = "Run";
     56      base.ReadOnly = true;
    5157    }
    5258    /// <summary>
     
    6571      viewHost.ViewType = null;
    6672      viewHost.Content = null;
     73      if (Content == null)
     74        Caption = "Run";
     75      else
     76        Caption = Content.Name + " (" + Content.GetType().Name + ")";
     77      SetEnableStateOfControls();
     78    }
     79    protected override void OnReadOnlyChanged() {
     80      base.OnReadOnlyChanged();
     81      SetEnableStateOfControls();
     82    }
     83    private void SetEnableStateOfControls() {
    6784      if (Content == null) {
    68         Caption = "Run";
    6985        parametersResultsGroupBox.Enabled = false;
     86        viewHost.Enabled = false;
    7087      } else {
    71         Caption = Content.Name + " (" + Content.GetType().Name + ")";
    7288        parametersResultsGroupBox.Enabled = true;
     89        viewHost.Enabled = true;
     90        viewHost.ReadOnly = ReadOnly;
    7391      }
    7492    }
Note: See TracChangeset for help on using the changeset viewer.