1  
     4  
     5  import org.aswing.DefaultListCell;
     6  import org.aswing.ListCell;
     7  import org.aswing.ListCellFactory;
     8  
     9  
    12  class org.aswing.DefaultListCellFactory implements ListCellFactory {
    13  	
    14  	private var shareCelles:Boolean;
    15  	private var cellHeight:Number;
    16  	
    17  	
    21  	public function DefaultListCellFactory(shareCelles:Boolean){
    22  		if(shareCelles == undefined){
    23  			shareCelles = true;
    24  		}
    25  		this.shareCelles = shareCelles;
    26  		cellHeight = -1;
    27  	}
    28  	
    29  	public function createNewCell() : ListCell {
    30  		return new DefaultListCell();
    31  	}
    32  	
    33  	
    37  	public function isAllCellHasSameHeight() : Boolean {
    38  		return true;
    39  	}
    40  	
    41  	
    45  	public function isShareCells() : Boolean {
    46  		return shareCelles;
    47  	}
    48  	
    49  	
    53  	public function getCellHeight() : Number {
    54  		if(cellHeight < 0){
    55  			var cell:ListCell = createNewCell();
    56  			cell.setValue("JjHhWpqQ1@|");
    57  			cellHeight = cell.getListCellComponent().getPreferredSize().height;
    58  		}
    59  		return cellHeight;
    60  	}
    61  
    62  }
    63