Changeset 10614
- Timestamp:
- 03/19/14 12:05:50 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 4 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataPreprocessingView.cs
r10586 r10614 23 23 using System.Windows.Forms; 24 24 using HeuristicLab.Common; 25 using HeuristicLab.Core;26 25 using HeuristicLab.Core.Views; 27 26 using HeuristicLab.MainForm; … … 29 28 namespace HeuristicLab.DataPreprocessing.Views { 30 29 [View("DataPreprocessing View")] 31 [Content(typeof(IPreprocessingContext), true)] 30 [Content(typeof(PreprocessingContext), true)] 31 [Content(typeof(IPreprocessingContext), false)] 32 32 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 41 33 public DataPreprocessingView() { 42 34 InitializeComponent(); 43 35 } 44 36 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; } 100 39 set { 101 40 base.Content = value; … … 103 42 } 104 43 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; 110 50 } 111 51 } 112 52 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; 118 59 } 119 60 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataPreprocessingView.designer.cs
r10558 r10614 47 47 this.components = new System.ComponentModel.Container(); 48 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataPreprocessingView)); 49 this.splitContainer1 = new System.Windows.Forms.SplitContainer();50 49 this.undoButton = new System.Windows.Forms.Button(); 51 50 this.applyInNewTabButton = new System.Windows.Forms.Button(); 52 51 this.exportProblemButton = new System.Windows.Forms.Button(); 53 this.contentListView = new System.Windows.Forms.ListView();54 this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();55 52 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(); 60 54 this.SuspendLayout(); 61 //62 // splitContainer163 //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.Panel170 //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.Panel277 //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;82 55 // 83 56 // undoButton 84 57 // 85 58 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); 87 60 this.undoButton.Name = "undoButton"; 88 61 this.undoButton.Size = new System.Drawing.Size(24, 24); … … 95 68 // 96 69 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); 98 71 this.applyInNewTabButton.Name = "applyInNewTabButton"; 99 72 this.applyInNewTabButton.Size = new System.Drawing.Size(24, 24); … … 106 79 // 107 80 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); 109 82 this.exportProblemButton.Name = "exportProblemButton"; 110 83 this.exportProblemButton.Size = new System.Drawing.Size(24, 24); … … 114 87 this.exportProblemButton.Click += new System.EventHandler(this.exportProblemButton_Click); 115 88 // 116 // contentListView89 // viewShortcutCollectionView 117 90 // 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) 119 92 | System.Windows.Forms.AnchorStyles.Left) 120 93 | 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; 146 102 // 147 103 // DataPreprocessingView … … 149 105 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 150 106 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); 152 111 this.Name = "DataPreprocessingView"; 153 112 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);158 113 this.ResumeLayout(false); 159 114 … … 162 117 #endregion 163 118 164 private System.Windows.Forms.ListView contentListView;165 119 private System.Windows.Forms.Button exportProblemButton; 166 120 private System.Windows.Forms.Button applyInNewTabButton; 167 121 private System.Windows.Forms.Button undoButton; 168 private MainForm.WindowsForms.ViewHost viewHost;169 private System.Windows.Forms.SplitContainer splitContainer1;170 122 private System.Windows.Forms.ToolTip toolTip; 123 private ViewShortcutCollectionView viewShortcutCollectionView; 171 124 172 125 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HeuristicLab.DataPreprocessing.Views-3.3.csproj
r10610 r10614 122 122 <DependentUpon>TransformationView.cs</DependentUpon> 123 123 </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> 124 130 </ItemGroup> 125 131 <ItemGroup> … … 136 142 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 137 143 <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> 138 148 </ProjectReference> 139 149 <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 78 78 <Compile Include="Implementations\ManipulationLogic.cs" /> 79 79 <Compile Include="Interfaces\IPreprocessingData.cs" /> 80 <Compile Include="Implementations\ViewShortcutCollection.cs" /> 80 81 <Compile Include="Interfaces\IDataGridLogic.cs" /> 81 82 <Compile Include="Implementations\FilterContent.cs" /> … … 93 94 <Compile Include="Interfaces\IManipulationLogic.cs" /> 94 95 <Compile Include="Interfaces\ITransformationLogic.cs" /> 96 <Compile Include="Interfaces\IViewShortcut.cs" /> 95 97 <Compile Include="ProblemDataCreator.cs" /> 96 98 <None Include="Plugin.cs.frame" /> -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridContent.cs
r10571 r10614 29 29 30 30 [Item("DataGrid", "Represents a data grid.")] 31 public class DataGridContent : Item, I DataGridContent {31 public class DataGridContent : Item, IViewShortcut, IDataGridContent { 32 32 33 33 private readonly IDataGridLogic dataGridLogic; 34 34 private readonly IManipulationLogic preprocessingDataManipulation; 35 35 36 public DataGridContent(IDataGridLogic theDataGridLogic, IManipulationLogic thePreprocessingDataManipulation) { 36 37 dataGridLogic = theDataGridLogic; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilterContent.cs
r10539 r10614 26 26 namespace HeuristicLab.DataPreprocessing { 27 27 [Item("Filter", "Represents the filter grid.")] 28 public class FilterContent : Item {28 public class FilterContent : Item, IViewShortcut { 29 29 30 30 public static new Image StaticItemImage { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/HistogramContent.cs
r10558 r10614 26 26 namespace HeuristicLab.DataPreprocessing { 27 27 [Item("Histogram", "Represents the histogram grid.")] 28 public class HistogramContent : Item {28 public class HistogramContent : Item, IViewShortcut { 29 29 30 30 private readonly IHistogramLogic histogramLogic; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/LineChartContent.cs
r10573 r10614 26 26 namespace HeuristicLab.DataPreprocessing { 27 27 [Item("LineChart", "Represents the line chart grid.")] 28 public class LineChartContent : Item {28 public class LineChartContent : Item, IViewShortcut { 29 29 30 30 private readonly ILineChartLogic lineChartLogic; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingContext.cs
r10586 r10614 31 31 : Item, IPreprocessingContext { 32 32 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 33 43 public PreprocessingContext(IDataAnalysisProblemData dataAnalysisProblemData, IAlgorithm algorithm, IDataAnalysisProblem problem) { 34 44 Data = new TransactionalPreprocessingData(dataAnalysisProblemData); … … 36 46 Algorithm = algorithm; 37 47 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 }; 38 66 } 39 67 … … 45 73 Problem = original.Problem; 46 74 } 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; }55 75 56 76 public override IDeepCloneable Clone(Cloner cloner) { … … 65 85 } 66 86 } 67 68 87 public IProblem ExportProblem() { 69 88 return Export(Problem, SetupProblem); 89 } 90 public IAlgorithm ExportAlgorithm() { 91 return Export(Algorithm, SetupAlgorithm); 70 92 } 71 93 … … 73 95 return (IDataAnalysisProblem)problem; 74 96 } 75 76 public IAlgorithm ExportAlgorithm() {77 return Export(Algorithm, SetupAlgorithm);78 }79 80 97 private IDataAnalysisProblem SetupAlgorithm(IAlgorithm algorithm) { 81 98 algorithm.Name = algorithm.Name + "(Preprocessed)"; 82 99 algorithm.Runs.Clear(); 83 84 100 return (IDataAnalysisProblem)algorithm.Problem; 85 101 } 86 87 102 private T Export<T>(T original, Func<T, IDataAnalysisProblem> setup) 88 103 where T : IItem { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticsContent.cs
r10551 r10614 25 25 namespace HeuristicLab.DataPreprocessing { 26 26 [Item("Statistics", "Represents the statistics grid.")] 27 public class StatisticsContent : Item {27 public class StatisticsContent : Item, IViewShortcut { 28 28 29 29 private readonly IStatisticsLogic statisticsLogic; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransformationContent.cs
r10539 r10614 26 26 namespace HeuristicLab.DataPreprocessing { 27 27 [Item("Transformation", "Represents the transformation grid.")] 28 public class TransformationContent : Item {28 public class TransformationContent : Item, IViewShortcut { 29 29 30 30 private readonly ITransformationLogic transformationLogic; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingContext.cs
r10586 r10614 31 31 ITransactionalPreprocessingData Data { get; } 32 32 33 ViewShortcutCollection ViewShortcuts { get; } 34 33 35 [Obsolete] 34 36 IDataAnalysisProblemData DataAnalysisProblemData { get; }
Note: See TracChangeset
for help on using the changeset viewer.