Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/21/10 06:14:03 (15 years ago)
Author:
swagner
Message:

Adapted views according the new read-only property (#973)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperatorView.cs

    r3376 r3454  
    6060      base.RegisterContentEvents();
    6161      ProgrammableOperator.CodeChanged += ProgrammableOperator_CodeChanged;
    62       ProgrammableOperator.DescriptionChanged += ProgrammableOperator_DescriptionChanged;
    6362      ProgrammableOperator.SignatureChanged += ProgrammableOperator_SignatureChanged;
    6463    }
     
    6665    protected override void DeregisterContentEvents() {
    6766      ProgrammableOperator.CodeChanged -= ProgrammableOperator_CodeChanged;
    68       ProgrammableOperator.DescriptionChanged -= ProgrammableOperator_DescriptionChanged;
    6967      ProgrammableOperator.SignatureChanged -= ProgrammableOperator_SignatureChanged;
    7068      base.DeregisterContentEvents();
     
    7573      if (ProgrammableOperator == null) {
    7674        codeEditor.Text = "";
    77         codeEditor.Enabled = false;
    78         descriptionTextBox.Text = "";
    79         descriptionTextBox.Enabled = false;
    8075        assembliesTreeView.Nodes.Clear();
    8176        parameterCollectionView.Content = null;
    8277      } else {
    83         codeEditor.Enabled = true;
    84         descriptionTextBox.Text = ProgrammableOperator.Description;
    85         descriptionTextBox.Enabled = true;
    8678        codeEditor.Prefix = GetGeneratedPrefix();
    8779        codeEditor.Suffix = @"
     
    10496        parameterCollectionView.Content = ProgrammableOperator.Parameters;
    10597      }
     98      SetEnabledStateOfControls();
     99    }
     100
     101    protected override void OnReadOnlyChanged() {
     102      base.OnReadOnlyChanged();
     103      SetEnabledStateOfControls();
     104    }
     105
     106    private void SetEnabledStateOfControls() {
     107      parameterCollectionView.Enabled = Content != null;
     108      parameterCollectionView.ReadOnly = ReadOnly;
     109      assembliesTreeView.Enabled = Content != null && !ReadOnly;
     110      namespacesTreeView.Enabled = Content != null && !ReadOnly;
     111      compileButton.Enabled = Content != null && !ReadOnly;
     112      codeEditor.Enabled = Content != null && !ReadOnly;
    106113    }
    107114
     
    141148    private void ProgrammableOperator_CodeChanged(object sender, EventArgs e) {
    142149      codeEditor.Text = ProgrammableOperator.Code;
    143     }
    144     private void ProgrammableOperator_DescriptionChanged(object sender, EventArgs e) {
    145       descriptionTextBox.Text = ProgrammableOperator.Description;
    146150    }
    147151    private void ProgrammableOperator_SignatureChanged(object sender, EventArgs args) {
     
    279283      new CodeViewer(ProgrammableOperator.CompilationUnitCode).ShowDialog(this);
    280284    }
    281 
    282     private void descriptionTextBox_TextChanged(object sender, EventArgs e) {
    283       ProgrammableOperator.SetDescription(descriptionTextBox.Text);
    284     }
    285 
    286 
    287285  }
    288286}
Note: See TracChangeset for help on using the changeset viewer.