1919import atlantafx .base .theme .Styles ;
2020import com .techsenger .tabshell .core .dialog .AbstractDialogFxView ;
2121import static com .techsenger .tabshell .dialogs .alert .AlertDialogType .ERROR ;
22- import com .techsenger .tabshell .dialogs .utils .FxViewUtils ;
2322import com .techsenger .tabshell .material .button .ResultButton ;
2423import com .techsenger .tabshell .material .button .ResultButtonName ;
2524import com .techsenger .tabshell .material .icon .Icon ;
2625import com .techsenger .tabshell .material .icon .IconViewBox ;
26+ import com .techsenger .tabshell .material .style .Spacing ;
2727import com .techsenger .toolkit .fx .utils .NodeUtils ;
28+ import javafx .geometry .Pos ;
2829import javafx .scene .control .Label ;
2930import javafx .scene .layout .HBox ;
31+ import javafx .scene .layout .Priority ;
32+ import javafx .scene .layout .VBox ;
3033
3134/**
3235 *
@@ -39,7 +42,20 @@ public class AlertDialogFxView<P extends AlertDialogPresenter<?>> extends Abstra
3942
4043 private final Label messageLabel = new Label ();
4144
42- private final HBox messageBox = new HBox (messageIconViewBox , messageLabel );
45+ private final HBox messageBox = new HBox (messageIconViewBox , messageLabel ) {
46+
47+ @ Override
48+ protected void layoutChildren () {
49+ super .layoutChildren ();
50+ double labelHeight = messageLabel .prefHeight (-1 );
51+ double iconHeight = messageIconViewBox .prefHeight (-1 );
52+ if (labelHeight >= iconHeight ) {
53+ setAlignment (Pos .TOP_LEFT );
54+ } else {
55+ setAlignment (Pos .CENTER_LEFT );
56+ }
57+ }
58+ };
4359
4460 private final ResultButton okButton = new ResultButton (AlertDialogButtons .OK , "OK" );
4561
@@ -100,7 +116,9 @@ protected void build() {
100116 throw new AssertionError ();
101117 }
102118 messageLabel .getStyleClass ().add ("message-label" );
103- FxViewUtils .buildIconedMessageBox (messageIconViewBox , messageLabel , messageBox );
119+ VBox .setVgrow (messageBox , Priority .ALWAYS );
120+ messageBox .getStyleClass ().add ("message-box" );
121+ messageBox .setSpacing (Spacing .HORIZONTAL_HALF );
104122 getContentBox ().getChildren ().add (messageBox );
105123 registerButtons (okButton , cancelButton , noButton , yesButton );
106124 }
0 commit comments