/* ----------------------------------------
 * Origin  : GFI INFORMATIQUE 
 * Project : CDPP Propagation Tool 
 * ----------------------------------------
 * History 
 * Version : 01/05/2015 : SCA : V2.1
 * Version : 13/05/2016 : SCA : V2.2
 *  Change windows style
 * ----------------------------------------
 */
package fr.tlse.irap.pt.client.controller.dialogbox;

import fr.tlse.irap.pt.client.component.DialogComponent;
import fr.tlse.irap.pt.client.controller.RootController;
import javafx.stage.Window;

public class DialogBox {

	public static ErrorComponent getErrorComponent() {
		return getErrorComponent(RootController.stage);
	}

	public static ErrorComponent getErrorComponent(Window owner) {
		ErrorComponent errorController = new ErrorComponent();
		//errorController.setImage(new Image("images/error-64.png"));
		new DialogComponent(errorController, owner, "Error");
		return errorController;
	}

	public static WarningComponent getWarningComponent() {
		return getWarningComponent(RootController.stage);
	}

	public static WarningComponent getWarningComponent(Window owner) {
		WarningComponent warnController = new WarningComponent();
		//warnController.setImage(new Image("images/Warning64.png"));
		new DialogComponent(warnController, owner, "Warning");
		return warnController;
	}

	public static LogComponent getInfoComponent() {
		return getInfoComponent(RootController.stage);
	}

	public static LogComponent getInfoComponent(Window owner) {
		LogComponent infoController = new LogComponent();
		//infoController.setImage(new Image("images/info.png"));
		new DialogComponent(infoController, owner, "Info");
		return infoController;
	}

	public static void error(String message) {
		getErrorComponent().setMessage(message).show();
	}
	
	public static void error(String message, Window parent) {
		getErrorComponent(parent).setMessage(message).show();
	}

	public static void warn(String message) {
		getWarningComponent().setMessage(message).show();
	}

	public static void warn(String message, Window parent) {
		getWarningComponent(parent).setMessage(message).show();
	}

	public static void info(String message) {
		getInfoComponent().setMessage(message).show();
	}

	public static void info(String message, Window parent) {
		getInfoComponent(parent).setMessage(message).show();
	}

}