Free cookie consent management tool by TermsFeed Policy Generator

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

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

Location:
trunk/sources/HeuristicLab.Operators.Programmable/3.3
Files:
3 edited

Legend:

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

    r3376 r3454  
    132132    }
    133133
    134     public void SetDescription(string description) {
    135       if (description == null)
    136         throw new NullReferenceException("description must not be null");
    137       Description = description;
    138     }
    139 
    140134    public IEnumerable<string> GetAllNamespaces(bool selectedAssembliesOnly) {
    141135      var namespaces = new HashSet<string>();
     
    223217      typeof(System.Text.StringBuilder).Assembly,
    224218      typeof(System.Data.Linq.DataContext).Assembly,
     219      typeof(HeuristicLab.Common.IDeepCloneable).Assembly,
    225220      typeof(HeuristicLab.Core.Item).Assembly,
    226221      typeof(HeuristicLab.Data.IntValue).Assembly,
     
    258253        "System.Linq",
    259254        "System.Data.Linq",
     255        "HeuristicLab.Common",
    260256        "HeuristicLab.Core",
    261257        "HeuristicLab.Data",
     
    419415    public override IDeepCloneable Clone(Cloner cloner) {
    420416      ProgrammableOperator clone = (ProgrammableOperator)base.Clone(cloner);
    421       clone.description = description;
    422417      clone.code = Code;
    423418      clone.executeMethod = executeMethod;
  • trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperatorView.Designer.cs

    r3014 r3454  
    7878      //
    7979      this.descriptionTextBox.Size = new System.Drawing.Size(913, 20);
    80       this.descriptionTextBox.TextChanged += new System.EventHandler(this.descriptionTextBox_TextChanged);
    8180      //
    8281      // tabPage2
  • 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.