/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Controllers.Dialog;

import Controllers.Traitement.MyWindow;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;

/**
 *
 * @author Maher
 */
public class MessageControle {
    
    public double Height = MyWindow.myStage.getHeight() ;
    public double Width = MyWindow.myStage.getWidth() ; 
    public Button bouttonNo = new Button();
    public Button bouttonOK = new Button();
    public Text titre = new Text();
    public TextFlow DetailMSG = new TextFlow();
    public Text titreMSG = new Text();
    public Text detail = new Text();
    public StackPane stackpane = new StackPane();
    
    
    public Node Setnotification(){
        
        
        Group group = new Group();
        
        AnchorPane Ap = new AnchorPane();
        Ap.setStyle("-fx-background-color: rgba(0,0,0,0.6);");
       
        Pane pa1 = new Pane();
        pa1.setStyle("-fx-background-color:#ffffff; -fx-border-color: #212121; -fx-border-radius: 10 10 0 0; -fx-background-radius: 10 10 0 0;");
        pa1.setPrefHeight(200);
        pa1.setPrefWidth(497);
        
        Pane pa2 = new Pane();
        pa2.setStyle("-fx-background-color:linear-gradient(to bottom, #585858, #333333); -fx-background-radius: 10 10 0 0;");
        pa2.setPrefHeight(30);
        pa2.setPrefWidth(497);
        
        Pane pa3 = new Pane();
        pa3.setStyle("-fx-background-color:linear-gradient(to bottom, #E2E2E2, #EDEDED); -fx-border-color: #B4B4B4;");
        pa3.setLayoutY(30);
        pa3.setPrefHeight(100);
        pa3.setPrefWidth(497);
        
        titre.setText("Alert Dialog");
        titre.setFont(Font.font("System", FontWeight.BOLD, 13));
        titre.setFill(Color.web("#ffffff"));
        titre.setLayoutX(17);
        titre.setLayoutY(22);
        
        Image imgicon = new Image(getClass().getResourceAsStream("/Public/icon/iconalert.png"));
        ImageView icon = new ImageView(imgicon);
        icon.setLayoutX(410);
        icon.setLayoutY(50);
        icon.setFitWidth(64);
        icon.setFitHeight(64);
        
        
        DetailMSG.setPrefHeight(120);
        DetailMSG.setPrefWidth(400);
        DetailMSG.setLayoutX(20);
        DetailMSG.setLayoutY(60);
       
        
        bouttonOK.setText("Ok");
        bouttonOK.setFont(Font.font ("System", FontWeight.BOLD, 12));
        bouttonOK.setPrefWidth(73);
        bouttonOK.setPrefHeight(30);
        bouttonOK.setLayoutX(210);
        bouttonOK.setLayoutY(150);
        
        group.getChildren().addAll(pa1, pa2, pa3, titre, icon, DetailMSG, bouttonOK);
       
        stackpane.setVisible(true);
        stackpane.getChildren().add(Ap);
        stackpane.getChildren().add(group);
        
        return stackpane;
            
    }
    
    public void ShowNotification()
    {
        Node node = this.Setnotification();
            
        StackPane Sp = new StackPane();
        
        Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
        
        Sp.getChildren().add(MyWindow.myParent);
        Sp.getChildren().add(node);
        
        Scene scene = new Scene(Sp);   
        
        Stage stage = MyWindow.myStage;
        stage.setScene(scene);
        stage.show();
    }
    
}
