Changeset 3367


Ignore:
Timestamp:
04/16/10 04:13:49 (11 years ago)
Author:
mkommend
Message:

adapted HL.Optimization.Views to new ReadOnly mechanism (ticket #973)

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r3299 r3367  
    113113        executionTimeTextBox.Enabled = true;
    114114      }
     115      SetEnableStateOfControls();
     116    }
     117
     118    protected override void OnReadOnlyChanged() {
     119      base.OnReadOnlyChanged();
     120      SetEnableStateOfControls();
     121    }
     122    private void SetEnableStateOfControls() {
     123      parameterCollectionView.ReadOnly = ReadOnly;
     124      problemViewHost.ReadOnly = ReadOnly;
     125      resultsView.ReadOnly = ReadOnly;
     126      runsView.ReadOnly = ReadOnly;
    115127    }
    116128
     
    140152        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    141153      else {
    142         nameTextBox.Enabled = Content.ExecutionState != ExecutionState.Started;
    143         descriptionTextBox.Enabled = Content.ExecutionState != ExecutionState.Started;
     154        this.ReadOnly = Content.ExecutionState == ExecutionState.Started;
    144155        SaveEnabled = Content.ExecutionState != ExecutionState.Started;
    145         parameterCollectionView.Enabled = Content.ExecutionState != ExecutionState.Started;
    146         newProblemButton.Enabled = openProblemButton.Enabled = saveProblemButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    147         problemViewHost.Enabled = Content.ExecutionState != ExecutionState.Started;
    148156        EnableDisableButtons();
    149157      }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs

    r3299 r3367  
    9797        executionTimeTextBox.Enabled = true;
    9898      }
     99      SetEnableStateOfControls();
     100    }
     101    protected override void OnReadOnlyChanged() {
     102      base.OnReadOnlyChanged();
     103      SetEnableStateOfControls();
     104    }
     105    private void SetEnableStateOfControls() {
     106      repetitionsNumericUpDown.ReadOnly = ReadOnly;
     107      algorithmViewHost.ReadOnly = ReadOnly;
     108      runsView.ReadOnly = ReadOnly;
    99109    }
    100110
     
    109119        Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    110120      else {
    111         nameTextBox.Enabled = Content.ExecutionState != ExecutionState.Started;
    112         descriptionTextBox.Enabled = Content.ExecutionState != ExecutionState.Started;
     121        this.ReadOnly = Content.ExecutionState == ExecutionState.Started;
    113122        SaveEnabled = Content.ExecutionState != ExecutionState.Started;
    114         repetitionsNumericUpDown.Enabled = Content.ExecutionState != ExecutionState.Started;
    115123        newAlgorithmButton.Enabled = openAlgorithmButton.Enabled = saveAlgorithmButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    116124        EnableDisableButtons();
     
    237245    private void algorithmPanel_DragEnterOver(object sender, DragEventArgs e) {
    238246      e.Effect = DragDropEffects.None;
     247      if (ReadOnly)
     248        return;
    239249      Type type = e.Data.GetData("Type") as Type;
    240250      if ((type != null) && (typeof(IAlgorithm).IsAssignableFrom(type))) {
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.cs

    r3361 r3367  
    101101        createUserDefinedAlgorithmButton.Enabled = true;
    102102      }
     103      SetEnableStateOfControls();
     104    }
     105
     106    protected override void OnReadOnlyChanged() {
     107      base.OnReadOnlyChanged();
     108      SetEnableStateOfControls();
     109    }
     110    private void SetEnableStateOfControls() {
     111      engineViewHost.ReadOnly = ReadOnly;
     112      if (Content == null)
     113        engineComboBox.Enabled = false;
     114      else
     115        engineComboBox.Enabled = Content.ExecutionState != ExecutionState.Started;
    103116    }
    104117
     
    108121      else {
    109122        createUserDefinedAlgorithmButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    110         engineComboBox.Enabled = Content.ExecutionState != ExecutionState.Started;
    111         engineViewHost.Enabled = Content.ExecutionState != ExecutionState.Started;
    112         operatorGraphViewHost.Enabled = Content.ExecutionState != ExecutionState.Started;
    113123        base.Content_ExecutionStateChanged(sender, e);
    114124      }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentView.cs

    r3329 r3367  
    8484        executionTimeTextBox.Enabled = true;
    8585      }
     86      SetEnableStateOfControls();
     87    }
     88
     89    protected override void OnReadOnlyChanged() {
     90      base.OnReadOnlyChanged();
     91      SetEnableStateOfControls();
     92    }
     93    private void SetEnableStateOfControls() {
     94      optimizerListView.ReadOnly = ReadOnly;
    8695    }
    8796
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3362 r3367  
    4545      InitializeComponent();
    4646      Caption = "Run Collection";
    47       base.ReadOnly = true;
    4847    }
    4948
     
    5150      : this() {
    5251      Content = content;
    53     }
    54     public override bool ReadOnly {
    55       get { return base.ReadOnly; }
    56       set { /*not needed because results are always readonly */}
    5752    }
    5853
     
    9792        itemsListView.Enabled = true;
    9893        detailsGroupBox.Enabled = true;
    99         removeButton.Enabled = true;
     94        removeButton.Enabled = !ReadOnly;
    10095        viewHost.Enabled = true;
    10196        viewHost.ReadOnly = ReadOnly;
     
    170165      if (itemsListView.SelectedItems.Count == 1) {
    171166        IRun item = (IRun)itemsListView.SelectedItems[0].Tag;
    172         IView view = MainFormManager.CreateDefaultView(item);
     167        IView view = MainFormManager.CreateDefaultView(item,ReadOnly);
    173168        if (view != null) view.Show();
    174169      }
     
    180175      data.SetData("Type", item.GetType());
    181176      data.SetData("Value", item);
    182       if (Content.IsReadOnly) {
     177      if (Content.IsReadOnly || ReadOnly) {
    183178        DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
    184179      } else {
     
    190185    protected virtual void itemsListView_DragEnterOver(object sender, DragEventArgs e) {
    191186      e.Effect = DragDropEffects.None;
     187      if (ReadOnly) return;
    192188      Type type = e.Data.GetData("Type") as Type;
    193189      if ((!Content.IsReadOnly) && (type != null) && (typeof(IRun).IsAssignableFrom(type))) {
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r3362 r3367  
    127127      if (listView.SelectedItems.Count == 1) {
    128128        IItem item = (IItem)listView.SelectedItems[0].Tag;
    129         IView view = MainFormManager.CreateDefaultView(item);
     129        IView view = MainFormManager.CreateDefaultView(item,ReadOnly);
    130130        if (view != null) view.Show();
    131131      }
     
    140140    }
    141141    private void showAlgorithmButton_Click(object sender, EventArgs e) {
    142       MainFormManager.CreateDefaultView(Content.Algorithm.Clone()).Show();
     142      MainFormManager.CreateDefaultView(Content.Algorithm.Clone(),ReadOnly).Show();
    143143    }
    144144  }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.cs

    r3361 r3367  
    5656    protected override void OnContentChanged() {
    5757      base.OnContentChanged();
    58       if (Content == null) 
     58      if (Content == null)
    5959        globalScopeView.Content = null;
    60       else 
     60      else
    6161        globalScopeView.Content = Content.GlobalScope;
     62      SetEnableStateOfControls();
    6263    }
    6364
    64     protected override void Content_ExecutionStateChanged(object sender, EventArgs e) {
    65       if (InvokeRequired)
    66         Invoke(new EventHandler(Content_ExecutionStateChanged), sender, e);
    67       else {
     65    protected override void OnReadOnlyChanged() {
     66      base.OnReadOnlyChanged();
     67      SetEnableStateOfControls();
     68    }
     69    private void SetEnableStateOfControls() {
     70      globalScopeView.ReadOnly = ReadOnly;
     71      operatorGraphViewHost.ReadOnly = ReadOnly;
     72      if (Content == null)
     73        newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = false;
     74      else
    6875        newOperatorGraphButton.Enabled = openOperatorGraphButton.Enabled = saveOperatorGraphButton.Enabled = Content.ExecutionState != ExecutionState.Started;
    69         globalScopeView.Enabled = Content.ExecutionState != ExecutionState.Started;
    70         base.Content_ExecutionStateChanged(sender, e);
    71       }
    7276    }
    7377
Note: See TracChangeset for help on using the changeset viewer.