Changeset 6666 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Views
- Timestamp:
- 08/17/11 14:37:34 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionModelView.cs
r6642 r6666 19 19 */ 20 20 #endregion 21 22 using System.Linq; 21 23 using System.Windows.Forms; 24 using HeuristicLab.Common; 22 25 using HeuristicLab.Core.Views; 23 26 using HeuristicLab.MainForm; … … 44 47 protected override void OnContentChanged() { 45 48 base.OnContentChanged(); 46 if (Content != null) 49 if (Content != null) { 50 view.Locked = Content.ProblemData == ClassificationEnsembleProblemData.EmptyProblemData; 47 51 view.Content = Content.ClassificationSolutions; 48 else52 } else 49 53 view.Content = null; 50 54 } … … 62 66 detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1; 63 67 } 68 69 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 70 validDragOperation = false; 71 if (ReadOnly || Locked) return; 72 if (Content.IsReadOnly) return; 73 74 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 75 validDragOperation = dropData.GetObjectGraphObjects().OfType<IClassificationSolution>().Any(); 76 } 77 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 78 if (e.Effect != DragDropEffects.None) { 79 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 80 var solutions = dropData.GetObjectGraphObjects().OfType<IClassificationSolution>(); 81 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 82 Cloner cloner = new Cloner(); 83 solutions = solutions.Select(s => cloner.Clone(s)); 84 } 85 foreach (var solution in solutions) 86 Content.Add(solution); 87 } 88 } 64 89 } 65 90 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r6652 r6666 182 182 <DependentUpon>ClusteringSolutionView.cs</DependentUpon> 183 183 </Compile> 184 <Compile Include="Solution Views\ClassificationEnsembleSolutionView.cs"> 185 <SubType>UserControl</SubType> 186 </Compile> 187 <Compile Include="Solution Views\ClassificationEnsembleSolutionView.Designer.cs"> 188 <DependentUpon>ClassificationEnsembleSolutionView.cs</DependentUpon> 189 </Compile> 184 190 <Compile Include="Solution Views\DiscriminantFunctionClassificationSolutionView.cs"> 185 191 <SubType>UserControl</SubType> … … 207 213 <Compile Include="Solution Views\NamedDataAnalysisSolutionView.Designer.cs"> 208 214 <DependentUpon>NamedDataAnalysisSolutionView.cs</DependentUpon> 215 </Compile> 216 <Compile Include="Solution Views\RegressionEnsembleSolutionView.cs"> 217 <SubType>UserControl</SubType> 218 </Compile> 219 <Compile Include="Solution Views\RegressionEnsembleSolutionView.Designer.cs"> 220 <DependentUpon>RegressionEnsembleSolutionView.cs</DependentUpon> 209 221 </Compile> 210 222 <Compile Include="Solution Views\RegressionSolutionView.cs"> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionEnsembleSolutionModelView.cs
r6642 r6666 19 19 */ 20 20 #endregion 21 22 using System.Linq; 21 23 using System.Windows.Forms; 24 using HeuristicLab.Common; 22 25 using HeuristicLab.Core.Views; 23 26 using HeuristicLab.MainForm; … … 44 47 protected override void OnContentChanged() { 45 48 base.OnContentChanged(); 46 if (Content != null) 49 if (Content != null) { 50 view.Locked = Content.ProblemData == RegressionEnsembleProblemData.EmptyProblemData; 47 51 view.Content = Content.RegressionSolutions; 48 else52 } else 49 53 view.Content = null; 50 54 } … … 59 63 addButton.Enabled = Content != null && !Content.IsReadOnly && !Locked; 60 64 removeButton.Enabled = Content != null && !Content.IsReadOnly && !Locked && itemsListView.SelectedItems.Count > 0; 61 itemsListView.Enabled = Content != null ;65 itemsListView.Enabled = Content != null && !Locked; 62 66 detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1; 67 } 68 69 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 70 validDragOperation = false; 71 if (ReadOnly || Locked) return; 72 if (Content.IsReadOnly) return; 73 74 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 75 validDragOperation = dropData.GetObjectGraphObjects().OfType<IRegressionSolution>().Any(); 76 } 77 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 78 if (e.Effect != DragDropEffects.None) { 79 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 80 var solutions = dropData.GetObjectGraphObjects().OfType<IRegressionSolution>(); 81 if (e.Effect.HasFlag(DragDropEffects.Copy)) { 82 Cloner cloner = new Cloner(); 83 solutions = solutions.Select(s => cloner.Clone(s)); 84 } 85 foreach (var solution in solutions) 86 Content.Add(solution); 87 } 63 88 } 64 89 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClassificationSolutionView.cs
r6653 r6666 21 21 22 22 using System.Windows.Forms; 23 using HeuristicLab.Core; 23 24 using HeuristicLab.MainForm; 24 25 … … 39 40 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 40 41 validDragOperation = false; 41 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is ClassificationProblemData)) { 42 validDragOperation = true; 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; 43 49 } 44 50 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
r6653 r6666 44 44 } 45 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(); 62 } 63 46 64 protected override void OnContentChanged() { 47 65 string selectedName = null; … … 66 84 67 85 protected virtual void AddEvaluationViewTypes() { 68 if (Content != null ) {86 if (Content != null && !Content.ProblemData.IsEmpty) { 69 87 var viewTypes = MainFormManager.GetViewTypes(Content.GetType(), true) 70 88 .Where(t => typeof(IDataAnalysisSolutionEvaluationView).IsAssignableFrom(t)); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs
r6653 r6666 21 21 22 22 using System.Windows.Forms; 23 using HeuristicLab.Core; 23 24 using HeuristicLab.MainForm; 24 25 … … 39 40 protected override void itemsListView_DragEnter(object sender, DragEventArgs e) { 40 41 validDragOperation = false; 41 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is RegressionProblemData)) { 42 validDragOperation = true; 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; 43 49 } 44 50 }
Note: See TracChangeset
for help on using the changeset viewer.