Ignore:
Timestamp:
01/17/16 20:06:18 (5 years ago)
Author:
abeham
Message:

#2560:

  • Updated clients (moving of all characteristic service methods to run creation service)
  • Adapted OKB problem view to display characteristic values for the instances
Location:
trunk/sources/HeuristicLab.Clients.OKB.Views/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/HeuristicLab.Clients.OKB.Views-3.3.csproj

    r11623 r13534  
    333333      <Private>False</Private>
    334334    </ProjectReference>
     335    <ProjectReference Include="..\..\HeuristicLab.Data.Views\3.3\HeuristicLab.Data.Views-3.3.csproj">
     336      <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project>
     337      <Name>HeuristicLab.Data.Views-3.3</Name>
     338    </ProjectReference>
    335339    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    336340      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
  • trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.Designer.cs

    r12012 r13534  
    4949      this.refreshButton = new System.Windows.Forms.Button();
    5050      this.cloneProblemButton = new System.Windows.Forms.Button();
     51      this.tabControl = new System.Windows.Forms.TabControl();
     52      this.parametersTabPage = new System.Windows.Forms.TabPage();
     53      this.characteristicsTabPage = new System.Windows.Forms.TabPage();
    5154      this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
     55      this.downloadCharacteristicsButton = new System.Windows.Forms.Button();
     56      this.uploadCharacteristicsButton = new System.Windows.Forms.Button();
     57      this.characteristicsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
    5258      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     59      this.tabControl.SuspendLayout();
     60      this.parametersTabPage.SuspendLayout();
     61      this.characteristicsTabPage.SuspendLayout();
    5362      this.SuspendLayout();
    5463      //
     
    7483      //
    7584      this.problemComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    76                   | System.Windows.Forms.AnchorStyles.Right)));
     85            | System.Windows.Forms.AnchorStyles.Right)));
    7786      this.problemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    7887      this.problemComboBox.FormattingEnabled = true;
     
    116125      this.cloneProblemButton.Click += new System.EventHandler(this.cloneProblemButton_Click);
    117126      //
     127      // tabControl
     128      //
     129      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     130            | System.Windows.Forms.AnchorStyles.Left)
     131            | System.Windows.Forms.AnchorStyles.Right)));
     132      this.tabControl.Controls.Add(this.parametersTabPage);
     133      this.tabControl.Controls.Add(this.characteristicsTabPage);
     134      this.tabControl.Location = new System.Drawing.Point(6, 53);
     135      this.tabControl.Name = "tabControl";
     136      this.tabControl.SelectedIndex = 0;
     137      this.tabControl.Size = new System.Drawing.Size(700, 340);
     138      this.tabControl.TabIndex = 8;
     139      //
     140      // parametersTabPage
     141      //
     142      this.parametersTabPage.Controls.Add(this.parameterCollectionView);
     143      this.parametersTabPage.Location = new System.Drawing.Point(4, 22);
     144      this.parametersTabPage.Name = "parametersTabPage";
     145      this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
     146      this.parametersTabPage.Size = new System.Drawing.Size(692, 314);
     147      this.parametersTabPage.TabIndex = 0;
     148      this.parametersTabPage.Text = "Parameters";
     149      this.parametersTabPage.UseVisualStyleBackColor = true;
     150      //
     151      // characteristicsTabPage
     152      //
     153      this.characteristicsTabPage.Controls.Add(this.characteristicsMatrixView);
     154      this.characteristicsTabPage.Controls.Add(this.uploadCharacteristicsButton);
     155      this.characteristicsTabPage.Controls.Add(this.downloadCharacteristicsButton);
     156      this.characteristicsTabPage.Location = new System.Drawing.Point(4, 22);
     157      this.characteristicsTabPage.Name = "characteristicsTabPage";
     158      this.characteristicsTabPage.Padding = new System.Windows.Forms.Padding(3);
     159      this.characteristicsTabPage.Size = new System.Drawing.Size(692, 314);
     160      this.characteristicsTabPage.TabIndex = 1;
     161      this.characteristicsTabPage.Text = "Characteristics";
     162      this.characteristicsTabPage.UseVisualStyleBackColor = true;
     163      //
    118164      // parameterCollectionView
    119165      //
    120166      this.parameterCollectionView.AllowEditingOfHiddenParameters = false;
    121       this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    122                   | System.Windows.Forms.AnchorStyles.Left)
    123                   | System.Windows.Forms.AnchorStyles.Right)));
    124167      this.parameterCollectionView.Caption = "ParameterCollection View";
    125168      this.parameterCollectionView.Content = null;
    126       this.parameterCollectionView.Location = new System.Drawing.Point(0, 53);
     169      this.parameterCollectionView.Dock = System.Windows.Forms.DockStyle.Fill;
     170      this.parameterCollectionView.Location = new System.Drawing.Point(3, 3);
    127171      this.parameterCollectionView.Name = "parameterCollectionView";
    128       this.parameterCollectionView.ReadOnly = false;
    129       this.parameterCollectionView.Size = new System.Drawing.Size(706, 340);
    130       this.parameterCollectionView.TabIndex = 7;
     172      this.parameterCollectionView.ReadOnly = true;
     173      this.parameterCollectionView.ShowDetails = true;
     174      this.parameterCollectionView.Size = new System.Drawing.Size(686, 308);
     175      this.parameterCollectionView.TabIndex = 8;
     176      //
     177      // downloadCharacteristicsButton
     178      //
     179      this.downloadCharacteristicsButton.Location = new System.Drawing.Point(6, 6);
     180      this.downloadCharacteristicsButton.Name = "downloadCharacteristicsButton";
     181      this.downloadCharacteristicsButton.Size = new System.Drawing.Size(26, 23);
     182      this.downloadCharacteristicsButton.TabIndex = 0;
     183      this.downloadCharacteristicsButton.Text = "Download";
     184      this.downloadCharacteristicsButton.UseVisualStyleBackColor = true;
     185      this.downloadCharacteristicsButton.Click += new System.EventHandler(this.downloadCharacteristicsButton_Click);
     186      //
     187      // uploadCharacteristicsButton
     188      //
     189      this.uploadCharacteristicsButton.Location = new System.Drawing.Point(38, 6);
     190      this.uploadCharacteristicsButton.Name = "uploadCharacteristicsButton";
     191      this.uploadCharacteristicsButton.Size = new System.Drawing.Size(26, 23);
     192      this.uploadCharacteristicsButton.TabIndex = 0;
     193      this.uploadCharacteristicsButton.Text = "Upload";
     194      this.uploadCharacteristicsButton.UseVisualStyleBackColor = true;
     195      this.uploadCharacteristicsButton.Click += new System.EventHandler(this.uploadCharacteristicsButton_Click);
     196      //
     197      // characteristicsMatrixView
     198      //
     199      this.characteristicsMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     200            | System.Windows.Forms.AnchorStyles.Left)
     201            | System.Windows.Forms.AnchorStyles.Right)));
     202      this.characteristicsMatrixView.Caption = "StringConvertibleMatrix View";
     203      this.characteristicsMatrixView.Content = null;
     204      this.characteristicsMatrixView.Location = new System.Drawing.Point(6, 35);
     205      this.characteristicsMatrixView.Name = "characteristicsMatrixView";
     206      this.characteristicsMatrixView.ReadOnly = false;
     207      this.characteristicsMatrixView.ShowRowsAndColumnsTextBox = false;
     208      this.characteristicsMatrixView.ShowStatisticalInformation = false;
     209      this.characteristicsMatrixView.Size = new System.Drawing.Size(680, 273);
     210      this.characteristicsMatrixView.TabIndex = 1;
    131211      //
    132212      // OKBProblemView
     
    134214      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    135215      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     216      this.Controls.Add(this.tabControl);
    136217      this.Controls.Add(this.problemComboBox);
    137       this.Controls.Add(this.parameterCollectionView);
    138218      this.Controls.Add(this.problemLabel);
    139219      this.Controls.Add(this.cloneProblemButton);
     
    144224      this.Controls.SetChildIndex(this.cloneProblemButton, 0);
    145225      this.Controls.SetChildIndex(this.problemLabel, 0);
    146       this.Controls.SetChildIndex(this.parameterCollectionView, 0);
     226      this.Controls.SetChildIndex(this.problemComboBox, 0);
     227      this.Controls.SetChildIndex(this.tabControl, 0);
    147228      this.Controls.SetChildIndex(this.nameTextBox, 0);
    148229      this.Controls.SetChildIndex(this.nameLabel, 0);
    149230      this.Controls.SetChildIndex(this.infoLabel, 0);
    150       this.Controls.SetChildIndex(this.problemComboBox, 0);
    151231      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
     232      this.tabControl.ResumeLayout(false);
     233      this.parametersTabPage.ResumeLayout(false);
     234      this.characteristicsTabPage.ResumeLayout(false);
    152235      this.ResumeLayout(false);
    153236      this.PerformLayout();
     
    161244    private System.Windows.Forms.Button refreshButton;
    162245    private System.Windows.Forms.Button cloneProblemButton;
    163     private HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView;
     246    private System.Windows.Forms.TabControl tabControl;
     247    private System.Windows.Forms.TabPage parametersTabPage;
     248    private System.Windows.Forms.TabPage characteristicsTabPage;
     249    private Core.Views.ParameterCollectionView parameterCollectionView;
     250    private Data.Views.StringConvertibleMatrixView characteristicsMatrixView;
     251    private System.Windows.Forms.Button uploadCharacteristicsButton;
     252    private System.Windows.Forms.Button downloadCharacteristicsButton;
    164253
    165254
  • trunk/sources/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBProblemView.cs

    r12012 r13534  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Linq;
    2425using System.Windows.Forms;
     26using HeuristicLab.Common.Resources;
    2527using HeuristicLab.Core.Views;
     28using HeuristicLab.Data;
    2629using HeuristicLab.MainForm;
    2730
     
    3841    public OKBProblemView() {
    3942      InitializeComponent();
     43      downloadCharacteristicsButton.Text = string.Empty;
     44      downloadCharacteristicsButton.Image = VSImageLibrary.Refresh;
     45      uploadCharacteristicsButton.Text = string.Empty;
     46      uploadCharacteristicsButton.Image = VSImageLibrary.PublishToWeb;
    4047    }
    4148
     
    7380      refreshButton.Enabled = (Content != null) && !ReadOnly && !Locked;
    7481      parameterCollectionView.Enabled = Content != null;
     82      characteristicsMatrixView.Enabled = Content != null;
     83      downloadCharacteristicsButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked;
     84      uploadCharacteristicsButton.Enabled = Content != null && Content.ProblemId != -1 && !Locked && !ReadOnly
     85        && characteristicsMatrixView.Content != null && characteristicsMatrixView.Content.Rows > 0;
    7586    }
    7687
     
    103114      if (InvokeRequired)
    104115        Invoke(new EventHandler(Content_ProblemChanged), sender, e);
    105       else
     116      else {
    106117        OnContentChanged();
     118        SetEnabledStateOfControls();
     119      }
    107120    }
    108121    #endregion
     
    123136      }
    124137    }
     138    private void downloadCharacteristicsButton_Click(object sender, EventArgs e) {
     139      var values = RunCreationClient.GetCharacteristicValues(Content.ProblemId).ToList();
     140      var content = new StringMatrix(values.Count, 3);
     141      for (var i = 0; i < values.Count; i++) {
     142        content[i, 0] = values[i].Name;
     143        content[i, 1] = values[i].ToString();
     144        content[i, 2] = values[i].GetType().Name;
     145      }
     146      characteristicsMatrixView.Content = content;
     147      SetEnabledStateOfControls();
     148    }
     149    private void uploadCharacteristicsButton_Click(object sender, EventArgs e) {
     150      var matrix = characteristicsMatrixView.Content as StringMatrix;
     151      if (matrix == null) return;
     152      var values = new List<Value>(matrix.Rows);
     153      for (var i = 0; i < matrix.Rows; i++) {
     154        var name = matrix[i, 0];
     155        var strValue = matrix[i, 1];
     156        var type = matrix[i, 2];
     157        values.Add(Value.Create(name, strValue, type));
     158      }
     159      try {
     160        RunCreationClient.SetCharacteristicValues(Content.ProblemId, values);
     161      } catch (Exception ex) { PluginInfrastructure.ErrorHandling.ShowErrorDialog(ex); }
     162    }
    125163    #endregion
    126164
Note: See TracChangeset for help on using the changeset viewer.