Changeset 3309


Ignore:
Timestamp:
04/12/10 15:15:50 (11 years ago)
Author:
mkommend
Message:

added DataSetChanged event in RegressionProblemData and adapted RegressionProblemDataView to show the included dataset (ticket #983)

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj

    r3294 r3309  
    125125      <Name>HeuristicLab.Core-3.3</Name>
    126126    </ProjectReference>
     127    <ProjectReference Include="..\..\HeuristicLab.Data.Views\3.3\HeuristicLab.Data.Views-3.3.csproj">
     128      <Project>{72104A0B-90E7-42F3-9ABE-9BBBADD4B943}</Project>
     129      <Name>HeuristicLab.Data.Views-3.3</Name>
     130    </ProjectReference>
    127131    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    128132      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/RegressionProblemData.cs

    r3294 r3309  
    4141    public Dataset Dataset {
    4242      get { return dataset; }
    43       set { dataset = value; }
     43      set {
     44        if (dataset != value) {
     45          if (value == null) throw new ArgumentNullException();
     46          else {
     47            dataset = value;
     48            OnDatasetChanged(EventArgs.Empty);
     49          }
     50        }
     51      }
    4452    }
    4553    private StringValue targetVariable;
     
    123131      if (listeners != null) listeners(this, e);
    124132    }
     133
     134    public event EventHandler DatasetChanged;
     135    protected virtual void OnDatasetChanged(EventArgs e) {
     136      EventHandler handler = DatasetChanged;
     137      if (handler != null) handler(this, e);
     138    }
    125139    #endregion
    126140
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/RegressionProblemDataView.Designer.cs

    r3294 r3309  
    4747    private void InitializeComponent() {
    4848      this.importButton = new System.Windows.Forms.Button();
    49       this.tabControl = new System.Windows.Forms.TabControl();
    50       this.parametersTabPage = new System.Windows.Forms.TabPage();
    51       this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
     49      this.datasetView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
    5250      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    53       this.tabControl.SuspendLayout();
    54       this.parametersTabPage.SuspendLayout();
    5551      this.SuspendLayout();
    5652      //
     
    7773      this.importButton.Click += new System.EventHandler(this.importButton_Click);
    7874      //
    79       // tabControl
     75      // datasetView
    8076      //
    81       this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     77      this.datasetView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    8278                  | System.Windows.Forms.AnchorStyles.Left)
    8379                  | System.Windows.Forms.AnchorStyles.Right)));
    84       this.tabControl.Controls.Add(this.parametersTabPage);
    85       this.tabControl.Location = new System.Drawing.Point(0, 52);
    86       this.tabControl.Name = "tabControl";
    87       this.tabControl.SelectedIndex = 0;
    88       this.tabControl.Size = new System.Drawing.Size(529, 341);
    89       this.tabControl.TabIndex = 4;
     80      this.datasetView.Caption = "StringConvertibleMatrix View";
     81      this.datasetView.Content = null;
     82      this.datasetView.Location = new System.Drawing.Point(0, 52);
     83      this.datasetView.Name = "datasetView";
     84      this.datasetView.Size = new System.Drawing.Size(526, 341);
     85      this.datasetView.TabIndex = 6;
    9086      //
    91       // parametersTabPage
    92       //
    93       this.parametersTabPage.Controls.Add(this.parameterCollectionView);
    94       this.parametersTabPage.Location = new System.Drawing.Point(4, 22);
    95       this.parametersTabPage.Name = "parametersTabPage";
    96       this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
    97       this.parametersTabPage.Size = new System.Drawing.Size(521, 315);
    98       this.parametersTabPage.TabIndex = 0;
    99       this.parametersTabPage.Text = "Parameters";
    100       this.parametersTabPage.UseVisualStyleBackColor = true;
    101       //
    102       // parameterCollectionView
    103       //
    104       this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    105                   | System.Windows.Forms.AnchorStyles.Left)
    106                   | System.Windows.Forms.AnchorStyles.Right)));
    107       this.parameterCollectionView.Caption = "ParameterCollection";
    108       this.parameterCollectionView.Content = null;
    109       this.parameterCollectionView.Location = new System.Drawing.Point(6, 6);
    110       this.parameterCollectionView.Name = "parameterCollectionView";
    111       this.parameterCollectionView.Size = new System.Drawing.Size(509, 303);
    112       this.parameterCollectionView.TabIndex = 0;
    113       //
    114       // RegressionProblemView
     87      // RegressionProblemDataView
    11588      //
    11689      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    11790      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    118       this.Controls.Add(this.tabControl);
    11991      this.Controls.Add(this.importButton);
    120       this.Name = "RegressionProblemView";
     92      this.Controls.Add(this.datasetView);
     93      this.Name = "RegressionProblemDataView";
    12194      this.Size = new System.Drawing.Size(529, 422);
     95      this.Controls.SetChildIndex(this.datasetView, 0);
    12296      this.Controls.SetChildIndex(this.importButton, 0);
    123       this.Controls.SetChildIndex(this.tabControl, 0);
    12497      this.Controls.SetChildIndex(this.nameLabel, 0);
    12598      this.Controls.SetChildIndex(this.descriptionLabel, 0);
     
    127100      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
    128101      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    129       this.tabControl.ResumeLayout(false);
    130       this.parametersTabPage.ResumeLayout(false);
    131102      this.ResumeLayout(false);
    132103      this.PerformLayout();
     
    137108
    138109    private System.Windows.Forms.Button importButton;
    139     private System.Windows.Forms.TabControl tabControl;
    140     private System.Windows.Forms.TabPage parametersTabPage;
    141     private HeuristicLab.Core.Views.ParameterCollectionView parameterCollectionView;
     110    private HeuristicLab.Data.Views.StringConvertibleMatrixView datasetView;
    142111
    143112  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/RegressionProblemDataView.cs

    r3294 r3309  
    4646    }
    4747
     48    protected override void RegisterContentEvents() {
     49      base.RegisterContentEvents();
     50      if (Content != null)
     51        Content.DatasetChanged += new EventHandler(Content_DatasetChanged);
     52    }
     53
     54    protected override void DeregisterContentEvents() {
     55      base.DeregisterContentEvents();
     56      if(Content != null)
     57        Content.DatasetChanged -= new EventHandler(Content_DatasetChanged);
     58    }
     59
     60    private void Content_DatasetChanged(object sender, EventArgs e) {
     61      this.datasetView.Content = this.Content.Dataset;
     62    }
     63
    4864    protected override void OnContentChanged() {
    4965      base.OnContentChanged();
    5066      if (Content == null) {
    51         parameterCollectionView.Content = null;
    52         parameterCollectionView.Enabled = false;
    5367        importButton.Enabled = false;
    5468      } else {
Note: See TracChangeset for help on using the changeset viewer.