package  grid
{
	import fl.controls.listClasses.CellRenderer;
	import fl.controls.listClasses.ICellRenderer;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	
	/**
	 * ...
	 * @author Maxim
	 */
	public class RightAlignCell extends CellRenderer implements ICellRenderer 
	{
		private var tf:TextFormat;
		
		public function RightAlignCell() 
		{
			super();
			tf = new TextFormat();
			tf.align = TextFormatAlign.RIGHT;
		}
		
		
		override protected function drawLayout():void {
			setStyle("textPadding", -30);
			//textField.width = this.width;
			//textField.border = true;
			textField.setTextFormat(tf); 
			super.drawLayout(); 			
		}
		
		override protected function drawBackground():void 
		{
			if (_listData.index % 2 == 0) {
				setStyle("upSkin", CellRenderer_upSkinGray);
				setStyle("overSkin", CellRenderer_upSkinGray);
				setStyle("downSkin", CellRenderer_upSkinGray);
				setStyle("selectedUpSkin", CellRenderer_upSkinGray);
				setStyle("selectedOverSkin", CellRenderer_upSkinGray);
				setStyle("selectedDownSkin", CellRenderer_upSkinGray);
				
			}else {
				setStyle("upSkin", CellRenderer_upSkinWhite); 
				setStyle("overSkin", CellRenderer_upSkinWhite);
				setStyle("downSkin", CellRenderer_upSkinWhite);
				setStyle("selectedUpSkin", CellRenderer_upSkinWhite);
				setStyle("selectedOverSkin", CellRenderer_upSkinWhite);
				setStyle("selectedDownSkin", CellRenderer_upSkinWhite);
			}
			
		
			
			super.drawBackground();
		}
	}

}