Skip to content

Commit

Permalink
Update paging controls visibility logic and default label strategy
Browse files Browse the repository at this point in the history
Bound visibility and managed properties to consider the `showPagingControls` property for better flexibility. Changed the default `MessageLabelStrategy` to `ALWAYS_SHOW` to ensure consistent paging label display.
  • Loading branch information
dlemmermann committed Dec 13, 2024
1 parent 237cdb9 commit 6ac0996
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public void start(Stage stage) {
CheckBox simulateDelay = new CheckBox("Simulate delay");
simulateDelay.selectedProperty().bindBidirectional(simulateDelayProperty);

CheckBox showPagingControls = new CheckBox("Show paging controls");
showPagingControls.selectedProperty().bindBidirectional(pagingListView.showPagingControlsProperty());

ComboBox<Side> location = new ComboBox<>();
location.getItems().addAll(Side.TOP, Side.BOTTOM);
location.valueProperty().bindBidirectional(pagingListView.pagingControlsLocationProperty());
Expand All @@ -86,7 +89,7 @@ public void start(Stage stage) {
Button increaseItemCount = new Button("Increase Count");
increaseItemCount.setOnAction(evt -> count.set(count.get() + 1));

HBox settingsBox = new HBox(10, fillBox, simulateDelay, new Label("Location"), location, clearSetData, reduceItemCount, increaseItemCount);
HBox settingsBox = new HBox(10, fillBox, simulateDelay, showPagingControls, location, clearSetData, reduceItemCount, increaseItemCount);
settingsBox.setAlignment(Pos.CENTER_LEFT);

VBox box = new VBox(20, pagingListView, settingsBox, new PagingControlsSettingsView(pagingListView), scenicView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public enum MessageLabelStrategy {
ALWAYS_SHOW
}

private final ObjectProperty<PagingControls.MessageLabelStrategy> messageLabelStrategy = new SimpleObjectProperty<>(this, "messageLabelStrategy", PagingControls.MessageLabelStrategy.SHOW_WHEN_NEEDED);
private final ObjectProperty<PagingControls.MessageLabelStrategy> messageLabelStrategy = new SimpleObjectProperty<>(this, "messageLabelStrategy", MessageLabelStrategy.ALWAYS_SHOW);

public final PagingControls.MessageLabelStrategy getMessageLabelStrategy() {
return messageLabelStrategy.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ public PagingListViewSkin(PagingListView<T> pagingListView) {
pagingControls.alignmentProperty().bindBidirectional(pagingListView.alignmentProperty());
pagingControls.firstLastPageDisplayModeProperty().bindBidirectional(pagingListView.firstLastPageDisplayModeProperty());
pagingControls.firstPageDividerProperty().bindBidirectional(pagingListView.firstPageDividerProperty());
pagingControls.maxPageIndicatorsCountProperty().bindBidirectional(pagingListView.maxPageIndicatorsCountProperty());
pagingControls.visibleProperty().bind(pagingControls.neededProperty());
pagingControls.managedProperty().bind(pagingControls.neededProperty());
pagingControls.visibleProperty().bind(pagingControls.neededProperty().and(pagingListView.showPagingControlsProperty()));
pagingControls.managedProperty().bind(pagingControls.neededProperty().and(pagingListView.showPagingControlsProperty()));

content.getStyleClass().add("content");

Expand Down

0 comments on commit 6ac0996

Please sign in to comment.