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.

Location:
branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4
Files:
8 edited
7 copied

Legend:

Unmodified
Added
Removed
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionModelView.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 == ClassificationEnsembleProblemData.EmptyProblemData;
    4751        view.Content = Content.ClassificationSolutions;
    48       else
     52      } else
    4953        view.Content = null;
    5054    }
     
    6266        detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1;
    6367      }
     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      }
    6489    }
    6590  }
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r6647 r6675  
    110110  </ItemGroup>
    111111  <ItemGroup>
     112    <Compile Include="Classification\ClassificationEnsembleSolutionEstimatedClassValuesView.cs">
     113      <SubType>UserControl</SubType>
     114    </Compile>
     115    <Compile Include="Classification\ClassificationEnsembleSolutionEstimatedClassValuesView.Designer.cs">
     116      <DependentUpon>ClassificationEnsembleSolutionEstimatedClassValuesView.cs</DependentUpon>
     117    </Compile>
    112118    <Compile Include="Classification\ClassificationEnsembleSolutionModelView.cs">
    113119      <SubType>UserControl</SubType>
     
    182188      <DependentUpon>ClusteringSolutionView.cs</DependentUpon>
    183189    </Compile>
     190    <Compile Include="Solution Views\ClassificationEnsembleSolutionView.cs">
     191      <SubType>UserControl</SubType>
     192    </Compile>
     193    <Compile Include="Solution Views\ClassificationEnsembleSolutionView.Designer.cs">
     194      <DependentUpon>ClassificationEnsembleSolutionView.cs</DependentUpon>
     195    </Compile>
    184196    <Compile Include="Solution Views\DiscriminantFunctionClassificationSolutionView.cs">
    185197      <SubType>UserControl</SubType>
     
    202214    <Compile Include="Interfaces\IDataAnalysisSolutionEvaluationView.cs" />
    203215    <Compile Include="MenuItems\CreateEnsembleMenuItem.cs" />
     216    <Compile Include="Solution Views\NamedDataAnalysisSolutionView.cs">
     217      <SubType>UserControl</SubType>
     218    </Compile>
     219    <Compile Include="Solution Views\NamedDataAnalysisSolutionView.Designer.cs">
     220      <DependentUpon>NamedDataAnalysisSolutionView.cs</DependentUpon>
     221    </Compile>
     222    <Compile Include="Solution Views\RegressionEnsembleSolutionView.cs">
     223      <SubType>UserControl</SubType>
     224    </Compile>
     225    <Compile Include="Solution Views\RegressionEnsembleSolutionView.Designer.cs">
     226      <DependentUpon>RegressionEnsembleSolutionView.cs</DependentUpon>
     227    </Compile>
    204228    <Compile Include="Solution Views\RegressionSolutionView.cs">
    205229      <SubType>UserControl</SubType>
  • 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    }
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClassificationSolutionView.cs

    r6647 r6675  
    2121
    2222using System.Windows.Forms;
     23using HeuristicLab.Core;
    2324using HeuristicLab.MainForm;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis.Views {
    2627  [View("ClassificationSolution View")]
    27   [Content(typeof(ClassificationSolutionBase), true)]
     28  [Content(typeof(ClassificationSolutionBase), false)]
    2829  public partial class ClassificationSolutionView : DataAnalysisSolutionView {
    2930    public ClassificationSolutionView() {
     
    3536      set { base.Content = value; }
    3637    }
     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
    3752  }
    3853}
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClusteringSolutionView.cs

    r6647 r6675  
    2525namespace HeuristicLab.Problems.DataAnalysis.Views {
    2626  [View("ClusteringSolution View")]
    27   [Content(typeof(ClusteringSolution), true)]
     27  [Content(typeof(ClusteringSolution), false)]
    2828  public partial class ClusteringSolutionView : DataAnalysisSolutionView {
    2929    public ClusteringSolutionView() {
     
    3535      set { base.Content = value; }
    3636    }
     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
    3746  }
    3847}
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs

    r6647 r6675  
    2525using System.Linq;
    2626using System.Windows.Forms;
     27using HeuristicLab.Core.Views;
    2728using HeuristicLab.MainForm;
     29using HeuristicLab.Optimization;
    2830using HeuristicLab.Optimization.Views;
    2931
    3032namespace HeuristicLab.Problems.DataAnalysis.Views {
    3133  [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> {
    3436    public DataAnalysisSolutionView() {
    3537      InitializeComponent();
     38      viewHost.ViewsLabelVisible = false;
    3639    }
    3740
     
    3942      get { return (DataAnalysisSolution)base.Content; }
    4043      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();
    4162    }
    4263
     
    5879    }
    5980
     81    protected override IResult CreateItem() {
     82      return null;
     83    }
     84
    6085    protected virtual void AddEvaluationViewTypes() {
    61       if (Content != null) {
     86      if (Content != null && !Content.ProblemData.IsEmpty) {
    6287        var viewTypes = MainFormManager.GetViewTypes(Content.GetType(), true)
    6388          .Where(t => typeof(IDataAnalysisSolutionEvaluationView).IsAssignableFrom(t));
     
    6893
    6994    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) {
    72106        MainFormManager.MainForm.ShowContent(Content, viewType);
    73       } else
    74         base.itemsListView_DoubleClick(sender, e);
     107      }
    75108    }
    76109
     
    102135        itemsListView.Items.Remove(item);
    103136    }
     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
    104155  }
    105156}
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DiscriminantFunctionClassificationSolutionView.cs

    r6647 r6675  
    2020#endregion
    2121
    22 using System.Windows.Forms;
     22
    2323using HeuristicLab.MainForm;
    24 
    2524namespace 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 {
    2928    public DiscriminantFunctionClassificationSolutionView() {
    3029      InitializeComponent();
  • branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs

    r6647 r6675  
    2121
    2222using System.Windows.Forms;
     23using HeuristicLab.Core;
    2324using HeuristicLab.MainForm;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis.Views {
    2627  [View("RegressionSolution View")]
    27   [Content(typeof(RegressionSolutionBase), true)]
     28  [Content(typeof(RegressionSolutionBase), false)]
    2829  public partial class RegressionSolutionView : DataAnalysisSolutionView {
    2930    public RegressionSolutionView() {
     
    3536      set { base.Content = value; }
    3637    }
     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
    3752  }
    3853}
Note: See TracChangeset for help on using the changeset viewer.