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

import java.net.URL;
import java.util.ResourceBundle;

import fr.tlse.irap.pt.client.component.DialogComponent;
import fr.tlse.irap.pt.client.component.IDialogComponent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;

public class LogComponent extends AnchorPane implements Initializable, IDialogComponent {

	private DialogComponent dialog;

	@FXML private Label msg; 
	@FXML private ImageView imgView; 
	@FXML private Button okBtn; 

	@Override
	public void initialize(URL location, ResourceBundle resources) {
		okBtn.setOnMouseClicked(new EventHandler<Event>() {
			@Override
			public void handle(Event event) {
				dialog.close();
			}
		});
	}

	public void setDialog(DialogComponent dialog) {
		this.dialog = dialog;
	}

	public Label getMsg() {
		return msg;
	}

	public LogComponent setMessage(String message) {
		this.msg.setText(message);
		return this;
	}

	public void show() {
		dialog.show();
	}
}
