Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/22/11 09:35:06 (13 years ago)
Author:
mkommend
Message:

#1479: Integrated trunk changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionEnsembleSolutionModelView.cs

    r6647 r6675  
    1919 */
    2020#endregion
     21
     22using System.Linq;
    2123using System.Windows.Forms;
     24using HeuristicLab.Common;
    2225using HeuristicLab.Core.Views;
    2326using HeuristicLab.MainForm;
     
    4447    protected override void OnContentChanged() {
    4548      base.OnContentChanged();
    46       if (Content != null)
     49      if (Content != null) {
     50        view.Locked = Content.ProblemData == RegressionEnsembleProblemData.EmptyProblemData;
    4751        view.Content = Content.RegressionSolutions;
    48       else
     52      } else
    4953        view.Content = null;
    5054    }
     
    5963        addButton.Enabled = Content != null && !Content.IsReadOnly && !Locked;
    6064        removeButton.Enabled = Content != null && !Content.IsReadOnly && !Locked && itemsListView.SelectedItems.Count > 0;
    61         itemsListView.Enabled = Content != null;
     65        itemsListView.Enabled = Content != null && !Locked;
    6266        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        }
    6388      }
    6489    }
Note: See TracChangeset for help on using the changeset viewer.