Changeset 16787
- Timestamp:
- 04/16/19 10:11:38 (6 years ago)
- Location:
- branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.Designer.cs
r16778 r16787 38 38 this.variableInput = new System.Windows.Forms.TextBox(); 39 39 this.groupBox1 = new System.Windows.Forms.GroupBox(); 40 this.numberderivationInput = new System.Windows.Forms.ComboBox(); 40 41 this.ischeckedCheckBox = new System.Windows.Forms.CheckBox(); 41 42 this.expressionInput = new System.Windows.Forms.TextBox(); … … 45 46 this.derivationInput = new System.Windows.Forms.CheckBox(); 46 47 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 47 this.numberderivationInput = new System.Windows.Forms.ComboBox();48 48 this.groupBox1.SuspendLayout(); 49 49 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); … … 191 191 this.groupBox1.Text = "Interval Constraints Detail"; 192 192 // 193 // numberderivationInput 194 // 195 this.numberderivationInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 196 | System.Windows.Forms.AnchorStyles.Right))); 197 this.numberderivationInput.FormattingEnabled = true; 198 this.numberderivationInput.Location = new System.Drawing.Point(111, 224); 199 this.numberderivationInput.Name = "numberderivationInput"; 200 this.numberderivationInput.Size = new System.Drawing.Size(470, 21); 201 this.numberderivationInput.TabIndex = 27; 202 this.numberderivationInput.SelectedIndexChanged += new System.EventHandler(this.numberderivationInput_SelectedIndexChanged); 203 // 193 204 // ischeckedCheckBox 194 205 // … … 200 211 this.ischeckedCheckBox.Text = "Enabled"; 201 212 this.ischeckedCheckBox.UseVisualStyleBackColor = true; 202 this.ischeckedCheckBox.Check StateChanged += new System.EventHandler(this.ischeckedCheckBox_CheckStateChanged);213 this.ischeckedCheckBox.CheckedChanged += new System.EventHandler(this.ischeckedCheckBox_CheckedChanged); 203 214 // 204 215 // expressionInput … … 253 264 this.errorProvider.ContainerControl = this; 254 265 this.errorProvider.RightToLeft = true; 255 //256 // numberderivationInput257 //258 this.numberderivationInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)259 | System.Windows.Forms.AnchorStyles.Right)));260 this.numberderivationInput.FormattingEnabled = true;261 this.numberderivationInput.Location = new System.Drawing.Point(111, 224);262 this.numberderivationInput.Name = "numberderivationInput";263 this.numberderivationInput.Size = new System.Drawing.Size(470, 21);264 this.numberderivationInput.TabIndex = 27;265 this.numberderivationInput.SelectedIndexChanged += new System.EventHandler(this.numberderivationInput_SelectedIndexChanged);266 266 // 267 267 // IntervalConstraintView -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/IntervalConstraintView.cs
r16778 r16787 38 38 } 39 39 40 protected override void RegisterContentEvents() { 41 base.RegisterContentEvents(); 42 Content.Changed += new EventHandler(Content_Changed); 43 } 44 45 protected override void DeregisterContentEvents() { 46 base.DeregisterContentEvents(); 47 Content.Changed -= new EventHandler(Content_Changed); 48 } 40 49 41 50 protected override void SetEnabledStateOfControls() { … … 91 100 numberderivationInput.SelectedItem = Content.NumberOfDerivation; 92 101 } 102 93 103 ischeckedCheckBox.Checked = Content.IsChecked; 94 Content.Changed += Content_Changed;95 104 } 96 105 SetEnabledStateOfControls(); … … 201 210 } 202 211 203 private void ischeckedCheckBox_Check StateChanged(object sender, EventArgs e) {212 private void ischeckedCheckBox_CheckedChanged(object sender, EventArgs e) { 204 213 if (Content.IsChecked != ischeckedCheckBox.Checked) { 205 214 Content.IsChecked = ischeckedCheckBox.Checked; … … 227 236 } 228 237 238 229 239 #endregion 230 231 240 232 241 } -
branches/2971_named_intervals/HeuristicLab.Problems.DataAnalysis.Views/3.4/ParsedConstraintView.cs
r16778 r16787 1 1 using System; 2 using System.Collections.Generic; 2 3 using HeuristicLab.Collections; 3 4 using HeuristicLab.Core; … … 19 20 errorOutput.Text = ""; 20 21 intervalConstraints = new CheckedItemList<IntervalConstraint>(); 21 intervalConstraints.CheckedItemsChanged += constraint s_CheckedItemsChanged;22 intervalConstraints.CheckedItemsChanged += constraint_CheckedItemChanged; 22 23 } 23 24 … … 27 28 } 28 29 29 private CheckedItemList<IntervalConstraint> ParseConstraints(string input) {30 CheckedItemList<IntervalConstraint> constraints = new CheckedItemList<IntervalConstraint>(IntervalConstraintsParser.ParseInput(input, Content.ProblemData.TargetVariable, Content.ProblemData.AllowedInputVariables));31 return constraints;30 private IEnumerable<IntervalConstraint> ParseConstraints(string input) { 31 return IntervalConstraintsParser.ParseInput(input, Content.ProblemData.TargetVariable, 32 Content.ProblemData.AllowedInputVariables); 32 33 } 33 34 34 35 private void parseBtn_Click(object sender, EventArgs e) { 35 36 if (constraintsInput.Text != null) { 36 intervalConstraints = ParseConstraints(constraintsInput.Text); 37 intervalConstraints.CheckedItemsChanged -= constraints_CheckedItemsChanged; 38 intervalConstraints.CheckedItemsChanged += constraints_CheckedItemsChanged; 37 ClearConstraints(); 38 var parsedConstraints = ParseConstraints(constraintsInput.Text); 39 foreach (var constraint in parsedConstraints) { 40 constraint.Changed += constraint_Changed; 41 intervalConstraints.Add(constraint, constraint.IsChecked); 42 } 39 43 constraintsOutput.Content = intervalConstraints; 40 44 Content.Constraints = intervalConstraints; … … 49 53 if (Content == null) { 50 54 ClearConstraints(); 51 constraintsInput.Text = string.Empty; 52 errorOutput.Text = string.Empty; 53 constraintsOutput.Content = intervalConstraints; 55 constraintsOutput.Content = intervalConstraints.AsReadOnly(); 54 56 } else { 57 ClearConstraints(); 55 58 constraintsInput.Text = Content.Input; 56 59 foreach (var constraint in Content.Constraints) { 57 constraint.Changed += new EventHandler(Content_Changed);60 constraint.Changed += constraint_Changed; 58 61 intervalConstraints.Add(constraint, constraint.IsChecked); 59 62 } 63 64 constraintsOutput.Content = intervalConstraints.AsReadOnly(); 60 65 } 61 constraintsOutput.Content = intervalConstraints; 66 SetEnabledStateOfControls(); 67 } 68 69 private void constraint_Changed(object sender, EventArgs e) { 70 var constraint = (IntervalConstraint) sender; 71 intervalConstraints.SetItemCheckedState(constraint, constraint.IsChecked); 72 } 73 74 private void constraint_CheckedItemChanged(object sender, 75 CollectionItemsChangedEventArgs<IndexedItem<IntervalConstraint>> e) { 76 ICheckedItemList<IntervalConstraint> checkedItemList = (ICheckedItemList<IntervalConstraint>) sender; 77 foreach (var indexedItem in e.Items) { 78 indexedItem.Value.IsChecked = checkedItemList.ItemChecked(indexedItem.Value); 79 } 62 80 } 63 81 … … 66 84 } 67 85 68 private void Content_Changed(object sender, EventArgs e) {69 var constraint = (IntervalConstraint) sender;70 intervalConstraints.SetItemCheckedState(constraint, constraint.IsChecked);71 constraintsOutput.Content = intervalConstraints;72 }73 74 private void constraints_CheckedItemsChanged(object sender,75 CollectionItemsChangedEventArgs<IndexedItem<IntervalConstraint>> e) {76 var checkedItemList = (ICheckedItemList<IntervalConstraint>) sender;77 foreach (var indexedItem in e.Items) {78 indexedItem.Value.IsChecked = checkedItemList.ItemChecked(indexedItem.Value);79 }80 }81 82 86 private void ClearConstraints() { 83 87 foreach (var constraint in intervalConstraints) { 84 constraint.Changed -= new EventHandler(Content_Changed);88 constraint.Changed -= constraint_Changed; 85 89 } 86 90 intervalConstraints.Clear();
Note: See TracChangeset
for help on using the changeset viewer.