Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/05/10 14:04:53 (14 years ago)
Author:
mkommend
Message:

corrected RunCollectionConstraints and the according views (ticket#970)

File:
1 edited

Legend:

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

    r3625 r3632  
    8484        OnColumnNamesChanged();
    8585      OnRowNamesChanged();
     86      this.UpdateFiltering(false);
    8687    }
    8788    protected override void OnItemsRemoved(IEnumerable<IRun> items) {
     
    160161    public override IDeepCloneable Clone(Cloner cloner) {
    161162      RunCollection clone = (RunCollection)base.Clone(cloner);
    162       clone.resultNames = this.resultNames;
    163       clone.parameterNames = this.parameterNames;
     163      clone.resultNames = new List<string>(this.resultNames);
     164      clone.parameterNames = new List<string>(this.parameterNames);
    164165      clone.dataTypes = new Dictionary<string, HashSet<Type>>();
    165166      foreach (string s in this.dataTypes.Keys)
    166167        clone.dataTypes[s] = new HashSet<Type>(this.dataTypes[s]);
    167 
    168168      return clone;
    169169    }
     
    252252
    253253    #region filtering
    254     private void UpdateFiltering() {
    255       list.ForEach(r => r.Visible = true);
     254    private void UpdateFiltering(bool reset) {
     255      if (reset)
     256        list.ForEach(r => r.Visible = true);
    256257      foreach (IRunCollectionConstraint constraint in this.constraints)
    257258        constraint.Check();
     
    278279      DeregisterConstraintEvents(e.OldItems);
    279280      RegisterConstraintEvents(e.Items);
    280       this.UpdateFiltering();
     281      this.UpdateFiltering(true);
    281282    }
    282283    protected virtual void Constraints_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) {
     
    284285      foreach (IRunCollectionConstraint constraint in e.Items)
    285286        constraint.ConstrainedValue = this;
    286       this.UpdateFiltering();
     287      this.UpdateFiltering(false);
    287288    }
    288289    protected virtual void Constraints_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRunCollectionConstraint> e) {
    289290      DeregisterConstraintEvents(e.Items);
    290       this.UpdateFiltering();
     291      this.UpdateFiltering(true);
    291292    }
    292293    protected virtual void Constraint_ActiveChanged(object sender, EventArgs e) {
    293       this.UpdateFiltering();
     294      IRunCollectionConstraint constraint = (IRunCollectionConstraint)sender;
     295      this.UpdateFiltering(!constraint.Active);
    294296    }
    295297    protected virtual void Constraint_ConstrainedValueChanged(object sender, EventArgs e) {
     
    297299    }
    298300    protected virtual void Constraint_ConstraintOperationChanged(object sender, EventArgs e) {
    299       this.UpdateFiltering();
     301      IRunCollectionConstraint constraint = (IRunCollectionConstraint)sender;
     302      if (constraint.Active)
     303        this.UpdateFiltering(true);
    300304    }
    301305    protected virtual void Constraint_ConstraintDataChanged(object sender, EventArgs e) {
    302       this.UpdateFiltering();
     306      IRunCollectionConstraint constraint = (IRunCollectionConstraint)sender;
     307      if (constraint.Active)
     308        this.UpdateFiltering(true);
    303309    }
    304310    #endregion
Note: See TracChangeset for help on using the changeset viewer.