Free cookie consent management tool by TermsFeed Policy Generator

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/HeuristicLab.Optimization.Views/3.3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • 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.