Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/01/21 14:37:18 (4 years ago)
Author:
dpiringe
Message:

#3026

  • removed the option to set the value for JsonItems via exporter
    • reworked some base controls
    • added new controls for JsonItem specific properties (e.g. ArrayResizable)
    • deleted a lot of obsolet controls
  • removed the Enable checkbox in the detail view of JsonItems
  • exporter now clones the IOptimizer object
  • added a check + message for unsupported exports
  • list of JsonItems now includes unsupported JsonItems (disabled and marked with 'unsupported')
  • refactored the converter type check
    • now every converter has to specify its supported type(s)
Location:
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration
Files:
10 added
21 deleted
19 edited

Legend:

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

    r17477 r17828  
    2626      IStorableContent content = view.Content as IStorableContent;
    2727      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        }
    3034      }
    3135    }
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/HeuristicLab.JsonInterface.OptimizerIntegration.csproj

    r17519 r17828  
    9595      <DependentUpon>Resources.resx</DependentUpon>
    9696    </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>
    97109    <Compile Include="Shared\JsonItemBaseControl.cs">
    98110      <SubType>UserControl</SubType>
     
    101113      <DependentUpon>JsonItemBaseControl.cs</DependentUpon>
    102114    </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>
    103121    <Compile Include="Shared\NumericRangeControl.cs">
    104122      <SubType>UserControl</SubType>
     
    108126    </Compile>
    109127    <Compile Include="ViewModels\ArrayValueVM.cs" />
     128    <Compile Include="ViewModels\ConcreteRestrictedJsonItemVM.cs" />
    110129    <Compile Include="ViewModels\DoubleVMs.cs" />
    111130    <Compile Include="ViewModels\IntVMs.cs" />
     
    132151    </Compile>
    133152    <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>
    170153    <Compile Include="MenuItems\ImportJsonTemplateMenuItem.cs" />
    171154    <Compile Include="MenuItems\ExportJsonTemplateMenuItem.cs" />
    172155    <Compile Include="Plugin.cs" />
    173156    <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>
    180157    <Compile Include="Views\ValueLookupJsonItemControl.cs">
    181158      <SubType>UserControl</SubType>
     
    232209      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    233210    </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>
    234217    <EmbeddedResource Include="Shared\JsonItemBaseControl.resx">
    235218      <DependentUpon>JsonItemBaseControl.cs</DependentUpon>
    236219    </EmbeddedResource>
     220    <EmbeddedResource Include="Shared\MatrixJsonItemControl.resx">
     221      <DependentUpon>MatrixJsonItemControl.cs</DependentUpon>
     222    </EmbeddedResource>
    237223    <EmbeddedResource Include="Shared\NumericRangeControl.resx">
    238224      <DependentUpon>NumericRangeControl.cs</DependentUpon>
     
    243229    <EmbeddedResource Include="Views\ExportJsonDialog.resx">
    244230      <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>
    266231    </EmbeddedResource>
    267232    <EmbeddedResource Include="Views\ValueLookupJsonItemControl.resx">
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/ConcreteItemsRestrictor.Designer.cs

    r17519 r17828  
    2525    private void InitializeComponent() {
    2626      this.tableOptions = new System.Windows.Forms.TableLayoutPanel();
     27      this.groupBox1 = new System.Windows.Forms.GroupBox();
     28      this.groupBox1.SuspendLayout();
    2729      this.SuspendLayout();
    2830      //
     
    3638      this.tableOptions.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
    3739      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);
    3942      this.tableOptions.Name = "tableOptions";
    4043      this.tableOptions.RowCount = 1;
    4144      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);
    4346      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";
    4459      //
    4560      // ConcreteItemsRestrictor
     
    4762      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    4863      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    49       this.Controls.Add(this.tableOptions);
     64      this.Controls.Add(this.groupBox1);
    5065      this.Margin = new System.Windows.Forms.Padding(0);
    5166      this.Name = "ConcreteItemsRestrictor";
    5267      this.Size = new System.Drawing.Size(500, 200);
     68      this.groupBox1.ResumeLayout(false);
    5369      this.ResumeLayout(false);
    5470
     
    5874
    5975    private System.Windows.Forms.TableLayoutPanel tableOptions;
     76    private System.Windows.Forms.GroupBox groupBox1;
    6077  }
    6178}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/JsonItemBaseControl.Designer.cs

    r17473 r17828  
    3030      this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
    3131      this.textBoxDescription = new System.Windows.Forms.TextBox();
    32       this.checkBoxActive = new System.Windows.Forms.CheckBox();
    3332      this.label1 = new System.Windows.Forms.Label();
    3433      this.labelDescription = new System.Windows.Forms.Label();
    35       this.labelEnable = new System.Windows.Forms.Label();
    3634      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    3735      this.tableLayoutPanel1.SuspendLayout();
     
    4846      this.textBoxName.Dock = System.Windows.Forms.DockStyle.Fill;
    4947      this.errorProvider.SetIconAlignment(this.textBoxName, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    50       this.textBoxName.Location = new System.Drawing.Point(100, 25);
    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);
    5250      this.textBoxName.Name = "textBoxName";
    5351      this.textBoxName.Size = new System.Drawing.Size(394, 20);
     
    6563      this.tableLayoutPanel1.Name = "tableLayoutPanel1";
    6664      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));
    6866      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));
    7167      this.tableLayoutPanel1.Size = new System.Drawing.Size(494, 594);
    7268      this.tableLayoutPanel1.TabIndex = 16;
     
    7773      this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
    7874      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);
    8679      this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill;
    8780      this.tableLayoutPanel5.Location = new System.Drawing.Point(0, 0);
    8881      this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0);
    8982      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);
    9588      this.tableLayoutPanel5.TabIndex = 17;
    9689      //
     
    9891      //
    9992      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);
    10194      this.textBoxDescription.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0);
    10295      this.textBoxDescription.Name = "textBoxDescription";
     
    10497      this.textBoxDescription.TabIndex = 14;
    10598      //
    106       // checkBoxActive
    107       //
    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       //
    11799      // label1
    118100      //
    119101      this.label1.AutoSize = true;
    120102      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);
    122104      this.label1.Margin = new System.Windows.Forms.Padding(0);
    123105      this.label1.Name = "label1";
     
    131113      this.labelDescription.AutoSize = true;
    132114      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);
    134116      this.labelDescription.Margin = new System.Windows.Forms.Padding(0);
    135117      this.labelDescription.Name = "labelDescription";
     
    138120      this.labelDescription.Text = "Description";
    139121      this.labelDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
    140       //
    141       // labelEnable
    142       //
    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;
    152122      //
    153123      // JsonItemBaseControl
     
    170140    #endregion
    171141    protected System.Windows.Forms.ErrorProvider errorProvider;
    172     protected System.Windows.Forms.Label labelEnable;
    173     protected System.Windows.Forms.CheckBox checkBoxActive;
    174142    protected System.Windows.Forms.TextBox textBoxName;
    175143    protected System.Windows.Forms.Label label1;
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/JsonItemBaseControl.cs

    r17471 r17828  
    2626      InitializeComponent();
    2727      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      }
    3133      Init();
    3234    }
    3335
    3436    private void Init() {
    35       checkBoxActive.DataBindings.Add("Checked", VM, nameof(IJsonItemVM.Selected),
    36         false, DataSourceUpdateMode.OnPropertyChanged);
    3737      textBoxName.DataBindings.Add("Text", VM, nameof(IJsonItemVM.Name));
    3838      textBoxDescription.DataBindings.Add("Text", VM, nameof(IJsonItemVM.Description));
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/NumericRangeControl.Designer.cs

    r17471 r17828  
    2626      this.components = new System.ComponentModel.Container();
    2727      this.groupBox2 = new System.Windows.Forms.GroupBox();
    28       this.checkBoxTo = new System.Windows.Forms.CheckBox();
     28      this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
    2929      this.textBoxTo = new System.Windows.Forms.TextBox();
    30       this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    3130      this.textBoxFrom = new System.Windows.Forms.TextBox();
    3231      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();
    3435      this.groupBox2.SuspendLayout();
     36      this.tableLayoutPanel2.SuspendLayout();
    3537      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    36       this.tableLayoutPanel2.SuspendLayout();
     38      this.tableLayoutPanel1.SuspendLayout();
    3739      this.SuspendLayout();
    3840      //
     
    4951      this.groupBox2.Text = "Range";
    5052      //
    51       // checkBoxTo
     53      // tableLayoutPanel2
    5254      //
    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;
    6272      //
    6373      // textBoxTo
     
    7282      this.textBoxTo.TabIndex = 6;
    7383      this.textBoxTo.Validating += new System.ComponentModel.CancelEventHandler(this.textBoxTo_Validating);
    74       //
    75       // errorProvider
    76       //
    77       this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
    78       this.errorProvider.ContainerControl = this;
    7984      //
    8085      // textBoxFrom
     
    102107      this.checkBoxFrom.UseVisualStyleBackColor = true;
    103108      //
    104       // tableLayoutPanel2
     109      // checkBoxTo
    105110      //
    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;
    122139      //
    123140      // NumericRangeControl
     
    125142      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    126143      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    127       this.Controls.Add(this.groupBox2);
     144      this.Controls.Add(this.tableLayoutPanel1);
    128145      this.Name = "NumericRangeControl";
    129146      this.Size = new System.Drawing.Size(526, 63);
    130147      this.groupBox2.ResumeLayout(false);
    131       ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    132148      this.tableLayoutPanel2.ResumeLayout(false);
    133149      this.tableLayoutPanel2.PerformLayout();
     150      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     151      this.tableLayoutPanel1.ResumeLayout(false);
    134152      this.ResumeLayout(false);
    135153
     
    144162    private System.Windows.Forms.TextBox textBoxFrom;
    145163    private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
     164    private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
    146165  }
    147166}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Shared/NumericRangeControl.cs

    r17444 r17828  
    5151      }
    5252    }
     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    }
    5364  }
    5465}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/ArrayValueVM.cs

    r17519 r17828  
    99namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    1010
    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 
    3711  public abstract class ArrayValueVM<T, JsonItemType> : RangedValueBaseVM<T, JsonItemType>, IArrayJsonItemVM
    3812    where T : IComparable
    3913    where JsonItemType : class, IArrayJsonItem, IIntervalRestrictedJsonItem<T> {
    40    
     14
     15    public override UserControl Control => CompoundControl.Create(base.Control, ArrayJsonItemControl.Create(this));
     16
    4117    public ArrayValueVM() { }
    4218   
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/DoubleVMs.cs

    r17519 r17828  
    88namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    99  public class DoubleRangeVM : RangeVM<double, DoubleRangeJsonItem> {
    10 
    1110    protected override double MinTypeValue => double.MinValue;
    12 
    1311    protected override double MaxTypeValue => double.MaxValue;
    14 
    15     public override UserControl Control =>
    16       new JsonItemRangeControl(this);
    1712  }
    1813
    1914  public class DoubleArrayValueVM : ArrayValueVM<double, DoubleArrayJsonItem> {
    20 
    2115    protected override double MinTypeValue => double.MinValue;
    22 
    2316    protected override double MaxTypeValue => double.MaxValue;
    24 
    25     public override UserControl Control =>
    26       new JsonItemDoubleArrayValueControl(this);
    27 
    2817    public override double[] Value {
    2918      get => Item.Value;
     
    3625
    3726  public class DoubleMatrixValueVM : MatrixValueVM<double, DoubleMatrixJsonItem> {
    38     public override UserControl Control =>
    39       new JsonItemDoubleMatrixValueControl(this);
    40 
    4127    public override double[][] Value {
    4228      get => Item.Value;
     
    4632      }
    4733    }
    48 
    4934    protected override double MinTypeValue => double.MinValue;
    50 
    5135    protected override double MaxTypeValue => double.MaxValue;
    5236  }
    5337
    5438  public class DoubleValueVM : SingleValueVM<double, DoubleJsonItem> {
    55 
    5639    protected override double MinTypeValue => double.MinValue;
    5740    protected override double MaxTypeValue => double.MaxValue;
    58 
    59     public override UserControl Control =>
    60        new JsonItemDoubleValueControl(this);
    6141  }
    6242}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/IntVMs.cs

    r17519 r17828  
    88namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    99  public class IntArrayValueVM : ArrayValueVM<int, IntArrayJsonItem> {
    10 
    1110    protected override int MinTypeValue => int.MinValue;
    12 
    1311    protected override int MaxTypeValue => int.MaxValue;
    14 
    15     public override UserControl Control =>
    16       new JsonItemBaseControl(this, new JsonItemIntArrayValueControl(this));
    1712
    1813    public override int[] Value {
     
    2621
    2722  public class IntRangeVM : RangeVM<int, IntRangeJsonItem> {
    28 
    2923    protected override int MinTypeValue => int.MinValue;
    30 
    3124    protected override int MaxTypeValue => int.MaxValue;
    32 
    33     public override UserControl Control =>
    34       new JsonItemRangeControl(this);
    3525  }
    3626
    3727  public class IntValueVM : SingleValueVM<int, IntJsonItem> {
    38 
    3928    protected override int MinTypeValue => int.MinValue;
    4029    protected override int MaxTypeValue => int.MaxValue;
    41 
    42     public override UserControl Control =>
    43       new JsonItemIntValueControl(this);
    4430  }
    4531
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVMBase.cs

    r17519 r17828  
    99
    1010namespace 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>
    1212    where JsonItemType : class, IJsonItem
    1313  {
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/LookupJsonItemVM.cs

    r17519 r17828  
    88namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    99  public class LookupJsonItemVM : JsonItemVMBase<LookupJsonItem>, ILookupJsonItemVM {
    10 
    11     public override UserControl Control => new LookupJsonItemControl(this);
    12 
     10    public override UserControl Control => null;
    1311    public string ActualName {
    1412      get => Item.ActualName;
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/MatrixValueVM.cs

    r17519 r17828  
    1313    where T : IComparable
    1414    where JsonItemType : class, IMatrixJsonItem, IIntervalRestrictedJsonItem<T> {
     15
     16    public override UserControl Control => CompoundControl.Create(base.Control, MatrixJsonItemControl.Create(this));
     17
    1518    public abstract T[][] Value { get; set; }
    1619    public bool RowsResizable {
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/RangedValueBaseVM.cs

    r17473 r17828  
    44using System.Text;
    55using System.Threading.Tasks;
     6using System.Windows.Forms;
    67
    78namespace HeuristicLab.JsonInterface.OptimizerIntegration {
     
    1112    where JsonItemType : class, IIntervalRestrictedJsonItem<T>
    1213  {
     14    public override UserControl Control => NumericRangeControl.Create(this);
     15
    1316    public T MinRange {
    1417      get => Item.Minimum;
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/SingleValueVM.cs

    r17519 r17828  
    1919    }
    2020   
    21     public override UserControl Control =>
    22        new JsonItemBoolControl(this);
     21    public override UserControl Control => null;
    2322  }
    2423
  • 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;
     1using System.Linq;
    82
    93namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    10   public class StringValueVM : JsonItemVMBase<StringJsonItem> {
    11     public override UserControl Control =>
    12        new JsonItemValidValuesControl(this);
    134
    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();
    217
    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);
    389  }
    3910
    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();
    4313
    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));
    5915  }
    6016}
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.Designer.cs

    r17481 r17828  
    249249      this.Name = "ExportJsonDialog";
    250250      this.RightToLeft = System.Windows.Forms.RightToLeft.No;
    251       this.ShowIcon = false;
    252251      this.Text = "Export Json";
    253252      this.groupBoxDetails.ResumeLayout(false);
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs

    r17601 r17828  
    4040
    4141        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        }
    5153      }
    5254    }
     
    6264    public ExportJsonDialog() {
    6365      InitializeComponent();
     66      this.Icon = HeuristicLab.Common.Resources.HeuristicLab.Icon;
    6467      InitCache();
    6568    }
    6669
    6770    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      }
    7075
    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);
    9081          Close();
     82        } catch (Exception ex) {
     83          ErrorHandling.ShowErrorDialog(this, ex);
    9184        }
    9285      }
     
    9891        foreach (var c in item.Children) {
    9992          if (IsDrawableItem(c)) {
     93            TreeNode childNode = new TreeNode(c.Name);
    10094            if (c is IResultJsonItem) {
    101               TreeNode childNode = new TreeNode(c.Name);
    10295              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;             
    10798            } else {
    108               TreeNode childNode = new TreeNode(c.Name);
    10999              node.Nodes.Add(childNode);
    110100              BuildTreeNode(childNode, c);
     
    115105    }
    116106
    117     private void RegisterItem(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)) {
    119109        IJsonItemVM vm = (IJsonItemVM)Activator.CreateInstance(vmType);
    120110
     
    128118        UserControl control = new JsonItemBaseControl(vm, vm.Control);
    129119        Node2Control.Add(node, control);
     120        return vm;
    130121      } else {
    131122        node.ForeColor = Color.LightGray;
    132123        node.NodeFont = new Font(SystemFonts.DialogFont, FontStyle.Italic);
    133124      }
     125      return null;
    134126    }
    135127
     
    142134      }
    143135     
    144       return b || !(item is EmptyJsonItem);
     136      return b || !(item is EmptyJsonItem) || !(item is UnsupportedJsonItem);
    145137    }
    146138   
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ValueLookupJsonItemControl.cs

    r17473 r17828  
    1111
    1212namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    13   public partial class ValueLookupJsonItemControl : LookupJsonItemControl {
     13  public partial class ValueLookupJsonItemControl : UserControl {
    1414    private static IDictionary<Type, Type> JI2VM { get; set; }
    1515
    16     public ValueLookupJsonItemControl(IValueLookupJsonItemVM vm) : base(vm) {
     16    public ValueLookupJsonItemControl(IValueLookupJsonItemVM vm) {
    1717      InitializeComponent();
    1818      InitCache();
     
    2222        content.Controls.Clear();
    2323        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        }
    2728      }
    2829    }
Note: See TracChangeset for help on using the changeset viewer.