Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/20 17:17:37 (4 years ago)
Author:
dpiringe
Message:

#3026:

  • refactored inheritance structure of json items, now the default JsonItem is an abstract class without properties Value and Range -> splitted up into new interfaces
  • updated view models for new json item structure
  • updated SingleLineArrayJsonWriter
Location:
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs

    r17471 r17473  
    5353      foreach (var vmType in ApplicationManager.Manager.GetTypes(typeof(IJsonItemVM))) {
    5454        IJsonItemVM vm = (IJsonItemVM)Activator.CreateInstance(vmType);
    55         JI2VM.Add(vm.JsonItemType, vmType);
     55        JI2VM.Add(vm.TargetedJsonItemType, vmType);
    5656      }
    5757    }
     
    102102              if(Node2VM.TryGetValue(childNode, out IJsonItemVM vm))
    103103                vm.Selected = true;
     104             
    104105            } else {
    105106              TreeNode childNode = new TreeNode(c.Name);
     
    126127        Node2Control.Add(node, control);
    127128      } else {
    128         //node.
     129        node.ForeColor = Color.LightGray;
     130        node.NodeFont = new Font(SystemFonts.DialogFont, FontStyle.Italic);
    129131      }
    130132    }
     
    138140      }
    139141     
    140       return b || (item.Value != null || item.Range != null || item is ILookupJsonItem || item is IResultJsonItem);
     142      return b || !(item is EmptyJsonItem);
    141143    }
    142144   
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.resx

    r17444 r17473  
    121121    <value>194, 17</value>
    122122  </metadata>
     123  <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     124    <value>37</value>
     125  </metadata>
    123126  <metadata name="jsonItemBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124127    <value>17, 17</value>
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemMultiValueControl.cs

    r17471 r17473  
    167167    private void InitRangeBinding() {
    168168      NumericRangeControl = numericRangeControl1;
    169       NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MinRange));
    170       NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MaxRange));
    171       NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMinRange),
     169      NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.MinRange));
     170      NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.MaxRange));
     171      NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.EnableMinRange),
    172172        false, DataSourceUpdateMode.OnPropertyChanged);
    173       NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMaxRange),
     173      NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.EnableMaxRange),
    174174        false, DataSourceUpdateMode.OnPropertyChanged);
    175175    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemRangeControl.Designer.cs

    r17471 r17473  
    2626      this.components = new System.ComponentModel.Container();
    2727      this.groupBox1 = new System.Windows.Forms.GroupBox();
     28      this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
     29      this.label2 = new System.Windows.Forms.Label();
    2830      this.textBoxValueTo = new System.Windows.Forms.TextBox();
     31      this.textBoxValueFrom = new System.Windows.Forms.TextBox();
    2932      this.label4 = new System.Windows.Forms.Label();
    30       this.label2 = new System.Windows.Forms.Label();
    3133      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    32       this.textBoxValueFrom = new System.Windows.Forms.TextBox();
    33       this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
    3434      this.numericRangeControl = new HeuristicLab.JsonInterface.OptimizerIntegration.NumericRangeControl();
    3535      this.groupBox1.SuspendLayout();
     36      this.tableLayoutPanel1.SuspendLayout();
    3637      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    37       this.tableLayoutPanel1.SuspendLayout();
    3838      this.SuspendLayout();
    3939      //
     
    5050      this.groupBox1.TabStop = false;
    5151      this.groupBox1.Text = "Value";
    52       //
    53       // textBoxValueTo
    54       //
    55       this.textBoxValueTo.Dock = System.Windows.Forms.DockStyle.Fill;
    56       this.textBoxValueTo.Location = new System.Drawing.Point(100, 24);
    57       this.textBoxValueTo.Margin = new System.Windows.Forms.Padding(0);
    58       this.textBoxValueTo.Name = "textBoxValueTo";
    59       this.textBoxValueTo.Size = new System.Drawing.Size(394, 20);
    60       this.textBoxValueTo.TabIndex = 3;
    61       //
    62       // label4
    63       //
    64       this.label4.AutoSize = true;
    65       this.label4.Dock = System.Windows.Forms.DockStyle.Fill;
    66       this.label4.Location = new System.Drawing.Point(0, 24);
    67       this.label4.Margin = new System.Windows.Forms.Padding(0);
    68       this.label4.Name = "label4";
    69       this.label4.Size = new System.Drawing.Size(100, 25);
    70       this.label4.TabIndex = 1;
    71       this.label4.Text = "To:";
    72       this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
    73       //
    74       // label2
    75       //
    76       this.label2.AutoSize = true;
    77       this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
    78       this.label2.Location = new System.Drawing.Point(0, 0);
    79       this.label2.Margin = new System.Windows.Forms.Padding(0);
    80       this.label2.Name = "label2";
    81       this.label2.Size = new System.Drawing.Size(100, 24);
    82       this.label2.TabIndex = 0;
    83       this.label2.Text = "From:";
    84       this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
    85       //
    86       // errorProvider
    87       //
    88       this.errorProvider.ContainerControl = this;
    89       //
    90       // textBoxValueFrom
    91       //
    92       this.textBoxValueFrom.Dock = System.Windows.Forms.DockStyle.Fill;
    93       this.textBoxValueFrom.Location = new System.Drawing.Point(100, 0);
    94       this.textBoxValueFrom.Margin = new System.Windows.Forms.Padding(0);
    95       this.textBoxValueFrom.Name = "textBoxValueFrom";
    96       this.textBoxValueFrom.Size = new System.Drawing.Size(394, 20);
    97       this.textBoxValueFrom.TabIndex = 2;
    9852      //
    9953      // tableLayoutPanel1
     
    11569      this.tableLayoutPanel1.Size = new System.Drawing.Size(494, 49);
    11670      this.tableLayoutPanel1.TabIndex = 19;
     71      //
     72      // label2
     73      //
     74      this.label2.AutoSize = true;
     75      this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
     76      this.label2.Location = new System.Drawing.Point(0, 0);
     77      this.label2.Margin = new System.Windows.Forms.Padding(0);
     78      this.label2.Name = "label2";
     79      this.label2.Size = new System.Drawing.Size(100, 24);
     80      this.label2.TabIndex = 0;
     81      this.label2.Text = "From:";
     82      this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     83      //
     84      // textBoxValueTo
     85      //
     86      this.textBoxValueTo.Dock = System.Windows.Forms.DockStyle.Fill;
     87      this.textBoxValueTo.Location = new System.Drawing.Point(100, 24);
     88      this.textBoxValueTo.Margin = new System.Windows.Forms.Padding(0);
     89      this.textBoxValueTo.Name = "textBoxValueTo";
     90      this.textBoxValueTo.Size = new System.Drawing.Size(394, 20);
     91      this.textBoxValueTo.TabIndex = 3;
     92      //
     93      // textBoxValueFrom
     94      //
     95      this.textBoxValueFrom.Dock = System.Windows.Forms.DockStyle.Fill;
     96      this.textBoxValueFrom.Location = new System.Drawing.Point(100, 0);
     97      this.textBoxValueFrom.Margin = new System.Windows.Forms.Padding(0);
     98      this.textBoxValueFrom.Name = "textBoxValueFrom";
     99      this.textBoxValueFrom.Size = new System.Drawing.Size(394, 20);
     100      this.textBoxValueFrom.TabIndex = 2;
     101      //
     102      // label4
     103      //
     104      this.label4.AutoSize = true;
     105      this.label4.Dock = System.Windows.Forms.DockStyle.Fill;
     106      this.label4.Location = new System.Drawing.Point(0, 24);
     107      this.label4.Margin = new System.Windows.Forms.Padding(0);
     108      this.label4.Name = "label4";
     109      this.label4.Size = new System.Drawing.Size(100, 25);
     110      this.label4.TabIndex = 1;
     111      this.label4.Text = "To:";
     112      this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     113      //
     114      // errorProvider
     115      //
     116      this.errorProvider.ContainerControl = this;
    117117      //
    118118      // numericRangeControl
     
    137137      this.Size = new System.Drawing.Size(500, 147);
    138138      this.groupBox1.ResumeLayout(false);
    139       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    140139      this.tableLayoutPanel1.ResumeLayout(false);
    141140      this.tableLayoutPanel1.PerformLayout();
     141      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    142142      this.ResumeLayout(false);
    143143
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemRangeControl.cs

    r17464 r17473  
    3232
    3333    private void InitNumbericRangeControl() {
    34       numericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MinRange));
    35       numericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MaxRange));
    36       numericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMinRange),
     34      numericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.MinRange));
     35      numericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.MaxRange));
     36      numericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.EnableMinRange),
    3737        false, DataSourceUpdateMode.OnPropertyChanged);
    38       numericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMaxRange),
     38      numericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.EnableMaxRange),
    3939        false, DataSourceUpdateMode.OnPropertyChanged);
    4040    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.cs

    r17464 r17473  
    1212  public partial class JsonItemValidValuesControl : UserControl {
    1313
    14     IJsonItemVM VM { get; set; }
     14    StringValueVM VM { get; set; }
    1515
    1616    public JsonItemValidValuesControl(StringValueVM vm) {
    1717      InitializeComponent();
    1818      VM = vm;
    19       if (VM.Item.Range != null) {
    20         foreach (var i in VM.Item.Range)
    21           SetupOption((string)i);
     19      if (VM.Item.ConcreteRestrictedItems != null) {
     20        foreach (var i in VM.Item.ConcreteRestrictedItems)
     21          SetupOption(i);
    2222        comboBoxValues.DataBindings.Add("SelectedItem", VM, nameof(StringValueVM.Value));
    2323      } else {
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValueControl.cs

    r17471 r17473  
    5858    protected void Init() {
    5959      TBValue.DataBindings.Add("Text", VM, ValuePropertyId);
    60       NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MinRange));
    61       NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM.MaxRange));
    62       NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMinRange),
     60      NumericRangeControl.TBMinRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.MinRange));
     61      NumericRangeControl.TBMaxRange.DataBindings.Add("Text", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.MaxRange));
     62      NumericRangeControl.EnableMinRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.EnableMinRange),
    6363        false, DataSourceUpdateMode.OnPropertyChanged);
    64       NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM.EnableMaxRange),
     64      NumericRangeControl.EnableMaxRange.DataBindings.Add("Checked", VM, nameof(RangedValueBaseVM<int, IntJsonItem>.EnableMaxRange),
    6565        false, DataSourceUpdateMode.OnPropertyChanged);
    6666    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ValueLookupJsonItemControl.Designer.cs

    r17471 r17473  
    1 namespace HeuristicLab.JsonInterface.OptimizerIntegration.Views {
     1namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    22  partial class ValueLookupJsonItemControl {
    33    /// <summary>
     
    2929      // content
    3030      //
    31       this.content.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    32             | System.Windows.Forms.AnchorStyles.Left)
    33             | System.Windows.Forms.AnchorStyles.Right)));
    34       this.content.Location = new System.Drawing.Point(0, 20);
     31      this.content.Dock = System.Windows.Forms.DockStyle.Fill;
     32      this.content.Location = new System.Drawing.Point(0, 22);
    3533      this.content.Margin = new System.Windows.Forms.Padding(0);
    3634      this.content.Name = "content";
    37       this.content.Size = new System.Drawing.Size(651, 350);
     35      this.content.Padding = new System.Windows.Forms.Padding(0, 3, 0, 0);
     36      this.content.Size = new System.Drawing.Size(500, 523);
    3837      this.content.TabIndex = 14;
    3938      //
     
    4443      this.Controls.Add(this.content);
    4544      this.Name = "ValueLookupJsonItemControl";
    46       this.Size = new System.Drawing.Size(651, 370);
     45      this.Size = new System.Drawing.Size(500, 545);
    4746      this.Controls.SetChildIndex(this.content, 0);
    4847      this.ResumeLayout(false);
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ValueLookupJsonItemControl.cs

    r17471 r17473  
    1010using HeuristicLab.PluginInfrastructure;
    1111
    12 namespace HeuristicLab.JsonInterface.OptimizerIntegration.Views {
     12namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    1313  public partial class ValueLookupJsonItemControl : LookupJsonItemControl {
    14     private IDictionary<Type, Type> JI2VM { get; set; }
     14    private static IDictionary<Type, Type> JI2VM { get; set; }
    1515
    16     public ValueLookupJsonItemControl() {
    17       InitializeComponent();
    18     }
    1916    public ValueLookupJsonItemControl(IValueLookupJsonItemVM vm) : base(vm) {
    2017      InitializeComponent();
    2118      InitCache();
    22       if (JI2VM.TryGetValue(vm.JsonItemReference.GetType(), out Type vmType)) {
     19      if (vm.JsonItemReference != null && JI2VM.TryGetValue(vm.JsonItemReference.GetType(), out Type vmType)) {
    2320        IJsonItemVM tmp = (IJsonItemVM)Activator.CreateInstance(vmType);
    24         content.Controls.Add(tmp.Control);
    25       } else {
    26         //node.
     21        tmp.Item = vm.JsonItemReference;
     22        content.Controls.Clear();
     23        UserControl control = tmp.Control;
     24        content.Controls.Add(control);
     25        control.Dock = DockStyle.Fill;
     26       
    2727      }
    2828    }
    2929
    3030    private void InitCache() {
    31       JI2VM = new Dictionary<Type, Type>();
    32       foreach (var vmType in ApplicationManager.Manager.GetTypes(typeof(IJsonItemVM))) {
    33         IJsonItemVM vm = (IJsonItemVM)Activator.CreateInstance(vmType);
    34         JI2VM.Add(vm.JsonItemType, vmType);
     31      if(JI2VM == null) {
     32        JI2VM = new Dictionary<Type, Type>();
     33        foreach (var vmType in ApplicationManager.Manager.GetTypes(typeof(IJsonItemVM))) {
     34          IJsonItemVM vm = (IJsonItemVM)Activator.CreateInstance(vmType);
     35          JI2VM.Add(vm.TargetedJsonItemType, vmType);
     36        }
    3537      }
    3638    }
Note: See TracChangeset for help on using the changeset viewer.