Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/01/11 10:46:20 (13 years ago)
Author:
gkronber
Message:

#1618 small change in data analysis views to make drag and drop behavior for changing the problem data of a solution consistent.

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClusteringSolutionView.cs

    r6653 r6692  
    2121
    2222using System.Windows.Forms;
     23using HeuristicLab.Core;
    2324using HeuristicLab.MainForm;
    2425
     
    3940    protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
    4041      validDragOperation = false;
    41       if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is ClusteringProblemData)) {
    42         validDragOperation = true;
     42      if (ReadOnly) return;
     43
     44      var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     45      if (dropData is ClusteringProblemData) validDragOperation = true;
     46      else if (dropData is IValueParameter) {
     47        var param = (IValueParameter)dropData;
     48        if (param.Value is ClusteringProblemData) validDragOperation = true;
    4349      }
    4450    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs

    r6666 r6692  
    2525using System.Linq;
    2626using System.Windows.Forms;
     27using HeuristicLab.Core;
    2728using HeuristicLab.Core.Views;
    2829using HeuristicLab.MainForm;
     
    139140    protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
    140141      validDragOperation = false;
    141       if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is DataAnalysisProblemData)) {
    142         validDragOperation = true;
     142      if (ReadOnly) return;
     143
     144      var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     145      if (dropData is DataAnalysisProblemData) validDragOperation = true;
     146      else if (dropData is IValueParameter) {
     147        var param = (IValueParameter)dropData;
     148        if (param.Value is DataAnalysisProblemData) validDragOperation = true;
    143149      }
    144150    }
     
    146152    protected override void itemsListView_DragDrop(object sender, DragEventArgs e) {
    147153      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);
     154        var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     155        if (dropData is DataAnalysisProblemData) {
     156          DataAnalysisProblemData problemData = (DataAnalysisProblemData)dropData;
    150157          Content.ProblemData = (DataAnalysisProblemData)problemData.Clone();
     158        } else if (dropData is IValueParameter) {
     159          var param = (IValueParameter)dropData;
     160          DataAnalysisProblemData problemData = param.Value as DataAnalysisProblemData;
     161          if (problemData != null)
     162            Content.ProblemData = (DataAnalysisProblemData)problemData.Clone();
    151163        }
    152164      }
Note: See TracChangeset for help on using the changeset viewer.