Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/20/11 02:36:00 (13 years ago)
Author:
swagner
Message:

Enabled hiding of parameters (#1377)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs

    r5445 r5768  
    5555    }
    5656
     57    [Storable(DefaultValue = false)]
     58    private bool hidden;
     59    public bool Hidden {
     60      get { return hidden; }
     61      set {
     62        if (value != hidden) {
     63          hidden = value;
     64          OnHiddenChanged();
     65        }
     66      }
     67    }
     68
    5769    private Lazy<ThreadLocal<IItem>> cachedActualValues;
    5870    public IItem ActualValue {
     
    8698      : base(original, cloner) {
    8799      dataType = original.dataType;
     100      hidden = original.hidden;
    88101      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    89102      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
     
    92105      : base("Anonymous") {
    93106      dataType = typeof(IItem);
     107      hidden = false;
    94108      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    95109      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
     
    99113      if (dataType == null) throw new ArgumentNullException();
    100114      this.dataType = dataType;
     115      hidden = false;
    101116      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    102117      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
     
    106121      if (dataType == null) throw new ArgumentNullException();
    107122      this.dataType = dataType;
     123      hidden = false;
    108124      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    109125      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
     
    116132    protected abstract IItem GetActualValue();
    117133    protected abstract void SetActualValue(IItem value);
     134
     135    public event EventHandler HiddenChanged;
     136    protected virtual void OnHiddenChanged() {
     137      EventHandler handler = HiddenChanged;
     138      if (handler != null) handler(this, EventArgs.Empty);
     139    }
    118140  }
    119141}
Note: See TracChangeset for help on using the changeset viewer.