Changeset 6675 for branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views
- Timestamp:
- 08/22/11 09:35:06 (13 years ago)
- Location:
- branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views
- Files:
-
- 5 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClassificationSolutionView.cs
r6647 r6675 21 21 22 22 using System.Windows.Forms; 23 using HeuristicLab.Core; 23 24 using HeuristicLab.MainForm; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis.Views { 26 27 [View("ClassificationSolution View")] 27 [Content(typeof(ClassificationSolutionBase), true)]28 [Content(typeof(ClassificationSolutionBase), false)] 28 29 public partial class ClassificationSolutionView : DataAnalysisSolutionView { 29 30 public ClassificationSolutionView() { … … 35 36 set { base.Content = value; } 36 37 } 38 39 #region drag and drop 40 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 41 validDragOperation = false; 42 if (ReadOnly) return; 43 44 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 45 if (dropData is ClassificationProblemData) validDragOperation = true; 46 else if (dropData is IValueParameter) { 47 var param = (IValueParameter)dropData; 48 if (param.Value is ClassificationProblemData) validDragOperation = true; 49 } 50 } 51 #endregion 37 52 } 38 53 } -
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClusteringSolutionView.cs
r6647 r6675 25 25 namespace HeuristicLab.Problems.DataAnalysis.Views { 26 26 [View("ClusteringSolution View")] 27 [Content(typeof(ClusteringSolution), true)]27 [Content(typeof(ClusteringSolution), false)] 28 28 public partial class ClusteringSolutionView : DataAnalysisSolutionView { 29 29 public ClusteringSolutionView() { … … 35 35 set { base.Content = value; } 36 36 } 37 38 #region drag and drop 39 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 40 validDragOperation = false; 41 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is ClusteringProblemData)) { 42 validDragOperation = true; 43 } 44 } 45 #endregion 37 46 } 38 47 } -
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
r6647 r6675 25 25 using System.Linq; 26 26 using System.Windows.Forms; 27 using HeuristicLab.Core.Views; 27 28 using HeuristicLab.MainForm; 29 using HeuristicLab.Optimization; 28 30 using HeuristicLab.Optimization.Views; 29 31 30 32 namespace HeuristicLab.Problems.DataAnalysis.Views { 31 33 [View("DataAnalysisSolution View")] 32 [Content(typeof(DataAnalysisSolution), true)]33 public partial class DataAnalysisSolutionView : ResultCollectionView{34 [Content(typeof(DataAnalysisSolution), false)] 35 public partial class DataAnalysisSolutionView : NamedItemCollectionView<IResult> { 34 36 public DataAnalysisSolutionView() { 35 37 InitializeComponent(); 38 viewHost.ViewsLabelVisible = false; 36 39 } 37 40 … … 39 42 get { return (DataAnalysisSolution)base.Content; } 40 43 set { base.Content = value; } 44 } 45 46 protected override void SetEnabledStateOfControls() { 47 base.SetEnabledStateOfControls(); 48 addButton.Enabled = false; 49 removeButton.Enabled = false; 50 } 51 52 protected override void RegisterContentEvents() { 53 base.RegisterContentEvents(); 54 Content.ProblemDataChanged += new EventHandler(Content_ProblemDataChanged); 55 } 56 protected override void DeregisterContentEvents() { 57 base.DeregisterContentEvents(); 58 Content.ProblemDataChanged -= new EventHandler(Content_ProblemDataChanged); 59 } 60 private void Content_ProblemDataChanged(object sender, EventArgs e) { 61 OnContentChanged(); 41 62 } 42 63 … … 58 79 } 59 80 81 protected override IResult CreateItem() { 82 return null; 83 } 84 60 85 protected virtual void AddEvaluationViewTypes() { 61 if (Content != null ) {86 if (Content != null && !Content.ProblemData.IsEmpty) { 62 87 var viewTypes = MainFormManager.GetViewTypes(Content.GetType(), true) 63 88 .Where(t => typeof(IDataAnalysisSolutionEvaluationView).IsAssignableFrom(t)); … … 68 93 69 94 protected override void itemsListView_DoubleClick(object sender, EventArgs e) { 70 if (itemsListView.SelectedItems.Count == 1 && itemsListView.SelectedItems[0].Tag is Type) { 71 Type viewType = (Type)itemsListView.SelectedItems[0].Tag; 95 if (itemsListView.SelectedItems.Count != 1) return; 96 97 IResult result = itemsListView.SelectedItems[0].Tag as IResult; 98 Type viewType = itemsListView.SelectedItems[0].Tag as Type; 99 if (result != null) { 100 IContentView view = MainFormManager.MainForm.ShowContent(result, typeof(ResultView)); 101 if (view != null) { 102 view.ReadOnly = ReadOnly; 103 view.Locked = Locked; 104 } 105 } else if (viewType != null) { 72 106 MainFormManager.MainForm.ShowContent(Content, viewType); 73 } else 74 base.itemsListView_DoubleClick(sender, e); 107 } 75 108 } 76 109 … … 102 135 itemsListView.Items.Remove(item); 103 136 } 137 138 #region drag and drop 139 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 140 validDragOperation = false; 141 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is DataAnalysisProblemData)) { 142 validDragOperation = true; 143 } 144 } 145 146 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 147 if (e.Effect != DragDropEffects.None) { 148 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is DataAnalysisProblemData) { 149 DataAnalysisProblemData problemData = (DataAnalysisProblemData)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 150 Content.ProblemData = (DataAnalysisProblemData)problemData.Clone(); 151 } 152 } 153 } 154 #endregion 104 155 } 105 156 } -
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DiscriminantFunctionClassificationSolutionView.cs
r6647 r6675 20 20 #endregion 21 21 22 using System.Windows.Forms; 22 23 23 using HeuristicLab.MainForm; 24 25 24 namespace HeuristicLab.Problems.DataAnalysis.Views { 26 [View(" DiscriminantFunctionClassificationSolution View")]27 [Content(typeof(DiscriminantFunctionClassificationSolutionBase), true)]28 public partial class DiscriminantFunctionClassificationSolutionView : DataAnalysisSolutionView {25 [View("ClassificationSolution View")] 26 [Content(typeof(DiscriminantFunctionClassificationSolutionBase), false)] 27 public partial class DiscriminantFunctionClassificationSolutionView : ClassificationSolutionView { 29 28 public DiscriminantFunctionClassificationSolutionView() { 30 29 InitializeComponent(); -
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs
r6647 r6675 21 21 22 22 using System.Windows.Forms; 23 using HeuristicLab.Core; 23 24 using HeuristicLab.MainForm; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis.Views { 26 27 [View("RegressionSolution View")] 27 [Content(typeof(RegressionSolutionBase), true)]28 [Content(typeof(RegressionSolutionBase), false)] 28 29 public partial class RegressionSolutionView : DataAnalysisSolutionView { 29 30 public RegressionSolutionView() { … … 35 36 set { base.Content = value; } 36 37 } 38 39 #region drag and drop 40 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 41 validDragOperation = false; 42 if (ReadOnly) return; 43 44 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 45 if (dropData is RegressionProblemData) validDragOperation = true; 46 else if (dropData is IValueParameter) { 47 var param = (IValueParameter)dropData; 48 if (param.Value is RegressionProblemData) validDragOperation = true; 49 } 50 } 51 #endregion 37 52 } 38 53 }
Note: See TracChangeset
for help on using the changeset viewer.