Skip to content

Commit

Permalink
8301797: Pagination control has the wrong size
Browse files Browse the repository at this point in the history
Reviewed-by: kcr, aghaisas
  • Loading branch information
Andy Goryachev committed Feb 6, 2023
1 parent 8f2fac0 commit 192ba4f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -194,6 +194,9 @@ public PaginationSkin(final Pagination control) {
nextStackPane.getStyleClass().add("page");
nextStackPane.setVisible(false);

// sets the current page index property in control to the same value (no-op)
resetIndexes(true);

this.navigation = new NavigationControl();

getChildren().addAll(currentStackPane, nextStackPane, navigation);
Expand Down Expand Up @@ -235,7 +238,6 @@ public PaginationSkin(final Pagination control) {
@Override
public void install() {
getSkinnable().setClip(clipRect);
resetIndexes(true);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -324,4 +324,23 @@ public VBox createPage(int pageIndex) {
}
return box;
}

/** JDK-8301797 */
@Test
public void testInitialPreferredSize() {
pagination.setPageCount(150);
pagination.setCurrentPageIndex(0);
pagination.setMaxPageIndicatorCount(50);
Label label = new Label();
pagination.setPageFactory(index -> {
label.setText("" + (index + 1));
return label;
});

root.getChildren().add(pagination);
show();

tk.firePulse();
assertTrue("pagination prefWidth() is incorrect", (pagination.prefWidth(-1) > 200));
}
}

1 comment on commit 192ba4f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.