Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/19/11 11:25:46 (13 years ago)
Author:
mkommend
Message:

#1624: Implemented RunCollectionContentConstraint to hide specific runs.

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
6 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/HeuristicLab.Optimization.Views-3.3.csproj

    r6662 r6673  
    128128      <DependentUpon>BatchRunView.cs</DependentUpon>
    129129    </Compile>
     130    <Compile Include="RunCollectionContentConstraintView.cs">
     131      <SubType>UserControl</SubType>
     132    </Compile>
     133    <Compile Include="RunCollectionContentConstraintView.Designer.cs">
     134      <DependentUpon>RunCollectionContentConstraintView.cs</DependentUpon>
     135    </Compile>
    130136    <Compile Include="ExperimentTreeView.cs">
    131137      <SubType>UserControl</SubType>
     
    176182      <DependentUpon>RunCollectionConstraintCollectionView.cs</DependentUpon>
    177183    </Compile>
    178     <Compile Include="RunCollectionConstraintView.cs">
    179       <SubType>UserControl</SubType>
    180     </Compile>
    181     <Compile Include="RunCollectionConstraintView.Designer.cs">
    182       <DependentUpon>RunCollectionConstraintView.cs</DependentUpon>
     184    <Compile Include="RunCollectionColumnConstraintView.cs">
     185      <SubType>UserControl</SubType>
     186    </Compile>
     187    <Compile Include="RunCollectionColumnConstraintView.Designer.cs">
     188      <DependentUpon>RunCollectionColumnConstraintView.cs</DependentUpon>
    183189    </Compile>
    184190    <Compile Include="OptimizerListView.cs">
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.Designer.cs

    r6558 r6673  
    6161      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    6262      this.openBoxPlotViewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     63      this.hideRunToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
    6364      this.zoomButton = new System.Windows.Forms.RadioButton();
    6465      this.selectButton = new System.Windows.Forms.RadioButton();
     
    214215      this.openBoxPlotViewToolStripMenuItem.Text = "Open BoxPlot View";
    215216      this.openBoxPlotViewToolStripMenuItem.Click += new System.EventHandler(this.openBoxPlotViewToolStripMenuItem_Click);
     217      //
     218      // hideRunToolStripMenuItem
     219      //
     220      this.hideRunToolStripMenuItem.Name = "hideRunToolStripMenuItem";
     221      this.hideRunToolStripMenuItem.Size = new System.Drawing.Size(256, 22);
     222      this.hideRunToolStripMenuItem.Text = "Hide Run";
     223      this.hideRunToolStripMenuItem.Click += new System.EventHandler(hideRunToolStripMenuItem_Click);
    216224      //
    217225      // zoomButton
     
    374382    private System.Windows.Forms.Label noRunsLabel;
    375383    private System.Windows.Forms.ToolStripMenuItem openBoxPlotViewToolStripMenuItem;
     384    private System.Windows.Forms.ToolStripMenuItem hideRunToolStripMenuItem;
    376385    private System.Windows.Forms.Button colorXAxisButton;
    377386    private System.Windows.Forms.Button colorYAxisButton;
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r6096 r6673  
    5555    public RunCollectionBubbleChartView() {
    5656      InitializeComponent();
    57       chart.ContextMenuStrip.Items.Insert(0, openBoxPlotViewToolStripMenuItem);
     57
     58      chart.ContextMenuStrip.Items.Insert(0, hideRunToolStripMenuItem);
     59      chart.ContextMenuStrip.Items.Insert(1, openBoxPlotViewToolStripMenuItem);
     60      chart.ContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(ContextMenuStrip_Opening);
    5861
    5962      runToDataPointMapping = new Dictionary<IRun, List<DataPoint>>();
     
    631634    }
    632635
     636    private IRun runToHide = null;
     637    private void ContextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) {
     638      var pos = Control.MousePosition;
     639      var chartPos = chart.PointToClient(pos);
     640
     641      HitTestResult h = this.chart.HitTest(chartPos.X, chartPos.Y);
     642      if (h.ChartElementType == ChartElementType.DataPoint) {
     643        runToHide = (IRun)((DataPoint)h.Object).Tag;
     644        hideRunToolStripMenuItem.Visible = true;
     645      } else {
     646        runToHide = null;
     647        hideRunToolStripMenuItem.Visible = false;
     648      }
     649
     650    }
     651    private void hideRunToolStripMenuItem_Click(object sender, EventArgs e) {
     652      var constraint = Content.Constraints.OfType<RunCollectionContentConstraint>().Where(c => c.Active).FirstOrDefault();
     653      if (constraint == null) {
     654        constraint = new RunCollectionContentConstraint();
     655        Content.Constraints.Add(constraint);
     656        constraint.Active = true;
     657      }
     658      constraint.ConstraintData.Add(runToHide);
     659    }
     660
    633661    private void openBoxPlotViewToolStripMenuItem_Click(object sender, EventArgs e) {
    634662      RunCollectionBoxPlotView boxplotView = new RunCollectionBoxPlotView();
     
    662690    }
    663691    #endregion
    664 
    665692  }
    666693}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionColumnConstraintView.Designer.cs

    r6661 r6673  
    2121
    2222namespace HeuristicLab.Optimization.Views {
    23   partial class RunCollectionConstraintView {
     23  partial class RunCollectionColumnConstraintView {
    2424    /// <summary>
    2525    /// Required designer variable.
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionColumnConstraintView.cs

    r6661 r6673  
    2828
    2929namespace HeuristicLab.Optimization.Views {
    30   [Content(typeof(IRunCollectionConstraint))]
    31   public partial class RunCollectionConstraintView : ItemView {
    32     public RunCollectionConstraintView() {
     30  [Content(typeof(IRunCollectionColumnConstraint))]
     31  public partial class RunCollectionColumnConstraintView : ItemView {
     32    public RunCollectionColumnConstraintView() {
    3333      InitializeComponent();
    3434    }
    3535
    36     public new IRunCollectionConstraint Content {
    37       get { return (IRunCollectionConstraint)base.Content; }
     36    public new IRunCollectionColumnConstraint Content {
     37      get { return (IRunCollectionColumnConstraint)base.Content; }
    3838      set { base.Content = value; }
    3939    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionComparisonConstraintView.cs

    r5445 r6673  
    2929namespace HeuristicLab.Optimization.Views {
    3030  [Content(typeof(RunCollectionComparisonConstraint), true)]
    31   public partial class RunCollectionComparisonConstraintView : RunCollectionConstraintView {
     31  public partial class RunCollectionComparisonConstraintView : RunCollectionColumnConstraintView {
    3232    public RunCollectionComparisonConstraintView() {
    3333      InitializeComponent();
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionContentConstraintView.Designer.cs

    r6661 r6673  
    2020#endregion
    2121
     22using System.Windows.Forms;
     23
    2224namespace HeuristicLab.Optimization.Views {
    23   partial class RunCollectionConstraintView {
     25  partial class RunCollectionContentConstraintView {
    2426    /// <summary>
    2527    /// Required designer variable.
     
    4547    /// </summary>
    4648    private void InitializeComponent() {
    47       this.lblConstrainedMember = new System.Windows.Forms.Label();
    48       this.lblComparisonOperation = new System.Windows.Forms.Label();
    49       this.lblCompareValue = new System.Windows.Forms.Label();
    50       this.cmbConstraintOperation = new System.Windows.Forms.ComboBox();
    5149      this.chbActive = new System.Windows.Forms.CheckBox();
    52       this.cmbConstraintColumn = new System.Windows.Forms.ComboBox();
     50      this.runsView = new HeuristicLab.Optimization.Views.RunCollectionContentConstraintView.RunSetView();
    5351      this.SuspendLayout();
    54       //
    55       // lblConstrainedMember
    56       //
    57       this.lblConstrainedMember.AutoSize = true;
    58       this.lblConstrainedMember.Location = new System.Drawing.Point(3, 6);
    59       this.lblConstrainedMember.Name = "lblConstrainedMember";
    60       this.lblConstrainedMember.Size = new System.Drawing.Size(107, 13);
    61       this.lblConstrainedMember.TabIndex = 0;
    62       this.lblConstrainedMember.Text = "Constrained Member:";
    63       //
    64       // lblComparisonOperation
    65       //
    66       this.lblComparisonOperation.AutoSize = true;
    67       this.lblComparisonOperation.Location = new System.Drawing.Point(3, 32);
    68       this.lblComparisonOperation.Name = "lblComparisonOperation";
    69       this.lblComparisonOperation.Size = new System.Drawing.Size(106, 13);
    70       this.lblComparisonOperation.TabIndex = 1;
    71       this.lblComparisonOperation.Text = "Constraint Operation:";
    72       //
    73       // lblCompareValue
    74       //
    75       this.lblCompareValue.AutoSize = true;
    76       this.lblCompareValue.Location = new System.Drawing.Point(3, 59);
    77       this.lblCompareValue.Name = "lblCompareValue";
    78       this.lblCompareValue.Size = new System.Drawing.Size(83, 13);
    79       this.lblCompareValue.TabIndex = 2;
    80       this.lblCompareValue.Text = "Constraint Data:";
    81       //
    82       // cmbConstraintOperation
    83       //
    84       this.cmbConstraintOperation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    85                   | System.Windows.Forms.AnchorStyles.Right)));
    86       this.cmbConstraintOperation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    87       this.cmbConstraintOperation.FormattingEnabled = true;
    88       this.cmbConstraintOperation.Location = new System.Drawing.Point(127, 29);
    89       this.cmbConstraintOperation.Name = "cmbConstraintOperation";
    90       this.cmbConstraintOperation.Size = new System.Drawing.Size(246, 21);
    91       this.cmbConstraintOperation.TabIndex = 4;
    92       this.cmbConstraintOperation.SelectedIndexChanged += new System.EventHandler(this.cmbComparisonOperation_SelectedIndexChanged);
    9352      //
    9453      // chbActive
    9554      //
    9655      this.chbActive.AutoSize = true;
    97       this.chbActive.Location = new System.Drawing.Point(127, 82);
     56      this.chbActive.Location = new System.Drawing.Point(3, 3);
    9857      this.chbActive.Name = "chbActive";
    9958      this.chbActive.Size = new System.Drawing.Size(56, 17);
     
    10362      this.chbActive.CheckedChanged += new System.EventHandler(this.chbActive_CheckedChanged);
    10463      //
    105       // cmbConstraintColumn
     64      // operatorSetView1
    10665      //
    107       this.cmbConstraintColumn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    108                   | System.Windows.Forms.AnchorStyles.Right)));
    109       this.cmbConstraintColumn.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    110       this.cmbConstraintColumn.FormattingEnabled = true;
    111       this.cmbConstraintColumn.Location = new System.Drawing.Point(127, 3);
    112       this.cmbConstraintColumn.Name = "cmbConstraintColumn";
    113       this.cmbConstraintColumn.Size = new System.Drawing.Size(246, 21);
    114       this.cmbConstraintColumn.TabIndex = 8;
    115       this.cmbConstraintColumn.SelectedIndexChanged += new System.EventHandler(this.cmbConstraintColumn_SelectedIndexChanged);
     66      this.runsView.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
     67      this.runsView.Caption = "Runs View";
     68      this.runsView.Content = null;
     69      this.runsView.Location = new System.Drawing.Point(3, 26);
     70      this.runsView.Name = "runsView";
     71      this.runsView.ReadOnly = false;
     72      this.runsView.Size = new System.Drawing.Size(309, 323);
     73      this.runsView.TabIndex = 8;
    11674      //
    117       // RunCollectionConstraintView
     75      // RunCollectionContentConstraintView
    11876      //
    11977      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    12078      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    121       this.Controls.Add(this.cmbConstraintColumn);
     79      this.Controls.Add(this.runsView);
    12280      this.Controls.Add(this.chbActive);
    123       this.Controls.Add(this.cmbConstraintOperation);
    124       this.Controls.Add(this.lblCompareValue);
    125       this.Controls.Add(this.lblComparisonOperation);
    126       this.Controls.Add(this.lblConstrainedMember);
    127       this.Name = "RunCollectionConstraintView";
    128       this.Size = new System.Drawing.Size(376, 102);
     81      this.Name = "RunCollectionContentConstraintView";
     82      this.Size = new System.Drawing.Size(315, 352);
    12983      this.ResumeLayout(false);
    13084      this.PerformLayout();
     
    13488    #endregion
    13589
    136     private System.Windows.Forms.Label lblConstrainedMember;
    137     private System.Windows.Forms.Label lblComparisonOperation;
    138     private System.Windows.Forms.Label lblCompareValue;
    13990    private System.Windows.Forms.CheckBox chbActive;
    140     protected System.Windows.Forms.ComboBox cmbConstraintColumn;
    141     protected System.Windows.Forms.ComboBox cmbConstraintOperation;
     91    private RunSetView runsView;
    14292  }
    14393}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionContentConstraintView.cs

    r6661 r6673  
    2222using System;
    2323using System.Linq;
    24 using HeuristicLab.Core;
     24using System.Windows.Forms;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core.Views;
    26 using HeuristicLab.Data;
    2727using HeuristicLab.MainForm;
    2828
    2929namespace HeuristicLab.Optimization.Views {
    30   [Content(typeof(IRunCollectionConstraint))]
    31   public partial class RunCollectionConstraintView : ItemView {
    32     public RunCollectionConstraintView() {
     30  [Content(typeof(RunCollectionContentConstraint), true)]
     31  public partial class RunCollectionContentConstraintView : ItemView {
     32    public RunCollectionContentConstraintView() {
    3333      InitializeComponent();
     34      runsView.ShowDetails = false;
    3435    }
    3536
    36     public new IRunCollectionConstraint Content {
    37       get { return (IRunCollectionConstraint)base.Content; }
     37    public new RunCollectionContentConstraint Content {
     38      get { return (RunCollectionContentConstraint)base.Content; }
    3839      set { base.Content = value; }
    3940    }
     
    4142    protected override void OnContentChanged() {
    4243      base.OnContentChanged();
    43       cmbConstraintColumn.Items.Clear();
    44       cmbConstraintOperation.Items.Clear();
    45 
    4644      if (Content != null) {
    47         cmbConstraintOperation.Items.AddRange(Content.AllowedConstraintOperations.ToArray());
    48         if (Content.ConstraintOperation != null)
    49           cmbConstraintOperation.SelectedItem = Content.ConstraintOperation;
    50         else if (cmbConstraintOperation.Items.Count != 0)
    51           cmbConstraintOperation.SelectedIndex = 0;
    52         UpdateColumnComboBox();
    5345        chbActive.Checked = Content.Active;
    5446        ReadOnly = Content.Active;
    55       } else
     47        runsView.RunCollection = Content.ConstrainedValue;
     48        runsView.Content = Content.ConstraintData;
     49      } else {
    5650        chbActive.Checked = false;
    57     }
    58 
    59     protected virtual void UpdateColumnComboBox() {
    60       this.cmbConstraintColumn.Items.Clear();
    61       if (Content.ConstrainedValue != null) {
    62         this.cmbConstraintColumn.Items.AddRange(((IStringConvertibleMatrix)Content.ConstrainedValue).ColumnNames.ToArray());
    63         if (!string.IsNullOrEmpty(Content.ConstraintColumn))
    64           this.cmbConstraintColumn.SelectedItem = Content.ConstraintColumn;
     51        runsView.RunCollection = null;
     52        runsView.Content = null;
    6553      }
    6654    }
     
    6856    protected override void RegisterContentEvents() {
    6957      base.RegisterContentEvents();
    70       this.Content.ActiveChanged += new EventHandler(Content_ActiveChanged);
    71       this.Content.ConstraintOperationChanged += new EventHandler(Content_ComparisonOperationChanged);
    72       this.Content.ConstraintColumnChanged += new EventHandler(Content_ConstraintColumnChanged);
    73       this.Content.ConstrainedValueChanged += new EventHandler(Content_ConstrainedValueChanged);
     58      Content.ActiveChanged += new EventHandler(Content_ActiveChanged);
    7459    }
    7560
    7661    protected override void DeregisterContentEvents() {
    7762      base.DeregisterContentEvents();
    78       this.Content.ActiveChanged -= new EventHandler(Content_ActiveChanged);
    79       this.Content.ConstraintOperationChanged -= new EventHandler(Content_ComparisonOperationChanged);
    80       this.Content.ConstraintColumnChanged -= new EventHandler(Content_ConstraintColumnChanged);
    81       this.Content.ConstrainedValueChanged += new EventHandler(Content_ConstrainedValueChanged);
     63      Content.ActiveChanged -= new EventHandler(Content_ActiveChanged);
    8264    }
    8365
    8466    protected override void SetEnabledStateOfControls() {
    8567      base.SetEnabledStateOfControls();
    86       cmbConstraintColumn.Enabled = !this.ReadOnly && Content != null;
    87       cmbConstraintOperation.Enabled = !this.ReadOnly && Content != null;
    88       chbActive.Enabled = !this.Locked && Content != null;
    89     }
    90 
    91     protected virtual void Content_ConstrainedValueChanged(object sender, EventArgs e) {
    92       this.UpdateColumnComboBox();
    93     }
    94 
    95     protected virtual void Content_ConstraintColumnChanged(object sender, EventArgs e) {
    96       if (Content.ConstrainedValue != null) {
    97         if (cmbConstraintColumn.SelectedItem.ToString() != Content.ConstraintColumn)
    98           cmbConstraintColumn.SelectedItem = Content.ConstraintColumn;
    99       }
    100     }
    101     private void cmbConstraintColumn_SelectedIndexChanged(object sender, EventArgs e) {
    102       if (Content.ConstrainedValue != null) {
    103         Content.ConstraintColumn = (string)cmbConstraintColumn.SelectedItem;
    104       }
    105     }
    106 
    107     protected virtual void Content_ComparisonOperationChanged(object sender, EventArgs e) {
    108       if (Content.ConstraintOperation != (ConstraintOperation)this.cmbConstraintOperation.SelectedItem)
    109         this.cmbConstraintOperation.SelectedItem = Content.ConstraintOperation;
    110     }
    111     protected virtual void cmbComparisonOperation_SelectedIndexChanged(object sender, EventArgs e) {
    112       Content.ConstraintOperation = (ConstraintOperation)this.cmbConstraintOperation.SelectedItem;
     68      chbActive.Enabled = !Locked && Content != null;
     69      runsView.Enabled = !Locked && Content != null;
    11370    }
    11471
    11572    protected virtual void Content_ActiveChanged(object sender, EventArgs e) {
    116       if (this.chbActive.Checked != Content.Active)
    117         this.chbActive.Checked = Content.Active;
    118       this.ReadOnly = Content.Active;
     73      chbActive.Checked = Content.Active;
     74      ReadOnly = Content.Active;
    11975    }
    12076    protected virtual void chbActive_CheckedChanged(object sender, EventArgs e) {
     
    12278        Content.Active = chbActive.Checked;
    12379    }
     80
     81    private class RunSetView : ItemSetView<IRun> {
     82      public RunCollection RunCollection { get; set; }
     83
     84      protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
     85        base.itemsListView_DragEnter(sender, e);
     86        if (RunCollection != null) {
     87          var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     88          foreach (var run in dropData.GetObjectGraphObjects().OfType<IRun>())
     89            validDragOperation = validDragOperation && RunCollection.Contains(run);
     90        }
     91      }
     92
     93      protected override void itemsListView_DragOver(object sender, DragEventArgs e) {
     94        e.Effect = DragDropEffects.None;
     95        if (validDragOperation) {
     96          e.Effect = DragDropEffects.Link;
     97        }
     98      }
     99    }
    124100  }
    125101}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionEqualityConstraintView.cs

    r5445 r6673  
    2525namespace HeuristicLab.Optimization.Views {
    2626  [Content(typeof(RunCollectionEqualityConstraint), true)]
    27   public partial class RunCollectionEqualityConstraintView : RunCollectionConstraintView {
     27  public partial class RunCollectionEqualityConstraintView : RunCollectionColumnConstraintView {
    2828    public RunCollectionEqualityConstraintView() {
    2929      InitializeComponent();
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionTypeCompatibilityConstraintView.cs

    r5445 r6673  
    2525namespace HeuristicLab.Optimization.Views {
    2626  [Content(typeof(RunCollectionTypeCompatibilityConstraint), true)]
    27   public partial class RunCollectionTypeCompatibilityConstraintView : RunCollectionConstraintView {
     27  public partial class RunCollectionTypeCompatibilityConstraintView : RunCollectionColumnConstraintView {
    2828    public RunCollectionTypeCompatibilityConstraintView() {
    2929      InitializeComponent();
Note: See TracChangeset for help on using the changeset viewer.