-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add paging controls settings and improve loading visualization
Introduced a new class, `PagingControlsSettingsView`, to enhance paging controls configurability. Updated loading behavior and added new 'loading' status to `PagingListView`, improving user feedback during data fetch operations. Refined CSS and bindings to better manage layout and styling of pagination elements.
- Loading branch information
1 parent
2f7f192
commit 73c7e03
Showing
8 changed files
with
184 additions
and
77 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
gemsfx-demo/src/main/java/com/dlsc/gemsfx/demo/PagingControlsSettingsView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.dlsc.gemsfx.demo; | ||
|
||
import com.dlsc.gemsfx.PagingControlBase; | ||
import com.dlsc.gemsfx.PagingControls; | ||
import com.dlsc.gemsfx.Spacer; | ||
import javafx.beans.binding.Bindings; | ||
import javafx.geometry.Pos; | ||
import javafx.scene.control.CheckBox; | ||
import javafx.scene.control.ChoiceBox; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.layout.FlowPane; | ||
import javafx.scene.layout.HBox; | ||
import javafx.scene.layout.Region; | ||
import javafx.scene.layout.VBox; | ||
|
||
import java.util.List; | ||
|
||
public class PagingControlsSettingsView extends VBox { | ||
|
||
public PagingControlsSettingsView(PagingControlBase pagingControls) { | ||
setSpacing(10); | ||
|
||
Label pageLabel = new Label(); | ||
pageLabel.textProperty().bind(Bindings.createStringBinding(() -> "Page Index: " + pagingControls.getPage(), pagingControls.pageProperty())); | ||
|
||
Label pageCountLabel = new Label(); | ||
pageCountLabel.textProperty().bind(Bindings.createStringBinding(() -> "Page count: " + pagingControls.getPageCount(), pagingControls.pageCountProperty())); | ||
|
||
ChoiceBox<PagingControls.FirstLastPageDisplayMode> displayModeChoiceBox = new ChoiceBox<>(); | ||
displayModeChoiceBox.getItems().setAll(PagingControls.FirstLastPageDisplayMode.values()); | ||
displayModeChoiceBox.valueProperty().bindBidirectional(pagingControls.firstLastPageDisplayModeProperty()); | ||
|
||
CheckBox showPreviousNextButton = new CheckBox("Show prev / next buttons"); | ||
showPreviousNextButton.selectedProperty().bindBidirectional(pagingControls.showPreviousNextPageButtonProperty()); | ||
|
||
ChoiceBox<PagingControlBase.MessageLabelStrategy> strategyChoiceBox = new ChoiceBox<>(); | ||
strategyChoiceBox.getItems().addAll(PagingControlBase.MessageLabelStrategy.values()); | ||
strategyChoiceBox.valueProperty().bindBidirectional(pagingControls.messageLabelStrategyProperty()); | ||
|
||
ChoiceBox<Integer> maxPageIndicatorsBox = new ChoiceBox<>(); | ||
maxPageIndicatorsBox.getItems().setAll(List.of(1, 2, 5, 10)); | ||
maxPageIndicatorsBox.valueProperty().bindBidirectional(pagingControls.maxPageIndicatorsCountProperty().asObject()); | ||
|
||
HBox displayModeBox = new HBox(5, new Label("Display mode: "), displayModeChoiceBox); | ||
displayModeBox.setAlignment(Pos.CENTER_LEFT); | ||
|
||
HBox strategyBox = new HBox(5, new Label("Label strategy: "), strategyChoiceBox); | ||
strategyBox.setAlignment(Pos.CENTER_LEFT); | ||
|
||
HBox indicatorBox = new HBox(5, new Label("# Indicators: "), maxPageIndicatorsBox); | ||
indicatorBox.setAlignment(Pos.CENTER_LEFT); | ||
|
||
FlowPane flowPane = new FlowPane(pageLabel, pageCountLabel, new Spacer(), showPreviousNextButton, displayModeBox, strategyBox, indicatorBox); | ||
flowPane.setVgap(10); | ||
flowPane.setHgap(20); | ||
|
||
setMaxHeight(Region.USE_PREF_SIZE); | ||
|
||
getChildren().setAll(flowPane); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.