Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/19/14 12:05:50 (11 years ago)
Author:
pfleck
Message:
  • replaced main menu list with ItemCollectionList
  • added ViewShortcut interface for menu items
Location:
branches/DataPreprocessing
Files:
4 added
12 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataPreprocessingView.cs

    r10586 r10614  
    2323using System.Windows.Forms;
    2424using HeuristicLab.Common;
    25 using HeuristicLab.Core;
    2625using HeuristicLab.Core.Views;
    2726using HeuristicLab.MainForm;
     
    2928namespace HeuristicLab.DataPreprocessing.Views {
    3029  [View("DataPreprocessing View")]
    31   [Content(typeof(IPreprocessingContext), true)]
     30  [Content(typeof(PreprocessingContext), true)]
     31  [Content(typeof(IPreprocessingContext), false)]
    3232  public partial class DataPreprocessingView : ItemView {
    33 
    34     private DataGridContent dataGridContent;
    35     private StatisticsContent statisticsContent;
    36     private FilterContent filterContent;
    37     private TransformationContent tranformationContent;
    38     private LineChartContent lineChartContent;
    39     private HistogramContent histogramContent;
    40 
    4133    public DataPreprocessingView() {
    4234      InitializeComponent();
    4335    }
    4436
    45     protected override void OnContentChanged() {
    46       base.OnContentChanged();
    47       InitializeContents();
    48     }
    49 
    50     //Create list view item for content list view
    51     private ListViewItem CreateListViewItem(IItem item) {
    52       ListViewItem listViewItem = new ListViewItem();
    53 
    54       listViewItem.Text = item.ToString();
    55       listViewItem.ToolTipText = item.ItemName + ": " + item.ItemDescription;
    56       contentListView.SmallImageList.Images.Add(item.ItemImage);
    57       listViewItem.ImageIndex = contentListView.SmallImageList.Images.Count - 1;
    58       listViewItem.Tag = item;
    59 
    60       return listViewItem;
    61     }
    62 
    63     private void InitializeContents() {
    64 
    65       //create content items
    66       ITransactionalPreprocessingData data = Content.Data;
    67       ISearchLogic searchLogic = new SearchLogic(data);
    68       var dataGridLogic = new DataGridLogic(data);
    69       StatisticsLogic statisticsLogic = new StatisticsLogic(data, searchLogic);
    70       dataGridContent = new DataGridContent(dataGridLogic, new ManipulationLogic(data, searchLogic, statisticsLogic));
    71       statisticsContent = new StatisticsContent(statisticsLogic);
    72       filterContent = new FilterContent(new FilterLogic());
    73       tranformationContent = new TransformationContent(new TransformationLogic(data, searchLogic, statisticsLogic));
    74       lineChartContent = new LineChartContent(new LineChartLogic(data));
    75       histogramContent = new HistogramContent(new HistogramLogic(data));
    76 
    77       //create view items
    78       contentListView.SmallImageList = new ImageList();
    79       ListViewItem contentListViewItem = CreateListViewItem(dataGridContent);
    80       ListViewItem statisticsListViewItem = CreateListViewItem(statisticsContent);
    81       ListViewItem filterListViewItem = CreateListViewItem(filterContent);
    82       ListViewItem transformationListViewItem = CreateListViewItem(tranformationContent);
    83       ListViewItem lineChartListViewItem = CreateListViewItem(lineChartContent);
    84       ListViewItem histogramListViewItem = CreateListViewItem(histogramContent);
    85 
    86       //add view items to content list view
    87       contentListView.Items.Add(statisticsListViewItem);
    88       contentListView.Items.Add(contentListViewItem);
    89       contentListView.Items.Add(filterListViewItem);
    90       contentListView.Items.Add(transformationListViewItem);
    91       contentListView.Items.Add(lineChartListViewItem);
    92       contentListView.Items.Add(histogramListViewItem);
    93 
    94       //default view -> statistic view
    95       contentListView.SelectedIndices.Add(0);
    96     }
    97 
    98     public new PreprocessingContext Content {
    99       get { return (PreprocessingContext)base.Content; }
     37    public new IPreprocessingContext Content {
     38      get { return (IPreprocessingContext)base.Content; }
    10039      set {
    10140        base.Content = value;
     
    10342    }
    10443
    105     private void listView1_SelectedIndexChanged(object sender, EventArgs e) {
    106 
    107       if (contentListView.SelectedItems.Count > 0) {
    108         ListViewItem listViewItem = (ListViewItem)contentListView.SelectedItems[0];
    109         this.viewHost.Content = (IItem)listViewItem.Tag;
     44    protected override void OnContentChanged() {
     45      base.OnContentChanged();
     46      if (Content != null) {
     47        viewShortcutCollectionView.Content = Content.ViewShortcuts;
     48      } else {
     49        viewShortcutCollectionView.Content = null;
    11050      }
    11151    }
    11252
    113     private void listView1_DoubleClick(object sender, EventArgs e) {
    114       if (contentListView.SelectedItems.Count > 0) {
    115         ListViewItem listViewItem = (ListViewItem)contentListView.SelectedItems[0];
    116         MainFormManager.MainForm.ShowContent((IItem)listViewItem.Tag);
    117       }
     53    protected override void SetEnabledStateOfControls() {
     54      base.SetEnabledStateOfControls();
     55      viewShortcutCollectionView.Enabled = Content != null;
     56      applyInNewTabButton.Enabled = Content != null;
     57      exportProblemButton.Enabled = Content != null;
     58      undoButton.Enabled = Content != null;
    11859    }
    11960
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataPreprocessingView.designer.cs

    r10558 r10614  
    4747      this.components = new System.ComponentModel.Container();
    4848      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataPreprocessingView));
    49       this.splitContainer1 = new System.Windows.Forms.SplitContainer();
    5049      this.undoButton = new System.Windows.Forms.Button();
    5150      this.applyInNewTabButton = new System.Windows.Forms.Button();
    5251      this.exportProblemButton = new System.Windows.Forms.Button();
    53       this.contentListView = new System.Windows.Forms.ListView();
    54       this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5552      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    56       ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
    57       this.splitContainer1.Panel1.SuspendLayout();
    58       this.splitContainer1.Panel2.SuspendLayout();
    59       this.splitContainer1.SuspendLayout();
     53      this.viewShortcutCollectionView = new HeuristicLab.DataPreprocessing.Views.ViewShortcutCollectionView();
    6054      this.SuspendLayout();
    61       //
    62       // splitContainer1
    63       //
    64       this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
    65       this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
    66       this.splitContainer1.Location = new System.Drawing.Point(0, 0);
    67       this.splitContainer1.Name = "splitContainer1";
    68       //
    69       // splitContainer1.Panel1
    70       //
    71       this.splitContainer1.Panel1.Controls.Add(this.undoButton);
    72       this.splitContainer1.Panel1.Controls.Add(this.applyInNewTabButton);
    73       this.splitContainer1.Panel1.Controls.Add(this.exportProblemButton);
    74       this.splitContainer1.Panel1.Controls.Add(this.contentListView);
    75       //
    76       // splitContainer1.Panel2
    77       //
    78       this.splitContainer1.Panel2.Controls.Add(this.viewHost);
    79       this.splitContainer1.Size = new System.Drawing.Size(838, 449);
    80       this.splitContainer1.SplitterDistance = 181;
    81       this.splitContainer1.TabIndex = 0;
    8255      //
    8356      // undoButton
    8457      //
    8558      this.undoButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Undo;
    86       this.undoButton.Location = new System.Drawing.Point(72, 14);
     59      this.undoButton.Location = new System.Drawing.Point(64, 3);
    8760      this.undoButton.Name = "undoButton";
    8861      this.undoButton.Size = new System.Drawing.Size(24, 24);
     
    9568      //
    9669      this.applyInNewTabButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;
    97       this.applyInNewTabButton.Location = new System.Drawing.Point(42, 14);
     70      this.applyInNewTabButton.Location = new System.Drawing.Point(34, 3);
    9871      this.applyInNewTabButton.Name = "applyInNewTabButton";
    9972      this.applyInNewTabButton.Size = new System.Drawing.Size(24, 24);
     
    10679      //
    10780      this.exportProblemButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Save;
    108       this.exportProblemButton.Location = new System.Drawing.Point(12, 14);
     81      this.exportProblemButton.Location = new System.Drawing.Point(4, 3);
    10982      this.exportProblemButton.Name = "exportProblemButton";
    11083      this.exportProblemButton.Size = new System.Drawing.Size(24, 24);
     
    11487      this.exportProblemButton.Click += new System.EventHandler(this.exportProblemButton_Click);
    11588      //
    116       // contentListView
     89      // viewShortcutCollectionView
    11790      //
    118       this.contentListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     91      this.viewShortcutCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    11992            | System.Windows.Forms.AnchorStyles.Left)
    12093            | System.Windows.Forms.AnchorStyles.Right)));
    121       this.contentListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    122       this.contentListView.Location = new System.Drawing.Point(12, 44);
    123       this.contentListView.Name = "contentListView";
    124       this.contentListView.Size = new System.Drawing.Size(157, 391);
    125       this.contentListView.TabIndex = 0;
    126       this.contentListView.UseCompatibleStateImageBehavior = false;
    127       this.contentListView.View = System.Windows.Forms.View.List;
    128       this.contentListView.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
    129       this.contentListView.DoubleClick += new System.EventHandler(this.listView1_DoubleClick);
    130       //
    131       // viewHost
    132       //
    133       this.viewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    134             | System.Windows.Forms.AnchorStyles.Left)
    135             | System.Windows.Forms.AnchorStyles.Right)));
    136       this.viewHost.Caption = "View";
    137       this.viewHost.Content = null;
    138       this.viewHost.Enabled = false;
    139       this.viewHost.Location = new System.Drawing.Point(16, 44);
    140       this.viewHost.Name = "viewHost";
    141       this.viewHost.ReadOnly = false;
    142       this.viewHost.Size = new System.Drawing.Size(621, 391);
    143       this.viewHost.TabIndex = 4;
    144       this.viewHost.ViewsLabelVisible = true;
    145       this.viewHost.ViewType = null;
     94      this.viewShortcutCollectionView.Caption = "ViewShortcutCollection View";
     95      this.viewShortcutCollectionView.Content = null;
     96      this.viewShortcutCollectionView.Location = new System.Drawing.Point(4, 33);
     97      this.viewShortcutCollectionView.Name = "viewShortcutCollectionView";
     98      this.viewShortcutCollectionView.ReadOnly = true;
     99      this.viewShortcutCollectionView.ShowDetails = true;
     100      this.viewShortcutCollectionView.Size = new System.Drawing.Size(831, 413);
     101      this.viewShortcutCollectionView.TabIndex = 4;
    146102      //
    147103      // DataPreprocessingView
     
    149105      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    150106      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    151       this.Controls.Add(this.splitContainer1);
     107      this.Controls.Add(this.viewShortcutCollectionView);
     108      this.Controls.Add(this.undoButton);
     109      this.Controls.Add(this.applyInNewTabButton);
     110      this.Controls.Add(this.exportProblemButton);
    152111      this.Name = "DataPreprocessingView";
    153112      this.Size = new System.Drawing.Size(838, 449);
    154       this.splitContainer1.Panel1.ResumeLayout(false);
    155       this.splitContainer1.Panel2.ResumeLayout(false);
    156       ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
    157       this.splitContainer1.ResumeLayout(false);
    158113      this.ResumeLayout(false);
    159114
     
    162117    #endregion
    163118
    164     private System.Windows.Forms.ListView contentListView;
    165119    private System.Windows.Forms.Button exportProblemButton;
    166120    private System.Windows.Forms.Button applyInNewTabButton;
    167121    private System.Windows.Forms.Button undoButton;
    168     private MainForm.WindowsForms.ViewHost viewHost;
    169     private System.Windows.Forms.SplitContainer splitContainer1;
    170122    private System.Windows.Forms.ToolTip toolTip;
     123    private ViewShortcutCollectionView viewShortcutCollectionView;
    171124
    172125  }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HeuristicLab.DataPreprocessing.Views-3.3.csproj

    r10610 r10614  
    122122      <DependentUpon>TransformationView.cs</DependentUpon>
    123123    </Compile>
     124    <Compile Include="ViewShortcutCollectionView.cs">
     125      <SubType>UserControl</SubType>
     126    </Compile>
     127    <Compile Include="ViewShortcutCollectionView.Designer.cs">
     128      <DependentUpon>ViewShortcutCollectionView.cs</DependentUpon>
     129    </Compile>
    124130  </ItemGroup>
    125131  <ItemGroup>
     
    136142      <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
    137143      <Name>HeuristicLab.Analysis-3.3</Name>
     144    </ProjectReference>
     145    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
     146      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
     147      <Name>HeuristicLab.Collections-3.3</Name>
    138148    </ProjectReference>
    139149    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/HeuristicLab.DataPreprocessing-3.3.csproj

    r10586 r10614  
    7878    <Compile Include="Implementations\ManipulationLogic.cs" />
    7979    <Compile Include="Interfaces\IPreprocessingData.cs" />
     80    <Compile Include="Implementations\ViewShortcutCollection.cs" />
    8081    <Compile Include="Interfaces\IDataGridLogic.cs" />
    8182    <Compile Include="Implementations\FilterContent.cs" />
     
    9394    <Compile Include="Interfaces\IManipulationLogic.cs" />
    9495    <Compile Include="Interfaces\ITransformationLogic.cs" />
     96    <Compile Include="Interfaces\IViewShortcut.cs" />
    9597    <Compile Include="ProblemDataCreator.cs" />
    9698    <None Include="Plugin.cs.frame" />
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridContent.cs

    r10571 r10614  
    2929
    3030  [Item("DataGrid", "Represents a data grid.")]
    31   public class DataGridContent : Item, IDataGridContent {
     31  public class DataGridContent : Item, IViewShortcut, IDataGridContent {
    3232
    3333    private readonly IDataGridLogic dataGridLogic;
    3434    private readonly IManipulationLogic preprocessingDataManipulation;
     35
    3536    public DataGridContent(IDataGridLogic theDataGridLogic, IManipulationLogic thePreprocessingDataManipulation) {
    3637      dataGridLogic = theDataGridLogic;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterContent.cs

    r10539 r10614  
    2626namespace HeuristicLab.DataPreprocessing {
    2727  [Item("Filter", "Represents the filter grid.")]
    28   public class FilterContent : Item {
     28  public class FilterContent : Item, IViewShortcut {
    2929
    3030    public static new Image StaticItemImage {
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/HistogramContent.cs

    r10558 r10614  
    2626namespace HeuristicLab.DataPreprocessing {
    2727  [Item("Histogram", "Represents the histogram grid.")]
    28   public class HistogramContent : Item {
     28  public class HistogramContent : Item, IViewShortcut {
    2929
    3030    private readonly IHistogramLogic histogramLogic;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/LineChartContent.cs

    r10573 r10614  
    2626namespace HeuristicLab.DataPreprocessing {
    2727  [Item("LineChart", "Represents the line chart grid.")]
    28   public class LineChartContent : Item {
     28  public class LineChartContent : Item, IViewShortcut {
    2929
    3030    private readonly ILineChartLogic lineChartLogic;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingContext.cs

    r10586 r10614  
    3131    : Item, IPreprocessingContext {
    3232
     33    public ITransactionalPreprocessingData Data { get; private set; }
     34
     35    public ViewShortcutCollection ViewShortcuts { get; private set; }
     36
     37    public IDataAnalysisProblemData DataAnalysisProblemData { get; private set; }
     38
     39    public IAlgorithm Algorithm { get; private set; }
     40
     41    public IDataAnalysisProblem Problem { get; private set; }
     42
    3343    public PreprocessingContext(IDataAnalysisProblemData dataAnalysisProblemData, IAlgorithm algorithm, IDataAnalysisProblem problem) {
    3444      Data = new TransactionalPreprocessingData(dataAnalysisProblemData);
     
    3646      Algorithm = algorithm;
    3747      Problem = problem;
     48
     49      var searchLogic = new SearchLogic(Data);
     50      var dataGridLogic = new DataGridLogic(Data);
     51      var statisticsLogic = new StatisticsLogic(Data, searchLogic);
     52      var manipulationLogic = new ManipulationLogic(Data, searchLogic, statisticsLogic);
     53      var transformationLogic = new TransformationLogic(Data, searchLogic, statisticsLogic);
     54      var lineChartLogic = new LineChartLogic(Data);
     55      var histogramLogic = new HistogramLogic(Data);
     56      var filterLogic = new FilterLogic();
     57
     58      ViewShortcuts = new ViewShortcutCollection {
     59        new DataGridContent(dataGridLogic, manipulationLogic),
     60        new StatisticsContent(statisticsLogic),
     61        new FilterContent(filterLogic),
     62        new TransformationContent(transformationLogic),
     63        new LineChartContent(lineChartLogic),
     64        new HistogramContent(histogramLogic)
     65      };
    3866    }
    3967
     
    4573      Problem = original.Problem;
    4674    }
    47 
    48     public ITransactionalPreprocessingData Data { get; private set; }
    49 
    50     public IDataAnalysisProblemData DataAnalysisProblemData { get; private set; }
    51 
    52     public IAlgorithm Algorithm { get; private set; }
    53 
    54     public IDataAnalysisProblem Problem { get; private set; }
    5575
    5676    public override IDeepCloneable Clone(Cloner cloner) {
     
    6585      }
    6686    }
    67 
    6887    public IProblem ExportProblem() {
    6988      return Export(Problem, SetupProblem);
     89    }
     90    public IAlgorithm ExportAlgorithm() {
     91      return Export(Algorithm, SetupAlgorithm);
    7092    }
    7193
     
    7395      return (IDataAnalysisProblem)problem;
    7496    }
    75 
    76     public IAlgorithm ExportAlgorithm() {
    77       return Export(Algorithm, SetupAlgorithm);
    78     }
    79 
    8097    private IDataAnalysisProblem SetupAlgorithm(IAlgorithm algorithm) {
    8198      algorithm.Name = algorithm.Name + "(Preprocessed)";
    8299      algorithm.Runs.Clear();
    83 
    84100      return (IDataAnalysisProblem)algorithm.Problem;
    85101    }
    86 
    87102    private T Export<T>(T original, Func<T, IDataAnalysisProblem> setup)
    88103        where T : IItem {
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticsContent.cs

    r10551 r10614  
    2525namespace HeuristicLab.DataPreprocessing {
    2626  [Item("Statistics", "Represents the statistics grid.")]
    27   public class StatisticsContent : Item {
     27  public class StatisticsContent : Item, IViewShortcut {
    2828
    2929    private readonly IStatisticsLogic statisticsLogic;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransformationContent.cs

    r10539 r10614  
    2626namespace HeuristicLab.DataPreprocessing {
    2727  [Item("Transformation", "Represents the transformation grid.")]
    28   public class TransformationContent : Item {
     28  public class TransformationContent : Item, IViewShortcut {
    2929
    3030    private readonly ITransformationLogic transformationLogic;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingContext.cs

    r10586 r10614  
    3131    ITransactionalPreprocessingData Data { get; }
    3232
     33    ViewShortcutCollection ViewShortcuts { get; }
     34
    3335    [Obsolete]
    3436    IDataAnalysisProblemData DataAnalysisProblemData { get; }
Note: See TracChangeset for help on using the changeset viewer.