changeset 5505:3fd034b34089

RT-33327 Wrong default horizontal scaling in Paginations control. fix proposed by Felipe, reviewed by Jonathan.
author psomashe
date Wed, 23 Oct 2013 12:02:41 -0700
parents 864db17fb10d
children e96b79ac3a8a
files modules/controls/src/main/java/com/sun/javafx/scene/control/skin/PaginationSkin.java
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/PaginationSkin.java	Wed Oct 23 10:20:06 2013 -0700
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/skin/PaginationSkin.java	Wed Oct 23 12:02:41 2013 -0700
@@ -150,7 +150,7 @@
 
     private void initializeSwipeAndTouchHandlers() {
         final Pagination control = getSkinnable();
-                    
+
         getSkinnable().setOnTouchPressed(new EventHandler<TouchEvent>() {
             @Override public void handle(TouchEvent e) {
                 if (touchEventId == -1) {
@@ -675,7 +675,7 @@
         } else if ("HEIGHT".equals(p)) {
             clipRect.setHeight(getSkinnable().getHeight());
         }
-        
+
         getSkinnable().requestLayout();
     }
 
@@ -734,12 +734,17 @@
                     minButtonSize = newFont.getSize() * 2;
                     for(Node child: controlBox.getChildren()) {
                         ((Control)child).setMinSize(minButtonSize, minButtonSize);
+                        // RT-33327 : min size is set on the toggle button but the
+                        // pref size does not match as computed by LabeledSkinBase#computePrefHeight 
+                        // so setting the prefSize ensures the desired size on the button.
+                        ((Control)child).setPrefSize(minButtonSize, minButtonSize);
                     }
                     // We want to relayout the indicator buttons because the size has changed.
                     requestLayout();
                 }
             });
             leftArrowButton.setMinSize(minButtonSize, minButtonSize);
+            leftArrowButton.setPrefSize(minButtonSize, minButtonSize);
             leftArrowButton.getStyleClass().add("left-arrow-button");
             leftArrowButton.setFocusTraversable(false);
             HBox.setMargin(leftArrowButton, new Insets(0, snapSize(arrowButtonGap.get()), 0, 0));
@@ -750,6 +755,7 @@
 
             rightArrowButton = new Button();
             rightArrowButton.setMinSize(minButtonSize, minButtonSize);
+            rightArrowButton.setPrefSize(minButtonSize, minButtonSize);
             rightArrowButton.getStyleClass().add("right-arrow-button");
             rightArrowButton.setFocusTraversable(false);
             HBox.setMargin(rightArrowButton, new Insets(0, 0, 0, snapSize(arrowButtonGap.get())));
@@ -826,6 +832,7 @@
             for (int i = fromIndex; i <= toIndex; i++) {
                 IndicatorButton ib = new IndicatorButton(i);
                 ib.setMinSize(minButtonSize, minButtonSize);
+                ib.setPrefSize(minButtonSize, minButtonSize);
                 ib.setToggleGroup(indicatorButtons);
                 controlBox.getChildren().add(ib);
             }