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.Parameters.Views/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.Designer.cs

    r3306 r4011  
    4747    private void InitializeComponent() {
    4848      this.valueGroupBox = new System.Windows.Forms.GroupBox();
    49       this.valuePanel = new System.Windows.Forms.Panel();
    50       this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     49      this.valueViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5150      this.clearValueButton = new System.Windows.Forms.Button();
    5251      this.setValueButton = new System.Windows.Forms.Button();
     
    5554      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5655      this.valueGroupBox.SuspendLayout();
    57       this.valuePanel.SuspendLayout();
    5856      this.SuspendLayout();
    5957      //
     
    9290                  | System.Windows.Forms.AnchorStyles.Left)
    9391                  | System.Windows.Forms.AnchorStyles.Right)));
    94       this.valueGroupBox.Controls.Add(this.valuePanel);
     92      this.valueGroupBox.Controls.Add(this.valueViewHost);
    9593      this.valueGroupBox.Controls.Add(this.clearValueButton);
    9694      this.valueGroupBox.Controls.Add(this.setValueButton);
     
    102100      this.valueGroupBox.Text = "Value";
    103101      //
    104       // valuePanel
     102      // viewHost
    105103      //
    106       this.valuePanel.AllowDrop = true;
    107       this.valuePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     104      this.valueViewHost.AllowDrop = true;
     105      this.valueViewHost.Content = null;
     106      this.valueViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    108107                  | System.Windows.Forms.AnchorStyles.Left)
    109108                  | System.Windows.Forms.AnchorStyles.Right)));
    110       this.valuePanel.Controls.Add(this.viewHost);
    111       this.valuePanel.Location = new System.Drawing.Point(6, 49);
    112       this.valuePanel.Name = "valuePanel";
    113       this.valuePanel.Size = new System.Drawing.Size(374, 156);
    114       this.valuePanel.TabIndex = 0;
    115       this.valuePanel.DragOver += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver);
    116       this.valuePanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragDrop);
    117       this.valuePanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver);
    118       //
    119       // viewHost
    120       //
    121       this.viewHost.Content = null;
    122       this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    123       this.viewHost.Location = new System.Drawing.Point(0, 0);
    124       this.viewHost.Name = "viewHost";
    125       this.viewHost.Size = new System.Drawing.Size(374, 156);
    126       this.viewHost.TabIndex = 0;
    127       this.viewHost.ViewType = null;
     109      this.valueViewHost.Location = new System.Drawing.Point(6, 49);
     110      this.valueViewHost.Name = "valueViewHost";
     111      this.valueViewHost.Size = new System.Drawing.Size(374, 156);
     112      this.valueViewHost.TabIndex = 0;
     113      this.valueViewHost.ViewType = null;
     114      this.valueViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.valueViewHostPanel_DragEnterOver);
     115      this.valueViewHost.DragDrop += new System.Windows.Forms.DragEventHandler(this.valueViewHost_DragDrop);
     116      this.valueViewHost.DragEnter += new System.Windows.Forms.DragEventHandler(this.valueViewHostPanel_DragEnterOver);
    128117      //
    129118      // clearValueButton
     
    189178      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    190179      this.valueGroupBox.ResumeLayout(false);
    191       this.valuePanel.ResumeLayout(false);
    192180      this.ResumeLayout(false);
    193181      this.PerformLayout();
     
    198186
    199187    protected System.Windows.Forms.GroupBox valueGroupBox;
    200     protected System.Windows.Forms.Panel valuePanel;
    201     protected HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
     188    protected HeuristicLab.MainForm.WindowsForms.ViewHost valueViewHost;
    202189    protected System.Windows.Forms.Button setValueButton;
    203190    protected System.Windows.Forms.Button clearValueButton;
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.cs

    r3904 r4011  
    7979      if (Content == null) {
    8080        actualNameTextBox.Text = "-";
    81         viewHost.Content = null;
     81        valueViewHost.Content = null;
    8282      } else {
    8383        actualNameTextBox.Text = Content.ActualName;
    84         viewHost.ViewType = null;
    85         viewHost.Content = Content.Value;
     84        valueViewHost.ViewType = null;
     85        valueViewHost.Content = Content.Value;
    8686      }
    8787    }
     
    107107      else {
    108108        clearValueButton.Enabled = Content.Value != null && !ReadOnly;
    109         viewHost.ViewType = null;
    110         viewHost.Content = Content.Value;
     109        valueViewHost.ViewType = null;
     110        valueViewHost.Content = Content.Value;
    111111      }
    112112    }
     
    133133      Content.Value = null;
    134134    }
    135     protected virtual void valuePanel_DragEnterOver(object sender, DragEventArgs e) {
     135    protected virtual void valueViewHostPanel_DragEnterOver(object sender, DragEventArgs e) {
    136136      e.Effect = DragDropEffects.None;
    137137      Type type = e.Data.GetData("Type") as Type;
     
    144144      }
    145145    }
    146     protected virtual void valuePanel_DragDrop(object sender, DragEventArgs e) {
     146    protected virtual void valueViewHost_DragDrop(object sender, DragEventArgs e) {
    147147      if (e.Effect != DragDropEffects.None) {
    148148        T value = e.Data.GetData("Value") as T;
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.Designer.cs

    r3306 r4011  
    4747    private void InitializeComponent() {
    4848      this.valueGroupBox = new System.Windows.Forms.GroupBox();
    49       this.valuePanel = new System.Windows.Forms.Panel();
    50       this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     49      this.valueViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5150      this.clearValueButton = new System.Windows.Forms.Button();
    5251      this.setValueButton = new System.Windows.Forms.Button();
    5352      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5453      this.valueGroupBox.SuspendLayout();
    55       this.valuePanel.SuspendLayout();
    5654      this.SuspendLayout();
    5755      //
     
    7876                  | System.Windows.Forms.AnchorStyles.Left)
    7977                  | System.Windows.Forms.AnchorStyles.Right)));
    80       this.valueGroupBox.Controls.Add(this.valuePanel);
     78      this.valueGroupBox.Controls.Add(this.valueViewHost);
    8179      this.valueGroupBox.Controls.Add(this.clearValueButton);
    8280      this.valueGroupBox.Controls.Add(this.setValueButton);
     
    8886      this.valueGroupBox.Text = "Value";
    8987      //
    90       // valuePanel
     88      // viewHost
    9189      //
    92       this.valuePanel.AllowDrop = true;
    93       this.valuePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     90      this.valueViewHost.AllowDrop = true;
     91      this.valueViewHost.Content = null;
     92      this.valueViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    9493                  | System.Windows.Forms.AnchorStyles.Left)
    9594                  | System.Windows.Forms.AnchorStyles.Right)));
    96       this.valuePanel.Controls.Add(this.viewHost);
    97       this.valuePanel.Location = new System.Drawing.Point(6, 49);
    98       this.valuePanel.Name = "valuePanel";
    99       this.valuePanel.Size = new System.Drawing.Size(374, 182);
    100       this.valuePanel.TabIndex = 0;
    101       this.valuePanel.DragOver += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver);
    102       this.valuePanel.DragDrop += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragDrop);
    103       this.valuePanel.DragEnter += new System.Windows.Forms.DragEventHandler(this.valuePanel_DragEnterOver);
    104       //
    105       // viewHost
    106       //
    107       this.viewHost.Content = null;
    108       this.viewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    109       this.viewHost.Location = new System.Drawing.Point(0, 0);
    110       this.viewHost.Name = "viewHost";
    111       this.viewHost.Size = new System.Drawing.Size(374, 182);
    112       this.viewHost.TabIndex = 0;
    113       this.viewHost.ViewType = null;
     95      this.valueViewHost.Location = new System.Drawing.Point(6, 49);
     96      this.valueViewHost.Name = "viewHost";
     97      this.valueViewHost.Size = new System.Drawing.Size(374, 182);
     98      this.valueViewHost.TabIndex = 0;
     99      this.valueViewHost.ViewType = null;
     100      this.valueViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.valueViewHost_DragEnterOver);
     101      this.valueViewHost.DragDrop += new System.Windows.Forms.DragEventHandler(this.valueViewHost_DragDrop);
     102      this.valueViewHost.DragEnter += new System.Windows.Forms.DragEventHandler(this.valueViewHost_DragEnterOver);
    114103      //
    115104      // clearValueButton
     
    152141      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    153142      this.valueGroupBox.ResumeLayout(false);
    154       this.valuePanel.ResumeLayout(false);
    155143      this.ResumeLayout(false);
    156144      this.PerformLayout();
     
    161149
    162150    protected System.Windows.Forms.GroupBox valueGroupBox;
    163     protected System.Windows.Forms.Panel valuePanel;
    164     protected HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
     151    protected HeuristicLab.MainForm.WindowsForms.ViewHost valueViewHost;
    165152    protected System.Windows.Forms.Button setValueButton;
    166153    protected System.Windows.Forms.Button clearValueButton;
  • trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.cs

    r3904 r4011  
    7878      if (Content == null) {
    7979        clearValueButton.Visible = true;
    80         viewHost.Content = null;
     80        valueViewHost.Content = null;
    8181      } else {
    8282        clearValueButton.Visible = !(Content is ValueParameter<T>);
    83         viewHost.ViewType = null;
    84         viewHost.Content = Content.Value;
     83        valueViewHost.ViewType = null;
     84        valueViewHost.Content = Content.Value;
    8585      }
    8686    }
     
    9898      else {
    9999        clearValueButton.Enabled = Content.Value != null && !ReadOnly;
    100         viewHost.ViewType = null;
    101         viewHost.Content = Content.Value;
     100        valueViewHost.ViewType = null;
     101        valueViewHost.Content = Content.Value;
    102102      }
    103103    }
     
    121121      Content.Value = null;
    122122    }
    123     protected virtual void valuePanel_DragEnterOver(object sender, DragEventArgs e) {
     123    protected virtual void valueViewHost_DragEnterOver(object sender, DragEventArgs e) {
    124124      e.Effect = DragDropEffects.None;
    125125      Type type = e.Data.GetData("Type") as Type;
     
    132132      }
    133133    }
    134     protected virtual void valuePanel_DragDrop(object sender, DragEventArgs e) {
     134    protected virtual void valueViewHost_DragDrop(object sender, DragEventArgs e) {
    135135      if (e.Effect != DragDropEffects.None) {
    136136        T value = e.Data.GetData("Value") as T;
Note: See TracChangeset for help on using the changeset viewer.