/* ----------------------------------------
 * Origin  : GFI INFORMATIQUE 
 * Project : CDPP Propagation Tool 
 * ----------------------------------------
 * History 
 * Version : 25/08/2016 : SCA : V2.2.2
 * 	Creation
 * ----------------------------------------
 */
package fr.tlse.irap.pt.client.controller.tools.externalLinks;

import java.util.Date;

import fr.tlse.irap.pt.client.component.DialogComponent;
import fr.tlse.irap.pt.client.controller.RootController;
import fr.tlse.irap.pt.client.controller.dialogbox.DialogBox;

public class ApisDialogBox {

	private static ApisComponent apisController;

	public static ApisComponent getApisComponent() {
		if (apisController == null) {
			apisController = new ApisComponent();
			new DialogComponent(apisController, RootController.stage, "APIS Interface");

		}
		apisController.getDialog().toFront();
		return apisController;
	}

	/**
	 * Show Apis interface initialized with date
	 * @param date
	 */
	public static void show(String target, Date date) {
    	if (target.equals("JUPITER") || target.equals("SATURN") || target.equals("URANUS")) {
    		getApisComponent().initComponentWith(target, date);
    	}
    	else {
    		DialogBox.warn("APIS Interface can only be called for an End giant planet");
    	}
	}

}