Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/01/11 15:51:30 (13 years ago)
Author:
epitzer
Message:

Integrate functionality of RunCollectionModificationEvaluator directly into RunCollection and its view. (#1622)

This update includes a modified RunCollectionModificationEvaluator that automatic migrates all modifies into the RunCollection.

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
2 added
3 edited

Legend:

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

    r6673 r6693  
    128128      <DependentUpon>BatchRunView.cs</DependentUpon>
    129129    </Compile>
     130    <Compile Include="RunCollectionModifierListView.cs">
     131      <SubType>UserControl</SubType>
     132    </Compile>
     133    <Compile Include="RunCollectionModifierListView.Designer.cs">
     134      <DependentUpon>RunCollectionModifierListView.cs</DependentUpon>
     135    </Compile>
    130136    <Compile Include="RunCollectionContentConstraintView.cs">
    131137      <SubType>UserControl</SubType>
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.Designer.cs

    r5744 r6693  
    6565      this.constraintPage = new System.Windows.Forms.TabPage();
    6666      this.runCollectionConstraintCollectionView = new HeuristicLab.Optimization.Views.RunCollectionConstraintCollectionView();
     67      this.modifiersPage = new System.Windows.Forms.TabPage();
     68      this.runCollectionModifiersListView = new HeuristicLab.Optimization.Views.RunCollectionModifiersListView();
    6769      this.splitContainer.Panel1.SuspendLayout();
    6870      this.splitContainer.Panel2.SuspendLayout();
     
    7476      this.runPage.SuspendLayout();
    7577      this.constraintPage.SuspendLayout();
     78      this.modifiersPage.SuspendLayout();
    7679      this.SuspendLayout();
    7780      //
     
    235238      this.tabControl.Controls.Add(this.runPage);
    236239      this.tabControl.Controls.Add(this.constraintPage);
     240      this.tabControl.Controls.Add(this.modifiersPage);
    237241      this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
    238242      this.tabControl.Location = new System.Drawing.Point(0, 0);
     
    274278      this.runCollectionConstraintCollectionView.Size = new System.Drawing.Size(518, 351);
    275279      this.runCollectionConstraintCollectionView.TabIndex = 0;
     280      //
     281      // modifiersPage
     282      //
     283      this.modifiersPage.Controls.Add(this.runCollectionModifiersListView);
     284      this.modifiersPage.Location = new System.Drawing.Point(4, 22);
     285      this.modifiersPage.Name = "modifiersPage";
     286      this.modifiersPage.Padding = new System.Windows.Forms.Padding(3);
     287      this.modifiersPage.Size = new System.Drawing.Size(524, 357);
     288      this.modifiersPage.TabIndex = 2;
     289      this.modifiersPage.Text = "Modification";
     290      this.modifiersPage.UseVisualStyleBackColor = true;
     291      //
     292      // runCollectionModifiersListView
     293      //
     294      this.runCollectionModifiersListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     295            | System.Windows.Forms.AnchorStyles.Left)
     296            | System.Windows.Forms.AnchorStyles.Right)));
     297      this.runCollectionModifiersListView.Caption = "Modifier View";
     298      this.runCollectionModifiersListView.Content = null;
     299      this.runCollectionModifiersListView.Location = new System.Drawing.Point(3, 6);
     300      this.runCollectionModifiersListView.Name = "runCollectionModifiersListView";
     301      this.runCollectionModifiersListView.ReadOnly = false;
     302      this.runCollectionModifiersListView.Size = new System.Drawing.Size(515, 345);
     303      this.runCollectionModifiersListView.TabIndex = 0;
    276304      //
    277305      // RunCollectionView
     
    291319      this.runPage.ResumeLayout(false);
    292320      this.constraintPage.ResumeLayout(false);
     321      this.modifiersPage.ResumeLayout(false);
    293322      this.ResumeLayout(false);
    294323
     
    314343    private Button clearButton;
    315344    private CheckBox showDetailsCheckBox;
     345    private TabPage modifiersPage;
     346    private RunCollectionModifiersListView runCollectionModifiersListView;
    316347  }
    317348}
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r6664 r6693  
    5858      itemsGroupBox.Text = "Runs";
    5959      itemListViewItemMapping = new Dictionary<IRun, List<ListViewItem>>();
     60      runCollectionModifiersListView.Evaluator = EvaluateModifications;
    6061    }
    6162
     
    9899        }
    99100      }
    100       var modifierMenuItem = new ToolStripMenuItem();
    101       modifierMenuItem.Text = "Modify RunCollection";
    102       modifierMenuItem.Click += ModifierMenuItem_OnClick;
    103       analyzeRunsToolStripDropDownButton.DropDownItems.Add(modifierMenuItem);
    104101    }
    105102
     
    122119          runCollectionConstraintCollectionView.Content = RunCollection.Constraints;
    123120          runCollectionConstraintCollectionView.ReadOnly = itemsListView.Items.Count == 0;
     121          if (!tabControl.TabPages.Contains(modifiersPage))
     122            tabControl.TabPages.Add(modifiersPage);
     123          runCollectionModifiersListView.Content = RunCollection.Modifiers;
    124124        }
    125125        foreach (IRun item in Content) {
     
    134134        if (tabControl.TabPages.Contains(constraintPage))
    135135          tabControl.TabPages.Remove(constraintPage);
     136        if (tabControl.TabPages.Contains(modifiersPage))
     137          tabControl.TabPages.Remove(modifiersPage);
    136138      }
    137139    }
     
    340342      }
    341343    }
    342     private void ModifierMenuItem_OnClick(object sender, EventArgs args) {
    343       var modifier = new RunCollectionModificationEvaluator();
    344       modifier.RunCollection.AddRange(Content.Select(r => (IRun)r.Clone()));
    345       MainFormManager.MainForm.ShowContent(modifier);
    346     }
    347344    private void removeButton_Click(object sender, EventArgs e) {
    348345      if (itemsListView.SelectedItems.Count > 0) {
     
    357354    #endregion
    358355
    359     #region CheckBox Events
     356    #region Control Events
    360357    private void showDetailsCheckBox_CheckedChanged(object sender, EventArgs e) {
    361358      if (showDetailsCheckBox.Checked) {
     
    368365      }
    369366    }
     367    private void EvaluateModifications() {
     368      if (RunCollection == null)
     369        return;
     370      ReadOnly = true;
     371      try {
     372        RunCollection.Modify();
     373      } finally {
     374        ReadOnly = false;
     375      }
     376    }
    370377    #endregion
    371378
Note: See TracChangeset for help on using the changeset viewer.