Changeset 16777


Ignore:
Timestamp:
04/12/19 10:32:44 (3 months ago)
Author:
chaider
Message:

#2971
-Fixed Dispose problem
-Added event handling for item selection

Location:
branches/2971_named_intervals
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.Designer.cs

    r16776 r16777  
    3939      this.numberderivationInput = new System.Windows.Forms.TextBox();
    4040      this.groupBox1 = new System.Windows.Forms.GroupBox();
     41      this.ischeckedCheckBox = new System.Windows.Forms.CheckBox();
     42      this.expressionInput = new System.Windows.Forms.TextBox();
     43      this.expressionLabel = new System.Windows.Forms.Label();
    4144      this.inclupperboundInput = new System.Windows.Forms.CheckBox();
    4245      this.incllowerboundInput = new System.Windows.Forms.CheckBox();
    4346      this.derivationInput = new System.Windows.Forms.CheckBox();
    44       this.expressionLabel = new System.Windows.Forms.Label();
    45       this.expressionInput = new System.Windows.Forms.TextBox();
    4647      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    4748      this.groupBox1.SuspendLayout();
     
    174175      // groupBox1
    175176      //
     177      this.groupBox1.Controls.Add(this.ischeckedCheckBox);
    176178      this.groupBox1.Controls.Add(this.expressionInput);
    177179      this.groupBox1.Controls.Add(this.expressionLabel);
     
    200202      this.groupBox1.Text = "Interval Constraints Detail";
    201203      //
     204      // ischeckedCheckBox
     205      //
     206      this.ischeckedCheckBox.AutoSize = true;
     207      this.ischeckedCheckBox.Location = new System.Drawing.Point(14, 257);
     208      this.ischeckedCheckBox.Name = "ischeckedCheckBox";
     209      this.ischeckedCheckBox.Size = new System.Drawing.Size(65, 17);
     210      this.ischeckedCheckBox.TabIndex = 26;
     211      this.ischeckedCheckBox.Text = "Enabled";
     212      this.ischeckedCheckBox.UseVisualStyleBackColor = true;
     213      this.ischeckedCheckBox.CheckStateChanged += new System.EventHandler(this.ischeckedCheckBox_CheckStateChanged);
     214      //
     215      // expressionInput
     216      //
     217      this.expressionInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     218            | System.Windows.Forms.AnchorStyles.Right)));
     219      this.expressionInput.Location = new System.Drawing.Point(108, 17);
     220      this.expressionInput.Name = "expressionInput";
     221      this.expressionInput.Size = new System.Drawing.Size(473, 20);
     222      this.expressionInput.TabIndex = 25;
     223      //
     224      // expressionLabel
     225      //
     226      this.expressionLabel.AutoSize = true;
     227      this.expressionLabel.Location = new System.Drawing.Point(11, 20);
     228      this.expressionLabel.Name = "expressionLabel";
     229      this.expressionLabel.Size = new System.Drawing.Size(61, 13);
     230      this.expressionLabel.TabIndex = 24;
     231      this.expressionLabel.Text = "Expression:";
     232      //
    202233      // inclupperboundInput
    203234      //
     
    228259      this.derivationInput.TabIndex = 21;
    229260      this.derivationInput.UseVisualStyleBackColor = true;
    230       //
    231       // expressionLabel
    232       //
    233       this.expressionLabel.AutoSize = true;
    234       this.expressionLabel.Location = new System.Drawing.Point(11, 20);
    235       this.expressionLabel.Name = "expressionLabel";
    236       this.expressionLabel.Size = new System.Drawing.Size(61, 13);
    237       this.expressionLabel.TabIndex = 24;
    238       this.expressionLabel.Text = "Expression:";
    239       //
    240       // expressionInput
    241       //
    242       this.expressionInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    243             | System.Windows.Forms.AnchorStyles.Right)));
    244       this.expressionInput.Location = new System.Drawing.Point(108, 17);
    245       this.expressionInput.Name = "expressionInput";
    246       this.expressionInput.Size = new System.Drawing.Size(473, 20);
    247       this.expressionInput.TabIndex = 25;
    248261      //
    249262      // errorProvider
     
    286299    private System.Windows.Forms.Label expressionLabel;
    287300    private System.Windows.Forms.ErrorProvider errorProvider;
     301    private System.Windows.Forms.CheckBox ischeckedCheckBox;
    288302  }
    289303}
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.cs

    r16776 r16777  
    8686        variableInput.Text = Content.Variable;
    8787        numberderivationInput.Text = Content.NumberOfDerivation.ToString();
     88        ischeckedCheckBox.Checked = Content.IsChecked;
     89        //Content.Changed += Content_Changed;
     90
    8891      }
    8992      SetEnabledStateOfControls();
     
    116119    #endregion
    117120
    118     #region content event handlers
     121    #region control event handlers
    119122
    120123    private void numberderivationInput_Validating(object sender, CancelEventArgs e) {
     
    196199
    197200    private void inclupperboundInput_CheckedChanged(object sender, EventArgs e) {
    198       if (Content.InclusiveUpperBound != incllowerboundInput.Checked) {
    199         Content.InclusiveUpperBound = incllowerboundInput.Checked;
    200         UpdateExpression();
    201       }
    202     }
     201      if (Content.InclusiveUpperBound != inclupperboundInput.Checked) {
     202        Content.InclusiveUpperBound = inclupperboundInput.Checked;
     203        UpdateExpression();
     204      }
     205    }
     206
     207    private void ischeckedCheckBox_CheckStateChanged(object sender, EventArgs e) {
     208      if (Content.IsChecked != ischeckedCheckBox.Checked) {
     209        Content.IsChecked = ischeckedCheckBox.Checked;
     210        UpdateControls();
     211      }
     212    }
     213
    203214    #endregion
    204215
    205 
     216    #region content event handlers
     217
     218    private void Content_Changed(object sender, EventArgs e) {
     219      UpdateControls();
     220    }
     221
     222    #endregion
    206223  }
    207224}
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.cs

    r16776 r16777  
    11using System;
    2 
     2using HeuristicLab.Collections;
    33using HeuristicLab.Core;
    44using HeuristicLab.MainForm;
     
    1919      errorOutput.Text = "";
    2020      intervalConstraints = new CheckedItemList<IntervalConstraint>();
    21     }
    22 
    23     private void Content_Changed(object sender, EventArgs e) {
    24       constraintsOutput.Content = intervalConstraints;
     21      intervalConstraints.CheckedItemsChanged += constraints_CheckedItemsChanged;
    2522    }
    2623
     
    3734    private void parseBtn_Click(object sender, EventArgs e) {
    3835      if (constraintsInput.Text != null) {
    39         var constaints = ParseConstraints(constraintsInput.Text);
    40         constraintsOutput.Content = constaints;
    41         Content.Constraints = constaints;
     36        intervalConstraints = ParseConstraints(constraintsInput.Text);
     37        intervalConstraints.CheckedItemsChanged += constraints_CheckedItemsChanged;
     38        constraintsOutput.Content = intervalConstraints;
     39        Content.Constraints = intervalConstraints;
    4240        Content.Input = constraintsInput.Text;
    4341        errorOutput.Text = "";
     
    5755        foreach (var constraint in Content.Constraints) {
    5856          constraint.Changed += new EventHandler(Content_Changed);
    59           intervalConstraints.Add(constraint, true);
     57          intervalConstraints.Add(constraint, constraint.IsChecked);
    6058        }
    6159      }
     60      constraintsOutput.Content = intervalConstraints;
    6261    }
    6362
    6463    private void constraintsInput_TextChanged(object sender, EventArgs e) {
    6564      errorOutput.Text = "Unparsed changes! Press parse button to save changes.";
     65    }
     66
     67    private void Content_Changed(object sender, EventArgs e) {
     68      var constraint = (IntervalConstraint) sender;
     69      intervalConstraints.SetItemCheckedState(constraint, constraint.IsChecked);
     70      constraintsOutput.Content = intervalConstraints;
     71    }
     72
     73    private void constraints_CheckedItemsChanged(object sender,
     74      CollectionItemsChangedEventArgs<IndexedItem<IntervalConstraint>> e) {
     75      var checkedItemList = (ICheckedItemList<IntervalConstraint>) sender;
     76      foreach (var indexedItem in e.Items) {
     77        indexedItem.Value.IsChecked = checkedItemList.ItemChecked(indexedItem.Value);
     78      }
    6679    }
    6780
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Parser/IntervalConstraint.cs

    r16776 r16777  
    4949    public int NumberOfDerivation { get; set; }
    5050
    51     public IntervalConstraint() {}
     51    private bool isChecked;
     52    public bool IsChecked {
     53      get => isChecked;
     54      set {
     55        if (value != isChecked) {
     56          isChecked = value;
     57          OnChanged(EventArgs.Empty);
     58        }
     59      }
     60    }
     61
     62    public IntervalConstraint() {
     63      name = "Empty";
     64      expression = "Empty";
     65      Interval = new Interval(0, 0);
     66      inclusiveLowerBound = true;
     67      inclusiveLowerBound = true;
     68      IsDerivation = false;
     69      isChecked = false;
     70    }
    5271
    5372    public IntervalConstraint(string name) {
    5473      base.name = name;
     74      IsChecked = true;
    5575    }
    5676
    5777    public IntervalConstraint(string expression, string definition, Interval interval, bool inclusiveLowerBound,
    58       bool inclusiveUpperBound, bool isDerivation, string variable, int numberOfDerivation) {
     78      bool inclusiveUpperBound, bool isDerivation, string variable, int numberOfDerivation, bool isChecked) {
    5979      base.name = expression;
    6080      Expression = expression;
     
    6686      Variable = variable;
    6787      NumberOfDerivation = numberOfDerivation;
     88      IsChecked = isChecked;
    6889    }
    6990
     
    82103      this.Variable = original.Variable;
    83104      this.NumberOfDerivation = original.NumberOfDerivation;
     105      this.isChecked = original.isChecked;
    84106    }
    85107
  • branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis/3.4/ParsedConstraint.cs

    r16776 r16777  
    4242      this.input = original.Input ?? string.Empty;
    4343      this.constraints = original.Constraints ?? new CheckedItemList<IntervalConstraint>();
    44      
     44      this.problemData = original.problemData;
    4545    }
    4646
Note: See TracChangeset for help on using the changeset viewer.