Changeset 5660


Ignore:
Timestamp:
03/10/11 13:00:48 (2 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

Location:
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3
Files:
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/HeuristicLab.Clients.OKB-3.3.csproj

    r5647 r5660  
    305305      <DependentUpon>OKBAlgorithmView.cs</DependentUpon> 
    306306    </Compile> 
    307     <Compile Include="RunCreation\Views\ProblemView.cs"> 
    308       <SubType>UserControl</SubType> 
    309     </Compile> 
    310     <Compile Include="RunCreation\Views\ProblemView.Designer.cs"> 
    311       <DependentUpon>ProblemView.cs</DependentUpon> 
     307    <Compile Include="RunCreation\Views\OKBProblemView.cs"> 
     308      <SubType>UserControl</SubType> 
     309    </Compile> 
     310    <Compile Include="RunCreation\Views\OKBProblemView.Designer.cs"> 
     311      <DependentUpon>OKBProblemView.cs</DependentUpon> 
    312312    </Compile> 
    313313    <None Include="app.config" /> 
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/Views/OKBAlgorithmView.Designer.cs

    r5647 r5660  
    5757      this.algorithmLabel = new System.Windows.Forms.Label(); 
    5858      this.refreshButton = new System.Windows.Forms.Button(); 
     59      this.cloneAlgorithmButton = new System.Windows.Forms.Button(); 
    5960      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 
    6061      this.tabControl.SuspendLayout(); 
     
    7172      this.nameTextBox.Location = new System.Drawing.Point(72, 29); 
    7273      this.nameTextBox.Size = new System.Drawing.Size(607, 20); 
    73       this.nameTextBox.TabIndex = 4; 
     74      this.nameTextBox.TabIndex = 5; 
    7475      //  
    7576      // nameLabel 
    7677      //  
    7778      this.nameLabel.Location = new System.Drawing.Point(3, 32); 
    78       this.nameLabel.TabIndex = 3; 
     79      this.nameLabel.TabIndex = 4; 
    7980      //  
    8081      // descriptionLabel 
    8182      //  
    8283      this.descriptionLabel.Location = new System.Drawing.Point(3, 58); 
    83       this.descriptionLabel.TabIndex = 5; 
     84      this.descriptionLabel.TabIndex = 6; 
    8485      //  
    8586      // descriptionTextBox 
     
    8788      this.descriptionTextBox.Location = new System.Drawing.Point(72, 55); 
    8889      this.descriptionTextBox.Size = new System.Drawing.Size(607, 20); 
    89       this.descriptionTextBox.TabIndex = 6; 
     90      this.descriptionTextBox.TabIndex = 7; 
    9091      //  
    9192      // tabControl 
     
    103104      this.tabControl.SelectedIndex = 0; 
    104105      this.tabControl.Size = new System.Drawing.Size(679, 371); 
    105       this.tabControl.TabIndex = 7; 
     106      this.tabControl.TabIndex = 8; 
    106107      //  
    107108      // problemTabPage 
     
    256257      this.startButton.Name = "startButton"; 
    257258      this.startButton.Size = new System.Drawing.Size(24, 24); 
    258       this.startButton.TabIndex = 8; 
     259      this.startButton.TabIndex = 9; 
    259260      this.toolTip.SetToolTip(this.startButton, "Start/Resume Algorithm"); 
    260261      this.startButton.UseVisualStyleBackColor = true; 
     
    268269      this.pauseButton.Name = "pauseButton"; 
    269270      this.pauseButton.Size = new System.Drawing.Size(24, 24); 
    270       this.pauseButton.TabIndex = 9; 
     271      this.pauseButton.TabIndex = 10; 
    271272      this.toolTip.SetToolTip(this.pauseButton, "Pause Algorithm"); 
    272273      this.pauseButton.UseVisualStyleBackColor = true; 
     
    280281      this.resetButton.Name = "resetButton"; 
    281282      this.resetButton.Size = new System.Drawing.Size(24, 24); 
    282       this.resetButton.TabIndex = 11; 
     283      this.resetButton.TabIndex = 12; 
    283284      this.toolTip.SetToolTip(this.resetButton, "Reset Algorithm"); 
    284285      this.resetButton.UseVisualStyleBackColor = true; 
     
    292293      this.executionTimeLabel.Name = "executionTimeLabel"; 
    293294      this.executionTimeLabel.Size = new System.Drawing.Size(83, 13); 
    294       this.executionTimeLabel.TabIndex = 12; 
     295      this.executionTimeLabel.TabIndex = 13; 
    295296      this.executionTimeLabel.Text = "&Execution Time:"; 
    296297      //  
     
    302303      this.executionTimeTextBox.ReadOnly = true; 
    303304      this.executionTimeTextBox.Size = new System.Drawing.Size(137, 20); 
    304       this.executionTimeTextBox.TabIndex = 13; 
     305      this.executionTimeTextBox.TabIndex = 14; 
    305306      //  
    306307      // openFileDialog 
     
    318319      this.stopButton.Name = "stopButton"; 
    319320      this.stopButton.Size = new System.Drawing.Size(24, 24); 
    320       this.stopButton.TabIndex = 10; 
     321      this.stopButton.TabIndex = 11; 
    321322      this.toolTip.SetToolTip(this.stopButton, "Stop Algorithm"); 
    322323      this.stopButton.UseVisualStyleBackColor = true; 
     
    331332      this.algorithmComboBox.Location = new System.Drawing.Point(72, 0); 
    332333      this.algorithmComboBox.Name = "algorithmComboBox"; 
    333       this.algorithmComboBox.Size = new System.Drawing.Size(577, 21); 
     334      this.algorithmComboBox.Size = new System.Drawing.Size(547, 21); 
    334335      this.algorithmComboBox.TabIndex = 1; 
    335336      this.algorithmComboBox.SelectedValueChanged += new System.EventHandler(this.algorithmComboBox_SelectedValueChanged); 
     
    351352      this.refreshButton.Name = "refreshButton"; 
    352353      this.refreshButton.Size = new System.Drawing.Size(24, 24); 
    353       this.refreshButton.TabIndex = 2; 
     354      this.refreshButton.TabIndex = 3; 
    354355      this.toolTip.SetToolTip(this.refreshButton, "Refresh Algorithms"); 
    355356      this.refreshButton.UseVisualStyleBackColor = true; 
    356357      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); 
    357358      //  
    358       // AlgorithmView 
     359      // cloneAlgorithmButton 
     360      //  
     361      this.cloneAlgorithmButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 
     362      this.cloneAlgorithmButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Clone; 
     363      this.cloneAlgorithmButton.Location = new System.Drawing.Point(625, -1); 
     364      this.cloneAlgorithmButton.Name = "cloneAlgorithmButton"; 
     365      this.cloneAlgorithmButton.Size = new System.Drawing.Size(24, 24); 
     366      this.cloneAlgorithmButton.TabIndex = 2; 
     367      this.toolTip.SetToolTip(this.cloneAlgorithmButton, "Clone Algorithm"); 
     368      this.cloneAlgorithmButton.UseVisualStyleBackColor = true; 
     369      this.cloneAlgorithmButton.Click += new System.EventHandler(this.cloneAlgorithmButton_Click); 
     370      //  
     371      // OKBAlgorithmView 
    359372      //  
    360373      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 
     
    362375      this.Controls.Add(this.algorithmComboBox); 
    363376      this.Controls.Add(this.algorithmLabel); 
     377      this.Controls.Add(this.cloneAlgorithmButton); 
    364378      this.Controls.Add(this.refreshButton); 
    365379      this.Controls.Add(this.tabControl); 
     
    370384      this.Controls.Add(this.stopButton); 
    371385      this.Controls.Add(this.resetButton); 
    372       this.Name = "AlgorithmView"; 
     386      this.Name = "OKBAlgorithmView"; 
    373387      this.Size = new System.Drawing.Size(679, 482); 
    374388      this.Controls.SetChildIndex(this.resetButton, 0); 
     
    384398      this.Controls.SetChildIndex(this.tabControl, 0); 
    385399      this.Controls.SetChildIndex(this.refreshButton, 0); 
     400      this.Controls.SetChildIndex(this.cloneAlgorithmButton, 0); 
    386401      this.Controls.SetChildIndex(this.algorithmLabel, 0); 
    387402      this.Controls.SetChildIndex(this.algorithmComboBox, 0); 
     
    422437    private System.Windows.Forms.Label algorithmLabel; 
    423438    private System.Windows.Forms.Button refreshButton; 
     439    private System.Windows.Forms.Button cloneAlgorithmButton; 
    424440  } 
    425441} 
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/Views/OKBAlgorithmView.cs

    r5647 r5660  
    124124      base.SetEnabledStateOfControls(); 
    125125      algorithmComboBox.Enabled = (Content != null) && !ReadOnly && !Locked && (algorithmComboBox.Items.Count > 0); 
     126      cloneAlgorithmButton.Enabled = (Content != null) && (Content.Problem != null) && !ReadOnly && !Locked; 
    126127      refreshButton.Enabled = (Content != null) && !ReadOnly && !Locked; 
    127128      parameterCollectionView.Enabled = Content != null; 
     
    246247 
    247248    #region Control Events 
     249    private void cloneAlgorithmButton_Click(object sender, EventArgs e) { 
     250      MainFormManager.MainForm.ShowContent((IContent)Content.Algorithm.Clone()); 
     251    } 
    248252    private void refreshButton_Click(object sender, System.EventArgs e) { 
    249253      RunCreationClient.Instance.Refresh(); 
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/Views/OKBProblemView.Designer.cs

    r5647 r5660  
    4848      this.problemLabel = new System.Windows.Forms.Label(); 
    4949      this.refreshButton = new System.Windows.Forms.Button(); 
     50      this.cloneProblemButton = new System.Windows.Forms.Button(); 
     51      this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 
     52      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 
    5053      this.SuspendLayout(); 
     54      //  
     55      // parameterCollectionView 
     56      //  
     57      this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     58                  | System.Windows.Forms.AnchorStyles.Left) 
     59                  | System.Windows.Forms.AnchorStyles.Right))); 
     60      this.parameterCollectionView.Content = null; 
     61      this.parameterCollectionView.Location = new System.Drawing.Point(0, 79); 
     62      this.parameterCollectionView.Name = "parameterCollectionView"; 
     63      this.parameterCollectionView.Size = new System.Drawing.Size(706, 314); 
     64      this.parameterCollectionView.TabIndex = 8; 
     65      //  
     66      // nameTextBox 
     67      //  
     68      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 
     69      this.errorProvider.SetIconPadding(this.nameTextBox, 2); 
     70      this.nameTextBox.Location = new System.Drawing.Point(72, 27); 
     71      this.nameTextBox.Size = new System.Drawing.Size(634, 20); 
     72      this.nameTextBox.TabIndex = 5; 
     73      //  
     74      // nameLabel 
     75      //  
     76      this.nameLabel.Location = new System.Drawing.Point(3, 30); 
     77      this.nameLabel.TabIndex = 4; 
     78      //  
     79      // descriptionLabel 
     80      //  
     81      this.descriptionLabel.Location = new System.Drawing.Point(3, 56); 
     82      this.descriptionLabel.TabIndex = 6; 
     83      //  
     84      // descriptionTextBox 
     85      //  
     86      this.descriptionTextBox.Location = new System.Drawing.Point(72, 53); 
     87      this.descriptionTextBox.Size = new System.Drawing.Size(634, 20); 
     88      this.descriptionTextBox.TabIndex = 7; 
    5189      //  
    5290      // problemComboBox 
     
    5694      this.problemComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 
    5795      this.problemComboBox.FormattingEnabled = true; 
    58       this.problemComboBox.Location = new System.Drawing.Point(57, 0); 
     96      this.problemComboBox.Location = new System.Drawing.Point(72, 0); 
    5997      this.problemComboBox.Name = "problemComboBox"; 
    60       this.problemComboBox.Size = new System.Drawing.Size(619, 21); 
    61       this.problemComboBox.TabIndex = 4; 
     98      this.problemComboBox.Size = new System.Drawing.Size(574, 21); 
     99      this.problemComboBox.TabIndex = 1; 
     100      this.problemComboBox.SelectedValueChanged += new System.EventHandler(this.problemComboBox_SelectedValueChanged); 
    62101      //  
    63102      // problemLabel 
     
    67106      this.problemLabel.Name = "problemLabel"; 
    68107      this.problemLabel.Size = new System.Drawing.Size(48, 13); 
    69       this.problemLabel.TabIndex = 3; 
     108      this.problemLabel.TabIndex = 0; 
    70109      this.problemLabel.Text = "&Problem:"; 
    71110      //  
     
    73112      //  
    74113      this.refreshButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 
     114      this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh; 
    75115      this.refreshButton.Location = new System.Drawing.Point(682, -1); 
    76116      this.refreshButton.Name = "refreshButton"; 
    77117      this.refreshButton.Size = new System.Drawing.Size(24, 24); 
    78       this.refreshButton.TabIndex = 5; 
     118      this.refreshButton.TabIndex = 3; 
     119      this.toolTip.SetToolTip(this.refreshButton, "Refresh Problems"); 
    79120      this.refreshButton.UseVisualStyleBackColor = true; 
    80121      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); 
     122      //  
     123      // cloneProblemButton 
     124      //  
     125      this.cloneProblemButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 
     126      this.cloneProblemButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Clone; 
     127      this.cloneProblemButton.Location = new System.Drawing.Point(652, -1); 
     128      this.cloneProblemButton.Name = "cloneProblemButton"; 
     129      this.cloneProblemButton.Size = new System.Drawing.Size(24, 24); 
     130      this.cloneProblemButton.TabIndex = 2; 
     131      this.toolTip.SetToolTip(this.cloneProblemButton, "Clone Problem"); 
     132      this.cloneProblemButton.UseVisualStyleBackColor = true; 
     133      this.cloneProblemButton.Click += new System.EventHandler(this.cloneProblemButton_Click); 
    81134      //  
    82135      // OKBProblemView 
     
    86139      this.Controls.Add(this.problemComboBox); 
    87140      this.Controls.Add(this.problemLabel); 
     141      this.Controls.Add(this.cloneProblemButton); 
    88142      this.Controls.Add(this.refreshButton); 
     143      this.Controls.Add(this.parameterCollectionView); 
    89144      this.Name = "OKBProblemView"; 
    90145      this.Size = new System.Drawing.Size(706, 393); 
     146      this.Controls.SetChildIndex(this.refreshButton, 0); 
     147      this.Controls.SetChildIndex(this.cloneProblemButton, 0); 
     148      this.Controls.SetChildIndex(this.problemLabel, 0); 
     149      this.Controls.SetChildIndex(this.descriptionLabel, 0); 
     150      this.Controls.SetChildIndex(this.parameterCollectionView, 0); 
     151      this.Controls.SetChildIndex(this.nameTextBox, 0); 
     152      this.Controls.SetChildIndex(this.descriptionTextBox, 0); 
     153      this.Controls.SetChildIndex(this.nameLabel, 0); 
     154      this.Controls.SetChildIndex(this.problemComboBox, 0); 
     155      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 
    91156      this.ResumeLayout(false); 
    92157      this.PerformLayout(); 
     
    99164    private System.Windows.Forms.Label problemLabel; 
    100165    private System.Windows.Forms.Button refreshButton; 
     166    private System.Windows.Forms.Button cloneProblemButton; 
     167    private HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView; 
    101168 
    102169 
  • branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/RunCreation/Views/OKBProblemView.cs

    r5647 r5660  
    2020#endregion 
    2121 
     22using System; 
     23using System.Linq; 
     24using System.Windows.Forms; 
     25using HeuristicLab.Common; 
    2226using HeuristicLab.Core.Views; 
    2327using HeuristicLab.MainForm; 
     
    2630  [View("OKBProblem View")] 
    2731  [Content(typeof(OKBProblem), true)] 
    28   public partial class OKBProblemView : ParameterizedNamedItemView { 
     32  public partial class OKBProblemView : NamedItemView { 
    2933    public new OKBProblem Content { 
    3034      get { return (OKBProblem)base.Content; } 
     
    3640    } 
    3741 
     42    protected override void OnInitialized(System.EventArgs e) { 
     43      base.OnInitialized(e); 
     44      RunCreationClient.Instance.Refreshing += new EventHandler(RunCreationClient_Refreshing); 
     45      RunCreationClient.Instance.Refreshed += new EventHandler(RunCreationClient_Refreshed); 
     46      PopulateComboBox(); 
     47    } 
     48 
     49    protected override void DeregisterContentEvents() { 
     50      Content.ProblemChanged -= new EventHandler(Content_ProblemChanged); 
     51      base.DeregisterContentEvents(); 
     52    } 
     53    protected override void RegisterContentEvents() { 
     54      base.RegisterContentEvents(); 
     55      Content.ProblemChanged += new EventHandler(Content_ProblemChanged); 
     56    } 
     57 
    3858    protected override void OnContentChanged() { 
    3959      base.OnContentChanged(); 
     60      if (Content == null) { 
     61        problemComboBox.SelectedIndex = -1; 
     62        parameterCollectionView.Content = null; 
     63      } else { 
     64        problemComboBox.SelectedItem = RunCreationClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId); 
     65        parameterCollectionView.Content = Content.Parameters; 
     66      } 
    4067    } 
    4168 
     69    protected override void SetEnabledStateOfControls() { 
     70      base.SetEnabledStateOfControls(); 
     71      problemComboBox.Enabled = (Content != null) && !ReadOnly && !Locked && (problemComboBox.Items.Count > 0); 
     72      cloneProblemButton.Enabled = (Content != null) && (Content.Problem != null) && !ReadOnly && !Locked; 
     73      refreshButton.Enabled = (Content != null) && !ReadOnly && !Locked; 
     74      parameterCollectionView.Enabled = Content != null; 
     75    } 
     76 
     77    protected override void OnClosed(FormClosedEventArgs e) { 
     78      RunCreationClient.Instance.Refreshing -= new EventHandler(RunCreationClient_Refreshing); 
     79      RunCreationClient.Instance.Refreshed -= new EventHandler(RunCreationClient_Refreshed); 
     80      base.OnClosed(e); 
     81    } 
     82 
     83    private void RunCreationClient_Refreshing(object sender, EventArgs e) { 
     84      if (InvokeRequired) { 
     85        Invoke(new EventHandler(RunCreationClient_Refreshing), sender, e); 
     86      } else { 
     87        Cursor = Cursors.AppStarting; 
     88        problemComboBox.Enabled = refreshButton.Enabled = false; 
     89      } 
     90    } 
     91    private void RunCreationClient_Refreshed(object sender, EventArgs e) { 
     92      if (InvokeRequired) { 
     93        Invoke(new EventHandler(RunCreationClient_Refreshed), sender, e); 
     94      } else { 
     95        PopulateComboBox(); 
     96        SetEnabledStateOfControls(); 
     97        Cursor = Cursors.Default; 
     98      } 
     99    } 
     100 
     101    #region Content Events 
     102    private void Content_ProblemChanged(object sender, EventArgs e) { 
     103      if (InvokeRequired) 
     104        Invoke(new EventHandler(Content_ProblemChanged), sender, e); 
     105      else { 
     106        problemComboBox.SelectedItem = RunCreationClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId); 
     107      } 
     108    } 
     109    #endregion 
     110 
     111    #region Control Events 
     112    private void cloneProblemButton_Click(object sender, EventArgs e) { 
     113      MainFormManager.MainForm.ShowContent((IContent)Content.Problem.Clone()); 
     114    } 
    42115    private void refreshButton_Click(object sender, System.EventArgs e) { 
     116      RunCreationClient.Instance.Refresh(); 
     117    } 
     118    private void problemComboBox_SelectedValueChanged(object sender, System.EventArgs e) { 
     119      Problem problem = problemComboBox.SelectedValue as Problem; 
     120      if ((problem != null) && (Content != null)) { 
     121        Content.Load(problem.Id); 
     122        if (Content.ProblemId != problem.Id)  // reset selected item if load was not successful 
     123          problemComboBox.SelectedItem = RunCreationClient.Instance.Problems.FirstOrDefault(x => x.Id == Content.ProblemId); 
     124      } 
     125    } 
     126    #endregion 
    43127 
     128    #region Helpers 
     129    private void PopulateComboBox() { 
     130      problemComboBox.DataSource = null; 
     131      problemComboBox.DataSource = RunCreationClient.Instance.Problems.ToList(); 
     132      problemComboBox.DisplayMember = "Name"; 
    44133    } 
     134    #endregion 
    45135  } 
    46136} 
Note: See TracChangeset for help on using the changeset viewer.