Changeset 17828
- Timestamp:
- 02/01/21 14:37:18 (4 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 10 added
- 21 deleted
- 50 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.App/JsonInterfaceForm.cs
r17599 r17828 37 37 this.configOpenButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Open; 38 38 this.outputOpenButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Save; 39 this.Icon = HeuristicLab.Common.Resources.HeuristicLab.Icon; 39 40 } 40 41 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.App/Runner.cs
r17560 r17828 33 33 WriteResultsToFile(outputFile, optimizer, configuredResultItem); 34 34 } catch (Exception e) { 35 Console.Error.WriteLine($"{e.Message} \n\n\n\n {e.StackTrace}"); 35 36 File.WriteAllText(outputFile, e.Message + "\n\n\n\n" + e.StackTrace); 37 Environment.Exit(-1); 36 38 } 37 39 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/FileManager.cs
r17477 r17828 26 26 IStorableContent content = view.Content as IStorableContent; 27 27 if (!view.Locked && content != null) { 28 exportDialog.Content = content; 29 exportDialog.ShowDialog(); 28 if(content is IOptimizer) { 29 exportDialog.Content = content; 30 exportDialog.ShowDialog(); 31 } else { 32 MessageBox.Show("This cannot item cannot be converted.", "Unsupported Item", MessageBoxButtons.OK); 33 } 30 34 } 31 35 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/HeuristicLab.JsonInterface.OptimizerIntegration.csproj
r17519 r17828 95 95 <DependentUpon>Resources.resx</DependentUpon> 96 96 </Compile> 97 <Compile Include="Shared\ArrayJsonItemControl.cs"> 98 <SubType>UserControl</SubType> 99 </Compile> 100 <Compile Include="Shared\ArrayJsonItemControl.Designer.cs"> 101 <DependentUpon>ArrayJsonItemControl.cs</DependentUpon> 102 </Compile> 103 <Compile Include="Shared\CompoundControl.cs"> 104 <SubType>UserControl</SubType> 105 </Compile> 106 <Compile Include="Shared\CompoundControl.Designer.cs"> 107 <DependentUpon>CompoundControl.cs</DependentUpon> 108 </Compile> 97 109 <Compile Include="Shared\JsonItemBaseControl.cs"> 98 110 <SubType>UserControl</SubType> … … 101 113 <DependentUpon>JsonItemBaseControl.cs</DependentUpon> 102 114 </Compile> 115 <Compile Include="Shared\MatrixJsonItemControl.cs"> 116 <SubType>UserControl</SubType> 117 </Compile> 118 <Compile Include="Shared\MatrixJsonItemControl.Designer.cs"> 119 <DependentUpon>MatrixJsonItemControl.cs</DependentUpon> 120 </Compile> 103 121 <Compile Include="Shared\NumericRangeControl.cs"> 104 122 <SubType>UserControl</SubType> … … 108 126 </Compile> 109 127 <Compile Include="ViewModels\ArrayValueVM.cs" /> 128 <Compile Include="ViewModels\ConcreteRestrictedJsonItemVM.cs" /> 110 129 <Compile Include="ViewModels\DoubleVMs.cs" /> 111 130 <Compile Include="ViewModels\IntVMs.cs" /> … … 132 151 </Compile> 133 152 <Compile Include="FileManager.cs" /> 134 <Compile Include="Views\JsonItemConcreteItemArrayControl.cs">135 <SubType>UserControl</SubType>136 </Compile>137 <Compile Include="Views\JsonItemConcreteItemArrayControl.Designer.cs">138 <DependentUpon>JsonItemConcreteItemArrayControl.cs</DependentUpon>139 </Compile>140 <Compile Include="Views\JsonItemMultiValueControl.cs">141 <SubType>UserControl</SubType>142 </Compile>143 <Compile Include="Views\JsonItemMultiValueControl.Designer.cs">144 <DependentUpon>JsonItemMultiValueControl.cs</DependentUpon>145 </Compile>146 <Compile Include="Views\JsonItemBoolControl.cs">147 <SubType>UserControl</SubType>148 </Compile>149 <Compile Include="Views\JsonItemBoolControl.Designer.cs">150 <DependentUpon>JsonItemBoolControl.cs</DependentUpon>151 </Compile>152 <Compile Include="Views\JsonItemRangeControl.cs">153 <SubType>UserControl</SubType>154 </Compile>155 <Compile Include="Views\JsonItemRangeControl.Designer.cs">156 <DependentUpon>JsonItemRangeControl.cs</DependentUpon>157 </Compile>158 <Compile Include="Views\JsonItemValueControl.cs">159 <SubType>UserControl</SubType>160 </Compile>161 <Compile Include="Views\JsonItemValueControl.Designer.cs">162 <DependentUpon>JsonItemValueControl.cs</DependentUpon>163 </Compile>164 <Compile Include="Views\JsonItemValidValuesControl.cs">165 <SubType>UserControl</SubType>166 </Compile>167 <Compile Include="Views\JsonItemValidValuesControl.Designer.cs">168 <DependentUpon>JsonItemValidValuesControl.cs</DependentUpon>169 </Compile>170 153 <Compile Include="MenuItems\ImportJsonTemplateMenuItem.cs" /> 171 154 <Compile Include="MenuItems\ExportJsonTemplateMenuItem.cs" /> 172 155 <Compile Include="Plugin.cs" /> 173 156 <Compile Include="Properties\AssemblyInfo.cs" /> 174 <Compile Include="Views\LookupJsonItemControl.cs">175 <SubType>UserControl</SubType>176 </Compile>177 <Compile Include="Views\LookupJsonItemControl.Designer.cs">178 <DependentUpon>LookupJsonItemControl.cs</DependentUpon>179 </Compile>180 157 <Compile Include="Views\ValueLookupJsonItemControl.cs"> 181 158 <SubType>UserControl</SubType> … … 232 209 <LastGenOutput>Resources.Designer.cs</LastGenOutput> 233 210 </EmbeddedResource> 211 <EmbeddedResource Include="Shared\ArrayJsonItemControl.resx"> 212 <DependentUpon>ArrayJsonItemControl.cs</DependentUpon> 213 </EmbeddedResource> 214 <EmbeddedResource Include="Shared\CompoundControl.resx"> 215 <DependentUpon>CompoundControl.cs</DependentUpon> 216 </EmbeddedResource> 234 217 <EmbeddedResource Include="Shared\JsonItemBaseControl.resx"> 235 218 <DependentUpon>JsonItemBaseControl.cs</DependentUpon> 236 219 </EmbeddedResource> 220 <EmbeddedResource Include="Shared\MatrixJsonItemControl.resx"> 221 <DependentUpon>MatrixJsonItemControl.cs</DependentUpon> 222 </EmbeddedResource> 237 223 <EmbeddedResource Include="Shared\NumericRangeControl.resx"> 238 224 <DependentUpon>NumericRangeControl.cs</DependentUpon> … … 243 229 <EmbeddedResource Include="Views\ExportJsonDialog.resx"> 244 230 <DependentUpon>ExportJsonDialog.cs</DependentUpon> 245 </EmbeddedResource>246 <EmbeddedResource Include="Views\JsonItemConcreteItemArrayControl.resx">247 <DependentUpon>JsonItemConcreteItemArrayControl.cs</DependentUpon>248 </EmbeddedResource>249 <EmbeddedResource Include="Views\JsonItemMultiValueControl.resx">250 <DependentUpon>JsonItemMultiValueControl.cs</DependentUpon>251 </EmbeddedResource>252 <EmbeddedResource Include="Views\JsonItemBoolControl.resx">253 <DependentUpon>JsonItemBoolControl.cs</DependentUpon>254 </EmbeddedResource>255 <EmbeddedResource Include="Views\JsonItemRangeControl.resx">256 <DependentUpon>JsonItemRangeControl.cs</DependentUpon>257 </EmbeddedResource>258 <EmbeddedResource Include="Views\JsonItemValueControl.resx">259 <DependentUpon>JsonItemValueControl.cs</DependentUpon>260 </EmbeddedResource>261 <EmbeddedResource Include="Views\JsonItemValidValuesControl.resx">262 <DependentUpon>JsonItemValidValuesControl.cs</DependentUpon>263 </EmbeddedResource>264 <EmbeddedResource Include="Views\LookupJsonItemControl.resx">265 <DependentUpon>LookupJsonItemControl.cs</DependentUpon>266 231 </EmbeddedResource> 267 232 <EmbeddedResource Include="Views\ValueLookupJsonItemControl.resx"> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/ConcreteItemsRestrictor.Designer.cs
r17519 r17828 25 25 private void InitializeComponent() { 26 26 this.tableOptions = new System.Windows.Forms.TableLayoutPanel(); 27 this.groupBox1 = new System.Windows.Forms.GroupBox(); 28 this.groupBox1.SuspendLayout(); 27 29 this.SuspendLayout(); 28 30 // … … 36 38 this.tableOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 37 39 this.tableOptions.Dock = System.Windows.Forms.DockStyle.Fill; 38 this.tableOptions.Location = new System.Drawing.Point(0, 0); 40 this.tableOptions.Location = new System.Drawing.Point(3, 16); 41 this.tableOptions.Margin = new System.Windows.Forms.Padding(0); 39 42 this.tableOptions.Name = "tableOptions"; 40 43 this.tableOptions.RowCount = 1; 41 44 this.tableOptions.RowStyles.Add(new System.Windows.Forms.RowStyle()); 42 this.tableOptions.Size = new System.Drawing.Size( 500, 200);45 this.tableOptions.Size = new System.Drawing.Size(494, 181); 43 46 this.tableOptions.TabIndex = 13; 47 // 48 // groupBox1 49 // 50 this.groupBox1.Controls.Add(this.tableOptions); 51 this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill; 52 this.groupBox1.Location = new System.Drawing.Point(0, 0); 53 this.groupBox1.Margin = new System.Windows.Forms.Padding(0); 54 this.groupBox1.Name = "groupBox1"; 55 this.groupBox1.Size = new System.Drawing.Size(500, 200); 56 this.groupBox1.TabIndex = 0; 57 this.groupBox1.TabStop = false; 58 this.groupBox1.Text = "Allowed Items"; 44 59 // 45 60 // ConcreteItemsRestrictor … … 47 62 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 48 63 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 49 this.Controls.Add(this. tableOptions);64 this.Controls.Add(this.groupBox1); 50 65 this.Margin = new System.Windows.Forms.Padding(0); 51 66 this.Name = "ConcreteItemsRestrictor"; 52 67 this.Size = new System.Drawing.Size(500, 200); 68 this.groupBox1.ResumeLayout(false); 53 69 this.ResumeLayout(false); 54 70 … … 58 74 59 75 private System.Windows.Forms.TableLayoutPanel tableOptions; 76 private System.Windows.Forms.GroupBox groupBox1; 60 77 } 61 78 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/JsonItemBaseControl.Designer.cs
r17473 r17828 30 30 this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); 31 31 this.textBoxDescription = new System.Windows.Forms.TextBox(); 32 this.checkBoxActive = new System.Windows.Forms.CheckBox();33 32 this.label1 = new System.Windows.Forms.Label(); 34 33 this.labelDescription = new System.Windows.Forms.Label(); 35 this.labelEnable = new System.Windows.Forms.Label();36 34 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 37 35 this.tableLayoutPanel1.SuspendLayout(); … … 48 46 this.textBoxName.Dock = System.Windows.Forms.DockStyle.Fill; 49 47 this.errorProvider.SetIconAlignment(this.textBoxName, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 50 this.textBoxName.Location = new System.Drawing.Point(100, 2 5);51 this.textBoxName.Margin = new System.Windows.Forms.Padding(0 );48 this.textBoxName.Location = new System.Drawing.Point(100, 2); 49 this.textBoxName.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0); 52 50 this.textBoxName.Name = "textBoxName"; 53 51 this.textBoxName.Size = new System.Drawing.Size(394, 20); … … 65 63 this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 66 64 this.tableLayoutPanel1.RowCount = 2; 67 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 75F));65 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F)); 68 66 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 69 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));70 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));71 67 this.tableLayoutPanel1.Size = new System.Drawing.Size(494, 594); 72 68 this.tableLayoutPanel1.TabIndex = 16; … … 77 73 this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); 78 74 this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 79 this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 80 this.tableLayoutPanel5.Controls.Add(this.textBoxDescription, 1, 2); 81 this.tableLayoutPanel5.Controls.Add(this.textBoxName, 1, 1); 82 this.tableLayoutPanel5.Controls.Add(this.checkBoxActive, 1, 0); 83 this.tableLayoutPanel5.Controls.Add(this.label1, 0, 1); 84 this.tableLayoutPanel5.Controls.Add(this.labelDescription, 0, 2); 85 this.tableLayoutPanel5.Controls.Add(this.labelEnable, 0, 0); 75 this.tableLayoutPanel5.Controls.Add(this.textBoxDescription, 1, 1); 76 this.tableLayoutPanel5.Controls.Add(this.textBoxName, 1, 0); 77 this.tableLayoutPanel5.Controls.Add(this.label1, 0, 0); 78 this.tableLayoutPanel5.Controls.Add(this.labelDescription, 0, 1); 86 79 this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; 87 80 this.tableLayoutPanel5.Location = new System.Drawing.Point(0, 0); 88 81 this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); 89 82 this.tableLayoutPanel5.Name = "tableLayoutPanel5"; 90 this.tableLayoutPanel5.RowCount = 3;91 this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));92 this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));93 this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType. Percent, 33.33333F));94 this.tableLayoutPanel5.Size = new System.Drawing.Size(494, 75);83 this.tableLayoutPanel5.RowCount = 1; 84 this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 85 this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 86 this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 87 this.tableLayoutPanel5.Size = new System.Drawing.Size(494, 50); 95 88 this.tableLayoutPanel5.TabIndex = 17; 96 89 // … … 98 91 // 99 92 this.textBoxDescription.Dock = System.Windows.Forms.DockStyle.Fill; 100 this.textBoxDescription.Location = new System.Drawing.Point(100, 52);93 this.textBoxDescription.Location = new System.Drawing.Point(100, 27); 101 94 this.textBoxDescription.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0); 102 95 this.textBoxDescription.Name = "textBoxDescription"; … … 104 97 this.textBoxDescription.TabIndex = 14; 105 98 // 106 // checkBoxActive107 //108 this.checkBoxActive.AutoSize = true;109 this.checkBoxActive.Dock = System.Windows.Forms.DockStyle.Fill;110 this.checkBoxActive.Location = new System.Drawing.Point(100, 0);111 this.checkBoxActive.Margin = new System.Windows.Forms.Padding(0);112 this.checkBoxActive.Name = "checkBoxActive";113 this.checkBoxActive.Size = new System.Drawing.Size(394, 25);114 this.checkBoxActive.TabIndex = 2;115 this.checkBoxActive.UseVisualStyleBackColor = true;116 //117 99 // label1 118 100 // 119 101 this.label1.AutoSize = true; 120 102 this.label1.Dock = System.Windows.Forms.DockStyle.Fill; 121 this.label1.Location = new System.Drawing.Point(0, 25);103 this.label1.Location = new System.Drawing.Point(0, 0); 122 104 this.label1.Margin = new System.Windows.Forms.Padding(0); 123 105 this.label1.Name = "label1"; … … 131 113 this.labelDescription.AutoSize = true; 132 114 this.labelDescription.Dock = System.Windows.Forms.DockStyle.Fill; 133 this.labelDescription.Location = new System.Drawing.Point(0, 50);115 this.labelDescription.Location = new System.Drawing.Point(0, 25); 134 116 this.labelDescription.Margin = new System.Windows.Forms.Padding(0); 135 117 this.labelDescription.Name = "labelDescription"; … … 138 120 this.labelDescription.Text = "Description"; 139 121 this.labelDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; 140 //141 // labelEnable142 //143 this.labelEnable.AutoSize = true;144 this.labelEnable.Dock = System.Windows.Forms.DockStyle.Fill;145 this.labelEnable.Location = new System.Drawing.Point(0, 0);146 this.labelEnable.Margin = new System.Windows.Forms.Padding(0);147 this.labelEnable.Name = "labelEnable";148 this.labelEnable.Size = new System.Drawing.Size(100, 25);149 this.labelEnable.TabIndex = 3;150 this.labelEnable.Text = "Enable";151 this.labelEnable.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;152 122 // 153 123 // JsonItemBaseControl … … 170 140 #endregion 171 141 protected System.Windows.Forms.ErrorProvider errorProvider; 172 protected System.Windows.Forms.Label labelEnable;173 protected System.Windows.Forms.CheckBox checkBoxActive;174 142 protected System.Windows.Forms.TextBox textBoxName; 175 143 protected System.Windows.Forms.Label label1; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/JsonItemBaseControl.cs
r17471 r17828 26 26 InitializeComponent(); 27 27 VM = vm; 28 control.Margin = new Padding() { All = 0 }; 29 tableLayoutPanel1.Controls.Add(control, 0, 1); 30 control.Dock = DockStyle.Fill; 28 if(control != null) { 29 control.Margin = new Padding() { All = 0 }; 30 tableLayoutPanel1.Controls.Add(control, 0, 1); 31 control.Dock = DockStyle.Fill; 32 } 31 33 Init(); 32 34 } 33 35 34 36 private void Init() { 35 checkBoxActive.DataBindings.Add("Checked", VM, nameof(IJsonItemVM.Selected),36 false, DataSourceUpdateMode.OnPropertyChanged);37 37 textBoxName.DataBindings.Add("Text", VM, nameof(IJsonItemVM.Name)); 38 38 textBoxDescription.DataBindings.Add("Text", VM, nameof(IJsonItemVM.Description)); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/NumericRangeControl.Designer.cs
r17471 r17828 26 26 this.components = new System.ComponentModel.Container(); 27 27 this.groupBox2 = new System.Windows.Forms.GroupBox(); 28 this. checkBoxTo = new System.Windows.Forms.CheckBox();28 this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); 29 29 this.textBoxTo = new System.Windows.Forms.TextBox(); 30 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);31 30 this.textBoxFrom = new System.Windows.Forms.TextBox(); 32 31 this.checkBoxFrom = new System.Windows.Forms.CheckBox(); 33 this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); 32 this.checkBoxTo = new System.Windows.Forms.CheckBox(); 33 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 34 this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); 34 35 this.groupBox2.SuspendLayout(); 36 this.tableLayoutPanel2.SuspendLayout(); 35 37 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 36 this.tableLayoutPanel 2.SuspendLayout();38 this.tableLayoutPanel1.SuspendLayout(); 37 39 this.SuspendLayout(); 38 40 // … … 49 51 this.groupBox2.Text = "Range"; 50 52 // 51 // checkBoxTo53 // tableLayoutPanel2 52 54 // 53 this.checkBoxTo.AutoSize = true; 54 this.checkBoxTo.Dock = System.Windows.Forms.DockStyle.Fill; 55 this.checkBoxTo.Location = new System.Drawing.Point(0, 22); 56 this.checkBoxTo.Margin = new System.Windows.Forms.Padding(0); 57 this.checkBoxTo.Name = "checkBoxTo"; 58 this.checkBoxTo.Size = new System.Drawing.Size(100, 22); 59 this.checkBoxTo.TabIndex = 7; 60 this.checkBoxTo.Text = "To:"; 61 this.checkBoxTo.UseVisualStyleBackColor = true; 55 this.tableLayoutPanel2.ColumnCount = 2; 56 this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); 57 this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 58 this.tableLayoutPanel2.Controls.Add(this.textBoxTo, 1, 1); 59 this.tableLayoutPanel2.Controls.Add(this.textBoxFrom, 1, 0); 60 this.tableLayoutPanel2.Controls.Add(this.checkBoxFrom, 0, 0); 61 this.tableLayoutPanel2.Controls.Add(this.checkBoxTo, 0, 1); 62 this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; 63 this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 16); 64 this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); 65 this.tableLayoutPanel2.Name = "tableLayoutPanel2"; 66 this.tableLayoutPanel2.RowCount = 2; 67 this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 68 this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 69 this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); 70 this.tableLayoutPanel2.Size = new System.Drawing.Size(520, 44); 71 this.tableLayoutPanel2.TabIndex = 22; 62 72 // 63 73 // textBoxTo … … 72 82 this.textBoxTo.TabIndex = 6; 73 83 this.textBoxTo.Validating += new System.ComponentModel.CancelEventHandler(this.textBoxTo_Validating); 74 //75 // errorProvider76 //77 this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;78 this.errorProvider.ContainerControl = this;79 84 // 80 85 // textBoxFrom … … 102 107 this.checkBoxFrom.UseVisualStyleBackColor = true; 103 108 // 104 // tableLayoutPanel2109 // checkBoxTo 105 110 // 106 this.tableLayoutPanel2.ColumnCount = 2; 107 this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); 108 this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 109 this.tableLayoutPanel2.Controls.Add(this.textBoxTo, 1, 1); 110 this.tableLayoutPanel2.Controls.Add(this.textBoxFrom, 1, 0); 111 this.tableLayoutPanel2.Controls.Add(this.checkBoxFrom, 0, 0); 112 this.tableLayoutPanel2.Controls.Add(this.checkBoxTo, 0, 1); 113 this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; 114 this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 16); 115 this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); 116 this.tableLayoutPanel2.Name = "tableLayoutPanel2"; 117 this.tableLayoutPanel2.RowCount = 2; 118 this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 119 this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 120 this.tableLayoutPanel2.Size = new System.Drawing.Size(520, 44); 121 this.tableLayoutPanel2.TabIndex = 22; 111 this.checkBoxTo.AutoSize = true; 112 this.checkBoxTo.Dock = System.Windows.Forms.DockStyle.Fill; 113 this.checkBoxTo.Location = new System.Drawing.Point(0, 22); 114 this.checkBoxTo.Margin = new System.Windows.Forms.Padding(0); 115 this.checkBoxTo.Name = "checkBoxTo"; 116 this.checkBoxTo.Size = new System.Drawing.Size(100, 22); 117 this.checkBoxTo.TabIndex = 7; 118 this.checkBoxTo.Text = "To:"; 119 this.checkBoxTo.UseVisualStyleBackColor = true; 120 // 121 // errorProvider 122 // 123 this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink; 124 this.errorProvider.ContainerControl = this; 125 // 126 // tableLayoutPanel1 127 // 128 this.tableLayoutPanel1.ColumnCount = 1; 129 this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 130 this.tableLayoutPanel1.Controls.Add(this.groupBox2, 0, 0); 131 this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 132 this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); 133 this.tableLayoutPanel1.Name = "tableLayoutPanel1"; 134 this.tableLayoutPanel1.RowCount = 2; 135 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 63F)); 136 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); 137 this.tableLayoutPanel1.Size = new System.Drawing.Size(526, 63); 138 this.tableLayoutPanel1.TabIndex = 23; 122 139 // 123 140 // NumericRangeControl … … 125 142 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 126 143 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 127 this.Controls.Add(this. groupBox2);144 this.Controls.Add(this.tableLayoutPanel1); 128 145 this.Name = "NumericRangeControl"; 129 146 this.Size = new System.Drawing.Size(526, 63); 130 147 this.groupBox2.ResumeLayout(false); 131 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();132 148 this.tableLayoutPanel2.ResumeLayout(false); 133 149 this.tableLayoutPanel2.PerformLayout(); 150 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 151 this.tableLayoutPanel1.ResumeLayout(false); 134 152 this.ResumeLayout(false); 135 153 … … 144 162 private System.Windows.Forms.TextBox textBoxFrom; 145 163 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; 164 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 146 165 } 147 166 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/NumericRangeControl.cs
r17444 r17828 51 51 } 52 52 } 53 54 public static UserControl Create(IJsonItemVM vm) { 55 NumericRangeControl numericRangeControl = new NumericRangeControl(); 56 numericRangeControl.TBMinRange.DataBindings.Add("Text", vm, nameof(RangedValueBaseVM<int, IntJsonItem>.MinRange)); 57 numericRangeControl.TBMaxRange.DataBindings.Add("Text", vm, nameof(RangedValueBaseVM<int, IntJsonItem>.MaxRange)); 58 numericRangeControl.EnableMinRange.DataBindings.Add("Checked", vm, nameof(RangedValueBaseVM<int, IntJsonItem>.EnableMinRange), 59 false, DataSourceUpdateMode.OnPropertyChanged); 60 numericRangeControl.EnableMaxRange.DataBindings.Add("Checked", vm, nameof(RangedValueBaseVM<int, IntJsonItem>.EnableMaxRange), 61 false, DataSourceUpdateMode.OnPropertyChanged); 62 return numericRangeControl; 63 } 53 64 } 54 65 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ArrayValueVM.cs
r17519 r17828 9 9 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 10 10 11 12 13 14 15 /*16 public class StringArrayValueVM : ArrayValueVM<int, IntArrayJsonItem> {17 public override Type TargetedJsonItemType => typeof(StringArrayJsonItem);18 19 protected override int MinTypeValue => int.MinValue;20 21 protected override int MaxTypeValue => int.MaxValue;22 23 public override UserControl Control =>24 new JsonItemBaseControl(this, new JsonItemIntArrayValueControl(this));25 26 public override int[] Value {27 get => Item.Value;28 set {29 Item.Value = value;30 OnPropertyChange(this, nameof(Value));31 }32 }33 }34 */35 36 37 11 public abstract class ArrayValueVM<T, JsonItemType> : RangedValueBaseVM<T, JsonItemType>, IArrayJsonItemVM 38 12 where T : IComparable 39 13 where JsonItemType : class, IArrayJsonItem, IIntervalRestrictedJsonItem<T> { 40 14 15 public override UserControl Control => CompoundControl.Create(base.Control, ArrayJsonItemControl.Create(this)); 16 41 17 public ArrayValueVM() { } 42 18 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/DoubleVMs.cs
r17519 r17828 8 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 9 public class DoubleRangeVM : RangeVM<double, DoubleRangeJsonItem> { 10 11 10 protected override double MinTypeValue => double.MinValue; 12 13 11 protected override double MaxTypeValue => double.MaxValue; 14 15 public override UserControl Control =>16 new JsonItemRangeControl(this);17 12 } 18 13 19 14 public class DoubleArrayValueVM : ArrayValueVM<double, DoubleArrayJsonItem> { 20 21 15 protected override double MinTypeValue => double.MinValue; 22 23 16 protected override double MaxTypeValue => double.MaxValue; 24 25 public override UserControl Control =>26 new JsonItemDoubleArrayValueControl(this);27 28 17 public override double[] Value { 29 18 get => Item.Value; … … 36 25 37 26 public class DoubleMatrixValueVM : MatrixValueVM<double, DoubleMatrixJsonItem> { 38 public override UserControl Control =>39 new JsonItemDoubleMatrixValueControl(this);40 41 27 public override double[][] Value { 42 28 get => Item.Value; … … 46 32 } 47 33 } 48 49 34 protected override double MinTypeValue => double.MinValue; 50 51 35 protected override double MaxTypeValue => double.MaxValue; 52 36 } 53 37 54 38 public class DoubleValueVM : SingleValueVM<double, DoubleJsonItem> { 55 56 39 protected override double MinTypeValue => double.MinValue; 57 40 protected override double MaxTypeValue => double.MaxValue; 58 59 public override UserControl Control =>60 new JsonItemDoubleValueControl(this);61 41 } 62 42 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/IntVMs.cs
r17519 r17828 8 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 9 public class IntArrayValueVM : ArrayValueVM<int, IntArrayJsonItem> { 10 11 10 protected override int MinTypeValue => int.MinValue; 12 13 11 protected override int MaxTypeValue => int.MaxValue; 14 15 public override UserControl Control =>16 new JsonItemBaseControl(this, new JsonItemIntArrayValueControl(this));17 12 18 13 public override int[] Value { … … 26 21 27 22 public class IntRangeVM : RangeVM<int, IntRangeJsonItem> { 28 29 23 protected override int MinTypeValue => int.MinValue; 30 31 24 protected override int MaxTypeValue => int.MaxValue; 32 33 public override UserControl Control =>34 new JsonItemRangeControl(this);35 25 } 36 26 37 27 public class IntValueVM : SingleValueVM<int, IntJsonItem> { 38 39 28 protected override int MinTypeValue => int.MinValue; 40 29 protected override int MaxTypeValue => int.MaxValue; 41 42 public override UserControl Control =>43 new JsonItemIntValueControl(this);44 30 } 45 31 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVMBase.cs
r17519 r17828 9 9 10 10 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 11 public abstract class JsonItemVMBase<JsonItemType> : IJsonItemVM<JsonItemType> //TODO: RENAME, oder vlt JsonItems direkt als VM?11 public abstract class JsonItemVMBase<JsonItemType> : IJsonItemVM<JsonItemType> 12 12 where JsonItemType : class, IJsonItem 13 13 { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/LookupJsonItemVM.cs
r17519 r17828 8 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 9 public class LookupJsonItemVM : JsonItemVMBase<LookupJsonItem>, ILookupJsonItemVM { 10 11 public override UserControl Control => new LookupJsonItemControl(this); 12 10 public override UserControl Control => null; 13 11 public string ActualName { 14 12 get => Item.ActualName; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/MatrixValueVM.cs
r17519 r17828 13 13 where T : IComparable 14 14 where JsonItemType : class, IMatrixJsonItem, IIntervalRestrictedJsonItem<T> { 15 16 public override UserControl Control => CompoundControl.Create(base.Control, MatrixJsonItemControl.Create(this)); 17 15 18 public abstract T[][] Value { get; set; } 16 19 public bool RowsResizable { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangedValueBaseVM.cs
r17473 r17828 4 4 using System.Text; 5 5 using System.Threading.Tasks; 6 using System.Windows.Forms; 6 7 7 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { … … 11 12 where JsonItemType : class, IIntervalRestrictedJsonItem<T> 12 13 { 14 public override UserControl Control => NumericRangeControl.Create(this); 15 13 16 public T MinRange { 14 17 get => Item.Minimum; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/SingleValueVM.cs
r17519 r17828 19 19 } 20 20 21 public override UserControl Control => 22 new JsonItemBoolControl(this); 21 public override UserControl Control => null; 23 22 } 24 23 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/StringValueVM.cs
r17560 r17828 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading; 6 using System.Threading.Tasks; 7 using System.Windows.Forms; 1 using System.Linq; 8 2 9 3 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 10 public class StringValueVM : JsonItemVMBase<StringJsonItem> {11 public override UserControl Control =>12 new JsonItemValidValuesControl(this);13 4 14 public string Value { 15 get => Item.Value?.ToString(); 16 set { 17 Item.Value = value; 18 OnPropertyChange(this, nameof(Value)); 19 } 20 } 5 public class StringValueVM : ConcreteRestrictedJsonItemVM<StringJsonItem, string, string> { 6 protected override string GetDefaultValue() => Range.FirstOrDefault(); 21 7 22 public IEnumerable<string> Range { 23 get => Item.ConcreteRestrictedItems; 24 set { 25 Item.ConcreteRestrictedItems = value; 26 //check if value is still in range 27 if (!Range.Contains(Value)) { 28 Value = Range.FirstOrDefault(); 29 if (Range.Count() == 0) 30 //if no elements exists -> deselect item 31 base.Selected = false; 32 OnPropertyChange(this, nameof(Value)); 33 } 34 35 OnPropertyChange(this, nameof(Range)); 36 } 37 } 8 protected override bool RangeContainsValue() => Range.Contains(Value); 38 9 } 39 10 40 public class StringArrayVM : JsonItemVMBase<StringArrayJsonItem> { 41 public override UserControl Control => 42 new JsonItemConcreteItemArrayControl(this); 11 public class StringArrayVM : ConcreteRestrictedJsonItemVM<StringArrayJsonItem, string, string[]> { 12 protected override string[] GetDefaultValue() => Range.ToArray(); 43 13 44 public string[] Value { 45 get => Item.Value; 46 set { 47 Item.Value = value; 48 OnPropertyChange(this, nameof(Value)); 49 } 50 } 51 52 public IEnumerable<string> Range { 53 get => Item.ConcreteRestrictedItems; 54 set { 55 Item.ConcreteRestrictedItems = value; 56 OnPropertyChange(this, nameof(Range)); 57 } 58 } 14 protected override bool RangeContainsValue() => Value.All(x => Range.Any(y => x == y)); 59 15 } 60 16 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.Designer.cs
r17481 r17828 249 249 this.Name = "ExportJsonDialog"; 250 250 this.RightToLeft = System.Windows.Forms.RightToLeft.No; 251 this.ShowIcon = false;252 251 this.Text = "Export Json"; 253 252 this.groupBoxDetails.ResumeLayout(false); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs
r17601 r17828 40 40 41 41 Optimizer = content as IOptimizer; 42 Root = JsonItemConverter.Extract(Optimizer); 43 TreeNode parent = new TreeNode(Root.Name); 44 treeView.AfterCheck += TreeView_AfterCheck; 45 BuildTreeNode(parent, Root); 46 treeView.Nodes.Add(parent); 47 treeView.ExpandAll(); 48 panelParameterDetails.Controls.Clear(); 49 panelResultDetails.Controls.Clear(); 50 42 if(Optimizer != null) { 43 Optimizer = (IOptimizer)Optimizer.Clone(); // clone the optimizer 44 Root = JsonItemConverter.Extract(Optimizer); 45 TreeNode parent = new TreeNode(Root.Name); 46 treeView.AfterCheck += TreeView_AfterCheck; 47 BuildTreeNode(parent, Root); 48 treeView.Nodes.Add(parent); 49 treeView.ExpandAll(); 50 panelParameterDetails.Controls.Clear(); 51 panelResultDetails.Controls.Clear(); 52 } 51 53 } 52 54 } … … 62 64 public ExportJsonDialog() { 63 65 InitializeComponent(); 66 this.Icon = HeuristicLab.Common.Resources.HeuristicLab.Icon; 64 67 InitCache(); 65 68 } 66 69 67 70 private void exportButton_Click(object sender, EventArgs e) { 68 // to set default value for disabled items 69 JsonItemConverter.Inject(Optimizer, Root); 71 if (FolderBrowserDialog == null) { 72 FolderBrowserDialog = new FolderBrowserDialog(); 73 FolderBrowserDialog.Description = "Select .json-Template Directory"; 74 } 70 75 71 // clear all runs 72 Optimizer.Runs.Clear(); 73 74 var validationResult = Root.GetValidator().Validate(); 75 if (!validationResult.Success) { 76 IList<Exception> list = new List<Exception>(); 77 //print faultyItems 78 foreach (var x in validationResult.Errors) { 79 list.Add(new Exception(x)); 80 } 81 ErrorHandling.ShowErrorDialog(this, new AggregateException(list)); 82 } else { 83 if (FolderBrowserDialog == null) { 84 FolderBrowserDialog = new FolderBrowserDialog(); 85 FolderBrowserDialog.Description = "Select .json-Template Dictionary"; 86 } 87 88 if (FolderBrowserDialog.ShowDialog() == DialogResult.OK) { 89 JsonTemplateGenerator.GenerateTemplate(FolderBrowserDialog.SelectedPath, textBoxTemplateName.Text, Optimizer, Root); 76 if (FolderBrowserDialog.ShowDialog() == DialogResult.OK) { 77 try { 78 JsonTemplateGenerator.GenerateTemplate( 79 Path.Combine(FolderBrowserDialog.SelectedPath, textBoxTemplateName.Text), 80 Optimizer, Root); 90 81 Close(); 82 } catch (Exception ex) { 83 ErrorHandling.ShowErrorDialog(this, ex); 91 84 } 92 85 } … … 98 91 foreach (var c in item.Children) { 99 92 if (IsDrawableItem(c)) { 93 TreeNode childNode = new TreeNode(c.Name); 100 94 if (c is IResultJsonItem) { 101 TreeNode childNode = new TreeNode(c.Name);102 95 treeViewResults.Nodes.Add(childNode); 103 RegisterItem(childNode, c, treeViewResults); 104 if(Node2VM.TryGetValue(childNode, out IJsonItemVM vm)) 105 vm.Selected = true; 106 96 IJsonItemVM vm = RegisterItem(childNode, c, treeViewResults); 97 if (vm != null) vm.Selected = true; 107 98 } else { 108 TreeNode childNode = new TreeNode(c.Name);109 99 node.Nodes.Add(childNode); 110 100 BuildTreeNode(childNode, c); … … 115 105 } 116 106 117 private voidRegisterItem(TreeNode node, IJsonItem item, TreeView tv) {118 if (JI2VM.TryGetValue(item.GetType(), out Type vmType)) { // TODO: enhance for interfaces?107 private IJsonItemVM RegisterItem(TreeNode node, IJsonItem item, TreeView tv) { 108 if (JI2VM.TryGetValue(item.GetType(), out Type vmType)) { 119 109 IJsonItemVM vm = (IJsonItemVM)Activator.CreateInstance(vmType); 120 110 … … 128 118 UserControl control = new JsonItemBaseControl(vm, vm.Control); 129 119 Node2Control.Add(node, control); 120 return vm; 130 121 } else { 131 122 node.ForeColor = Color.LightGray; 132 123 node.NodeFont = new Font(SystemFonts.DialogFont, FontStyle.Italic); 133 124 } 125 return null; 134 126 } 135 127 … … 142 134 } 143 135 144 return b || !(item is EmptyJsonItem) ;136 return b || !(item is EmptyJsonItem) || !(item is UnsupportedJsonItem); 145 137 } 146 138 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ValueLookupJsonItemControl.cs
r17473 r17828 11 11 12 12 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 13 public partial class ValueLookupJsonItemControl : LookupJsonItemControl {13 public partial class ValueLookupJsonItemControl : UserControl { 14 14 private static IDictionary<Type, Type> JI2VM { get; set; } 15 15 16 public ValueLookupJsonItemControl(IValueLookupJsonItemVM vm) : base(vm){16 public ValueLookupJsonItemControl(IValueLookupJsonItemVM vm) { 17 17 InitializeComponent(); 18 18 InitCache(); … … 22 22 content.Controls.Clear(); 23 23 UserControl control = tmp.Control; 24 content.Controls.Add(control); 25 control.Dock = DockStyle.Fill; 26 24 if(control != null) { 25 content.Controls.Add(control); 26 control.Dock = DockStyle.Fill; 27 } 27 28 } 28 29 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/AlgorithmConverter.cs
r17451 r17828 12 12 13 13 public override Type ConvertableType => typeof(IAlgorithm); 14 15 public override bool CanConvertType(Type t) => 16 t.GetInterfaces().Any(x => x == ConvertableType); 14 17 15 18 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/BaseConverter.cs
r17477 r17828 12 12 { 13 13 public abstract int Priority { get; } 14 15 public abstract bool CanConvertType(Type t); 16 14 17 public abstract Type ConvertableType { get; } 15 18 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/BatchRunConverter.cs
r17540 r17828 10 10 public override int Priority => 10; 11 11 public override Type ConvertableType => HEAL.Attic.Mapper.StaticCache.GetType(new Guid("E85407E0-18EC-4198-8321-9CF030FDF6D7")); 12 13 public override bool CanConvertType(Type t) => ConvertableType.IsAssignableFrom(t); 12 14 13 15 public override IJsonItem Extract(IItem value, IJsonItemConverter root) { … … 31 33 Maximum = int.MaxValue 32 34 }); 33 34 35 return batchRunJI; 35 36 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ConstrainedValueParameterConverter.cs
r17485 r17828 11 11 public override int Priority => 3; 12 12 public override Type ConvertableType => typeof(IConstrainedValueParameter<>); 13 14 public override bool CanConvertType(Type t) => 15 t.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IConstrainedValueParameter<>)); 13 16 14 17 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/EnumTypeConverter.cs
r17473 r17828 11 11 public override int Priority => 1; 12 12 public override Type ConvertableType => typeof(EnumValue<>); 13 14 public override bool CanConvertType(Type t) => 15 typeof(EnumValue<>).IsAssignableFrom(t) || 16 (t.IsGenericType && t.GetGenericTypeDefinition() == ConvertableType); 13 17 14 18 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) => … … 25 29 Value = Enum.GetName(enumType, val), 26 30 ConcreteRestrictedItems = Enum.GetNames(enumType) 27 };31 }; 28 32 } 29 33 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ExperimentConverter.cs
r17540 r17828 11 11 public override int Priority => 10; 12 12 public override Type ConvertableType => HEAL.Attic.Mapper.StaticCache.GetType(new Guid("A8A4536B-54C1-4A17-AB58-A6006F7F394B")); 13 14 public override bool CanConvertType(Type t) => 15 ConvertableType.IsAssignableFrom(t); 13 16 14 17 public override IJsonItem Extract(IItem value, IJsonItemConverter root) { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/LookupParameterConverter.cs
r17471 r17828 10 10 public override int Priority => 3; 11 11 public override Type ConvertableType => typeof(ILookupParameter); 12 12 13 public override bool CanConvertType(Type t) => 14 t.GetInterfaces().Any(x => x == typeof(ILookupParameter)); 15 13 16 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) => 14 17 ((ILookupParameter)item).ActualName = ((ILookupJsonItem)data).ActualName as string; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/MultiCheckedOperatorConverter.cs
r17484 r17828 10 10 public class MultiCheckedOperatorConverter : ParameterizedItemConverter { 11 11 public override int Priority => 3; 12 12 13 public override Type ConvertableType => typeof(ICheckedMultiOperator<>); 13 14 15 public override bool CanConvertType(Type t) => 16 t.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == ConvertableType); 17 14 18 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 15 19 base.Inject(item, data, root); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ParameterizedItemConverter.cs
r17473 r17828 10 10 public override int Priority => 2; 11 11 public override Type ConvertableType => typeof(IParameterizedItem); 12 13 public override bool CanConvertType(Type t) => 14 t.GetInterfaces().Any(x => x == typeof(IParameterizedItem)); 12 15 13 16 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { … … 39 42 return item; 40 43 } 44 41 45 } 42 46 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/RegressionProblemDataConverter.cs
r17560 r17828 34 34 public override Type ConvertableType => HEAL.Attic.Mapper.StaticCache.GetType(new Guid("EE612297-B1AF-42D2-BF21-AF9A2D42791C")); 35 35 36 public override bool CanConvertType(Type t) => 37 ConvertableType.IsAssignableFrom(t); 38 36 39 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 37 40 … … 180 183 if(it != null) { 181 184 if(it.MoveNext() && it.Current is double) { 182 CreateMatrix(dict, out IList<string> rowNames, out double[][] mat);185 CreateMatrix(dict, out IList<string> columnNames, out double[][] mat); 183 186 return new DoubleMatrixJsonItem() { 184 187 Name = Dataset, 185 188 Value = mat, 186 RowNames = rowNames,189 ColumnNames = columnNames, 187 190 Minimum = double.MinValue, 188 191 Maximum = double.MaxValue 189 192 }; 190 193 } else if(it.Current is int) { 191 CreateMatrix(dict, out IList<string> rowNames, out int[][] mat);194 CreateMatrix(dict, out IList<string> columnNames, out int[][] mat); 192 195 return new IntMatrixJsonItem() { 193 196 Name = Dataset, 194 197 Value = mat, 195 RowNames = rowNames,198 ColumnNames = columnNames, 196 199 Minimum = int.MinValue, 197 200 Maximum = int.MaxValue 198 201 }; 199 202 } else if (it.Current is bool) { 200 CreateMatrix(dict, out IList<string> rowNames, out bool[][] mat);203 CreateMatrix(dict, out IList<string> columnNames, out bool[][] mat); 201 204 return new BoolMatrixJsonItem() { 202 205 Name = Dataset, 203 206 Value = mat, 204 RowNames = rowNames207 ColumnNames = columnNames 205 208 }; 206 209 } … … 210 213 } 211 214 212 private void CreateMatrix<T>(Dictionary<string, IList> dict, out IList<string> rowNames, out T[][] matrix) {215 private void CreateMatrix<T>(Dictionary<string, IList> dict, out IList<string> columnNames, out T[][] matrix) { 213 216 int cols = dict.Count, rows = 0, c = 0; 214 rowNames = new List<string>();217 columnNames = new List<string>(); 215 218 matrix = new T[cols][]; 216 219 foreach (var x in dict) { 217 220 rows = Math.Max(rows, x.Value.Count); 218 rowNames.Add(x.Key);221 columnNames.Add(x.Key); 219 222 220 223 matrix[c] = new T[rows]; 224 221 225 int r = 0; 222 223 foreach (var rowValue in x.Value) { 224 matrix[c][r] = (T)rowValue; 226 foreach (var callValue in x.Value) { 227 matrix[c][r] = (T)callValue; 225 228 ++r; 226 229 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ResultParameterConverter.cs
r17473 r17828 12 12 13 13 public override Type ConvertableType => typeof(IResultParameter); 14 15 public override bool CanConvertType(Type t) => 16 t.GetInterfaces().Any(x => x == typeof(IResultParameter)); 14 17 15 18 public override IJsonItem Extract(IItem value, IJsonItemConverter root) { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/StringValueConverter.cs
r17483 r17828 12 12 public override Type ConvertableType => typeof(StringValue); 13 13 14 public override bool CanConvertType(Type t) => 15 ConvertableType.IsAssignableFrom(t); 16 14 17 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) => 15 18 ((StringValue)item).Value = ((StringJsonItem)data).Value; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueLookupParameterConverter.cs
r17483 r17828 10 10 public override int Priority => 4; 11 11 public override Type ConvertableType => typeof(IValueLookupParameter); 12 13 public override bool CanConvertType(Type t) => 14 t.GetInterfaces().Any(x => x == typeof(IValueLookupParameter)); 12 15 13 16 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueParameterConverter.cs
r17519 r17828 10 10 public override int Priority => 2; 11 11 public override Type ConvertableType => typeof(IValueParameter); 12 13 public override bool CanConvertType(Type t) => 14 t.GetInterfaces().Any(x => x == typeof(IValueParameter)); 12 15 13 16 public override void Inject(IItem value, IJsonItem data, IJsonItemConverter root) { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueRangeConverter.cs
r17483 r17828 14 14 public override int Priority => 1; 15 15 public override Type ConvertableType => typeof(IntRange); 16 17 public override bool CanConvertType(Type t) => 18 ConvertableType.IsAssignableFrom(t); 16 19 17 20 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { … … 39 42 public override Type ConvertableType => typeof(DoubleRange); 40 43 44 public override bool CanConvertType(Type t) => 45 ConvertableType.IsAssignableFrom(t); 46 41 47 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 42 48 DoubleRange range = item as DoubleRange; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeArrayConverter.cs
r17477 r17828 13 13 public override int Priority => 1; 14 14 public override Type ConvertableType => typeof(IntArray); 15 16 public override bool CanConvertType(Type t) => 17 ConvertableType.IsAssignableFrom(t); 15 18 16 19 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { … … 39 42 public override Type ConvertableType => typeof(DoubleArray); 40 43 44 public override bool CanConvertType(Type t) => 45 ConvertableType.IsAssignableFrom(t); 46 41 47 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 42 48 DoubleArray arr = item as DoubleArray; … … 63 69 public override int Priority => 2; 64 70 public override Type ConvertableType => typeof(PercentArray); 71 72 public override bool CanConvertType(Type t) => 73 ConvertableType.IsAssignableFrom(t); 65 74 66 75 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { … … 89 98 public override Type ConvertableType => typeof(BoolArray); 90 99 100 public override bool CanConvertType(Type t) => 101 ConvertableType.IsAssignableFrom(t); 102 91 103 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 92 104 BoolArray arr = item as BoolArray; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeMatrixConverter.cs
r17483 r17828 12 12 public override int Priority => 1; 13 13 public override Type ConvertableType => typeof(IntMatrix); 14 14 15 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) { 15 16 IntMatrix mat = item as IntMatrix; … … 92 93 where T : struct 93 94 { 95 public override bool CanConvertType(Type t) => 96 ConvertableType.IsAssignableFrom(t); 97 94 98 #region Helper 99 /// <summary> 100 /// Copies the data into the matrix object. Uses reflection to set the 101 /// row and column size of the matrix, because it is not possible to 102 /// create a new matrix at this point and there exists no public resize method. 103 /// </summary> 104 /// <param name="matrix"></param> 105 /// <param name="data"></param> 95 106 protected void CopyMatrixData(MatrixType matrix, T[][] data) { 96 107 var cols = data.Length; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Converters/ValueTypeValueConverter.cs
r17483 r17828 12 12 public override int Priority => 1; 13 13 public override Type ConvertableType => typeof(IntValue); 14 15 public override bool CanConvertType(Type t) => 16 ConvertableType.IsAssignableFrom(t); 14 17 15 18 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) => … … 30 33 public override Type ConvertableType => typeof(DoubleValue); 31 34 35 public override bool CanConvertType(Type t) => 36 ConvertableType.IsAssignableFrom(t); 37 32 38 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) => 33 39 ((DoubleValue)item).Value = ((DoubleJsonItem)data).Value; … … 46 52 public override int Priority => 2; 47 53 public override Type ConvertableType => typeof(PercentValue); 54 55 public override bool CanConvertType(Type t) => 56 ConvertableType.IsAssignableFrom(t); 48 57 49 58 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) => … … 64 73 public override Type ConvertableType => typeof(BoolValue); 65 74 75 public override bool CanConvertType(Type t) => 76 ConvertableType.IsAssignableFrom(t); 77 66 78 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) => 67 79 ((BoolValue)item).Value = ((BoolJsonItem)data).Value; … … 79 91 public override Type ConvertableType => typeof(DateTimeValue); 80 92 93 public override bool CanConvertType(Type t) => 94 ConvertableType.IsAssignableFrom(t); 95 81 96 public override void Inject(IItem item, IJsonItem data, IJsonItemConverter root) => 82 97 ((DateTimeValue)item).Value = ((DateTimeJsonItem)data).Value; -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Interfaces/IConcreteRestrictedJsonItem.cs
r17519 r17828 1 using System.Collections.Generic; 1 using System.Collections; 2 using System.Collections.Generic; 2 3 3 4 namespace HeuristicLab.JsonInterface { 4 5 public interface IConcreteRestrictedJsonItem<T> : IJsonItem { 5 6 /// <summary> 6 /// The item,7 /// array of restricted items 7 8 /// </summary> 8 9 IEnumerable<T> ConcreteRestrictedItems { get; set; } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Interfaces/IJsonItemConverter.cs
r17519 r17828 29 29 /// </summary> 30 30 int Priority { get; } 31 32 /// <summary> 33 /// Checks if the given type can be converted. 34 /// </summary> 35 /// <param name="t"></param> 36 /// <returns></returns> 37 bool CanConvertType(Type t); 31 38 } 32 39 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItemConverter.cs
r17540 r17828 22 22 23 23 public Type ConvertableType => throw new NotImplementedException(); 24 25 public bool CanConvertType(Type t) => throw new NotImplementedException(); 24 26 #endregion 25 27 … … 32 34 IList<IJsonItemConverter> possibleConverters = new List<IJsonItemConverter>(); 33 35 34 foreach (var x in Converters) 35 if ( CompareTypes(type, x.Key))36 foreach (var x in Converters) { 37 if (x.Value.CanConvertType(type)) 36 38 possibleConverters.Add(x.Value); 39 } 40 37 41 38 42 if(possibleConverters.Count > 0) { … … 61 65 else { 62 66 IJsonItemConverter converter = GetConverter(item.GetType()); 63 if (converter == null) return new UnsupportedJsonItem(); 67 if (converter == null) 68 return new UnsupportedJsonItem() { Name = $"{item.ItemName} (unsupported)" }; 64 69 IJsonItem tmp = converter.Extract(item, root); 65 70 ExtractCache.Add(hash, tmp); … … 84 89 Converters = converters; 85 90 } 86 87 private bool CompareGenericTypes(Type t1, Type t2) =>88 (t1.IsGenericType && t1.GetGenericTypeDefinition() == t2) /*||89 (t2.IsGenericType && t2.GetGenericTypeDefinition() == t1)*/;90 91 private bool CompareTypes(Type t1, Type t2) =>92 t1 == t2 || /*t1.IsAssignableFrom(t2) ||*/93 t1.GetInterfaces().Any(94 i => i == t2 || CompareGenericTypes(i, t2)95 ) ||96 CompareGenericTypes(t1, t2);97 91 } 98 92 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateGenerator.cs
r17689 r17828 12 12 public class JsonTemplateGenerator { 13 13 14 public static void GenerateTemplate(string path, IOptimizer optimizer) => 15 GenerateTemplate(path, optimizer.Name, optimizer); 14 /// <summary> 15 /// static Function to generate a template. 16 /// </summary> 17 /// <param name="templatePath">the path for the template files</param> 18 /// <param name="optimizer">the optimizer object to serialize</param> 19 /// <param name="rootItem">Root JsonItem for serialization, considers only active JsonItems for serialization</param> 20 public static void GenerateTemplate(string templatePath, IOptimizer optimizer, IJsonItem rootItem) { 21 // clear all runs 22 optimizer.Runs.Clear(); 16 23 17 public static void GenerateTemplate(string path, string templateName, IOptimizer optimizer) => 18 GenerateTemplate(path, templateName, optimizer, JsonItemConverter.Extract(optimizer)); 24 // validation 25 ValidationResult validationResult = rootItem.GetValidator().Validate(); 26 if (!validationResult.Success) 27 throw validationResult.GenerateException(); 19 28 20 public static void GenerateTemplate(string path, string templateName, IOptimizer optimizer, IJsonItem rootItem) {21 29 #region Init 22 30 JObject template = JObject.Parse(Constants.Template); … … 24 32 JArray resultItems = new JArray(); 25 33 IList<IJsonItem> jsonItems = new List<IJsonItem>(); 26 string fullPath = Path.GetFullPath(path); 34 string templateName = Path.GetFileName(templatePath); 35 string templateDirectory = Path.GetDirectoryName(templatePath); 36 27 37 #endregion 28 38 … … 35 45 #region Serialize HL File 36 46 ProtoBufSerializer serializer = new ProtoBufSerializer(); 37 string hlFilePath = Path.Combine( fullPath, templateName + ".hl");47 string hlFilePath = Path.Combine(templateDirectory, $"{templateName}.hl"); 38 48 serializer.Serialize(optimizer, hlFilePath); 39 49 #endregion … … 56 66 57 67 #region Serialize and write to file 58 File.WriteAllText( fullPath + @"\" + templateName + ".json", SingleLineArrayJsonWriter.Serialize(template));68 File.WriteAllText(Path.Combine(templateDirectory, $"{templateName}.json"), SingleLineArrayJsonWriter.Serialize(template)); 59 69 #endregion 60 70 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonTemplateInstantiator.cs
r17560 r17828 1 using System.Collections.Generic; 1 using System; 2 using System.Collections.Generic; 2 3 using System.IO; 3 4 using System.Linq; … … 66 67 IJsonItem rootItem = Objects.First().Value; 67 68 68 //TODO validate 69 // validation 70 ValidationResult validationResult = rootItem.GetValidator().Validate(); 71 if (!validationResult.Success) 72 throw validationResult.GenerateException(); 69 73 70 74 // inject configuration … … 105 109 if (Objects.TryGetValue(path, out IJsonItem param)) { 106 110 // remove fixed template parameter from config => dont allow to copy them from concrete config 111 // TODO: shift this into JsonItems? 107 112 obj.Property(nameof(IIntervalRestrictedJsonItem<int>.Minimum))?.Remove(); 108 113 obj.Property(nameof(IIntervalRestrictedJsonItem<int>.Maximum))?.Remove(); 109 114 obj.Property(nameof(IConcreteRestrictedJsonItem<string>.ConcreteRestrictedItems))?.Remove(); 115 obj.Property(nameof(IMatrixJsonItem.ColumnsResizable))?.Remove(); 116 obj.Property(nameof(IMatrixJsonItem.RowsResizable))?.Remove(); 117 obj.Property(nameof(IArrayJsonItem.Resizable))?.Remove(); 110 118 // merge 111 119 param.SetJObject(obj); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/ConcreteRestrictedValueJsonItem.cs
r17519 r17828 1 using System.Collections.Generic; 1 using System.Collections; 2 using System.Collections.Generic; 2 3 using System.Linq; 3 4 4 5 namespace HeuristicLab.JsonInterface { 6 5 7 public abstract class ConcreteRestrictedValueJsonItem<T> : ValueJsonItem<T>, IConcreteRestrictedJsonItem<T> { 8 6 9 public IEnumerable<T> ConcreteRestrictedItems { get; set; } 7 10 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/IntervalRestrictedValueJsonItem.cs
r17519 r17828 20 20 if (minProp != null) Minimum = minProp.ToObject<T>(); 21 21 22 23 22 var maxProp = jObject[nameof(IIntervalRestrictedJsonItem<T>.Maximum)]; 24 23 if (maxProp != null) Maximum = maxProp.ToObject<T>(); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/JsonItem.cs
r17519 r17828 1 using System.Collections; 1 using System; 2 using System.Collections; 2 3 using System.Collections.Generic; 3 4 using System.Linq; … … 26 27 public bool Success { get; } 27 28 public IEnumerable<string> Errors { get; } 29 30 public Exception GenerateException() => 31 new AggregateException(Errors.Select(x => new ArgumentException(x))); 28 32 } 29 33 … … 76 80 } 77 81 78 // TODO jsonIgnore dataType?79 82 [JsonIgnore] 80 83 public virtual IEnumerable<IJsonItem> Children { get; protected set; } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/ResultJsonItem.cs
r17519 r17828 2 2 public class ResultJsonItem : JsonItem, IResultJsonItem { 3 3 protected override ValidationResult Validate() => ValidationResult.Successful(); 4 5 public string Converter { get; set; } 4 6 } 5 7 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/UnsupportedJsonItem.cs
r17519 r17828 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Linq; 3 4 using Newtonsoft.Json; 4 5 5 6 namespace HeuristicLab.JsonInterface { 6 7 public class UnsupportedJsonItem : JsonItem { 8 /* 7 9 public override string Name { 8 10 get => throw new NotSupportedException(); … … 10 12 } 11 13 12 public override string Description { 14 public override string Description { // TODO 13 15 get => throw new NotSupportedException(); 14 16 set => throw new NotSupportedException(); … … 18 20 get => throw new NotSupportedException(); 19 21 } 22 */ 20 23 21 24 [JsonIgnore] 22 25 public override IEnumerable<IJsonItem> Children { 23 get => throw new NotSupportedException();26 get => Enumerable.Empty<IJsonItem>(); 24 27 protected set => throw new NotSupportedException(); 25 28 } 26 29 /* 27 30 [JsonIgnore] 28 31 public override IJsonItem Parent { … … 30 33 set => throw new NotSupportedException(); 31 34 } 32 35 */ 33 36 protected override ValidationResult Validate() => ValidationResult.Successful(); 34 37 } -
branches/3026_IntegrationIntoSymSpace/Heuristiclab.ConfigStarter/Program.cs
r17601 r17828 48 48 49 49 50 JsonTemplateGenerator.GenerateTemplate(@"C:\Workspace\ConfigStarter\", "Template", alg, root);50 //JsonTemplateGenerator.GenerateTemplate(@"C:\Workspace\ConfigStarter\", "Template", alg, root); 51 51 52 52
Note: See TracChangeset
for help on using the changeset viewer.