Changeset 17446 for branches/3026_IntegrationIntoSymSpace
- Timestamp:
- 02/20/20 16:58:03 (5 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 16 added
- 1 deleted
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/HeuristicLab.JsonInterface.OptimizerIntegration.csproj
r17431 r17446 78 78 </ItemGroup> 79 79 <ItemGroup> 80 <Compile Include="Interfaces\IArrayJsonItemVM.cs" /> 81 <Compile Include="Interfaces\IJsonItemVM.cs" /> 82 <Compile Include="Interfaces\IMatrixJsonItemVM.cs" /> 80 83 <Compile Include="Properties\Resources.Designer.cs"> 81 84 <AutoGen>True</AutoGen> … … 100 103 <Compile Include="ViewModels\RangedValueBaseVM.cs" /> 101 104 <Compile Include="ViewModels\RangeVM.cs" /> 105 <Compile Include="ViewModels\ResultItemVM.cs" /> 102 106 <Compile Include="ViewModels\SingleValueVM.cs" /> 103 107 <Compile Include="ViewModels\StringValueVM.cs" /> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/JsonItemBaseControl.cs
r17444 r17446 11 11 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 12 12 public partial class JsonItemBaseControl : UserControl { 13 protected JsonItemVMBaseVM { get; set; }13 protected IJsonItemVM VM { get; set; } 14 14 15 15 private JsonItemBaseControl() { … … 17 17 } 18 18 19 public JsonItemBaseControl( JsonItemVMBasevm) {19 public JsonItemBaseControl(IJsonItemVM vm) { 20 20 InitializeComponent(); 21 21 VM = vm; 22 22 23 checkBoxActive.DataBindings.Add("Checked", VM, nameof( JsonItemVMBase.Selected),23 checkBoxActive.DataBindings.Add("Checked", VM, nameof(IJsonItemVM.Selected), 24 24 false, DataSourceUpdateMode.OnPropertyChanged); 25 textBoxName.DataBindings.Add("Text", VM, nameof( JsonItemVMBase.Name));26 textBoxDescription.DataBindings.Add("Text", VM, nameof( JsonItemVMBase.Description));27 textBoxActualName.DataBindings.Add("Text", VM, nameof( JsonItemVMBase.ActualName));25 textBoxName.DataBindings.Add("Text", VM, nameof(IJsonItemVM.Name)); 26 textBoxDescription.DataBindings.Add("Text", VM, nameof(IJsonItemVM.Description)); 27 textBoxActualName.DataBindings.Add("Text", VM, nameof(IJsonItemVM.ActualName)); 28 28 29 29 if (string.IsNullOrWhiteSpace(VM.Item.ActualName)) -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/NumericRangeControl.Designer.cs
r17444 r17446 26 26 this.components = new System.ComponentModel.Container(); 27 27 this.textBoxFrom = new System.Windows.Forms.TextBox(); 28 this.label6 = new System.Windows.Forms.Label();29 28 this.groupBox2 = new System.Windows.Forms.GroupBox(); 30 29 this.checkBoxTo = new System.Windows.Forms.CheckBox(); 31 30 this.textBoxTo = new System.Windows.Forms.TextBox(); 32 this.label1 = new System.Windows.Forms.Label();33 31 this.checkBoxFrom = new System.Windows.Forms.CheckBox(); 34 32 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); … … 49 47 this.textBoxFrom.Validating += new System.ComponentModel.CancelEventHandler(this.textBoxFrom_Validating); 50 48 // 51 // label652 //53 this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)54 | System.Windows.Forms.AnchorStyles.Right)));55 this.label6.AutoSize = true;56 this.label6.Location = new System.Drawing.Point(31, 21);57 this.label6.Name = "label6";58 this.label6.Size = new System.Drawing.Size(30, 13);59 this.label6.TabIndex = 0;60 this.label6.Text = "From";61 //62 49 // groupBox2 63 50 // 64 51 this.groupBox2.Controls.Add(this.checkBoxTo); 65 52 this.groupBox2.Controls.Add(this.textBoxTo); 66 this.groupBox2.Controls.Add(this.label1);67 53 this.groupBox2.Controls.Add(this.checkBoxFrom); 68 54 this.groupBox2.Controls.Add(this.textBoxFrom); 69 this.groupBox2.Controls.Add(this.label6);70 55 this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; 71 56 this.groupBox2.Location = new System.Drawing.Point(0, 0); … … 79 64 // 80 65 this.checkBoxTo.AutoSize = true; 81 this.checkBoxTo.Location = new System.Drawing.Point( 10, 46);66 this.checkBoxTo.Location = new System.Drawing.Point(9, 45); 82 67 this.checkBoxTo.Name = "checkBoxTo"; 83 this.checkBoxTo.Size = new System.Drawing.Size( 15, 14);68 this.checkBoxTo.Size = new System.Drawing.Size(42, 17); 84 69 this.checkBoxTo.TabIndex = 7; 70 this.checkBoxTo.Text = "To:"; 85 71 this.checkBoxTo.UseVisualStyleBackColor = true; 86 72 // … … 97 83 this.textBoxTo.Validating += new System.ComponentModel.CancelEventHandler(this.textBoxTo_Validating); 98 84 // 99 // label1100 //101 this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)102 | System.Windows.Forms.AnchorStyles.Right)));103 this.label1.AutoSize = true;104 this.label1.Location = new System.Drawing.Point(31, 46);105 this.label1.Name = "label1";106 this.label1.Size = new System.Drawing.Size(20, 13);107 this.label1.TabIndex = 5;108 this.label1.Text = "To";109 //110 85 // checkBoxFrom 111 86 // 112 87 this.checkBoxFrom.AutoSize = true; 113 this.checkBoxFrom.Location = new System.Drawing.Point( 10, 20);88 this.checkBoxFrom.Location = new System.Drawing.Point(9, 19); 114 89 this.checkBoxFrom.Name = "checkBoxFrom"; 115 this.checkBoxFrom.Size = new System.Drawing.Size( 15, 14);90 this.checkBoxFrom.Size = new System.Drawing.Size(52, 17); 116 91 this.checkBoxFrom.TabIndex = 4; 92 this.checkBoxFrom.Text = "From:"; 117 93 this.checkBoxFrom.UseVisualStyleBackColor = true; 118 94 // … … 138 114 #endregion 139 115 private System.Windows.Forms.TextBox textBoxFrom; 140 private System.Windows.Forms.Label label6;141 116 private System.Windows.Forms.GroupBox groupBox2; 142 117 private System.Windows.Forms.CheckBox checkBoxTo; 143 118 private System.Windows.Forms.TextBox textBoxTo; 144 private System.Windows.Forms.Label label1;145 119 private System.Windows.Forms.CheckBox checkBoxFrom; 146 120 private System.Windows.Forms.ErrorProvider errorProvider; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ArrayValueVM.cs
r17433 r17446 8 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 9 10 public class DoubleArrayValueVM : ArrayValueVM<double > {10 public class DoubleArrayValueVM : ArrayValueVM<double, DoubleArrayJsonItem> { 11 11 public override Type JsonItemType => typeof(DoubleArrayJsonItem); 12 12 … … 15 15 protected override double MaxTypeValue => double.MaxValue; 16 16 17 public override JsonItemBaseControl GetControl() =>17 public override JsonItemBaseControl Control => 18 18 new JsonItemDoubleArrayValueControl(this); 19 19 … … 27 27 } 28 28 29 public class IntArrayValueVM : ArrayValueVM<int > {29 public class IntArrayValueVM : ArrayValueVM<int, IntArrayJsonItem> { 30 30 public override Type JsonItemType => typeof(IntArrayJsonItem); 31 31 … … 34 34 protected override int MaxTypeValue => int.MaxValue; 35 35 36 public override JsonItemBaseControl GetControl() =>36 public override JsonItemBaseControl Control => 37 37 new JsonItemIntArrayValueControl(this); 38 38 … … 46 46 } 47 47 48 public abstract class ArrayValueVM<T> : RangedValueBaseVM<T> { 48 public abstract class ArrayValueVM<T, JsonItemType> : RangedValueBaseVM<T>, IArrayJsonItemVM 49 where JsonItemType : IArrayJsonItem { 49 50 50 51 public ArrayValueVM() { } 51 52 52 public void SetIndexValue( object obj, int index) {53 public void SetIndexValue(T data, int index) { 53 54 T[] tmp = Value; 54 55 if(index >= tmp.Length) { // increasing array … … 57 58 tmp = newArr; 58 59 } 59 tmp[index] = (T)Convert.ChangeType(obj, typeof(T));60 tmp[index] = data; 60 61 Value = tmp; 61 62 } 62 63 63 64 public abstract T[] Value { get; set; } 65 public bool Resizable { 66 get => ((IArrayJsonItem)Item).Resizable; 67 set { 68 ((IArrayJsonItem)Item).Resizable = value; 69 OnPropertyChange(this, nameof(IArrayJsonItemVM.Resizable)); 70 } 71 } 64 72 } 65 73 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVMBase.cs
r17444 r17446 9 9 10 10 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 11 public class JsonItemVMBase : I NotifyPropertyChanged, IDisposable{11 public class JsonItemVMBase : IJsonItemVM { 12 12 public event PropertyChangedEventHandler PropertyChanged; 13 13 public event Action ItemChanged; … … 78 78 } 79 79 80 public virtual JsonItemBaseControl GetControl() { 81 return new JsonItemBaseControl(this); 82 } 83 80 public virtual JsonItemBaseControl Control => new JsonItemBaseControl(this); 81 84 82 #region IDisposable Support 85 83 private bool disposedValue = false; // To detect redundant calls -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/MatrixValueVM.cs
r17433 r17446 8 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 9 10 public class DoubleMatrixValueVM : MatrixValueVM<double > {10 public class DoubleMatrixValueVM : MatrixValueVM<double, DoubleMatrixJsonItem> { 11 11 public override Type JsonItemType => typeof(DoubleMatrixJsonItem); 12 public override JsonItemBaseControl GetControl() =>12 public override JsonItemBaseControl Control => 13 13 new JsonItemDoubleMatrixValueControl(this); 14 14 … … 26 26 } 27 27 28 public abstract class MatrixValueVM<T> : RangedValueBaseVM<T> { 28 public abstract class MatrixValueVM<T, JsonItemType> : RangedValueBaseVM<T>, IMatrixJsonItemVM 29 where JsonItemType : IMatrixJsonItem { 30 public abstract T[][] Value { get; set; } 31 public bool RowsResizable { 32 get => ((IMatrixJsonItem)Item).RowsResizable; 33 set { 34 ((IMatrixJsonItem)Item).RowsResizable = value; 35 OnPropertyChange(this, nameof(RowsResizable)); 36 } 37 } 29 38 30 public MatrixValueVM() {} 31 public void SetCellValue(object obj, int col, int row) { 39 public bool ColumnsResizable { 40 get => ((IMatrixJsonItem)Item).ColumnsResizable; 41 set { 42 ((IMatrixJsonItem)Item).ColumnsResizable = value; 43 OnPropertyChange(this, nameof(ColumnsResizable)); 44 } 45 } 46 47 public void SetCellValue(T data, int row, int col) { 48 32 49 T[][] tmp = Value; 33 50 51 // increase y 34 52 if (row >= tmp.Length) { // increasing array 35 53 T[][] newArr = new T[row + 1][]; … … 38 56 tmp = newArr; 39 57 } 58 59 // increase x 40 60 for(int i = 0; i < tmp.Length; ++i) { 41 61 if(col >= tmp[i].Length) { … … 45 65 } 46 66 } 47 tmp[row][col] = (T)Convert.ChangeType(obj.ToString().Replace(",","."), 48 typeof(T), 49 System.Globalization.CultureInfo.InvariantCulture); 67 68 tmp[row][col] = data; 50 69 Value = tmp; 51 70 } 52 53 public abstract T[][] Value { get; set; }54 55 71 } 56 72 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangeVM.cs
r17420 r17446 15 15 protected override int MaxTypeValue => int.MaxValue; 16 16 17 public override JsonItemBaseControl GetControl()=>17 public override JsonItemBaseControl Control => 18 18 new JsonItemRangeControl(this); 19 19 } … … 26 26 protected override double MaxTypeValue => double.MaxValue; 27 27 28 public override JsonItemBaseControl GetControl()=>28 public override JsonItemBaseControl Control => 29 29 new JsonItemRangeControl(this); 30 30 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/SingleValueVM.cs
r17443 r17446 14 14 protected override int MaxTypeValue => int.MaxValue; 15 15 16 public override JsonItemBaseControl GetControl()=>16 public override JsonItemBaseControl Control => 17 17 new JsonItemIntValueControl(this); 18 18 } … … 24 24 protected override double MaxTypeValue => double.MaxValue; 25 25 26 public override JsonItemBaseControl GetControl()=>26 public override JsonItemBaseControl Control => 27 27 new JsonItemDoubleValueControl(this); 28 28 } … … 34 34 protected override bool MaxTypeValue => true; 35 35 36 public override JsonItemBaseControl GetControl()=>36 public override JsonItemBaseControl Control => 37 37 new JsonItemBoolControl(this); 38 38 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/StringValueVM.cs
r17443 r17446 8 8 public class StringValueVM : JsonItemVMBase { 9 9 public override Type JsonItemType => typeof(StringJsonItem); 10 public override JsonItemBaseControl GetControl()=>10 public override JsonItemBaseControl Control => 11 11 new JsonItemValidValuesControl(this); 12 12 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.Designer.cs
r17444 r17446 29 29 this.treeView = new System.Windows.Forms.TreeView(); 30 30 this.groupBoxDetails = new System.Windows.Forms.GroupBox(); 31 this.panel = new System.Windows.Forms.Panel();31 this.panelParameterDetails = new System.Windows.Forms.Panel(); 32 32 this.resultItems = new System.Windows.Forms.CheckedListBox(); 33 this.groupBox2 = new System.Windows.Forms.GroupBox();34 33 this.groupBox3 = new System.Windows.Forms.GroupBox(); 35 34 this.treeViewResults = new System.Windows.Forms.TreeView(); … … 41 40 this.textBoxTemplateName = new System.Windows.Forms.TextBox(); 42 41 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 42 this.splitContainer1 = new System.Windows.Forms.SplitContainer(); 43 this.groupBox = new System.Windows.Forms.GroupBox(); 44 this.panelResultDetails = new System.Windows.Forms.Panel(); 43 45 this.jsonItemBindingSource = new System.Windows.Forms.BindingSource(this.components); 44 46 this.groupBoxDetails.SuspendLayout(); 45 this.groupBox2.SuspendLayout();46 47 this.groupBox3.SuspendLayout(); 47 48 ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); … … 53 54 this.tabPage2.SuspendLayout(); 54 55 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 56 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); 57 this.splitContainer1.Panel1.SuspendLayout(); 58 this.splitContainer1.Panel2.SuspendLayout(); 59 this.splitContainer1.SuspendLayout(); 60 this.groupBox.SuspendLayout(); 55 61 ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).BeginInit(); 56 62 this.SuspendLayout(); … … 65 71 // 66 72 this.exportButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 67 this.exportButton.Location = new System.Drawing.Point(6 29, 578);73 this.exportButton.Location = new System.Drawing.Point(630, 575); 68 74 this.exportButton.Name = "exportButton"; 69 75 this.exportButton.Size = new System.Drawing.Size(191, 29); … … 75 81 // treeView 76 82 // 77 this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)78 | System.Windows.Forms.AnchorStyles.Left)79 | System.Windows.Forms.AnchorStyles.Right)));80 83 this.treeView.CheckBoxes = true; 81 this.treeView.Location = new System.Drawing.Point(6, 19); 84 this.treeView.Dock = System.Windows.Forms.DockStyle.Fill; 85 this.treeView.Location = new System.Drawing.Point(0, 6); 82 86 this.treeView.Name = "treeView"; 83 this.treeView.Size = new System.Drawing.Size(3 52, 471);87 this.treeView.Size = new System.Drawing.Size(370, 493); 84 88 this.treeView.TabIndex = 3; 85 89 this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); … … 87 91 // groupBoxDetails 88 92 // 89 this.groupBoxDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 90 | System.Windows.Forms.AnchorStyles.Left) 91 | System.Windows.Forms.AnchorStyles.Right))); 92 this.groupBoxDetails.Controls.Add(this.panel); 93 this.groupBoxDetails.Location = new System.Drawing.Point(3, 0); 93 this.groupBoxDetails.Controls.Add(this.panelParameterDetails); 94 this.groupBoxDetails.Dock = System.Windows.Forms.DockStyle.Fill; 95 this.groupBoxDetails.Location = new System.Drawing.Point(0, 0); 94 96 this.groupBoxDetails.Name = "groupBoxDetails"; 95 this.groupBoxDetails.Size = new System.Drawing.Size(4 15, 496);97 this.groupBoxDetails.Size = new System.Drawing.Size(422, 499); 96 98 this.groupBoxDetails.TabIndex = 4; 97 99 this.groupBoxDetails.TabStop = false; 98 100 this.groupBoxDetails.Text = "Details"; 99 101 // 100 // panel 101 // 102 this.panel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 103 | System.Windows.Forms.AnchorStyles.Left) 104 | System.Windows.Forms.AnchorStyles.Right))); 105 this.panel.AutoScroll = true; 106 this.panel.Location = new System.Drawing.Point(7, 20); 107 this.panel.Name = "panel"; 108 this.panel.Size = new System.Drawing.Size(402, 470); 109 this.panel.TabIndex = 0; 102 // panelParameterDetails 103 // 104 this.panelParameterDetails.AutoScroll = true; 105 this.panelParameterDetails.Dock = System.Windows.Forms.DockStyle.Fill; 106 this.panelParameterDetails.Location = new System.Drawing.Point(3, 16); 107 this.panelParameterDetails.Name = "panelParameterDetails"; 108 this.panelParameterDetails.Size = new System.Drawing.Size(416, 480); 109 this.panelParameterDetails.TabIndex = 0; 110 110 // 111 111 // resultItems 112 112 // 113 this.resultItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 114 | System.Windows.Forms.AnchorStyles.Left) 115 | System.Windows.Forms.AnchorStyles.Right))); 113 this.resultItems.Dock = System.Windows.Forms.DockStyle.Fill; 116 114 this.resultItems.FormattingEnabled = true; 117 this.resultItems.Location = new System.Drawing.Point( 6, 364);115 this.resultItems.Location = new System.Drawing.Point(0, 6); 118 116 this.resultItems.Name = "resultItems"; 119 this.resultItems.Size = new System.Drawing.Size( 777, 124);117 this.resultItems.Size = new System.Drawing.Size(373, 393); 120 118 this.resultItems.TabIndex = 5; 121 // 122 // groupBox2 123 // 124 this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 125 | System.Windows.Forms.AnchorStyles.Left) 126 | System.Windows.Forms.AnchorStyles.Right))); 127 this.groupBox2.Controls.Add(this.treeView); 128 this.groupBox2.Location = new System.Drawing.Point(0, 0); 129 this.groupBox2.Name = "groupBox2"; 130 this.groupBox2.Size = new System.Drawing.Size(364, 496); 131 this.groupBox2.TabIndex = 6; 132 this.groupBox2.TabStop = false; 133 this.groupBox2.Text = "Elements"; 119 this.resultItems.SelectedValueChanged += new System.EventHandler(this.resultItems_SelectedValueChanged); 134 120 // 135 121 // groupBox3 … … 138 124 | System.Windows.Forms.AnchorStyles.Left) 139 125 | System.Windows.Forms.AnchorStyles.Right))); 126 this.groupBox3.Controls.Add(this.splitContainer1); 140 127 this.groupBox3.Controls.Add(this.treeViewResults); 141 this.groupBox3.Controls.Add(this.resultItems);142 128 this.groupBox3.Location = new System.Drawing.Point(6, 6); 143 129 this.groupBox3.Name = "groupBox3"; 144 this.groupBox3.Size = new System.Drawing.Size(7 89, 496);130 this.groupBox3.Size = new System.Drawing.Size(790, 493); 145 131 this.groupBox3.TabIndex = 7; 146 132 this.groupBox3.TabStop = false; … … 152 138 this.treeViewResults.Location = new System.Drawing.Point(6, 19); 153 139 this.treeViewResults.Name = "treeViewResults"; 154 this.treeViewResults.Size = new System.Drawing.Size(777, 339);140 this.treeViewResults.Size = new System.Drawing.Size(777, 63); 155 141 this.treeViewResults.TabIndex = 6; 156 142 // 157 143 // splitContainer2 158 144 // 159 this.splitContainer2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 160 | System.Windows.Forms.AnchorStyles.Left) 161 | System.Windows.Forms.AnchorStyles.Right))); 162 this.splitContainer2.Location = new System.Drawing.Point(6, 6); 145 this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; 146 this.splitContainer2.Location = new System.Drawing.Point(3, 3); 163 147 this.splitContainer2.Name = "splitContainer2"; 164 148 // 165 149 // splitContainer2.Panel1 166 150 // 167 this.splitContainer2.Panel1.Controls.Add(this.groupBox2); 151 this.splitContainer2.Panel1.Controls.Add(this.treeView); 152 this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(0, 6, 0, 0); 168 153 // 169 154 // splitContainer2.Panel2 170 155 // 171 156 this.splitContainer2.Panel2.Controls.Add(this.groupBoxDetails); 172 this.splitContainer2.Size = new System.Drawing.Size(7 89, 496);173 this.splitContainer2.SplitterDistance = 3 67;157 this.splitContainer2.Size = new System.Drawing.Size(796, 499); 158 this.splitContainer2.SplitterDistance = 370; 174 159 this.splitContainer2.TabIndex = 9; 175 160 // … … 184 169 this.tabControl1.Name = "tabControl1"; 185 170 this.tabControl1.SelectedIndex = 0; 186 this.tabControl1.Size = new System.Drawing.Size(8 09, 534);171 this.tabControl1.Size = new System.Drawing.Size(810, 531); 187 172 this.tabControl1.TabIndex = 10; 188 173 // … … 193 178 this.tabPage1.Name = "tabPage1"; 194 179 this.tabPage1.Padding = new System.Windows.Forms.Padding(3); 195 this.tabPage1.Size = new System.Drawing.Size(80 1, 508);180 this.tabPage1.Size = new System.Drawing.Size(802, 505); 196 181 this.tabPage1.TabIndex = 0; 197 182 this.tabPage1.Text = "Parameters"; … … 204 189 this.tabPage2.Name = "tabPage2"; 205 190 this.tabPage2.Padding = new System.Windows.Forms.Padding(3); 206 this.tabPage2.Size = new System.Drawing.Size(80 1, 508);191 this.tabPage2.Size = new System.Drawing.Size(802, 505); 207 192 this.tabPage2.TabIndex = 1; 208 193 this.tabPage2.Text = "Results"; … … 225 210 this.textBoxTemplateName.Location = new System.Drawing.Point(100, 12); 226 211 this.textBoxTemplateName.Name = "textBoxTemplateName"; 227 this.textBoxTemplateName.Size = new System.Drawing.Size(72 0, 20);212 this.textBoxTemplateName.Size = new System.Drawing.Size(721, 20); 228 213 this.textBoxTemplateName.TabIndex = 12; 229 214 this.textBoxTemplateName.Text = "Template"; … … 235 220 this.errorProvider.ContainerControl = this; 236 221 // 222 // splitContainer1 223 // 224 this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 225 | System.Windows.Forms.AnchorStyles.Left) 226 | System.Windows.Forms.AnchorStyles.Right))); 227 this.splitContainer1.Location = new System.Drawing.Point(6, 88); 228 this.splitContainer1.Name = "splitContainer1"; 229 // 230 // splitContainer1.Panel1 231 // 232 this.splitContainer1.Panel1.Controls.Add(this.resultItems); 233 this.splitContainer1.Panel1.Padding = new System.Windows.Forms.Padding(0, 6, 0, 0); 234 // 235 // splitContainer1.Panel2 236 // 237 this.splitContainer1.Panel2.Controls.Add(this.groupBox); 238 this.splitContainer1.Size = new System.Drawing.Size(778, 399); 239 this.splitContainer1.SplitterDistance = 373; 240 this.splitContainer1.TabIndex = 7; 241 // 242 // groupBox 243 // 244 this.groupBox.Controls.Add(this.panelResultDetails); 245 this.groupBox.Dock = System.Windows.Forms.DockStyle.Fill; 246 this.groupBox.Location = new System.Drawing.Point(0, 0); 247 this.groupBox.Name = "groupBox"; 248 this.groupBox.Size = new System.Drawing.Size(401, 399); 249 this.groupBox.TabIndex = 5; 250 this.groupBox.TabStop = false; 251 this.groupBox.Text = "Details"; 252 // 253 // panelResultDetails 254 // 255 this.panelResultDetails.AutoScroll = true; 256 this.panelResultDetails.Dock = System.Windows.Forms.DockStyle.Fill; 257 this.panelResultDetails.Location = new System.Drawing.Point(3, 16); 258 this.panelResultDetails.Name = "panelResultDetails"; 259 this.panelResultDetails.Size = new System.Drawing.Size(395, 380); 260 this.panelResultDetails.TabIndex = 0; 261 // 237 262 // jsonItemBindingSource 238 263 // … … 243 268 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 244 269 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 245 this.ClientSize = new System.Drawing.Size(83 3, 619);270 this.ClientSize = new System.Drawing.Size(834, 616); 246 271 this.Controls.Add(this.textBoxTemplateName); 247 272 this.Controls.Add(this.label1); … … 253 278 this.Text = "Export Json"; 254 279 this.groupBoxDetails.ResumeLayout(false); 255 this.groupBox2.ResumeLayout(false);256 280 this.groupBox3.ResumeLayout(false); 257 281 this.splitContainer2.Panel1.ResumeLayout(false); … … 263 287 this.tabPage2.ResumeLayout(false); 264 288 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 289 this.splitContainer1.Panel1.ResumeLayout(false); 290 this.splitContainer1.Panel2.ResumeLayout(false); 291 ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); 292 this.splitContainer1.ResumeLayout(false); 293 this.groupBox.ResumeLayout(false); 265 294 ((System.ComponentModel.ISupportInitialize)(this.jsonItemBindingSource)).EndInit(); 266 295 this.ResumeLayout(false); … … 277 306 private System.Windows.Forms.TreeView treeView; 278 307 private System.Windows.Forms.GroupBox groupBoxDetails; 279 private System.Windows.Forms.Panel panel ;308 private System.Windows.Forms.Panel panelParameterDetails; 280 309 private System.Windows.Forms.CheckedListBox resultItems; 281 private System.Windows.Forms.GroupBox groupBox2;282 310 private System.Windows.Forms.GroupBox groupBox3; 283 311 private System.Windows.Forms.SplitContainer splitContainer2; … … 289 317 private System.Windows.Forms.TextBox textBoxTemplateName; 290 318 private System.Windows.Forms.ErrorProvider errorProvider; 319 private System.Windows.Forms.SplitContainer splitContainer1; 320 private System.Windows.Forms.GroupBox groupBox; 321 private System.Windows.Forms.Panel panelResultDetails; 291 322 } 292 323 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs
r17444 r17446 18 18 private static FolderBrowserDialog FolderBrowserDialog { get; set; } 19 19 private IDictionary<int, UserControl> Hash2Control { get; set; } = new Dictionary<int, UserControl>(); 20 private IDictionary<TreeNode, JsonItemVMBase> Node2VM { get; set; } = new Dictionary<TreeNode, JsonItemVMBase>();20 private IDictionary<TreeNode, IJsonItemVM> Node2VM { get; set; } = new Dictionary<TreeNode, IJsonItemVM>(); 21 21 private IJsonItem Root { get; set; } 22 22 private IOptimizer Optimizer { get; set; } 23 private IList< JsonItemVMBase> VMs { get; set; }23 private IList<IJsonItemVM> VMs { get; set; } 24 24 private JCGenerator Generator { get; set; } = new JCGenerator(); 25 25 private IDictionary<string, IJsonItem> ResultItems { get; set; } = new Dictionary<string, IJsonItem>(); … … 31 31 content = value; 32 32 33 VMs = new List< JsonItemVMBase>();33 VMs = new List<IJsonItemVM>(); 34 34 treeView.Nodes.Clear(); 35 35 ResultItems.Clear(); … … 49 49 private void TreeView_AfterCheck(object sender, TreeViewEventArgs e) { 50 50 if (e.Action != TreeViewAction.Unknown) { 51 if (Node2VM.TryGetValue(e.Node, out JsonItemVMBasevm)) {51 if (Node2VM.TryGetValue(e.Node, out IJsonItemVM vm)) { 52 52 vm.Selected = e.Node.Checked; 53 53 } … … 72 72 private void exportButton_Click(object sender, EventArgs e) { 73 73 foreach (var x in VMs) { 74 if (! x.Selected) {74 if (!(x is ResultItemVM) && !x.Selected) { 75 75 x.Item.Parent.Children.Remove(x.Item); 76 76 } … … 104 104 if (FolderBrowserDialog.ShowDialog() == DialogResult.OK) { 105 105 Generator.GenerateTemplate(FolderBrowserDialog.SelectedPath, textBoxTemplateName.Text, Optimizer, Root); 106 Close(); 106 107 } 107 108 Close();109 108 } 110 109 } 111 110 112 111 private void BuildTreeNode(TreeNode node, IJsonItem item) { 112 RegisterItem(node, item); 113 if (item.Children != null) { 114 foreach (var c in item.Children) { 115 if (IsDrawableItem(c)) { 116 if (c is ResultItem) { 117 resultItems.Items.Add(c.Name, true); 118 ResultItems.Add(c.Name, c); 119 TreeNode childNode = new TreeNode(c.Name); 120 treeViewResults.Nodes.Add(childNode); 121 RegisterItem(childNode, c); 122 //Hash2Control.Add(c.GetHashCode(), new JsonItemBaseControl(new JsonItemVMBase() { Item = c })); 123 } else { 124 TreeNode childNode = new TreeNode(c.Name); 125 node.Nodes.Add(childNode); 126 BuildTreeNode(childNode, c); 127 } 128 } 129 } 130 } 131 } 132 133 private void RegisterItem(TreeNode node, IJsonItem item) { 113 134 if (JI2VM.TryGetValue(item.GetType(), out Type vmType)) { 114 JsonItemVMBase vm = (JsonItemVMBase)Activator.CreateInstance(vmType);115 VMs.Add(vm); 135 IJsonItemVM vm = (IJsonItemVM)Activator.CreateInstance(vmType); 136 116 137 vm.Item = item; 117 138 vm.TreeNode = node; 118 139 vm.TreeView = treeView; 140 node.Checked = vm.Selected; 141 142 VMs.Add(vm); 119 143 Node2VM.Add(node, vm); 120 node.Checked = vm.Selected; 121 UserControl control = vm.GetControl(); 144 UserControl control = vm.Control; 122 145 Hash2Control.Add(node.GetHashCode(), control); 123 if (item.Children != null) {124 foreach (var c in item.Children) {125 if (IsDrawableItem(c)) {126 if (c is ResultItem) {127 resultItems.Items.Add(c.Name, true);128 129 ResultItems.Add(c.Name, c);130 } else {131 TreeNode childNode = new TreeNode(c.Name);132 node.Nodes.Add(childNode);133 BuildTreeNode(childNode, c);134 }135 }136 }137 }138 146 } 139 147 } … … 152 160 private void treeView_AfterSelect(object sender, TreeViewEventArgs e) { 153 161 if(Hash2Control.TryGetValue(treeView.SelectedNode.GetHashCode(), out UserControl control)) { 154 panel.Controls.Clear(); 155 if (control != null) { 156 panel.Controls.Add(control); 157 control.Width = panel.Width; 158 control.Height = panel.Height; 159 control.Dock = DockStyle.Fill; 160 control.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; 161 } 162 panel.Refresh(); 162 SetControlOnPanel(control, panelParameterDetails); 163 163 } 164 164 } … … 172 172 } 173 173 } 174 175 private void resultItems_SelectedValueChanged(object sender, EventArgs e) { 176 if(ResultItems.TryGetValue(resultItems.SelectedItem.ToString(), out IJsonItem item) && 177 Hash2Control.TryGetValue(item.GetHashCode(), out UserControl control)) { 178 SetControlOnPanel(control, panelResultDetails); 179 } 180 } 181 182 private void SetControlOnPanel(UserControl control, Panel panel) { 183 panel.Controls.Clear(); 184 if (control != null) { 185 panel.Controls.Add(control); 186 control.Width = panel.Width; 187 control.Height = panel.Height; 188 control.Dock = DockStyle.Fill; 189 control.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; 190 } 191 panel.Refresh(); 192 } 174 193 } 175 194 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemBoolControl.Designer.cs
r17443 r17446 26 26 this.checkBoxValue = new System.Windows.Forms.CheckBox(); 27 27 this.label2 = new System.Windows.Forms.Label(); 28 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 28 29 this.SuspendLayout(); 29 30 // … … 42 43 // 43 44 this.label2.AutoSize = true; 44 this.label2.Location = new System.Drawing.Point(6, 10 1);45 this.label2.Location = new System.Drawing.Point(6, 102); 45 46 this.label2.Name = "label2"; 46 47 this.label2.Size = new System.Drawing.Size(34, 13); … … 54 55 this.Controls.Add(this.label2); 55 56 this.Controls.Add(this.checkBoxValue); 57 this.errorProvider.SetIconAlignment(this, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 56 58 this.Name = "JsonItemBoolControl"; 57 this.Size = new System.Drawing.Size(500, 1 40);59 this.Size = new System.Drawing.Size(500, 121); 58 60 this.Controls.SetChildIndex(this.checkBoxValue, 0); 59 61 this.Controls.SetChildIndex(this.label2, 0); 62 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 60 63 this.ResumeLayout(false); 61 64 this.PerformLayout(); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemBoolControl.resx
r17404 r17446 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 </metadata> 120 123 </root> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemMultiValueControl.Designer.cs
r17433 r17446 26 26 this.dataGridView = new System.Windows.Forms.DataGridView(); 27 27 this.numericRangeControl1 = new HeuristicLab.JsonInterface.OptimizerIntegration.NumericRangeControl(); 28 this.groupBox1 = new System.Windows.Forms.GroupBox(); 29 this.textBoxRows = new System.Windows.Forms.TextBox(); 30 this.checkBoxColumns = new System.Windows.Forms.CheckBox(); 31 this.checkBoxRows = new System.Windows.Forms.CheckBox(); 32 this.textBoxColumns = new System.Windows.Forms.TextBox(); 33 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 28 34 ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); 35 this.groupBox1.SuspendLayout(); 29 36 this.SuspendLayout(); 30 37 // 31 38 // dataGridView 32 39 // 40 this.dataGridView.AllowUserToAddRows = false; 41 this.dataGridView.AllowUserToDeleteRows = false; 42 this.dataGridView.AllowUserToResizeColumns = false; 43 this.dataGridView.AllowUserToResizeRows = false; 33 44 this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 34 45 | System.Windows.Forms.AnchorStyles.Left) 35 46 | System.Windows.Forms.AnchorStyles.Right))); 36 47 this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 37 this.dataGridView.Location = new System.Drawing.Point( 9, 101);48 this.dataGridView.Location = new System.Drawing.Point(6, 67); 38 49 this.dataGridView.Name = "dataGridView"; 39 this.dataGridView.Size = new System.Drawing.Size(4 87, 208);50 this.dataGridView.Size = new System.Drawing.Size(473, 192); 40 51 this.dataGridView.TabIndex = 13; 41 52 // … … 44 55 this.numericRangeControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 45 56 | System.Windows.Forms.AnchorStyles.Right))); 46 this.numericRangeControl1.Location = new System.Drawing.Point(9, 3 15);57 this.numericRangeControl1.Location = new System.Drawing.Point(9, 372); 47 58 this.numericRangeControl1.Name = "numericRangeControl1"; 48 this.numericRangeControl1.Size = new System.Drawing.Size(487, 128);59 this.numericRangeControl1.Size = new System.Drawing.Size(487, 71); 49 60 this.numericRangeControl1.TabIndex = 14; 61 // 62 // groupBox1 63 // 64 this.groupBox1.Controls.Add(this.textBoxColumns); 65 this.groupBox1.Controls.Add(this.textBoxRows); 66 this.groupBox1.Controls.Add(this.checkBoxColumns); 67 this.groupBox1.Controls.Add(this.checkBoxRows); 68 this.groupBox1.Controls.Add(this.dataGridView); 69 this.groupBox1.Location = new System.Drawing.Point(9, 101); 70 this.groupBox1.Name = "groupBox1"; 71 this.groupBox1.Size = new System.Drawing.Size(485, 265); 72 this.groupBox1.TabIndex = 15; 73 this.groupBox1.TabStop = false; 74 this.groupBox1.Text = "Value"; 75 this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 76 | System.Windows.Forms.AnchorStyles.Left) 77 | System.Windows.Forms.AnchorStyles.Right))); 78 // 79 // textBoxRows 80 // 81 this.textBoxRows.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 82 | System.Windows.Forms.AnchorStyles.Right))); 83 this.errorProvider.SetIconAlignment(this.textBoxRows, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 84 this.textBoxRows.Location = new System.Drawing.Point(83, 17); 85 this.textBoxRows.Name = "textBoxRows"; 86 this.textBoxRows.ReadOnly = true; 87 this.textBoxRows.Size = new System.Drawing.Size(396, 20); 88 this.textBoxRows.TabIndex = 16; 89 this.textBoxRows.TextChanged += new System.EventHandler(this.textBoxRows_TextChanged); 90 this.textBoxRows.Validating += new System.ComponentModel.CancelEventHandler(this.textBoxRows_Validating); 91 // 92 // checkBoxColumns 93 // 94 this.checkBoxColumns.AutoSize = true; 95 this.checkBoxColumns.Location = new System.Drawing.Point(7, 43); 96 this.checkBoxColumns.Name = "checkBoxColumns"; 97 this.checkBoxColumns.Size = new System.Drawing.Size(69, 17); 98 this.checkBoxColumns.TabIndex = 15; 99 this.checkBoxColumns.Text = "Columns:"; 100 this.checkBoxColumns.UseVisualStyleBackColor = true; 101 // 102 // checkBoxRows 103 // 104 this.checkBoxRows.AutoSize = true; 105 this.checkBoxRows.Location = new System.Drawing.Point(7, 20); 106 this.checkBoxRows.Name = "checkBoxRows"; 107 this.checkBoxRows.Size = new System.Drawing.Size(56, 17); 108 this.checkBoxRows.TabIndex = 14; 109 this.checkBoxRows.Text = "Rows:"; 110 this.checkBoxRows.UseVisualStyleBackColor = true; 111 // 112 // textBoxColumns 113 // 114 this.textBoxColumns.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 115 | System.Windows.Forms.AnchorStyles.Right))); 116 this.errorProvider.SetIconAlignment(this.textBoxColumns, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 117 this.textBoxColumns.Location = new System.Drawing.Point(83, 43); 118 this.textBoxColumns.Name = "textBoxColumns"; 119 this.textBoxColumns.ReadOnly = true; 120 this.textBoxColumns.Size = new System.Drawing.Size(396, 20); 121 this.textBoxColumns.TabIndex = 17; 122 this.textBoxColumns.TextChanged += new System.EventHandler(this.textBoxColumns_TextChanged); 123 this.textBoxColumns.Validating += new System.ComponentModel.CancelEventHandler(this.textBoxColumns_Validating); 50 124 // 51 125 // JsonItemMultiValueControl … … 53 127 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 54 128 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 129 this.Controls.Add(this.groupBox1); 55 130 this.Controls.Add(this.numericRangeControl1); 56 this. Controls.Add(this.dataGridView);131 this.errorProvider.SetIconAlignment(this, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 57 132 this.Name = "JsonItemMultiValueControl"; 58 133 this.Size = new System.Drawing.Size(502, 449); 59 this.Controls.SetChildIndex(this.dataGridView, 0);60 134 this.Controls.SetChildIndex(this.numericRangeControl1, 0); 135 this.Controls.SetChildIndex(this.groupBox1, 0); 136 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 61 137 ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); 138 this.groupBox1.ResumeLayout(false); 139 this.groupBox1.PerformLayout(); 62 140 this.ResumeLayout(false); 63 141 this.PerformLayout(); … … 69 147 private System.Windows.Forms.DataGridView dataGridView; 70 148 private NumericRangeControl numericRangeControl1; 149 private System.Windows.Forms.GroupBox groupBox1; 150 private System.Windows.Forms.CheckBox checkBoxColumns; 151 private System.Windows.Forms.CheckBox checkBoxRows; 152 private System.Windows.Forms.TextBox textBoxRows; 153 private System.Windows.Forms.TextBox textBoxColumns; 71 154 } 72 155 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemMultiValueControl.cs
r17433 r17446 14 14 15 15 public JsonItemDoubleMatrixValueControl(DoubleMatrixValueVM vm) : base(vm, vm.Value) { } 16 protected override void SaveCellData( object data, int col, int row) {16 protected override void SaveCellData(double data, int row, int col) { 17 17 DoubleMatrixValueVM vm = VM as DoubleMatrixValueVM; 18 vm.SetCellValue(data, col, row);18 vm.SetCellValue(data, row, col); 19 19 } 20 20 } … … 23 23 public JsonItemIntArrayValueControl(IntArrayValueVM vm) : base(vm, vm.Value) { } 24 24 25 protected override void SaveCellData( object data, int col, int row) {25 protected override void SaveCellData(int data, int row, int col) { 26 26 IntArrayValueVM vm = VM as IntArrayValueVM; 27 27 vm.SetIndexValue(data, row); … … 32 32 public JsonItemDoubleArrayValueControl(DoubleArrayValueVM vm) : base(vm, vm.Value) { } 33 33 34 protected override void SaveCellData( object data, int col, int row) {34 protected override void SaveCellData(double data, int row, int col) { 35 35 DoubleArrayValueVM vm = VM as DoubleArrayValueVM; 36 36 vm.SetIndexValue(data, row); … … 40 40 public abstract partial class JsonItemMultiValueControl<T> : JsonItemBaseControl { 41 41 protected NumericRangeControl NumericRangeControl { get; set; } 42 43 public JsonItemMultiValueControl(JsonItemVMBase vm, T[][] matrix) : base(vm) { 42 private int _rows; 43 private int Rows { 44 get => _rows; 45 set { 46 _rows = value; 47 RefreshMatrix(); 48 } 49 } 50 51 private int _cols; 52 private int Columns { 53 get => _cols; 54 set { 55 _cols = value; 56 RefreshMatrix(); 57 } 58 } 59 60 private T[][] Matrix { get; set; } 61 62 public JsonItemMultiValueControl(IMatrixJsonItemVM vm, T[][] matrix) : base(vm) { 44 63 InitializeComponent(); 64 65 checkBoxRows.DataBindings.Add("Checked", vm, nameof(IMatrixJsonItemVM.RowsResizable)); 66 checkBoxColumns.DataBindings.Add("Checked", vm, nameof(IMatrixJsonItemVM.ColumnsResizable)); 67 45 68 int rows = matrix.Length; 46 69 int cols = matrix.Max(x => x.Length); 47 70 48 // columns must added first 49 for (int c = 0; c < cols; ++c) { 50 dataGridView.Columns.Add($"Column {c}", $"Column {c}"); 51 } 52 53 dataGridView.Rows.Add(rows); 54 for (int c = 0; c < cols; ++c) { 55 for(int r = 0; r < rows; ++r) { 56 dataGridView[c, r].Value = matrix[r][c]; 57 } 58 } 59 71 Matrix = matrix; 72 _cols = cols; 73 _rows = rows; 74 RefreshMatrix(); 75 InitSizeConfiguration(rows, cols); 60 76 dataGridView.CellEndEdit += DataGridView_CellEndEdit; 61 77 InitRangeBinding(); 62 78 } 63 64 public JsonItemMultiValueControl( JsonItemVMBasevm, T[] array) : base(vm) {79 80 public JsonItemMultiValueControl(IArrayJsonItemVM vm, T[] array) : base(vm) { 65 81 InitializeComponent(); 82 83 checkBoxRows.DataBindings.Add("Checked", vm, nameof(IArrayJsonItemVM.Resizable)); 84 66 85 int length = array.Length; 67 86 68 dataGridView.Columns.Add("Value", "Value"); 69 dataGridView.Rows.Add(length); 70 for(int i = 0; i < length; ++i) { 71 dataGridView[0, i].Value = array[i]; 72 } 87 Matrix = new T[array.Length][]; 88 for (int r = 0; r < length; ++r) { 89 Matrix[r] = new T[1]; 90 Matrix[r][0] = array[r]; 91 } 92 93 _cols = 1; 94 _rows = length; 95 RefreshMatrix(); 96 97 InitSizeConfiguration(length, null); 73 98 dataGridView.CellEndEdit += DataGridView_CellEndEdit; 74 99 InitRangeBinding(); 75 100 } 76 77 private void DataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { 78 SaveCellData(dataGridView[e.ColumnIndex, e.RowIndex].Value, e.ColumnIndex, e.RowIndex); 79 } 80 81 protected abstract void SaveCellData(object data, int col, int row); 101 102 protected abstract void SaveCellData(T data, int row, int col); 103 104 private void InitSizeConfiguration(int? rows, int? columns) { 105 if(rows != null) { 106 checkBoxRows.CheckedChanged += CheckBoxRows_CheckedChanged; 107 textBoxRows.Text = rows.ToString(); 108 } else { 109 checkBoxRows.Enabled = false; 110 textBoxRows.ReadOnly = true; 111 } 112 113 if (columns != null) { 114 checkBoxColumns.CheckedChanged += CheckBoxColumns_CheckedChanged; 115 textBoxColumns.Text = columns.ToString(); 116 } else { 117 checkBoxColumns.Enabled = false; 118 textBoxColumns.ReadOnly = true; 119 } 120 } 121 122 private void RefreshMatrix() { 123 dataGridView.Rows.Clear(); 124 dataGridView.Columns.Clear(); 125 126 T[][] tmp = Matrix; 127 Matrix = new T[Rows][]; 128 129 // columns must added first 130 for(int c = 0; c < Columns; ++c) { 131 dataGridView.Columns.Add($"Column {c}", $"Column {c}"); 132 } 133 134 for (int r = 0; r < Rows; ++r) { 135 T[] newCol = new T[Columns]; 136 if(r < tmp.Length) 137 Array.Copy(tmp[r], 0, newCol, 0, Math.Min(tmp[r].Length, Columns)); 138 Matrix[r] = newCol; 139 } 140 141 if(Rows > 0 && Columns > 0) { 142 dataGridView.Rows.Add(Rows); 143 for (int c = 0; c < Columns; ++c) { 144 for (int r = 0; r < Rows; ++r) { 145 //col and row is switched for dataGridView 146 dataGridView[c, r].Value = Matrix[r][c]; 147 dataGridView.Rows[r].HeaderCell.Value = $"Row {r}"; 148 } 149 } 150 } 151 dataGridView.RowHeadersWidth = 100; 152 } 82 153 83 154 private void InitRangeBinding() { … … 90 161 false, DataSourceUpdateMode.OnPropertyChanged); 91 162 } 163 164 private void textBoxRows_Validating(object sender, CancelEventArgs e) { 165 if (string.IsNullOrWhiteSpace(textBoxRows.Text)) { 166 errorProvider.SetError(textBoxRows, "'Rows' must not be empty."); 167 e.Cancel = true; 168 } else if (!int.TryParse(textBoxRows.Text, out int r)) { 169 errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer."); 170 e.Cancel = true; 171 } else if (r == 0) { 172 errorProvider.SetError(textBoxRows, "Value of 'Rows' must be an integer larger than 0."); 173 e.Cancel = true; 174 } else { 175 errorProvider.SetError(textBoxRows, null); 176 } 177 } 178 179 private void textBoxColumns_Validating(object sender, CancelEventArgs e) { 180 if (string.IsNullOrWhiteSpace(textBoxColumns.Text)) { 181 errorProvider.SetError(textBoxColumns, "'Columns' must not be empty."); 182 e.Cancel = true; 183 } else if (!int.TryParse(textBoxColumns.Text, out int r)) { 184 errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer."); 185 e.Cancel = true; 186 } else if (r == 0) { 187 errorProvider.SetError(textBoxColumns, "Value of 'Columns' must be an integer larger than 0."); 188 e.Cancel = true; 189 } else { 190 errorProvider.SetError(textBoxColumns, null); 191 } 192 } 193 194 private void textBoxRows_TextChanged(object sender, EventArgs e) { 195 if(int.TryParse(textBoxRows.Text, out int r)) { 196 Rows = r; 197 } 198 } 199 200 private void textBoxColumns_TextChanged(object sender, EventArgs e) { 201 if (int.TryParse(textBoxColumns.Text, out int c)) { 202 Columns = c; 203 } 204 } 205 206 private void CheckBoxColumns_CheckedChanged(object sender, EventArgs e) { 207 textBoxColumns.ReadOnly = !checkBoxColumns.Checked; 208 } 209 210 private void CheckBoxRows_CheckedChanged(object sender, EventArgs e) { 211 textBoxRows.ReadOnly = !checkBoxRows.Checked; 212 } 213 214 private void DataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { 215 object val = dataGridView[e.ColumnIndex, e.RowIndex].Value; 216 Matrix[e.RowIndex][e.ColumnIndex] = (T)Convert.ChangeType(val.ToString().Replace(",", "."), 217 typeof(T), 218 System.Globalization.CultureInfo.InvariantCulture); 219 SaveCellData(Matrix[e.RowIndex][e.ColumnIndex], e.RowIndex, e.ColumnIndex); 220 } 92 221 } 93 222 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemMultiValueControl.resx
r17431 r17446 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 </metadata> 120 123 </root> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.Designer.cs
r17443 r17446 35 35 this.tableOptions.AutoScroll = true; 36 36 this.tableOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 37 this.tableOptions.BackColor = System.Drawing.SystemColors.Control;38 37 this.tableOptions.ColumnCount = 2; 39 38 this.tableOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj
r17439 r17446 67 67 <Compile Include="Converters\ValueLookupParameterConverter.cs" /> 68 68 <Compile Include="Converters\ValueRangeConverter.cs" /> 69 <Compile Include="Interfaces\IArrayJsonItem.cs" /> 69 70 <Compile Include="Interfaces\IJsonItem.cs" /> 70 71 <Compile Include="Interfaces\IJsonItemValidator.cs" /> 72 <Compile Include="Interfaces\IMatrixJsonItem.cs" /> 73 <Compile Include="Models\ArrayJsonItemBase.cs" /> 74 <Compile Include="Models\BoolJsonItems.cs" /> 75 <Compile Include="Models\DateTimeJsonItem.cs" /> 76 <Compile Include="Models\DoubleJsonItems.cs" /> 71 77 <Compile Include="Models\GenericJsonItem.cs" /> 78 <Compile Include="Models\IntJsonItems.cs" /> 72 79 <Compile Include="Models\JsonItem.cs" /> 73 <Compile Include="Models\ JsonItems.cs" />80 <Compile Include="Models\MatrixJsonItemBase.cs" /> 74 81 <Compile Include="Models\ResultItem.cs" /> 82 <Compile Include="Models\StringJsonItem.cs" /> 75 83 <Compile Include="Models\UnsupportedJsonItem.cs" /> 76 84 <Compile Include="SingleLineArrayJsonWriter.cs" /> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Interfaces/IJsonItem.cs
r17444 r17446 5 5 using System.Threading.Tasks; 6 6 using Newtonsoft.Json; 7 using Newtonsoft.Json.Linq; 7 8 8 9 namespace HeuristicLab.JsonInterface { … … 45 46 /// </summary> 46 47 void LoosenPath(); 48 49 void SetFromJObject(JObject jObject); 47 50 } 48 51 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateInstantiator.cs
r17442 r17446 51 51 52 52 // extract metadata information 53 string optimizerName = instData.Template[Constants.Metadata][Constants.TemplateName].ToString();54 53 string hLFileLocation = Path.GetFullPath(instData.Template[Constants.Metadata][Constants.HLFileLocation].ToString()); 55 54 … … 78 77 79 78 #region Helper 80 81 private static object GetValueFromJObject(JObject obj) =>82 obj[nameof(IJsonItem.Value)]?.ToObject<object>();83 84 79 private static IEnumerable<string> CollectResults(InstData instData) { 85 80 IList<string> res = new List<string>(); … … 107 102 else old = tmp; 108 103 } 109 tmp.Value = GetValueFromJObject(obj); 110 tmp.Range = obj[nameof(IJsonItem.Range)]?.ToObject<object[]>(); 111 tmp.ActualName = obj[nameof(IJsonItem.ActualName)]?.ToString(); 104 tmp.SetFromJObject(obj); 112 105 instData.Objects.Add(tmp.Path, tmp); 113 106 } … … 120 113 // override default value 121 114 if (instData.Objects.TryGetValue(path, out IJsonItem param)) { 122 param.Value = GetValueFromJObject(obj); 123 // override ActualName (for LookupParameters) 124 if (param.ActualName != null) 125 param.ActualName = obj[nameof(IJsonItem.ActualName)]?.ToString(); 115 // save range from template 116 IEnumerable<object> tmpRange = param.Range; 117 param.SetFromJObject(obj); 118 // set range from template 119 param.Range = tmpRange; 126 120 } else throw new InvalidDataException($"No parameter with path='{path}' defined!"); 127 121 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItem.cs
r17444 r17446 5 5 using System.Text; 6 6 using Newtonsoft.Json; 7 using Newtonsoft.Json.Linq; 7 8 8 9 namespace HeuristicLab.JsonInterface { … … 114 115 public void FixatePath() => fixedPath = Path; 115 116 public void LoosenPath() => fixedPath = ""; 117 118 public virtual void SetFromJObject(JObject jObject) { 119 Value = jObject[nameof(IJsonItem.Value)]?.ToObject<object>(); 120 Range = jObject[nameof(IJsonItem.Range)]?.ToObject<object[]>(); 121 ActualName = jObject[nameof(IJsonItem.ActualName)]?.ToString(); 122 } 116 123 #endregion 117 124 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/BestTSPSolutionAnalyzer.cs
r17180 r17446 56 56 get { return (LookupParameter<PathTSPTour>)Parameters["BestSolution"]; } 57 57 } 58 public ValueLookupParameter<ResultCollection> ResultsParameter {59 get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; }60 }58 //public ValueLookupParameter<ResultCollection> ResultsParameter { 59 // get { return (ValueLookupParameter<ResultCollection>)Parameters["Results"]; } 60 //} 61 61 public LookupParameter<DoubleValue> BestKnownQualityParameter { 62 62 get { return (LookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; } … … 64 64 public LookupParameter<Permutation> BestKnownSolutionParameter { 65 65 get { return (LookupParameter<Permutation>)Parameters["BestKnownSolution"]; } 66 } 67 public IResultParameter<PathTSPTour> BestSolutionResultParameter { 68 get { return (IResultParameter<PathTSPTour>)Parameters["Best TSP Solution"]; } 69 } 70 71 72 [StorableHook(HookType.AfterDeserialization)] 73 private void AfterDeserialization() { 74 // BackwardsCompatibility3.3 75 #region Backwards compatible code, remove with 3.4 76 if (!Parameters.ContainsKey("Best TSP Solution")) { 77 Parameters.Add(new ResultParameter<PathTSPTour>("Best TSP Solution", "The best TSP solution found so far.")); 78 } 79 #endregion 66 80 } 67 81 … … 79 93 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the TSP solutions which should be analyzed.")); 80 94 Parameters.Add(new LookupParameter<PathTSPTour>("BestSolution", "The best TSP solution.")); 81 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best TSP solution should be stored."));95 //Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best TSP solution should be stored.")); 82 96 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this TSP instance.")); 83 97 Parameters.Add(new LookupParameter<Permutation>("BestKnownSolution", "The best known solution of this TSP instance.")); 98 Parameters.Add(new ResultParameter<PathTSPTour>("Best TSP Solution", "The best TSP solution found so far.")); 84 99 85 100 MaximizationParameter.Hidden = true; … … 88 103 QualityParameter.Hidden = true; 89 104 BestSolutionParameter.Hidden = true; 90 ResultsParameter.Hidden = true;105 //ResultsParameter.Hidden = true; 91 106 BestKnownQualityParameter.Hidden = true; 92 107 BestKnownSolutionParameter.Hidden = true; … … 97 112 ItemArray<Permutation> permutations = PermutationParameter.ActualValue; 98 113 ItemArray<DoubleValue> qualities = QualityParameter.ActualValue; 99 ResultCollection results = ResultsParameter.ActualValue;114 //ResultCollection results = ResultsParameter.ActualValue; 100 115 bool max = MaximizationParameter.ActualValue.Value; 101 116 DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue; … … 117 132 tour = new PathTSPTour(coordinates, (Permutation)permutations[i].Clone(), new DoubleValue(qualities[i].Value)); 118 133 BestSolutionParameter.ActualValue = tour; 119 results.Add(new Result("Best TSP Solution", tour)); 134 BestSolutionResultParameter.ActualValue = tour; 135 //results.Add(new Result("Best TSP Solution", tour)); 120 136 } else { 121 137 if (max && tour.Quality.Value < qualities[i].Value ||
Note: See TracChangeset
for help on using the changeset viewer.