Jonathan Giles avatar Jonathan Giles committed f0cf7bd

Slightly improved layout when masthead is showing (text is less indented now).

Comments (0)

Files changed (3)

src/main/java/org/controlsfx/dialogs/Dialog.java

     }
 
 
-    /////// Resizable property
+    // Resizable property
 
     /**
      * Determines of dialog is resizable
         return dialog.resizableProperty();
     }
 
-    // Resizable property
+    // graphic property
 
-    private final ObjectProperty<Image> graphicProperty = new SimpleObjectProperty<Image>();
+    private final ObjectProperty<Node> graphicProperty = new SimpleObjectProperty<Node>();
 
     /**
      * Dialog's graphic.
      * Presented either in the masthead, if one is available or in the content 
      * @return dialog's graphic
      */
-    public final Image getGraphic() {
+    public final Node getGraphic() {
         return graphicProperty.get();
     }
 
      * Sets dialog's graphic
      * @param graphic dialog's graphic. Used if not null.
      */
-    public final void setGraphic(Image graphic) {
+    public final void setGraphic(Node graphic) {
         this.graphicProperty.set(graphic);
     }
 
-    public ObjectProperty<Image> graphicProperty() {
+    public ObjectProperty<Node> graphicProperty() {
         return graphicProperty;
     }
 
         BorderPane.setAlignment(mastheadVBox, Pos.CENTER_LEFT);
 
         if (graphicProperty.get() != null) {
-            mastheadPanel.setRight(new ImageView(graphicProperty.get()));
+            mastheadPanel.setRight(getGraphic());
         }
 
         setMasthead(mastheadPanel);
         label.getStyleClass().addAll("center-content-area", "main-message");
         label.setAlignment(Pos.TOP_LEFT);
         label.setTextAlignment(TextAlignment.LEFT);
+        label.setMaxWidth(Double.MAX_VALUE);
 
         // FIXME we don't want to restrict the width, but for now this works ok
         label.setPrefWidth(MAIN_TEXT_WIDTH);
-        label.setMaxWidth(360);
+//        label.setMaxWidth(360);
         label.setWrapText(true);
 
         setContent(label);
         contentPanel.setCenter(content);
         
         // dialog image can go to the left if there is no masthead
-        if (!hasMasthead() && graphicProperty != null) {
-            ImageView dialogGraphic = new ImageView(graphicProperty.get());
-            Pane pane = new Pane(dialogGraphic);
-            pane.setPadding(new Insets(0, 0, 0, 12));
-            contentPanel.setLeft(pane);
+        final Node graphic = getGraphic();
+        if (!hasMasthead() && graphic != null) {
+            Pane graphicPane = new Pane(graphic);
+            graphicPane.getStyleClass().add("graphic");
+            contentPanel.setLeft(graphicPane);
         }
 
         if (contentPanel.getChildren().size() > 0) {
         }
 
         if (hasExpandableContent()) {
-
             Node ec = getExpandableContent();
 
             centerPanel.getChildren().add(ec);

src/main/java/org/controlsfx/dialogs/Dialogs.java

         String actualMasthead = masthead == null ? null : (USE_DEFAULT.equals(masthead) ? dlgType.getDefaultMasthead() : masthead);
         Dialog dlg = new Dialog(owner, actualTitle);
         dlg.setResizable(false);
-        dlg.setGraphic(dlgType.getImage());
+        dlg.setGraphic(new ImageView(dlgType.getImage()));
         dlg.setMasthead(actualMasthead);
         dlg.getActions().addAll(dlgType.getActions());
         return dlg;

src/main/resources/org/controlsfx/dialogs/dialogs.css

 }
 
 .dialog .main-message {
-    -fx-font-size: 1.166667em;
+    -fx-font-size: 1em;
 }
 
 .dialog .main-comment {
 }
 
 .dialog .masthead-label-1 {
-    -fx-font-size: 1.166667em; /*15px;*/
+    -fx-font-size: 1.249999em; 
     -fx-wrap-text: true;
 }
 
 .dialog .center-panel {
-    -fx-padding: 16 16 14 28;
+    -fx-padding: 16 16 14 16;
     -fx-spacing: 14;
     -fx-background-color: linear-gradient(#ffffff,#f3f3f4);
     -fx-border-width: 1 1 1 1;
     -fx-font-size: 1.083333em; /*13px;*/
 }
 
+.dialog .center-content-panel .graphic {
+    -fx-padding: 0 0 0 12;
+}
+
 .dialog .center-panel .button-bar {
     -fx-padding: 8 0 8 0;
 }
   -fx-graphic: url("../../../impl/org/controlsfx/dialogs/resources/more-details.png");
   -fx-alignment: baseline-left;
   -fx-focus-traversable: false;
-  -fx-padding: 5;
+  -fx-padding: 5 5 5 0;
 }
 
 .dialog .details-button.less {
 .dialog .details-button:hover {
     -fx-underline: true;
 }
-
-.dialog .test-border {
-    -fx-border-insets: 0;
-    -fx-border-width: 2px;
-    -fx-border-color: red;
-}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.