Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/05/14 16:39:01 (11 years ago)
Author:
psteiner
Message:

Added Views and Classes for Filtering

Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj

    r10546 r10549  
    8080    <Compile Include="Implementations\DataGridLogic.cs" />
    8181    <Compile Include="Implementations\DataPreprocessingChangedEvent.cs" />
     82    <Compile Include="Implementations\Filter\ComparisonFilter.cs" />
     83    <Compile Include="Implementations\Filter\IFilter.cs" />
    8284    <Compile Include="Implementations\ManipulationLogic.cs" />
    8385    <Compile Include="Interfaces\IDataGridLogic.cs" />
     
    98100    <Compile Include="Interfaces\ITransformationLogic.cs" />
    99101    <Compile Include="ProblemDataCreator.cs" />
     102    <Compile Include="Views\ComparisonFilterView.cs">
     103      <SubType>UserControl</SubType>
     104    </Compile>
     105    <Compile Include="Views\ComparisonFilterView.Designer.cs">
     106      <DependentUpon>ComparisonFilterView.cs</DependentUpon>
     107    </Compile>
    100108    <Compile Include="Views\FilterView.cs">
    101109      <SubType>UserControl</SubType>
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/FilterView.Designer.cs

    r10539 r10549  
    4444    /// the contents of this method with the code editor.
    4545    /// </summary>
    46     private void InitializeComponent() {
    47       components = new System.ComponentModel.Container();
     46    private void InitializeComponent()
     47    {
     48      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
     49      this.deleteFilter = new System.Windows.Forms.Button();
     50      this.newFilter = new System.Windows.Forms.Button();
     51      this.listView1 = new System.Windows.Forms.ListView();
     52      this.applyFilter = new System.Windows.Forms.Button();
     53      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     54      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     55      this.splitContainer1.Panel1.SuspendLayout();
     56      this.splitContainer1.Panel2.SuspendLayout();
     57      this.splitContainer1.SuspendLayout();
     58      this.SuspendLayout();
     59      //
     60      // splitContainer1
     61      //
     62      this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
     63      this.splitContainer1.Location = new System.Drawing.Point(0, 0);
     64      this.splitContainer1.Name = "splitContainer1";
     65      //
     66      // splitContainer1.Panel1
     67      //
     68      this.splitContainer1.Panel1.AccessibleName = "splitContainer1";
     69      this.splitContainer1.Panel1.Controls.Add(this.deleteFilter);
     70      this.splitContainer1.Panel1.Controls.Add(this.newFilter);
     71      this.splitContainer1.Panel1.Controls.Add(this.listView1);
     72      //
     73      // splitContainer1.Panel2
     74      //
     75      this.splitContainer1.Panel2.AccessibleName = "splitContainer2";
     76      this.splitContainer1.Panel2.Controls.Add(this.applyFilter);
     77      this.splitContainer1.Panel2.Controls.Add(this.viewHost);
     78      this.splitContainer1.Size = new System.Drawing.Size(697, 490);
     79      this.splitContainer1.SplitterDistance = 232;
     80      this.splitContainer1.TabIndex = 0;
     81      //
     82      // deleteFilter
     83      //
     84      this.deleteFilter.Image = HeuristicLab.Common.Resources.VSImageLibrary.Delete;
     85      this.deleteFilter.Location = new System.Drawing.Point(45, 24);
     86      this.deleteFilter.Name = "deleteFilter";
     87      this.deleteFilter.Size = new System.Drawing.Size(24, 24);
     88      this.deleteFilter.TabIndex = 6;
     89      this.deleteFilter.UseVisualStyleBackColor = true;
     90      this.deleteFilter.Click += new System.EventHandler(this.deleteFilter_Click);
     91      //
     92      // newFilter
     93      //
     94      this.newFilter.Image = HeuristicLab.Common.Resources.VSImageLibrary.Add;
     95      this.newFilter.Location = new System.Drawing.Point(15, 24);
     96      this.newFilter.Name = "newFilter";
     97      this.newFilter.Size = new System.Drawing.Size(24, 24);
     98      this.newFilter.TabIndex = 5;
     99      this.newFilter.UseVisualStyleBackColor = true;
     100      this.newFilter.Click += new System.EventHandler(this.newFilter_Click);
     101      //
     102      // listView1
     103      //
     104      this.listView1.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.listView1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     108      this.listView1.Location = new System.Drawing.Point(14, 54);
     109      this.listView1.Name = "listView1";
     110      this.listView1.Size = new System.Drawing.Size(157, 391);
     111      this.listView1.TabIndex = 4;
     112      this.listView1.UseCompatibleStateImageBehavior = false;
     113      this.listView1.View = System.Windows.Forms.View.List;
     114      this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
     115      this.listView1.DoubleClick += new System.EventHandler(this.listView1_DoubleClick_1);
     116      //
     117      // applyFilter
     118      //
     119      this.applyFilter.Location = new System.Drawing.Point(383, 422);
     120      this.applyFilter.Name = "applyFilter";
     121      this.applyFilter.Size = new System.Drawing.Size(75, 23);
     122      this.applyFilter.TabIndex = 1;
     123      this.applyFilter.Text = "Apply Filters";
     124      this.applyFilter.UseVisualStyleBackColor = true;
     125      //
     126      // viewHost
     127      //
     128      this.viewHost.Caption = "View";
     129      this.viewHost.Content = null;
     130      this.viewHost.Enabled = false;
     131      this.viewHost.Location = new System.Drawing.Point(4, 4);
     132      this.viewHost.Name = "viewHost";
     133      this.viewHost.ReadOnly = false;
     134      this.viewHost.Size = new System.Drawing.Size(454, 410);
     135      this.viewHost.TabIndex = 0;
     136      this.viewHost.ViewsLabelVisible = true;
     137      this.viewHost.ViewType = null;
     138      //
     139      // FilterView
     140      //
     141      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    48142      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     143      this.Controls.Add(this.splitContainer1);
     144      this.Name = "FilterView";
     145      this.Size = new System.Drawing.Size(697, 490);
     146      this.splitContainer1.Panel1.ResumeLayout(false);
     147      this.splitContainer1.Panel2.ResumeLayout(false);
     148      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
     149      this.splitContainer1.ResumeLayout(false);
     150      this.ResumeLayout(false);
     151
    49152    }
    50153
    51154    #endregion
     155
     156    private System.Windows.Forms.SplitContainer splitContainer1;
     157    private System.Windows.Forms.ListView listView1;
     158    private System.Windows.Forms.Button deleteFilter;
     159    private System.Windows.Forms.Button newFilter;
     160    private MainForm.WindowsForms.ViewHost viewHost;
     161    private System.Windows.Forms.Button applyFilter;
    52162  }
    53163}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/FilterView.cs

    r10539 r10549  
    2424using HeuristicLab.MainForm;
    2525using HeuristicLab.MainForm.WindowsForms;
     26using HeuristicLab.Core;
     27using System.Collections.Generic;
     28using System;
     29using System.ComponentModel;
    2630
    27 namespace HeuristicLab.DataPreprocessing {
     31namespace HeuristicLab.DataPreprocessing
     32{
    2833
    2934  [View("Filter View")]
    3035  [Content(typeof(FilterContent), false)]
    31   public partial class FilterView : ItemView {
     36  public partial class FilterView : ItemView
     37  {
    3238
    33     public new FilterContent Content {
     39    public new FilterContent Content
     40    {
    3441      get { return (FilterContent)base.Content; }
    3542      set { base.Content = value; }
    3643    }
    3744
    38     public FilterView() {
     45    public FilterView()
     46    {
    3947      InitializeComponent();
     48      listView1.SmallImageList = new ImageList();
    4049    }
    4150
    42     protected override void OnContentChanged() {
     51    protected override void OnContentChanged()
     52    {
    4353      base.OnContentChanged();
    4454    }
     55
     56    // Filter Contents
     57    private IDictionary<IFilter, ListViewItem> filters = new Dictionary<IFilter, ListViewItem>();
     58
     59    private void listView1_DoubleClick(object sender, EventArgs e)
     60    {
     61
     62    }
     63
     64    private void newFilter_Click(object sender, EventArgs e)
     65    {
     66      //TODO Filter Choose View...
     67      IFilter filter = new ComparisonFilter();
     68      //filter.FilterName = "ComparisonFilter" + (i++);
     69      //filter.PropertyChanged += filter_PropertyChanged;
     70
     71      ListViewItem filterViewItem = CreateListViewItem(filter);
     72      filters.Add(filter, filterViewItem);
     73      //add view items to content list view
     74      listView1.Items.Add(filterViewItem);
     75      //select top filter
     76      listView1.SelectedIndices.Add(0);
     77    }
     78
     79    private void filter_PropertyChanged(object sender, PropertyChangedEventArgs e)
     80    {
     81      ListViewItem listViewItem;
     82      try
     83      {
     84        IFilter filter = (IFilter)sender;
     85        filters.TryGetValue(filter, out listViewItem);
     86        listViewItem.Name = filter.ItemName;
     87      }
     88      catch (KeyNotFoundException)
     89      {
     90        //nothing to do
     91      }
     92
     93    }
     94
     95    private ListViewItem CreateListViewItem(IFilter filter)
     96    {
     97      ListViewItem listViewItem = new ListViewItem();
     98
     99      listViewItem.Text = filter.ItemName;
     100      listView1.SmallImageList.Images.Add(filter.ItemImage);
     101      listViewItem.ImageIndex = listView1.SmallImageList.Images.Count - 1;
     102      listViewItem.Tag = filter;
     103      return listViewItem;
     104    }
     105
     106    private void deleteFilter_Click(object sender, EventArgs e)
     107    {
     108      //delete view item of filter
     109      //listView1.Items.Remove();
     110      //select top filter
     111      if (listView1.Items.Count > 0)
     112      {
     113        listView1.SelectedItems[0].Remove();
     114      }
     115      if (listView1.Items.Count > 0)
     116      {
     117        listView1.SelectedIndices.Add(0);
     118      }
     119    }
     120
     121    private void listView1_SelectedIndexChanged(object sender, EventArgs e)
     122    {
     123      if (listView1.SelectedItems.Count > 0)
     124      {
     125        ListViewItem listViewItem = (ListViewItem)listView1.SelectedItems[0];
     126        this.viewHost.Content = (IItem)listViewItem.Tag;
     127      }
     128    }
     129
     130    private void listView1_DoubleClick_1(object sender, EventArgs e)
     131    {
     132      if (listView1.SelectedItems.Count > 0)
     133      {
     134        ListViewItem listViewItem = (ListViewItem)listView1.SelectedItems[0];
     135        MainFormManager.MainForm.ShowContent((IItem)listViewItem.Tag);
     136      }
     137    }
     138
    45139  }
    46140}
Note: See TracChangeset for help on using the changeset viewer.