// sadly setMaxHeight() isn't working with TextFlow
// so, we have to clip notification text manually
private void createView() {
        FontIcon closeBtn = Controls.fontIcon(Material2AL.CLOSE, "close-icon");
        closeBtn.setCursor(Cursor.HAND);
        closeBtn.setOnMouseClicked(e -> close());
        GridPane.setValignment(closeBtn, VPos.TOP);
        GridPane.setHalignment(closeBtn, HPos.RIGHT);
        TextFlow textFlow = Containers.create(TextFlow::new, "text");
        // sadly setMaxHeight() isn't working with TextFlow
        // so, we have to clip notification text manually
        Text text = new Text(notification.getClippedText(Toast.MAX_MESSAGE_LEN));
        textFlow.getChildren().addAll(text);
        Hyperlink expandBtn = new Hyperlink(t(ACTION_MORE));
        expandBtn.setOnAction(e -> expand());
        if (expandHandler == null) { expandBtn.setManaged(false); }
        add(textFlow, 0, 0);
        add(closeBtn, 1, 0);
        add(expandBtn, 0, 2, REMAINING, 1);
        getColumnConstraints().addAll(HGROW_ALWAYS, HGROW_NEVER);
        getRowConstraints().addAll(VGROW_ALWAYS, VGROW_NEVER);
        VBox.setVgrow(this, Priority.NEVER);
        getStyleClass().addAll("toast", notification.getType().name().toLowerCase());
    }
GridPane.setHalignment(closeBtn, HPos.RIGHT);
TextFlow textFlow = Containers.create(TextFlow::new, "text");
// sadly setMaxHeight() isn't working with TextFlow
// so, we have to clip notification text manually
Text text = new Text(notification.getClippedText(Toast.MAX_MESSAGE_LEN));
textFlow.getChildren().addAll(text);
private void createView() {
FontIcon closeBtn = Controls.fontIcon(Material2AL.CLOSE, "close-icon");
closeBtn.setCursor(Cursor.HAND);
closeBtn.setOnMouseClicked(e -> close());
GridPane.setValignment(closeBtn, VPos.TOP);
GridPane.setHalignment(closeBtn, HPos.RIGHT);
TextFlow textFlow = Containers.create(TextFlow::new, "text");
// sadly setMaxHeight() isn't working with TextFlow
// so, we have to clip notification text manually
Text text = new Text(notification.getClippedText(Toast.MAX_MESSAGE_LEN));
textFlow.getChildren().addAll(text);
Hyperlink expandBtn = new Hyperlink(t(ACTION_MORE));
expandBtn.setOnAction(e -> expand());
if (expandHandler == null) { expandBtn.setManaged(false); }
add(textFlow, 0, 0);
add(closeBtn, 1, 0);
add(expandBtn, 0, 2, REMAINING, 1);
getColumnConstraints().addAll(HGROW_ALWAYS, HGROW_NEVER);
getRowConstraints().addAll(VGROW_ALWAYS, VGROW_NEVER);
private void createView() {
FontIcon closeBtn = Controls.fontIcon(Material2AL.CLOSE, "close-icon");
closeBtn.setCursor(Cursor.HAND);
closeBtn.setOnMouseClicked(e -> close());
GridPane.setValignment(closeBtn, VPos.TOP);
GridPane.setHalignment(closeBtn, HPos.RIGHT);
TextFlow textFlow = Containers.create(TextFlow::new, "text");
// sadly setMaxHeight() isn't working with TextFlow
// so, we have to clip notification text manually
Text text = new Text(notification.getClippedText(Toast.MAX_MESSAGE_LEN));
textFlow.getChildren().addAll(text);
Hyperlink expandBtn = new Hyperlink(t(ACTION_MORE));
expandBtn.setOnAction(e -> expand());
if (expandHandler == null) { expandBtn.setManaged(false); }
add(textFlow, 0, 0);
add(closeBtn, 1, 0);
add(expandBtn, 0, 2, REMAINING, 1);
getColumnConstraints().addAll(HGROW_ALWAYS, HGROW_NEVER);
getRowConstraints().addAll(VGROW_ALWAYS, VGROW_NEVER);
VBox.setVgrow(this, Priority.NEVER);
getStyleClass().addAll("toast", notification.getType().name().toLowerCase());
}