@Override
  protected void layoutChildren(
      double contentX, double contentY, double contentWidth, double contentHeight) {
    super.layoutChildren(contentX, contentY, contentWidth, contentHeight);
    if (dialogPane.isVisible() && getChildren().contains(dialogPane)) {

      double dialogPrefWidth = dialogPane.prefWidth(-1);
      double dialogPrefHeight = dialogPane.prefHeight(-1);

      final WorkbenchDialog dialog = getSkinnable().getDialog();

      final double maxWidth = contentWidth * (1 - MARGIN_PERCENT);
      final double maxHeight = contentHeight * (1 - MARGIN_PERCENT);

      // on a maximized dialog, set the size to the maximum, else use the dialog size
      if (dialog == null) {
        dialogPrefWidth = dialogPane.getWidth();
        dialogPrefHeight = dialogPane.getHeight();
      } else if (dialog.isMaximized()) {
        dialogPrefWidth = maxWidth;
        dialogPrefHeight = maxHeight;
      }

      // make sure dialog doesn't get bigger than the maximum size
      if (dialogPrefWidth > maxWidth) {
        dialogPrefWidth = maxWidth;
      }
      if (dialogPrefHeight > maxHeight) {
        dialogPrefHeight = maxHeight;
      }

      final double dialogTargetX = contentX + (contentWidth - dialogPrefWidth) / 2;
      final double dialogTargetY = contentY + (contentHeight - dialogPrefHeight) / 2;
      dialogPane.resizeRelocate(
          dialogTargetX, dialogTargetY, dialogPrefWidth, dialogPrefHeight);

      // make sure the content and title are never longer than the dialog (causing it not to wrap)
      dialogContentPane.setMaxWidth(dialogPrefWidth);
      dialogTitle.setMaxWidth(dialogPrefWidth);
    }
  }
Creates a new {@link DialogSkin} object for a corresponding {@link DialogControl}.

@param dialogControl the {@link DialogControl} for which this Skin is created
workbenchfx-core/src/main/java/com/dlsc/workbenchfx/view/controls/dialog/DialogSkin.java