Changeset 10614 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/DataPreprocessingView.cs
- Timestamp:
- 03/19/14 12:05:50 (11 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.