Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4162 for trunk/sources


Ignore:
Timestamp:
08/05/10 10:16:57 (14 years ago)
Author:
mkommend
Message:

correct RunCollectionConstraintCollectionView to displayed cloned constraints correctly (ticket #1131)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionConstraintCollectionView.cs

    r4068 r4162  
    3434  [Content(typeof(IItemCollection<IRunCollectionConstraint>), false)]
    3535  public partial class RunCollectionConstraintCollectionView : ItemCollectionView<IRunCollectionConstraint> {
    36     /// <summary>
    37     /// Initializes a new instance of <see cref="VariablesScopeView"/> with caption "Variables Scope View".
    38     /// </summary>
    3936    public RunCollectionConstraintCollectionView() {
    4037      InitializeComponent();
     
    6158    }
    6259
     60    protected override ListViewItem CreateListViewItem(IRunCollectionConstraint item) {
     61      ListViewItem listViewItem = base.CreateListViewItem(item);
     62      if (item.Active)
     63        listViewItem.Font = new Font(listViewItem.Font, FontStyle.Bold);
     64      else
     65        listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular);
     66      return listViewItem;
     67    }
     68
    6369    protected override void RegisterContentEvents() {
    6470      base.RegisterContentEvents();
     
    7581      foreach (IRunCollectionConstraint constraint in e.Items)
    7682        RegisterConstraintEvents(constraint);
     83
    7784    }
    7885    protected override void Content_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) {
     
    9299      constraint.ActiveChanged += new EventHandler(constraint_ActiveChanged);
    93100    }
    94 
    95101    protected virtual void DeregisterConstraintEvents(IRunCollectionConstraint constraint) {
    96102      constraint.ActiveChanged -= new EventHandler(constraint_ActiveChanged);
    97103    }
    98 
    99104    protected virtual void constraint_ActiveChanged(object sender, EventArgs e) {
    100       IRunCollectionConstraint constraint = sender as IRunCollectionConstraint;
    101       if (constraint != null) {
    102         foreach (ListViewItem listViewItem in GetListViewItemsForItem(constraint)) {
    103           if (constraint.Active)
    104             listViewItem.Font = new Font(listViewItem.Font, FontStyle.Bold);
    105           else
    106             listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular);
    107         }
     105      IRunCollectionConstraint constraint = (IRunCollectionConstraint)sender;
     106      foreach (ListViewItem listViewItem in GetListViewItemsForItem(constraint)) {
     107        if (constraint.Active)
     108          listViewItem.Font = new Font(listViewItem.Font, FontStyle.Bold);
     109        else
     110          listViewItem.Font = new Font(listViewItem.Font, FontStyle.Regular);
    108111      }
    109112      this.AdjustListViewColumnSizes();
Note: See TracChangeset for help on using the changeset viewer.