Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/20/10 20:04:08 (14 years ago)
Author:
swagner
Message:

Operator architecture refactoring (#95)

  • worked on parameterized items
Location:
trunk/sources/HeuristicLab.Operators.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Operators.Views/3.3/OperatorView.Designer.cs

    r2805 r2845  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
     47      this.breakpointLabel = new System.Windows.Forms.Label();
     48      this.breakpointCheckBox = new System.Windows.Forms.CheckBox();
    4849      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    4950      this.SuspendLayout();
     51      //
     52      // parameterCollectionView
     53      //
     54      this.parameterCollectionView.Location = new System.Drawing.Point(0, 139);
     55      this.parameterCollectionView.Size = new System.Drawing.Size(490, 214);
     56      this.parameterCollectionView.TabIndex = 6;
    5057      //
    5158      // nameTextBox
     
    5360      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    5461      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
    55       this.nameTextBox.Size = new System.Drawing.Size(418, 20);
    5662      //
    57       // descriptionTextBox
     63      // breakpointLabel
    5864      //
    59       this.descriptionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    60                   | System.Windows.Forms.AnchorStyles.Right)));
    61       this.descriptionTextBox.Size = new System.Drawing.Size(418, 87);
     65      this.breakpointLabel.AutoSize = true;
     66      this.breakpointLabel.Location = new System.Drawing.Point(3, 120);
     67      this.breakpointLabel.Name = "breakpointLabel";
     68      this.breakpointLabel.Size = new System.Drawing.Size(61, 13);
     69      this.breakpointLabel.TabIndex = 4;
     70      this.breakpointLabel.Text = "&Breakpoint:";
    6271      //
    63       // parameterCollectionView
     72      // breakpointCheckBox
    6473      //
    65       this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    66                   | System.Windows.Forms.AnchorStyles.Left)
    67                   | System.Windows.Forms.AnchorStyles.Right)));
    68       this.parameterCollectionView.Caption = "ParameterCollection";
    69       this.parameterCollectionView.Location = new System.Drawing.Point(0, 119);
    70       this.parameterCollectionView.Name = "parameterCollectionView";
    71       this.parameterCollectionView.Size = new System.Drawing.Size(490, 234);
    72       this.parameterCollectionView.TabIndex = 4;
     74      this.breakpointCheckBox.AutoSize = true;
     75      this.breakpointCheckBox.Location = new System.Drawing.Point(72, 119);
     76      this.breakpointCheckBox.Name = "breakpointCheckBox";
     77      this.breakpointCheckBox.Size = new System.Drawing.Size(15, 14);
     78      this.breakpointCheckBox.TabIndex = 5;
     79      this.breakpointCheckBox.UseVisualStyleBackColor = true;
     80      this.breakpointCheckBox.CheckedChanged += new System.EventHandler(this.breakpointCheckBox_CheckedChanged);
    7381      //
    7482      // OperatorView
     
    7684      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    7785      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    78       this.Controls.Add(this.parameterCollectionView);
     86      this.Controls.Add(this.breakpointLabel);
     87      this.Controls.Add(this.breakpointCheckBox);
    7988      this.Name = "OperatorView";
    80       this.Size = new System.Drawing.Size(490, 353);
     89      this.Controls.SetChildIndex(this.breakpointCheckBox, 0);
     90      this.Controls.SetChildIndex(this.breakpointLabel, 0);
    8191      this.Controls.SetChildIndex(this.nameTextBox, 0);
    8292      this.Controls.SetChildIndex(this.nameLabel, 0);
     
    92102    #endregion
    93103
    94     protected HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView;
     104    private System.Windows.Forms.Label breakpointLabel;
     105    private System.Windows.Forms.CheckBox breakpointCheckBox;
    95106
    96107  }
  • trunk/sources/HeuristicLab.Operators.Views/3.3/OperatorView.cs

    r2805 r2845  
    2323using HeuristicLab.Core.Views;
    2424using HeuristicLab.MainForm;
     25using System;
    2526
    2627namespace HeuristicLab.Operators.Views {
     
    3031  [Content(typeof(Operator), true)]
    3132  [Content(typeof(IOperator), false)]
    32   public partial class OperatorView : NamedItemView {
     33  public partial class OperatorView : ParameterizedNamedItemView {
    3334    public new IOperator Content {
    3435      get { return (IOperator)base.Content; }
     
    5152    }
    5253
     54    /// <summary>
     55    /// Removes the eventhandlers from the underlying <see cref="IOperatorGraph"/>.
     56    /// </summary>
     57    /// <remarks>Calls <see cref="ViewBase.RemoveItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
     58    protected override void DeregisterContentEvents() {
     59      Content.BreakpointChanged -= new EventHandler(Content_BreakpointChanged);
     60      base.DeregisterContentEvents();
     61    }
     62
     63    /// <summary>
     64    /// Adds eventhandlers to the underlying <see cref="IOperatorGraph"/>.
     65    /// </summary>
     66    /// <remarks>Calls <see cref="ViewBase.AddItemEvents"/> of base class <see cref="ViewBase"/>.</remarks>
     67    protected override void RegisterContentEvents() {
     68      base.RegisterContentEvents();
     69      Content.BreakpointChanged += new EventHandler(Content_BreakpointChanged);
     70    }
     71
    5372    protected override void OnContentChanged() {
    5473      base.OnContentChanged();
    5574      if (Content == null) {
    56         parameterCollectionView.Content = null;
     75        breakpointCheckBox.Checked = false;
     76        breakpointCheckBox.Enabled = false;
    5777      } else {
    58         parameterCollectionView.Content = ((IOperator)Content).Parameters;
     78        breakpointCheckBox.Checked = Content.Breakpoint;
    5979      }
     80    }
     81
     82    private void Content_BreakpointChanged(object sender, EventArgs e) {
     83      if (InvokeRequired)
     84        Invoke(new EventHandler(Content_DescriptionChanged), sender, e);
     85      else
     86        breakpointCheckBox.Checked = Content.Breakpoint;
     87    }
     88
     89    private void breakpointCheckBox_CheckedChanged(object sender, System.EventArgs e) {
     90      if (Content != null) Content.Breakpoint = breakpointCheckBox.Checked;
    6091    }
    6192  }
Note: See TracChangeset for help on using the changeset viewer.