package gallery.view 
{
	import gallery.GalleryApp;
	import gallery.components.GalleryImagesUI;
	import gallery.model.vo.GalleryImageVo;

	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;

	/**
	 * ...
	 * @author Shuhan Kuang {shuhankuang[at]gmail.com}
	 * @site http://www.shuhanarts.com
	 */
	public class GalleryImagesUIMediator extends Mediator 
	{

		static public var NAME : String = 'ImageLoaderUIMediator';
		//
		private var imageLoaderUI : GalleryImagesUI;

		/**
		 * Cons..
		 * @param	mediatorName
		 * @param	viewComponent
		 */
		public function GalleryImagesUIMediator(mediatorName : String, viewComponent : Object) {
			super(NAME, viewComponent);
			imageLoaderUI = GalleryImagesUI(viewComponent)
		}

		override public function listNotificationInterests() : Array {
			return [GalleryApp.ON_CATEGORY_DATA_LOAD_INIT,
			GalleryApp.ON_CATEGORY_DATA_LOAD_START,
			GalleryApp.ON_IMAGE_LOAD_INIT,
			GalleryApp.ON_IMAGE_LOAD_START,
			GalleryApp.ON_CHANGE_IMAGE,
			GalleryApp.ON_IMAGES_DATA_LOAD_INIT,
			GalleryApp.ON_IMAGES_DATA_LOAD_START,
			GalleryApp.ON_SLIDESHOW_START,
			GalleryApp.ON_SLIDESHOW_STOP];
		}

		override public function handleNotification( notification : INotification ) : void {
			//value from notification..
			var eventName : String = notification.getName();
			var body : Object = notification.getBody();
			//
			switch(eventName) {
				case GalleryApp.ON_CATEGORY_DATA_LOAD_INIT :
					imageLoaderUI.init(body);
					break;
				case GalleryApp.ON_CATEGORY_DATA_LOAD_START :
					//
					break;
				case GalleryApp.ON_IMAGE_LOAD_INIT :
					//
					break;
				case GalleryApp.ON_IMAGE_LOAD_START :
					
					break;
				case GalleryApp.ON_IMAGES_DATA_LOAD_INIT :
					imageLoaderUI.initImages(body);
					break;
				case GalleryApp.ON_IMAGES_DATA_LOAD_START :
					 
					break;
				case GalleryApp.ON_CHANGE_IMAGE :
					var image : GalleryImageVo = GalleryImageVo(body);
					imageLoaderUI.load(image);
					break;
				case GalleryApp.ON_SLIDESHOW_START : 
					//
					break;
				case GalleryApp.ON_SLIDESHOW_STOP : 
					//
					break;
				default :
					//
					break;
			}
		}
	}
}