Changeset 17687 for branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs
- Timestamp:
- 07/19/20 19:07:40 (4 years ago)
- Location:
- branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
- Property svn:mergeinfo changed
-
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs
r9708 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 67 67 // oldValueTextBox 68 68 // 69 this.oldValueTextBox.Location = new System.Drawing.Point(1 23, 6);69 this.oldValueTextBox.Location = new System.Drawing.Point(106, 6); 70 70 this.oldValueTextBox.Name = "oldValueTextBox"; 71 71 this.oldValueTextBox.ReadOnly = true; … … 75 75 // newValueTextBox 76 76 // 77 this.newValueTextBox.Location = new System.Drawing.Point(1 23, 42);77 this.newValueTextBox.Location = new System.Drawing.Point(106, 32); 78 78 this.newValueTextBox.Name = "newValueTextBox"; 79 79 this.newValueTextBox.Size = new System.Drawing.Size(131, 20); … … 86 86 // 87 87 this.newValueLabel.AutoSize = true; 88 this.newValueLabel.Location = new System.Drawing.Point(12, 45);88 this.newValueLabel.Location = new System.Drawing.Point(12, 35); 89 89 this.newValueLabel.Name = "newValueLabel"; 90 90 this.newValueLabel.Size = new System.Drawing.Size(59, 13); … … 101 101 // 102 102 this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; 103 this.okButton.Location = new System.Drawing.Point( 15, 79);103 this.okButton.Location = new System.Drawing.Point(81, 66); 104 104 this.okButton.Name = "okButton"; 105 105 this.okButton.Size = new System.Drawing.Size(75, 23); … … 113 113 this.cancelButton.CausesValidation = false; 114 114 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 115 this.cancelButton.Location = new System.Drawing.Point(1 79, 79);115 this.cancelButton.Location = new System.Drawing.Point(162, 66); 116 116 this.cancelButton.Name = "cancelButton"; 117 117 this.cancelButton.Size = new System.Drawing.Size(75, 23); … … 127 127 this.AutoSize = true; 128 128 this.CancelButton = this.cancelButton; 129 this.ClientSize = new System.Drawing.Size(2 69, 116);129 this.ClientSize = new System.Drawing.Size(248, 101); 130 130 this.ControlBox = false; 131 131 this.Controls.Add(this.cancelButton); -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.cs
r9708 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs
r9708 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 57 57 this.okButton = new System.Windows.Forms.Button(); 58 58 this.cancelButton = new System.Windows.Forms.Button(); 59 this.variableNameTextBox = new System.Windows.Forms.TextBox(); 59 60 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 60 61 this.SuspendLayout(); … … 63 64 // 64 65 this.nodeSymbolLabel.AutoSize = true; 65 this.nodeSymbolLabel.Location = new System.Drawing.Point(1 3, 13);66 this.nodeSymbolLabel.Location = new System.Drawing.Point(19, 13); 66 67 this.nodeSymbolLabel.Name = "nodeSymbolLabel"; 67 68 this.nodeSymbolLabel.Size = new System.Drawing.Size(41, 13); … … 73 74 this.allowedSymbolsCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 74 75 this.allowedSymbolsCombo.FormattingEnabled = true; 75 this.allowedSymbolsCombo.Location = new System.Drawing.Point(1 20, 10);76 this.allowedSymbolsCombo.Location = new System.Drawing.Point(101, 10); 76 77 this.allowedSymbolsCombo.Name = "allowedSymbolsCombo"; 77 this.allowedSymbolsCombo.Size = new System.Drawing.Size(1 08, 21);78 this.allowedSymbolsCombo.Size = new System.Drawing.Size(127, 21); 78 79 this.allowedSymbolsCombo.TabIndex = 1; 79 80 this.allowedSymbolsCombo.SelectedIndexChanged += new System.EventHandler(this.allowedSymbolsCombo_SelectedIndexChanged); … … 83 84 // 84 85 this.variableWeightLabel.AutoSize = true; 85 this.variableWeightLabel.Location = new System.Drawing.Point(1 3, 44);86 this.variableWeightLabel.Location = new System.Drawing.Point(19, 40); 86 87 this.variableWeightLabel.Name = "variableWeightLabel"; 87 88 this.variableWeightLabel.Size = new System.Drawing.Size(41, 13); … … 93 94 // 94 95 this.variableNameLabel.AutoSize = true; 95 this.variableNameLabel.Location = new System.Drawing.Point(1 3, 74);96 this.variableNameLabel.Location = new System.Drawing.Point(19, 66); 96 97 this.variableNameLabel.Name = "variableNameLabel"; 97 98 this.variableNameLabel.Size = new System.Drawing.Size(35, 13); … … 104 105 this.variableNamesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 105 106 this.variableNamesCombo.FormattingEnabled = true; 106 this.variableNamesCombo.Location = new System.Drawing.Point(1 20, 71);107 this.variableNamesCombo.Location = new System.Drawing.Point(101, 63); 107 108 this.variableNamesCombo.Name = "variableNamesCombo"; 108 this.variableNamesCombo.Size = new System.Drawing.Size(1 08, 21);109 this.variableNamesCombo.Size = new System.Drawing.Size(127, 21); 109 110 this.variableNamesCombo.TabIndex = 5; 110 111 this.variableNamesCombo.Visible = false; … … 112 113 // variableWeightTextBox 113 114 // 114 this.variableWeightTextBox.Location = new System.Drawing.Point(1 20, 41);115 this.variableWeightTextBox.Location = new System.Drawing.Point(101, 37); 115 116 this.variableWeightTextBox.Name = "variableWeightTextBox"; 116 this.variableWeightTextBox.Size = new System.Drawing.Size(1 08, 20);117 this.variableWeightTextBox.Size = new System.Drawing.Size(127, 20); 117 118 this.variableWeightTextBox.TabIndex = 6; 118 119 this.variableWeightTextBox.Text = "0.0"; … … 122 123 // constantValueTextBox 123 124 // 124 this.constantValueTextBox.Location = new System.Drawing.Point(1 20, 41);125 this.constantValueTextBox.Location = new System.Drawing.Point(101, 37); 125 126 this.constantValueTextBox.Name = "constantValueTextBox"; 126 this.constantValueTextBox.Size = new System.Drawing.Size(1 08, 20);127 this.constantValueTextBox.Size = new System.Drawing.Size(127, 20); 127 128 this.constantValueTextBox.TabIndex = 7; 128 129 this.constantValueTextBox.Text = "0.0"; … … 133 134 // 134 135 this.constantValueLabel.AutoSize = true; 135 this.constantValueLabel.Location = new System.Drawing.Point(1 3, 44);136 this.constantValueLabel.Location = new System.Drawing.Point(19, 40); 136 137 this.constantValueLabel.Name = "constantValueLabel"; 137 138 this.constantValueLabel.Size = new System.Drawing.Size(34, 13); … … 149 150 // 150 151 this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; 151 this.okButton.Location = new System.Drawing.Point( 12, 112);152 this.okButton.Location = new System.Drawing.Point(72, 98); 152 153 this.okButton.Name = "okButton"; 153 154 this.okButton.Size = new System.Drawing.Size(75, 23); … … 160 161 // 161 162 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 162 this.cancelButton.Location = new System.Drawing.Point(153, 112);163 this.cancelButton.Location = new System.Drawing.Point(153, 98); 163 164 this.cancelButton.Name = "cancelButton"; 164 165 this.cancelButton.Size = new System.Drawing.Size(75, 23); … … 168 169 this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); 169 170 // 171 // variableNameTextBox 172 // 173 this.variableNameTextBox.Location = new System.Drawing.Point(101, 63); 174 this.variableNameTextBox.Name = "variableNameTextBox"; 175 this.variableNameTextBox.Size = new System.Drawing.Size(127, 20); 176 this.variableNameTextBox.TabIndex = 11; 177 this.variableNameTextBox.Visible = false; 178 // 170 179 // InsertNodeDialog 171 180 // … … 173 182 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 174 183 this.CancelButton = this.cancelButton; 175 this.ClientSize = new System.Drawing.Size(24 0, 147);184 this.ClientSize = new System.Drawing.Size(241, 133); 176 185 this.ControlBox = false; 186 this.Controls.Add(this.variableNameTextBox); 177 187 this.Controls.Add(this.cancelButton); 178 188 this.Controls.Add(this.okButton); … … 208 218 private System.Windows.Forms.Button cancelButton; 209 219 private System.Windows.Forms.Button okButton; 220 private System.Windows.Forms.TextBox variableNameTextBox; 210 221 } 211 222 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.cs
r9708 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using System.Collections.Generic; 24 24 using System.ComponentModel; 25 using System.Linq; 25 26 using System.Text; 26 27 using System.Windows.Forms; … … 30 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views { 31 32 public partial class InsertNodeDialog : Form { 33 public string SelectedVariableName { 34 get { 35 var variable = SelectedSymbol as Variable; 36 if (variable == null) 37 return string.Empty; 38 return variable.VariableNames.Any() ? variableNamesCombo.Text : variableNameTextBox.Text; 39 } 40 } 41 32 42 public InsertNodeDialog() { 33 43 InitializeComponent(); … … 40 50 } 41 51 42 public ISymbol SelectedSymbol (){43 return (ISymbol)allowedSymbolsCombo.SelectedItem;52 public ISymbol SelectedSymbol { 53 get { return (ISymbol)allowedSymbolsCombo.SelectedItem; } 44 54 } 45 55 … … 55 65 constantValueLabel.Visible = true; 56 66 constantValueTextBox.Visible = true; 57 } else if (symbol is Variable) { 58 var variable = (Variable)symbol; 59 foreach (var name in variable.VariableNames) variableNamesCombo.Items.Add(name); 60 variableNamesCombo.SelectedIndex = 0; 67 } else if (symbol is VariableBase) { 68 var variableSymbol = (VariableBase)symbol; 69 if (variableSymbol.VariableNames.Any()) { 70 foreach (var name in variableSymbol.VariableNames) 71 variableNamesCombo.Items.Add(name); 72 variableNamesCombo.SelectedIndex = 0; 73 variableNamesCombo.Visible = true; 74 variableNameTextBox.Visible = false; 75 } else { 76 variableNamesCombo.Visible = false; 77 variableNameTextBox.Visible = true; 78 } 61 79 variableNameLabel.Visible = true; 62 variableNamesCombo.Visible = true;63 80 variableWeightLabel.Visible = true; 64 81 variableWeightTextBox.Visible = true; -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs
r9708 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 55 55 this.okButton = new System.Windows.Forms.Button(); 56 56 this.cancelButton = new System.Windows.Forms.Button(); 57 this.variableNameTextBox = new System.Windows.Forms.TextBox(); 57 58 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 58 59 this.SuspendLayout(); … … 61 62 // 62 63 this.originalValueLabel.AutoSize = true; 63 this.originalValueLabel.Location = new System.Drawing.Point( 12, 48);64 this.originalValueLabel.Location = new System.Drawing.Point(6, 42); 64 65 this.originalValueLabel.Name = "originalValueLabel"; 65 66 this.originalValueLabel.Size = new System.Drawing.Size(72, 13); … … 69 70 // oldValueTextBox 70 71 // 71 this.oldValueTextBox.Location = new System.Drawing.Point(1 23, 45);72 this.oldValueTextBox.Location = new System.Drawing.Point(101, 39); 72 73 this.oldValueTextBox.Name = "oldValueTextBox"; 73 74 this.oldValueTextBox.ReadOnly = true; … … 77 78 // newValueTextBox 78 79 // 79 this.newValueTextBox.Location = new System.Drawing.Point(1 23, 82);80 this.newValueTextBox.Location = new System.Drawing.Point(101, 65); 80 81 this.newValueTextBox.Name = "newValueTextBox"; 81 82 this.newValueTextBox.Size = new System.Drawing.Size(131, 20); … … 88 89 // 89 90 this.newValueLabel.AutoSize = true; 90 this.newValueLabel.Location = new System.Drawing.Point( 12, 85);91 this.newValueLabel.Location = new System.Drawing.Point(6, 68); 91 92 this.newValueLabel.Name = "newValueLabel"; 92 93 this.newValueLabel.Size = new System.Drawing.Size(59, 13); … … 103 104 // 104 105 this.variableNameLabel.AutoSize = true; 105 this.variableNameLabel.Location = new System.Drawing.Point( 12, 12);106 this.variableNameLabel.Location = new System.Drawing.Point(6, 15); 106 107 this.variableNameLabel.Name = "variableNameLabel"; 107 108 this.variableNameLabel.Size = new System.Drawing.Size(76, 13); … … 114 115 this.variableNamesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 115 116 this.variableNamesCombo.FormattingEnabled = true; 116 this.variableNamesCombo.Location = new System.Drawing.Point(1 23, 9);117 this.variableNamesCombo.Location = new System.Drawing.Point(101, 12); 117 118 this.variableNamesCombo.Name = "variableNamesCombo"; 118 119 this.variableNamesCombo.Size = new System.Drawing.Size(131, 21); … … 126 127 // 127 128 this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; 128 this.okButton.Location = new System.Drawing.Point( 15, 119);129 this.okButton.Location = new System.Drawing.Point(75, 98); 129 130 this.okButton.Name = "okButton"; 130 131 this.okButton.Size = new System.Drawing.Size(75, 23); … … 138 139 this.cancelButton.CausesValidation = false; 139 140 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 140 this.cancelButton.Location = new System.Drawing.Point(1 79, 119);141 this.cancelButton.Location = new System.Drawing.Point(156, 98); 141 142 this.cancelButton.Name = "cancelButton"; 142 143 this.cancelButton.Size = new System.Drawing.Size(75, 23); … … 146 147 this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); 147 148 // 149 // variableNameTextBox 150 // 151 this.variableNameTextBox.Location = new System.Drawing.Point(101, 12); 152 this.variableNameTextBox.Name = "variableNameTextBox"; 153 this.variableNameTextBox.Size = new System.Drawing.Size(131, 20); 154 this.variableNameTextBox.TabIndex = 12; 155 this.variableNameTextBox.Visible = false; 156 // 148 157 // VariableNodeEditDialog 149 158 // … … 152 161 this.AutoSize = true; 153 162 this.CancelButton = this.cancelButton; 154 this.ClientSize = new System.Drawing.Size(2 69, 154);163 this.ClientSize = new System.Drawing.Size(244, 134); 155 164 this.ControlBox = false; 165 this.Controls.Add(this.variableNameTextBox); 156 166 this.Controls.Add(this.cancelButton); 157 167 this.Controls.Add(this.okButton); … … 188 198 public System.Windows.Forms.TextBox newValueTextBox; 189 199 public System.Windows.Forms.ComboBox variableNamesCombo; 200 private System.Windows.Forms.TextBox variableNameTextBox; 190 201 } 191 202 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.cs
r9708 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.ComponentModel; 24 using System.Linq; 24 25 using System.Text; 25 26 using System.Windows.Forms; … … 33 34 get { return variableTreeNode; } 34 35 set { 35 if (InvokeRequired) 36 Invoke(new Action<SymbolicExpressionTreeNode>(x => variableTreeNode = (VariableTreeNode)x), value); 37 else 36 if (InvokeRequired) { 37 Invoke(new Action<SymbolicExpressionTreeNode>(x => 38 { 39 variableTreeNode = (VariableTreeNode) x; 40 variableNameTextBox.Text = variableTreeNode.VariableName; 41 }), value); 42 } else { 38 43 variableTreeNode = value; 44 variableNameTextBox.Text = variableTreeNode.VariableName; 45 } 39 46 } 47 } 48 49 public string SelectedVariableName { 50 get { return variableNamesCombo.Visible ? variableNamesCombo.Text : variableNameTextBox.Text; } 40 51 } 41 52 … … 43 54 InitializeComponent(); 44 55 oldValueTextBox.TabStop = false; // cannot receive focus using tab key 45 46 56 NewNode = (VariableTreeNode)node; // will throw an invalid cast exception if node is not of the correct type 47 57 InitializeFields(); … … 57 67 variableNameLabel.Visible = true; 58 68 variableNamesCombo.Visible = true; 59 foreach (var name in variableTreeNode.Symbol.VariableNames) variableNamesCombo.Items.Add(name); 60 variableNamesCombo.SelectedIndex = variableNamesCombo.Items.IndexOf(variableTreeNode.VariableName); 69 if (variableTreeNode.Symbol.VariableNames.Any()) { 70 foreach (var name in variableTreeNode.Symbol.VariableNames) 71 variableNamesCombo.Items.Add(name); 72 variableNamesCombo.SelectedIndex = variableNamesCombo.Items.IndexOf(variableTreeNode.VariableName); 73 variableNamesCombo.Visible = true; 74 variableNameTextBox.Visible = false; 75 } else { 76 variableNamesCombo.Visible = false; 77 variableNameTextBox.Visible = true; 78 } 61 79 } 62 80 } … … 93 111 #region combo box validation and events 94 112 private void variableNamesCombo_Validating(object sender, CancelEventArgs e) { 113 if (variableNamesCombo.Items.Count == 0) return; 95 114 if (variableNamesCombo.Items.Contains(variableNamesCombo.SelectedItem)) return; 96 115 e.Cancel = true; … … 119 138 private void OnDialogValidated(object sender, EventArgs e) { 120 139 double weight = double.Parse(newValueTextBox.Text); 121 var variableName = (string)variableNamesCombo.SelectedItem;122 140 // we impose an extra validation condition: that the weight/value be different than the original ones 141 var variableName = SelectedVariableName; 123 142 if (variableTreeNode.Weight.Equals(weight) && variableTreeNode.VariableName.Equals(variableName)) return; 124 143 variableTreeNode.Weight = weight;
Note: See TracChangeset
for help on using the changeset viewer.