/*-----------------------------------------------------------------------------
	Copyright the original author or authors.
	 
	Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at
	 
		http://www.mozilla.org/MPL/MPL-1.1.html
	 
	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-----------------------------------------------------------------------------*/
 
import com.bourre.events.EventBroadcaster;
import com.bourre.mvc.AbstractController;
 
import net.customactions.asdk.core.ICoreObject;
import net.customactions.asdk.util.ClassUtil;
import net.customactions.aslicensor.mvc.LicensorModel;
import net.customactions.aslicensor.mvc.LicensorView;
 
/**
 * {@code LicensorController } class is responsible of communication between
 * View and Model in MVC Design.
 * 
 * <p>Use PixLib MVC Implementation
 * <p>Extends {@link com.bourre.mvc.AbstractController} class
 *
 * @author Romain Ecarnot
 * @version 1.0
 */
class net.customactions.aslicensor.mvc.LicensorController extends AbstractController implements ICoreObject {
	
	//-------------------------------------------------------------------------
	// Public API
	//-------------------------------------------------------------------------
	
	/**
	 * Constructs a new {@code LicensorController} instance.
	 * 
	 * @param p_mcContainer {@code MovieClip} view container
	 */
	public function LicensorController (p_mcContainer : MovieClip) {
		super();
		
		__oEB = new EventBroadcaster(this);
		setModel( new LicensorModel() );
		setView( new LicensorView( LicensorModel(getModel() ), this, p_mcContainer) );
		
		__sClassName = ClassUtil.getClassName(this);
	}
	
	/**
	 * Calls {@code LicensorModel} to select license file.
	 */
	public function browseLicense(Void) : Void {
		LicensorModel( getModel() ).browseLicense();
	}
	
	/**
	 * Calls {@code LicensorModel} to select source folder.
	 */
	public function browseSource(Void) : Void {
		LicensorModel( getModel() ).browseSource();
	}
	
	/**
	 * Calls {@code LicensorModel} to check files listing.
	 */
	public function check(Void) : Void {
		LicensorModel( getModel() ).check();
	}
	
	/**
	 * Calls {@code LicensorModel} to process license insertion.
	 */
	public function process(Void) : Void {
		LicensorModel( getModel() ).process();
	}
	
	/**
	 * Returns full namespace + classname for this instance.
	 * 
	 * <p>ASDK core implementation
	 * 
	 * @return String
	 */
	public function getClassName(Void) : String {
		return __sClassName;
	}
	
	
	/*------------------------------------------------------------------------------------------*/
	
	
	//-------------------------------------------------------------------------
	// Internal properties
	//-------------------------------------------------------------------------
	 
	private var __oEB : EventBroadcaster;
	private var __sClassName : String;
	
}