1  /**
     2   * com.sekati.demo.FilterBtn
     3   * @version 1.0.1
     4   * @author jason m horwitz | sekati.com
     5   * Copyright (C) 2007  jason m horwitz, Sekat LLC. All Rights Reserved.
     6   * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
     7   */
     8  
     9  import com.sekati.display.CoreClip;
    10  import com.sekati.log.Out;
    11  import com.sekati.utils.Delegate;
    12  
    13  /**
    14   * FilterBtn demo for {@link com.sekati.log.Out} and {@link com.sekati.log.OutPanel}
    15   */
    16  class com.project.ui.FilterBtn extends CoreClip {
    17  
    18  	private var _tf:TextField;
    19  	private var _out:Out;
    20  	private var _self:String;
    21  	private var _isFiltered:Boolean;
    22  
    23  	// constructor
    24  	private function FilterBtn() {
    25  	}
    26  
    27  	private function configUI():Void {
    28  		_tf = _this.tf;
    29  		_out = Out.getInstance( );
    30  		_self = _this._name;
    31  		_isFiltered = false;
    32  		setText( );
    33  		_out.trace( _this, "filterBtn initialized ..." );
    34  		_this.onRollOver = Delegate.create( _this, btn_onRollOver );
    35  		_this.onRollOut = Delegate.create( _this, btn_onRollOut );
    36  		_this.onPress = Delegate.create( _this, btn_onPress );
    37  		_this.onRelease = Delegate.create( _this, btn_onRelease );
    38  		_this.onReleaseOutside = Delegate.create( _this, btn_onRelease );
    39  	}
    40  
    41  	private function btn_onRollOver():Void {
    42  		_out.info( _this, _self + ".onRollOver()" );
    43  	}
    44  
    45  	private function btn_onRollOut():Void {
    46  		_out.info( _this, _self + ".onRollOut()" );
    47  	}
    48  
    49  	private function btn_onPress():Void {
    50  		_out.info( _this, _self + ".onPress()" );
    51  		toggleFilter( );
    52  		setText( );
    53  		_out.status( _this, _self + "._isFiltered = " + _isFiltered );
    54  	}
    55  
    56  	private function btn_onRelease():Void {
    57  		_out.info( _this, _self + ".onRelease()" );
    58  	}
    59  
    60  	private function toggleFilter():Void {
    61  		_isFiltered = (_isFiltered) ? false : true;
    62  		_out.setFilter( _this, _isFiltered );
    63  	}
    64  
    65  	private function setText():Void {
    66  		_tf.text = _self;
    67  		_tf.text += (_isFiltered) ? " (filtered)" : " (unfiltered)";
    68  	}
    69  }