package be.iminds.ilabt.jfed.experimenter_gui.ui;

import javafx.application.Application;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Hyperlink;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;

/**
 * User: twalcari
 * Date: 7/2/2015
 * Time: 10:08
 */
public class TextFlowAlertTest extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {

        final Text introText = new Text(String.format("jFed detected that node(s) %s cannot be reached.\n" +
                "You can take the following steps to resolve the problem:\n\n", "node1, node2"));
        introText.setStyle("-fx-font-weight: bold");

        final Hyperlink text1 = new Hyperlink("1. Try enabling the proxy for SSH connections");
        text1.setOnAction(actionEvent -> new Alert(Alert.AlertType.INFORMATION, "Clicked 1").show());

        final Hyperlink text2 = new Hyperlink("2. Check the support forum");
        text2.setOnAction(actionEvent -> new Alert(Alert.AlertType.INFORMATION, "Clicked 2").show());

        final Hyperlink text3 = new Hyperlink("3. Request assistance by submitting a bug report");
        text3.setOnAction(actionEvent -> new Alert(Alert.AlertType.INFORMATION, "Clicked 3").show());

        TextFlow errorMessageTextFlow = new TextFlow(
                introText,
                text1, new Text("\n"),
                text2, new Text("\n"),
                text3
        );

        TextFlowAlert textFlowAlert = new TextFlowAlert(Alert.AlertType.WARNING, errorMessageTextFlow);
        textFlowAlert.setHeaderText("Experiment connectivity issues");
        textFlowAlert.setTitle("Experiment connectivity issues");

        textFlowAlert.showAndWait();



        new TextFlowAlert(Alert.AlertType.WARNING, errorMessageTextFlow, ButtonType.CLOSE).show();




    }
}