Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10977


Ignore:
Timestamp:
06/11/14 12:35:14 (10 years ago)
Author:
rstoll
Message:
  • Simplified DataGridContent - using a private set in the property instead of private fields
  • Disabled transformation if filter is active
  • Code Fromatted
Location:
branches/DataPreprocessing
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/CheckedTransformationListView.cs

    r10902 r10977  
    5656
    5757          return (ITransformation)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(new[] { columnNames });
    58         } catch (Exception ex) {
     58        }
     59        catch (Exception ex) {
    5960          ErrorHandling.ShowErrorDialog(this, ex);
    6061        }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs

    r10970 r10977  
    6767          new FilterContent(filterLogic),
    6868          new ManipulationContent(manipulationLogic, searchLogic, dataGridLogic, filterLogic),
    69           new TransformationContent(data)
     69          new TransformationContent(data, filterLogic)
    7070        };
    7171
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ManipulationView.Designer.cs

    r10970 r10977  
    419419      this.lblPreviewInActive.Text = "Filters are active and thus manipulations cannot be applied!\r\n\r\nPlease deactive t" +
    420420    "he filter(s) first in order to be able to perform manipulations.";
     421      this.lblPreviewInActive.Visible = false;
    421422      //
    422423      // tabPreviewDeleteColumnsInfo
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ManipulationView.cs

    r10970 r10977  
    4545      tabsPreview.ItemSize = new Size(0, 1);
    4646      tabsPreview.SizeMode = TabSizeMode.Fixed;
    47       lblPreviewInActive.Visible = false;
    4847
    4948      validators = new Action[] {
     
    7372        }
    7473        cmbVariableNames.SelectedIndex = 0;
    75         checkFilters();
     74        CheckFilters();
    7675      }
    7776    }
     
    9190    private void FilterLogic_FilterChanged(object sender, EventArgs e) {
    9291      if (Content != null) {
    93         checkFilters();
    94       }
    95     }
    96 
    97     private void checkFilters() {
     92        CheckFilters();
     93      }
     94    }
     95
     96    private void CheckFilters() {
    9897      if (Content.FilterLogic.IsFiltered) {
    9998        tabsPreview.SelectedIndex = 0;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/TransformationView.Designer.cs

    r10948 r10977  
    4747    /// </summary>
    4848    private void InitializeComponent() {
    49       this.transformationListView = new HeuristicLab.DataPreprocessing.Views.CheckedTransformationListView();
    5049      this.applyButton = new System.Windows.Forms.Button();
    5150      this.preserveColumnsCheckbox = new System.Windows.Forms.CheckBox();
     51      this.lblFilterNotice = new System.Windows.Forms.Label();
     52      this.transformationListView = new HeuristicLab.DataPreprocessing.Views.CheckedTransformationListView();
    5253      this.SuspendLayout();
    53       //
    54       // transformationListView
    55       //
    56       this.transformationListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    57             | System.Windows.Forms.AnchorStyles.Left)
    58             | System.Windows.Forms.AnchorStyles.Right)));
    59       this.transformationListView.Caption = "Transformations";
    60       this.transformationListView.Content = null;
    61       this.transformationListView.Location = new System.Drawing.Point(0, 0);
    62       this.transformationListView.Name = "transformationListView";
    63       this.transformationListView.ReadOnly = false;
    64       this.transformationListView.Size = new System.Drawing.Size(627, 482);
    65       this.transformationListView.TabIndex = 0;
    6654      //
    6755      // applyButton
     
    8775      this.preserveColumnsCheckbox.UseVisualStyleBackColor = true;
    8876      //
     77      // lblFilterNotice
     78      //
     79      this.lblFilterNotice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     80      this.lblFilterNotice.AutoSize = true;
     81      this.lblFilterNotice.Location = new System.Drawing.Point(20, 493);
     82      this.lblFilterNotice.Name = "lblFilterNotice";
     83      this.lblFilterNotice.Size = new System.Drawing.Size(274, 13);
     84      this.lblFilterNotice.TabIndex = 3;
     85      this.lblFilterNotice.Text = "Transformations cannot be applied since a filter is active!";
     86      this.lblFilterNotice.Visible = false;
     87      //
     88      // transformationListView
     89      //
     90      this.transformationListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     91            | System.Windows.Forms.AnchorStyles.Left)
     92            | System.Windows.Forms.AnchorStyles.Right)));
     93      this.transformationListView.Caption = "Transformations";
     94      this.transformationListView.Content = null;
     95      this.transformationListView.Location = new System.Drawing.Point(0, 0);
     96      this.transformationListView.Name = "transformationListView";
     97      this.transformationListView.ReadOnly = false;
     98      this.transformationListView.Size = new System.Drawing.Size(627, 482);
     99      this.transformationListView.TabIndex = 0;
     100      //
    89101      // TransformationView
    90102      //
    91103      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    92104      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     105      this.Controls.Add(this.lblFilterNotice);
    93106      this.Controls.Add(this.preserveColumnsCheckbox);
    94107      this.Controls.Add(this.applyButton);
     
    105118    private System.Windows.Forms.Button applyButton;
    106119    private System.Windows.Forms.CheckBox preserveColumnsCheckbox;
     120    private System.Windows.Forms.Label lblFilterNotice;
    107121  }
    108122}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/TransformationView.cs

    r10948 r10977  
    4848      } else {
    4949        transformationListView.Content = Content.CheckedTransformationList;
     50        CheckFilters();
     51      }
     52    }
     53
     54    /// <summary>
     55    /// Adds eventhandlers to the current instance.
     56    /// </summary>
     57    protected override void RegisterContentEvents() {
     58      Content.FilterLogic.FilterChanged += FilterLogic_FilterChanged;
     59    }
     60
     61    /// <summary>
     62    /// Removes the eventhandlers from the current instance.
     63    /// </summary>
     64    protected override void DeregisterContentEvents() {
     65      Content.FilterLogic.FilterChanged -= FilterLogic_FilterChanged;
     66    }
     67
     68    void FilterLogic_FilterChanged(object sender, EventArgs e) {
     69      if (Content != null) {
     70        CheckFilters();
     71      }
     72    }
     73
     74    private void CheckFilters() {
     75      if (Content.FilterLogic.IsFiltered) {
     76        applyButton.Enabled = false;
     77        lblFilterNotice.Visible = true;
     78      } else {
     79        applyButton.Enabled = true;
     80        lblFilterNotice.Visible = false;
    5081      }
    5182    }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/DataGridContent.cs

    r10964 r10977  
    3131  public class DataGridContent : Item, IViewShortcut, IDataGridContent {
    3232
    33     private readonly IDataGridLogic dataGridLogic;
    34     private readonly IManipulationLogic manipulationLogic;
    35     private readonly IFilterLogic filterLogic;
    36 
    37     public IManipulationLogic ManipulationLogic {
    38       get { return manipulationLogic; }
    39     }
    40 
    41     public IDataGridLogic DataGridLogic {
    42       get {
    43         return dataGridLogic;
    44       }
    45     }
    46 
    47     public IFilterLogic FilterLogic {
    48       get {
    49         return filterLogic;
    50       }
    51     }
     33    public IManipulationLogic ManipulationLogic { get; private set; }
     34    public IDataGridLogic DataGridLogic { get; private set; }
     35    public IFilterLogic FilterLogic { get; private set; }
    5236
    5337    public static new Image StaticItemImage {
     
    5741    public int Rows {
    5842      get {
    59         return dataGridLogic.Rows;
     43        return DataGridLogic.Rows;
    6044      }
    6145      set {
     
    6650    public int Columns {
    6751      get {
    68         return dataGridLogic.Columns;
     52        return DataGridLogic.Columns;
    6953      }
    7054      set {
     
    7559    public IEnumerable<string> ColumnNames {
    7660      get {
    77         return dataGridLogic.ColumnNames;
     61        return DataGridLogic.ColumnNames;
    7862      }
    7963      set {
     
    8468    public IEnumerable<string> RowNames {
    8569      get {
    86         return dataGridLogic.RowNames;
     70        return DataGridLogic.RowNames;
    8771      }
    8872      set {
     
    10589
    10690    public DataGridContent(IDataGridLogic theDataGridLogic, IManipulationLogic theManipulationLogic, IFilterLogic theFilterLogic) {
    107       dataGridLogic = theDataGridLogic;
    108       manipulationLogic = theManipulationLogic;
    109       filterLogic = theFilterLogic;
     91      DataGridLogic = theDataGridLogic;
     92      ManipulationLogic = theManipulationLogic;
     93      FilterLogic = theFilterLogic;
    11094    }
    11195
     
    120104
    121105    public string GetValue(int rowIndex, int columnIndex) {
    122       return dataGridLogic.GetValue(columnIndex, rowIndex);
     106      return DataGridLogic.GetValue(columnIndex, rowIndex);
    123107    }
    124108
    125109    public bool SetValue(string value, int rowIndex, int columnIndex) {
    126       return dataGridLogic.SetValue(value, columnIndex, rowIndex);
     110      return DataGridLogic.SetValue(value, columnIndex, rowIndex);
    127111    }
    128112
    129113    public event DataPreprocessingChangedEventHandler Changed {
    130       add { dataGridLogic.Changed += value; }
    131       remove { dataGridLogic.Changed -= value; }
     114      add { DataGridLogic.Changed += value; }
     115      remove { DataGridLogic.Changed -= value; }
    132116    }
    133117
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/TransformationContent.cs

    r10902 r10977  
    3030
    3131    public IPreprocessingData Data { get; private set; }
     32    public IFilterLogic FilterLogic { get; private set; }
    3233
    3334    public ICheckedItemList<ITransformation> CheckedTransformationList { get; private set; }
    3435
    35     public TransformationContent(IPreprocessingData data) {
     36    public static new Image StaticItemImage {
     37      get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; }
     38    }
     39
     40    public TransformationContent(IPreprocessingData data, IFilterLogic filterLogic) {
    3641      Data = data;
    3742      CheckedTransformationList = new CheckedItemList<ITransformation>();
     43      FilterLogic = filterLogic;
    3844    }
    3945
     
    4450    }
    4551
    46     public static new Image StaticItemImage {
    47       get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; }
    48     }
    49 
    5052    public override IDeepCloneable Clone(Cloner cloner) {
    5153      return new TransformationContent(this, cloner);
Note: See TracChangeset for help on using the changeset viewer.