Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/10 14:36:22 (14 years ago)
Author:
mkommend
Message:
  • refactored ViewHost and various views to use fewer nested controls
  • added UnitTests for ContentViews to ensure proper using of the ContentAttribute
  • fixed some views which could not handle null as Content

(ticket #972)

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs

    r3764 r4011  
    5050      this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
    5151      this.problemTabPage = new System.Windows.Forms.TabPage();
    52       this.problemPanel = new System.Windows.Forms.Panel();
    5352      this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5453      this.openProblemButton = new System.Windows.Forms.Button();
     
    6968      this.parametersTabPage.SuspendLayout();
    7069      this.problemTabPage.SuspendLayout();
    71       this.problemPanel.SuspendLayout();
    7270      this.resultsTabPage.SuspendLayout();
    7371      this.runsTabPage.SuspendLayout();
     
    123121      // problemTabPage
    124122      //
    125       this.problemTabPage.Controls.Add(this.problemPanel);
     123      this.problemTabPage.Controls.Add(this.problemViewHost);
    126124      this.problemTabPage.Controls.Add(this.openProblemButton);
    127125      this.problemTabPage.Controls.Add(this.newProblemButton);
     
    134132      this.problemTabPage.UseVisualStyleBackColor = true;
    135133      //
    136       // problemPanel
    137       //
    138       this.problemPanel.AllowDrop = true;
    139       this.problemPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    140                   | System.Windows.Forms.AnchorStyles.Left)
    141                   | System.Windows.Forms.AnchorStyles.Right)));
    142       this.problemPanel.Controls.Add(this.problemViewHost);
    143       this.problemPanel.Location = new System.Drawing.Point(6, 36);
    144       this.problemPanel.Name = "problemPanel";
    145       this.problemPanel.Size = new System.Drawing.Size(659, 332);
    146       this.problemPanel.TabIndex = 3;
    147       this.problemPanel.DragOver += new System.Windows.Forms.DragEventHandler(this.problemPanel_DragEnterOver);
    148       this.problemPanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.problemPanel_DragDrop);
    149       this.problemPanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.problemPanel_DragEnterOver);
    150       //
    151134      // problemViewHost
    152135      //
     136      this.problemViewHost.AllowDrop = true;
    153137      this.problemViewHost.Content = null;
    154       this.problemViewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    155       this.problemViewHost.Location = new System.Drawing.Point(0, 0);
     138      this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     139                  | System.Windows.Forms.AnchorStyles.Left)
     140                  | System.Windows.Forms.AnchorStyles.Right)));
     141      this.problemViewHost.Location = new System.Drawing.Point(6, 36);
    156142      this.problemViewHost.Name = "problemViewHost";
    157143      this.problemViewHost.Size = new System.Drawing.Size(659, 332);
    158       this.problemViewHost.TabIndex = 0;
     144      this.problemViewHost.TabIndex = 3;
    159145      this.problemViewHost.ViewType = null;
     146      this.problemViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.problemViewHost_DragEnterOver);
     147      this.problemViewHost.DragDrop += new System.Windows.Forms.DragEventHandler(this.problemViewHost_DragDrop);
     148      this.problemViewHost.DragEnter += new System.Windows.Forms.DragEventHandler(this.problemViewHost_DragEnterOver);
    160149      //
    161150      // openProblemButton
     
    327316      this.parametersTabPage.ResumeLayout(false);
    328317      this.problemTabPage.ResumeLayout(false);
    329       this.problemPanel.ResumeLayout(false);
    330318      this.resultsTabPage.ResumeLayout(false);
    331319      this.runsTabPage.ResumeLayout(false);
     
    355343    protected System.Windows.Forms.TabPage runsTabPage;
    356344    protected RunCollectionView runsView;
    357     protected System.Windows.Forms.Panel problemPanel;
    358 
    359345  }
    360346}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs

    r3904 r4011  
    216216      Content.Prepare(false);
    217217    }
    218     protected virtual void problemPanel_DragEnterOver(object sender, DragEventArgs e) {
     218    protected virtual void problemViewHost_DragEnterOver(object sender, DragEventArgs e) {
    219219      e.Effect = DragDropEffects.None;
    220220      Type type = e.Data.GetData("Type") as Type;
     
    227227      }
    228228    }
    229     protected virtual void problemPanel_DragDrop(object sender, DragEventArgs e) {
     229    protected virtual void problemViewHost_DragDrop(object sender, DragEventArgs e) {
    230230      if (e.Effect != DragDropEffects.None) {
    231231        IProblem problem = e.Data.GetData("Value") as IProblem;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.Designer.cs

    r3764 r4011  
    4848      this.tabControl = new System.Windows.Forms.TabControl();
    4949      this.algorithmTabPage = new System.Windows.Forms.TabPage();
    50       this.algorithmPanel = new System.Windows.Forms.Panel();
    5150      this.algorithmViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5251      this.openAlgorithmButton = new System.Windows.Forms.Button();
     
    6665      this.tabControl.SuspendLayout();
    6766      this.algorithmTabPage.SuspendLayout();
    68       this.algorithmPanel.SuspendLayout();
    6967      this.runsTabPage.SuspendLayout();
    7068      ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit();
     
    9694      // algorithmTabPage
    9795      //
    98       this.algorithmTabPage.Controls.Add(this.algorithmPanel);
     96      this.algorithmTabPage.Controls.Add(this.algorithmViewHost);
    9997      this.algorithmTabPage.Controls.Add(this.openAlgorithmButton);
    10098      this.algorithmTabPage.Controls.Add(this.newAlgorithmButton);
     
    107105      this.algorithmTabPage.UseVisualStyleBackColor = true;
    108106      //
    109       // algorithmPanel
    110       //
    111       this.algorithmPanel.AllowDrop = true;
    112       this.algorithmPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     107      // algorithmViewHost
     108      //
     109      this.algorithmViewHost.Content = null;
     110      this.algorithmViewHost.AllowDrop = true;
     111      this.algorithmViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    113112                  | System.Windows.Forms.AnchorStyles.Left)
    114113                  | System.Windows.Forms.AnchorStyles.Right)));
    115       this.algorithmPanel.Controls.Add(this.algorithmViewHost);
    116       this.algorithmPanel.Location = new System.Drawing.Point(6, 36);
    117       this.algorithmPanel.Name = "algorithmPanel";
    118       this.algorithmPanel.Size = new System.Drawing.Size(659, 306);
    119       this.algorithmPanel.TabIndex = 3;
    120       this.algorithmPanel.DragOver += new System.Windows.Forms.DragEventHandler(this.algorithmPanel_DragEnterOver);
    121       this.algorithmPanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.algorithmPanel_DragDrop);
    122       this.algorithmPanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.algorithmPanel_DragEnterOver);
    123       //
    124       // algorithmViewHost
    125       //
    126       this.algorithmViewHost.Content = null;
    127       this.algorithmViewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    128       this.algorithmViewHost.Location = new System.Drawing.Point(0, 0);
     114      this.algorithmViewHost.Location = new System.Drawing.Point(6, 36);
    129115      this.algorithmViewHost.Name = "algorithmViewHost";
    130116      this.algorithmViewHost.Size = new System.Drawing.Size(659, 306);
    131       this.algorithmViewHost.TabIndex = 0;
     117      this.algorithmViewHost.TabIndex = 3;
    132118      this.algorithmViewHost.ViewType = null;
     119      this.algorithmViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.algorithmViewHost_DragEnterOver);
     120      this.algorithmViewHost.DragDrop += new System.Windows.Forms.DragEventHandler(this.algorithmViewHost_DragDrop);
     121      this.algorithmViewHost.DragEnter += new System.Windows.Forms.DragEventHandler(this.algorithmViewHost_DragEnterOver);
    133122      //
    134123      // openAlgorithmButton
     
    317306      this.tabControl.ResumeLayout(false);
    318307      this.algorithmTabPage.ResumeLayout(false);
    319       this.algorithmPanel.ResumeLayout(false);
    320308      this.runsTabPage.ResumeLayout(false);
    321309      ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).EndInit();
     
    342330    private RunCollectionView runsView;
    343331    private System.Windows.Forms.Button pauseButton;
    344     private System.Windows.Forms.Panel algorithmPanel;
    345 
    346332  }
    347333}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs

    r3904 r4011  
    140140    }
    141141    private void repetitionsNumericUpDown_ValueChanged(object sender, EventArgs e) {
    142       Content.Repetitions = (int)repetitionsNumericUpDown.Value;
     142      if (Content != null)
     143        Content.Repetitions = (int)repetitionsNumericUpDown.Value;
    143144    }
    144145    private void newAlgorithmButton_Click(object sender, EventArgs e) {
     
    197198      Content.Prepare(false);
    198199    }
    199     private void algorithmPanel_DragEnterOver(object sender, DragEventArgs e) {
     200    private void algorithmViewHost_DragEnterOver(object sender, DragEventArgs e) {
    200201      e.Effect = DragDropEffects.None;
    201202      if (ReadOnly)
     
    210211      }
    211212    }
    212     private void algorithmPanel_DragDrop(object sender, DragEventArgs e) {
     213    private void algorithmViewHost_DragDrop(object sender, DragEventArgs e) {
    213214      if (e.Effect != DragDropEffects.None) {
    214215        IAlgorithm algorithm = e.Data.GetData("Value") as IAlgorithm;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs

    r3764 r4011  
    5858      this.resultsTabPage.SuspendLayout();
    5959      this.runsTabPage.SuspendLayout();
    60       this.problemPanel.SuspendLayout();
    6160      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6261      this.engineTabPage.SuspendLayout();
     
    148147      // problemPanel
    149148      //
    150       this.problemPanel.Size = new System.Drawing.Size(693, 399);
     149      this.problemViewHost.Size = new System.Drawing.Size(693, 399);
    151150      //
    152151      // nameTextBox
     
    276275      this.resultsTabPage.ResumeLayout(false);
    277276      this.runsTabPage.ResumeLayout(false);
    278       this.problemPanel.ResumeLayout(false);
    279277      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    280278      this.engineTabPage.ResumeLayout(false);
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs

    r3904 r4011  
    103103    }
    104104
     105    private string selectedName;
    105106    private void FillListView() {
    106       string selectedName = null;
    107107      if (listView.SelectedItems.Count == 1) selectedName = listView.SelectedItems[0].SubItems[0].Text;
    108108
     
    117117          for (int i = 0; i < listView.Columns.Count; i++)
    118118            listView.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     119          selectedName = null;
    119120        }
    120121      }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/UserDefinedAlgorithmView.Designer.cs

    r3770 r4011  
    5454      this.resultsTabPage.SuspendLayout();
    5555      this.runsTabPage.SuspendLayout();
    56       this.problemPanel.SuspendLayout();
    5756      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5857      this.globalScopeTabPage.SuspendLayout();
     
    152151      this.resultsTabPage.ResumeLayout(false);
    153152      this.runsTabPage.ResumeLayout(false);
    154       this.problemPanel.ResumeLayout(false);
    155153      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    156154      this.globalScopeTabPage.ResumeLayout(false);
Note: See TracChangeset for help on using the changeset viewer.