Changeset 2974
- Timestamp:
- 03/09/10 03:57:18 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayDataView.Designer.cs
r2973 r2974 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 this. rowsLabel = new System.Windows.Forms.Label();49 this. rowsTextBox = new System.Windows.Forms.TextBox();48 this.lengthLabel = new System.Windows.Forms.Label(); 49 this.lengthTextBox = new System.Windows.Forms.TextBox(); 50 50 this.dataGridView = new System.Windows.Forms.DataGridView(); 51 51 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); … … 54 54 this.SuspendLayout(); 55 55 // 56 // rowsLabel56 // lengthLabel 57 57 // 58 this. rowsLabel.AutoSize = true;59 this. rowsLabel.Location = new System.Drawing.Point(3, 3);60 this. rowsLabel.Name = "rowsLabel";61 this. rowsLabel.Size = new System.Drawing.Size(37, 13);62 this. rowsLabel.TabIndex = 0;63 this. rowsLabel.Text = "&Rows:";58 this.lengthLabel.AutoSize = true; 59 this.lengthLabel.Location = new System.Drawing.Point(3, 3); 60 this.lengthLabel.Name = "lengthLabel"; 61 this.lengthLabel.Size = new System.Drawing.Size(43, 13); 62 this.lengthLabel.TabIndex = 0; 63 this.lengthLabel.Text = "&Length:"; 64 64 // 65 // rowsTextBox65 // lengthTextBox 66 66 // 67 this. rowsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)67 this.lengthTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 68 68 | System.Windows.Forms.AnchorStyles.Right))); 69 this. rowsTextBox.Location = new System.Drawing.Point(69, 0);70 this. rowsTextBox.Name = "rowsTextBox";71 this. rowsTextBox.Size = new System.Drawing.Size(355, 20);72 this. rowsTextBox.TabIndex = 1;73 this. rowsTextBox.Validated += new System.EventHandler(this.rowsTextBox_Validated);74 this. rowsTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.rowsTextBox_KeyDown);75 this. rowsTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.rowsTextBox_Validating);69 this.lengthTextBox.Location = new System.Drawing.Point(52, 0); 70 this.lengthTextBox.Name = "lengthTextBox"; 71 this.lengthTextBox.Size = new System.Drawing.Size(372, 20); 72 this.lengthTextBox.TabIndex = 1; 73 this.lengthTextBox.Validated += new System.EventHandler(this.lengthTextBox_Validated); 74 this.lengthTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lengthTextBox_KeyDown); 75 this.lengthTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.lengthTextBox_Validating); 76 76 // 77 77 // dataGridView … … 88 88 this.dataGridView.Name = "dataGridView"; 89 89 this.dataGridView.Size = new System.Drawing.Size(424, 378); 90 this.dataGridView.TabIndex = 4;90 this.dataGridView.TabIndex = 2; 91 91 this.dataGridView.CellParsing += new System.Windows.Forms.DataGridViewCellParsingEventHandler(this.dataGridView_CellParsing); 92 92 this.dataGridView.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView_CellValidating); … … 103 103 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 104 104 this.Controls.Add(this.dataGridView); 105 this.Controls.Add(this. rowsTextBox);106 this.Controls.Add(this. rowsLabel);105 this.Controls.Add(this.lengthTextBox); 106 this.Controls.Add(this.lengthLabel); 107 107 this.Name = "StringConvertibleArrayDataView"; 108 108 this.Size = new System.Drawing.Size(424, 404); … … 116 116 #endregion 117 117 118 private System.Windows.Forms.Label rowsLabel;119 private System.Windows.Forms.TextBox rowsTextBox;118 private System.Windows.Forms.Label lengthLabel; 119 private System.Windows.Forms.TextBox lengthTextBox; 120 120 private System.Windows.Forms.DataGridView dataGridView; 121 121 private System.Windows.Forms.ErrorProvider errorProvider; -
trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleArrayDataView.cs
r2973 r2974 40 40 InitializeComponent(); 41 41 Caption = "StringConvertibleArrayData View"; 42 errorProvider.SetIconAlignment( rowsTextBox, ErrorIconAlignment.MiddleLeft);43 errorProvider.SetIconPadding( rowsTextBox, 2);42 errorProvider.SetIconAlignment(lengthTextBox, ErrorIconAlignment.MiddleLeft); 43 errorProvider.SetIconPadding(lengthTextBox, 2); 44 44 } 45 45 public StringConvertibleArrayDataView(IStringConvertibleArrayData content) … … 65 65 if (Content == null) { 66 66 Caption = "StringConvertibleArrayData View"; 67 rowsTextBox.Text = "";68 rowsTextBox.Enabled = false;67 lengthTextBox.Text = ""; 68 lengthTextBox.Enabled = false; 69 69 dataGridView.Rows.Clear(); 70 70 dataGridView.Columns.Clear(); … … 77 77 78 78 private void UpdateData() { 79 rowsTextBox.Text = Content.Rows.ToString();80 rowsTextBox.Enabled = true;79 lengthTextBox.Text = Content.Length.ToString(); 80 lengthTextBox.Enabled = true; 81 81 dataGridView.Rows.Clear(); 82 82 dataGridView.Columns.Clear(); 83 if (Content. Rows> 0) {83 if (Content.Length > 0) { 84 84 dataGridView.ColumnCount++; 85 85 dataGridView.Columns[0].FillWeight = float.Epsilon; // sum of all fill weights must not be larger than 65535 86 dataGridView.RowCount = Content. Rows;87 for (int i = 0; i < Content. Rows; i++) {86 dataGridView.RowCount = Content.Length; 87 for (int i = 0; i < Content.Length; i++) { 88 88 dataGridView.Rows[i].Cells[0].Value = Content.GetValue(i); 89 89 } … … 110 110 111 111 #region TextBox Events 112 private void rowsTextBox_Validating(object sender, CancelEventArgs e) {112 private void lengthTextBox_Validating(object sender, CancelEventArgs e) { 113 113 int i = 0; 114 if (!int.TryParse( rowsTextBox.Text, out i) || (i < 0)) {114 if (!int.TryParse(lengthTextBox.Text, out i) || (i < 0)) { 115 115 e.Cancel = true; 116 errorProvider.SetError( rowsTextBox, "Invalid Number of Rows(Valid Values: Positive Integers Larger or Equal to 0)");117 rowsTextBox.SelectAll();116 errorProvider.SetError(lengthTextBox, "Invalid Array Length (Valid Values: Positive Integers Larger or Equal to 0)"); 117 lengthTextBox.SelectAll(); 118 118 } 119 119 } 120 private void rowsTextBox_Validated(object sender, EventArgs e) {121 Content. Rows = int.Parse(rowsTextBox.Text);122 errorProvider.SetError( rowsTextBox, string.Empty);120 private void lengthTextBox_Validated(object sender, EventArgs e) { 121 Content.Length = int.Parse(lengthTextBox.Text); 122 errorProvider.SetError(lengthTextBox, string.Empty); 123 123 } 124 private void rowsTextBox_KeyDown(object sender, KeyEventArgs e) {124 private void lengthTextBox_KeyDown(object sender, KeyEventArgs e) { 125 125 if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) 126 rowsLabel.Focus(); // set focus on label to validate data126 lengthLabel.Focus(); // set focus on label to validate data 127 127 if (e.KeyCode == Keys.Escape) { 128 rowsTextBox.Text = Content.Rows.ToString();129 rowsLabel.Focus(); // set focus on label to validate data128 lengthTextBox.Text = Content.Length.ToString(); 129 lengthLabel.Focus(); // set focus on label to validate data 130 130 } 131 131 } -
trunk/sources/HeuristicLab.Data/3.3/BoolArrayData.cs
r2973 r2974 41 41 42 42 #region IStringConvertibleArrayData Members 43 int IStringConvertibleArrayData. Rows{43 int IStringConvertibleArrayData.Length { 44 44 get { return Length; } 45 45 set { Length = value; } -
trunk/sources/HeuristicLab.Data/3.3/DoubleArrayData.cs
r2973 r2974 41 41 42 42 #region IStringConvertibleArrayData Members 43 int IStringConvertibleArrayData. Rows{43 int IStringConvertibleArrayData.Length { 44 44 get { return Length; } 45 45 set { Length = value; } -
trunk/sources/HeuristicLab.Data/3.3/IStringConvertibleArrayData.cs
r2973 r2974 25 25 namespace HeuristicLab.Data { 26 26 public interface IStringConvertibleArrayData { 27 int Rows{ get; set; }27 int Length { get; set; } 28 28 29 29 bool Validate(string value, out string errorMessage); -
trunk/sources/HeuristicLab.Data/3.3/IntArrayData.cs
r2973 r2974 41 41 42 42 #region IStringConvertibleArrayData Members 43 int IStringConvertibleArrayData. Rows{43 int IStringConvertibleArrayData.Length { 44 44 get { return Length; } 45 45 set { Length = value; } -
trunk/sources/HeuristicLab.Data/3.3/StringArrayData.cs
r2973 r2974 97 97 98 98 #region IStringConvertibleArrayData Members 99 int IStringConvertibleArrayData. Rows{99 int IStringConvertibleArrayData.Length { 100 100 get { return Length; } 101 101 set { Length = value; } -
trunk/sources/HeuristicLab.Encodings.Permutation/3.3/Permutation.cs
r2906 r2974 31 31 [Item("Permutation", "Represents a permutation of integer values.")] 32 32 [Creatable("Test")] 33 public sealed class Permutation : ValueTypeArrayData<int>, IStringConvertible MatrixData {33 public sealed class Permutation : ValueTypeArrayData<int>, IStringConvertibleArrayData { 34 34 public Permutation() : base() { } 35 35 public Permutation(int length) … … 85 85 } 86 86 87 #region IStringConvertibleMatrixData Members 88 StringConvertibleArrayDataDimensions IStringConvertibleMatrixData.Dimensions { 89 get { return StringConvertibleArrayDataDimensions.Rows; } 90 } 91 int IStringConvertibleMatrixData.Rows { 87 #region IStringConvertibleArrayData Members 88 int IStringConvertibleArrayData.Length { 92 89 get { return Length; } 93 90 set { Length = value; } 94 91 } 95 int IStringConvertibleMatrixData.Columns {96 get { return 1; }97 set { throw new NotSupportedException("The number of columns cannot be changed."); }98 }99 92 100 bool IStringConvertible MatrixData.Validate(string value, out string errorMessage) {93 bool IStringConvertibleArrayData.Validate(string value, out string errorMessage) { 101 94 int val; 102 95 bool valid = int.TryParse(value, out val); … … 111 104 return valid; 112 105 } 113 string IStringConvertible MatrixData.GetValue(int rowIndex, int columIndex) {114 return this[ rowIndex].ToString();106 string IStringConvertibleArrayData.GetValue(int index) { 107 return this[index].ToString(); 115 108 } 116 bool IStringConvertible MatrixData.SetValue(string value, int rowIndex, int columnIndex) {109 bool IStringConvertibleArrayData.SetValue(string value, int index) { 117 110 int val; 118 111 if (int.TryParse(value, out val)) { 119 this[ rowIndex] = val;112 this[index] = val; 120 113 return true; 121 114 } else { … … 123 116 } 124 117 } 125 event EventHandler<EventArgs<int, int>> IStringConvertibleMatrixData.ItemChanged {126 add { base.ItemChanged += value; }127 remove { base.ItemChanged -= value; }128 }129 event EventHandler IStringConvertibleMatrixData.Reset {130 add { base.Reset += value; }131 remove { base.Reset -= value; }132 }133 118 #endregion 134 119 }
Note: See TracChangeset
for help on using the changeset viewer.