Changeset 17519 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration
- Timestamp:
- 04/27/20 15:53:26 (5 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration
- Files:
-
- 8 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/HeuristicLab.JsonInterface.OptimizerIntegration.csproj
r17471 r17519 108 108 </Compile> 109 109 <Compile Include="ViewModels\ArrayValueVM.cs" /> 110 <Compile Include="ViewModels\DoubleVMs.cs" /> 111 <Compile Include="ViewModels\IntVMs.cs" /> 110 112 <Compile Include="ViewModels\JsonItemVMBase.cs" /> 111 113 <Compile Include="ViewModels\LookupJsonItemVM.cs" /> … … 117 119 <Compile Include="ViewModels\StringValueVM.cs" /> 118 120 <Compile Include="ViewModels\ValueLookupJsonItemVM.cs" /> 121 <Compile Include="Shared\ConcreteItemsRestrictor.cs"> 122 <SubType>UserControl</SubType> 123 </Compile> 124 <Compile Include="Shared\ConcreteItemsRestrictor.Designer.cs"> 125 <DependentUpon>ConcreteItemsRestrictor.cs</DependentUpon> 126 </Compile> 119 127 <Compile Include="Views\ExportJsonDialog.cs"> 120 128 <SubType>Form</SubType> … … 124 132 </Compile> 125 133 <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> 126 140 <Compile Include="Views\JsonItemMultiValueControl.cs"> 127 141 <SubType>UserControl</SubType> … … 224 238 <DependentUpon>NumericRangeControl.cs</DependentUpon> 225 239 </EmbeddedResource> 240 <EmbeddedResource Include="Shared\ConcreteItemsRestrictor.resx"> 241 <DependentUpon>ConcreteItemsRestrictor.cs</DependentUpon> 242 </EmbeddedResource> 226 243 <EmbeddedResource Include="Views\ExportJsonDialog.resx"> 227 244 <DependentUpon>ExportJsonDialog.cs</DependentUpon> 245 </EmbeddedResource> 246 <EmbeddedResource Include="Views\JsonItemConcreteItemArrayControl.resx"> 247 <DependentUpon>JsonItemConcreteItemArrayControl.cs</DependentUpon> 228 248 </EmbeddedResource> 229 249 <EmbeddedResource Include="Views\JsonItemMultiValueControl.resx"> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ArrayValueVM.cs
r17484 r17519 9 9 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 10 10 11 public class DoubleArrayValueVM : ArrayValueVM<double, DoubleArrayJsonItem> { 12 public override Type TargetedJsonItemType => typeof(DoubleArrayJsonItem); 11 13 12 14 protected override double MinTypeValue => double.MinValue;15 13 16 protected override double MaxTypeValue => double.MaxValue;17 14 18 public override UserControl Control => 19 new JsonItemDoubleArrayValueControl(this); 20 21 public override double[] Value { 22 get => Item.Value; 23 set { 24 Item.Value = value; 25 OnPropertyChange(this, nameof(Value)); 26 } 27 } 28 } 29 30 public class IntArrayValueVM : ArrayValueVM<int, IntArrayJsonItem> { 31 public override Type TargetedJsonItemType => typeof(IntArrayJsonItem); 15 /* 16 public class StringArrayValueVM : ArrayValueVM<int, IntArrayJsonItem> { 17 public override Type TargetedJsonItemType => typeof(StringArrayJsonItem); 32 18 33 19 protected override int MinTypeValue => int.MinValue; … … 37 23 public override UserControl Control => 38 24 new JsonItemBaseControl(this, new JsonItemIntArrayValueControl(this)); 39 25 40 26 public override int[] Value { 41 27 get => Item.Value; … … 46 32 } 47 33 } 34 */ 35 48 36 49 37 public abstract class ArrayValueVM<T, JsonItemType> : RangedValueBaseVM<T, JsonItemType>, IArrayJsonItemVM -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVMBase.cs
r17477 r17519 9 9 10 10 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 11 public abstract class JsonItemVMBase<JsonItemType> : IJsonItemVM<JsonItemType> 11 public abstract class JsonItemVMBase<JsonItemType> : IJsonItemVM<JsonItemType> //TODO: RENAME, oder vlt JsonItems direkt als VM? 12 12 where JsonItemType : class, IJsonItem 13 13 { … … 58 58 } 59 59 60 public abstract Type TargetedJsonItemType { get; }60 public virtual Type TargetedJsonItemType => typeof(JsonItemType); 61 61 public abstract UserControl Control { get; } 62 62 -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/LookupJsonItemVM.cs
r17473 r17519 8 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 9 public class LookupJsonItemVM : JsonItemVMBase<LookupJsonItem>, ILookupJsonItemVM { 10 public override Type TargetedJsonItemType => typeof(LookupJsonItem);11 10 12 11 public override UserControl Control => new LookupJsonItemControl(this); -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/MatrixValueVM.cs
r17484 r17519 9 9 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 10 10 11 public class DoubleMatrixValueVM : MatrixValueVM<double, DoubleMatrixJsonItem> {12 public override Type TargetedJsonItemType => typeof(DoubleMatrixJsonItem);13 public override UserControl Control =>14 new JsonItemDoubleMatrixValueControl(this);15 16 public override double[][] Value {17 get => Item.Value;18 set {19 Item.Value = value;20 OnPropertyChange(this, nameof(Value));21 }22 }23 24 protected override double MinTypeValue => double.MinValue;25 26 protected override double MaxTypeValue => double.MaxValue;27 }28 11 29 12 public abstract class MatrixValueVM<T, JsonItemType> : RangedValueBaseVM<T, JsonItemType>, IMatrixJsonItemVM -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangeVM.cs
r17473 r17519 8 8 9 9 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 10 11 public class IntRangeVM : RangeVM<int, IntRangeJsonItem> {12 public override Type TargetedJsonItemType => typeof(IntRangeJsonItem);13 14 protected override int MinTypeValue => int.MinValue;15 16 protected override int MaxTypeValue => int.MaxValue;17 18 public override UserControl Control =>19 new JsonItemRangeControl(this);20 }21 22 public class DoubleRangeVM : RangeVM<double, DoubleRangeJsonItem> {23 public override Type TargetedJsonItemType => typeof(DoubleRangeJsonItem);24 25 protected override double MinTypeValue => double.MinValue;26 27 protected override double MaxTypeValue => double.MaxValue;28 29 public override UserControl Control =>30 new JsonItemRangeControl(this);31 }32 10 33 11 public abstract class RangeVM<T, JsonItemType> : RangedValueBaseVM<T, JsonItemType> -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/SingleValueVM.cs
r17473 r17519 8 8 9 9 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 10 public class IntValueVM : SingleValueVM<int, IntJsonItem> {11 public override Type TargetedJsonItemType => typeof(IntJsonItem);12 13 protected override int MinTypeValue => int.MinValue;14 protected override int MaxTypeValue => int.MaxValue;15 16 public override UserControl Control =>17 new JsonItemIntValueControl(this);18 }19 20 public class DoubleValueVM : SingleValueVM<double, DoubleJsonItem> {21 public override Type TargetedJsonItemType => typeof(DoubleJsonItem);22 23 protected override double MinTypeValue => double.MinValue;24 protected override double MaxTypeValue => double.MaxValue;25 26 public override UserControl Control =>27 new JsonItemDoubleValueControl(this);28 }29 10 30 11 public class BoolValueVM : JsonItemVMBase<BoolJsonItem> { 31 public override Type TargetedJsonItemType => typeof(BoolJsonItem);32 12 33 13 public bool Value { -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/StringValueVM.cs
r17473 r17519 9 9 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 10 10 public class StringValueVM : JsonItemVMBase<StringJsonItem> { 11 public override Type TargetedJsonItemType => typeof(StringJsonItem);12 11 public override UserControl Control => 13 12 new JsonItemValidValuesControl(this); … … 37 36 } 38 37 } 38 } 39 39 40 public class StringArrayVM : JsonItemVMBase<StringArrayJsonItem> { 41 public override UserControl Control => 42 new JsonItemConcreteItemArrayControl(this); 43 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 } 40 59 } 41 60 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemMultiValueControl.cs
r17485 r17519 80 80 int cols = matrix.Length; 81 81 int rows = matrix.Max(x => x.Length); 82 82 83 83 Matrix = matrix; 84 84 Columns = cols; … … 250 250 typeof(T), 251 251 System.Globalization.CultureInfo.InvariantCulture); 252 //Save(Matrix[e.ColumnIndex][e.RowIndex], e.ColumnIndex, e.RowIndex);253 252 Save(); 254 253 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.Designer.cs
r17471 r17519 25 25 private void InitializeComponent() { 26 26 this.components = new System.ComponentModel.Container(); 27 this.tableOptions = new System.Windows.Forms.TableLayoutPanel();28 27 this.comboBoxValues = new System.Windows.Forms.ComboBox(); 29 28 this.label2 = new System.Windows.Forms.Label(); 30 29 this.groupBoxRange = new System.Windows.Forms.GroupBox(); 30 this.concreteItemsRestrictor = new HeuristicLab.JsonInterface.OptimizerIntegration.ConcreteItemsRestrictor(); 31 31 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 32 32 this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); … … 37 37 this.tableLayoutPanel2.SuspendLayout(); 38 38 this.SuspendLayout(); 39 //40 // tableOptions41 //42 this.tableOptions.AutoScroll = true;43 this.tableOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;44 this.tableOptions.ColumnCount = 2;45 this.tableOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));46 this.tableOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());47 this.tableOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));48 this.tableOptions.Dock = System.Windows.Forms.DockStyle.Fill;49 this.tableOptions.Location = new System.Drawing.Point(3, 16);50 this.tableOptions.Name = "tableOptions";51 this.tableOptions.RowCount = 1;52 this.tableOptions.RowStyles.Add(new System.Windows.Forms.RowStyle());53 this.tableOptions.Size = new System.Drawing.Size(494, 217);54 this.tableOptions.TabIndex = 12;55 39 // 56 40 // comboBoxValues … … 79 63 // groupBoxRange 80 64 // 81 this.groupBoxRange.Controls.Add(this. tableOptions);65 this.groupBoxRange.Controls.Add(this.concreteItemsRestrictor); 82 66 this.groupBoxRange.Dock = System.Windows.Forms.DockStyle.Fill; 83 67 this.groupBoxRange.Location = new System.Drawing.Point(0, 22); … … 88 72 this.groupBoxRange.TabStop = false; 89 73 this.groupBoxRange.Text = "Range"; 74 // 75 // concreteItemsRestrictor 76 // 77 this.concreteItemsRestrictor.Dock = System.Windows.Forms.DockStyle.Fill; 78 this.concreteItemsRestrictor.Location = new System.Drawing.Point(3, 16); 79 this.concreteItemsRestrictor.Margin = new System.Windows.Forms.Padding(0); 80 this.concreteItemsRestrictor.Name = "concreteItemsRestrictor"; 81 this.concreteItemsRestrictor.Size = new System.Drawing.Size(494, 217); 82 this.concreteItemsRestrictor.TabIndex = 0; 90 83 // 91 84 // errorProvider … … 122 115 this.tableLayoutPanel2.RowCount = 1; 123 116 this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); 124 this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 2 0F));117 this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22F)); 125 118 this.tableLayoutPanel2.Size = new System.Drawing.Size(500, 22); 126 119 this.tableLayoutPanel2.TabIndex = 19; … … 146 139 147 140 #endregion 148 private System.Windows.Forms.TableLayoutPanel tableOptions;149 141 private System.Windows.Forms.ComboBox comboBoxValues; 150 142 private System.Windows.Forms.Label label2; … … 153 145 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; 154 146 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; 147 private ConcreteItemsRestrictor concreteItemsRestrictor; 155 148 } 156 149 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.cs
r17473 r17519 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 1 using System.Collections.Generic; 4 2 using System.Drawing; 5 using System.Data;6 3 using System.Linq; 7 using System.Text;8 using System.Threading.Tasks;9 4 using System.Windows.Forms; 10 5 … … 18 13 VM = vm; 19 14 if (VM.Item.ConcreteRestrictedItems != null) { 20 foreach (var i in VM.Item.ConcreteRestrictedItems) 21 SetupOption(i); 15 concreteItemsRestrictor.OnChecked += AddComboOption; 16 concreteItemsRestrictor.OnUnchecked += RemoveComboOption; 17 concreteItemsRestrictor.Init(VM.Item.ConcreteRestrictedItems); 22 18 comboBoxValues.DataBindings.Add("SelectedItem", VM, nameof(StringValueVM.Value)); 23 19 } else { 24 comboBoxValues.Hide();25 20 groupBoxRange.Hide(); 26 21 TextBox tb = new TextBox(); 27 this.Controls.Add(tb); 22 tableLayoutPanel2.Controls.Remove(comboBoxValues); 23 tableLayoutPanel2.Controls.Add(tb, 1, 0); 24 28 25 tb.Location = comboBoxValues.Location; 29 tb.Size = comboBoxValues.Size; 30 tb.Anchor = comboBoxValues.Anchor; 31 tb.Dock = comboBoxValues.Dock; 26 tb.Margin = new Padding(0); 27 tb.Size = new Size(comboBoxValues.Size.Width, 20); 28 tb.Anchor = AnchorStyles.Top | AnchorStyles.Left; 29 tb.Dock = DockStyle.Fill; 30 32 31 tb.DataBindings.Add("Text", VM, nameof(StringValueVM.Value)); 33 32 tb.Show(); 34 33 } 35 34 } 36 37 private void SetupOption(string opt) {38 AddComboOption(opt);39 TextBox tb = new TextBox();40 tb.Text = opt;41 //tb.Size = new Size()42 tb.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;43 //tb.Dock = DockStyle.Right | DockStyle.Left;44 tb.ReadOnly = true;45 35 46 CheckBox checkBox = new CheckBox(); 47 checkBox.Checked = true; 48 49 checkBox.CheckStateChanged += (o, args) => { 50 if (checkBox.Checked) 51 AddComboOption(opt); 52 else 53 RemoveComboOption(opt); 54 }; 55 tableOptions.Controls.Add(checkBox); 56 tableOptions.Controls.Add(tb); 57 } 58 59 private void AddComboOption(string opt) { 36 private void AddComboOption(object opt) { 60 37 comboBoxValues.Items.Add(opt); 61 38 IList<string> items = new List<string>(); … … 63 40 items.Add((string)i); 64 41 } 65 ((StringValueVM)VM).Range = items;42 VM.Range = items; 66 43 comboBoxValues.Enabled = true; 67 tableOptions.Refresh();68 44 } 69 45 70 private void RemoveComboOption( stringopt) {46 private void RemoveComboOption(object opt) { 71 47 comboBoxValues.Items.Remove(opt); 72 48 IList<string> items = new List<string>(); … … 74 50 items.Add((string)i); 75 51 } 76 ((StringValueVM)VM).Range = items;77 if ( ((StringValueVM)VM).Range.Count() <= 0) {52 VM.Range = items; 53 if (VM.Range.Count() <= 0) { 78 54 comboBoxValues.Enabled = false; 79 55 comboBoxValues.SelectedIndex = -1; 80 56 } 81 tableOptions.Refresh();82 57 } 83 58 }
Note: See TracChangeset
for help on using the changeset viewer.