本文整理汇总了Java中javafx.scene.control.Pagination类的典型用法代码示例。如果您正苦于以下问题:Java Pagination类的具体用法?Java Pagination怎么用?Java Pagination使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Pagination类属于javafx.scene.control包,在下文中一共展示了Pagination类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import javafx.scene.control.Pagination; //导入依赖的package包/类
@Override
public void start(final Stage stage) throws Exception {
fonts = Font.getFamilies().toArray(fonts);
pagination = new Pagination(fonts.length/itemsPerPage(), 0);
pagination.getStyleClass().add(Pagination.STYLE_CLASS_BULLET);
pagination.setPageFactory((Integer pageIndex) -> createPage(pageIndex));
AnchorPane anchor = new AnchorPane();
AnchorPane.setTopAnchor(pagination, 10.0);
AnchorPane.setRightAnchor(pagination, 10.0);
AnchorPane.setBottomAnchor(pagination, 10.0);
AnchorPane.setLeftAnchor(pagination, 10.0);
anchor.getChildren().addAll(pagination);
Scene scene = new Scene(anchor);
stage.setScene(scene);
stage.setTitle("PaginationSample");
scene.getStylesheets().add("paginationsample/ControlStyle.css");
stage.show();
}
示例2: pageInformationAlignmentProperty
import javafx.scene.control.Pagination; //导入依赖的package包/类
public final ObjectProperty<Side> pageInformationAlignmentProperty() {
if (pageInformationAlignment == null) {
pageInformationAlignment = new StyleableObjectProperty<Side>(Side.BOTTOM) {
@Override
protected void invalidated() {
getSkinnable().requestLayout();
}
@Override
public CssMetaData<Pagination, Side> getCssMetaData() {
return StyleableProperties.PAGE_INFORMATION_ALIGNMENT;
}
@Override
public Object getBean() {
return CPagenationSkin.this;
}
@Override
public String getName() {
return "pageInformationAlignment";
}
};
}
return pageInformationAlignment;
}
示例3: setIndicatorType
import javafx.scene.control.Pagination; //导入依赖的package包/类
private void setIndicatorType() {
if (getSkinnable().getStyleClass().contains(Pagination.STYLE_CLASS_BULLET)) {
getStyleClass().remove("number-button");
getStyleClass().add("bullet-button");
setText(null);
// Bind the width in addition to the height to ensure the region is square
prefWidthProperty().bind(minWidthProperty());
} else {
getStyleClass().remove("bullet-button");
getStyleClass().add("number-button");
setText(Integer.toString(this.pageNumber + 1));
// Free the width to conform to the text content
prefWidthProperty().unbind();
}
}
示例4: dnd
import javafx.scene.control.Pagination; //导入依赖的package包/类
protected void dnd() throws InterruptedException {
sceneSource.mouse().click(1, new Point(0, 0));
Wrap from = Lookups.byID(sceneSource, ID_DRAG_SOURCE, Node.class);
Wrap to = Lookups.byID(sceneTarget, ID_DRAG_TARGET, Node.class);
Point fromPoint = from.getClickPoint();
Point toPoint = to.getClickPoint();
final Object fromControl = from.getControl();
if (fromControl instanceof MenuBar || fromControl instanceof ToolBar
|| fromControl instanceof ScrollPane || fromControl instanceof Pagination) {
fromPoint = new Point(2, 2);
}
if (fromControl instanceof TitledPane) {
fromPoint = new Point(5, 30);
}
final Object toControl = to.getControl();
if (toControl instanceof MenuBar || toControl instanceof ToolBar
|| toControl instanceof ScrollPane || toControl instanceof Pagination) {
toPoint = new Point(2, 2);
}
if (toControl instanceof TitledPane) {
toPoint = new Point(30, 30);
}
dnd(from, fromPoint, to, toPoint);
}
示例5: createPaginatedPane
import javafx.scene.control.Pagination; //导入依赖的package包/类
private AnchorPane createPaginatedPane(BulkSettingsPanel bulkSettingsPanel) {
double screenX = Screen.getPrimary().getBounds().getMaxX();
double screenY = Screen.getPrimary().getBounds().getMaxY();
Pagination pagination = new Pagination(calcNumberOfPages());
pagination.setPrefHeight(screenY);
pagination.setPrefWidth(screenX - bulkSettingsPanel.getPrefWidth() - 1);
pagination.setPageFactory(callbacks.pageFactory);
AnchorPane anchor = new AnchorPane();
anchor.setPrefHeight(screenY - 10);
anchor.setPrefWidth(screenX - 250);
AnchorPane.setTopAnchor(pagination, 10.0);
AnchorPane.setRightAnchor(pagination, 10.0);
AnchorPane.setBottomAnchor(pagination, 10.0);
AnchorPane.setLeftAnchor(pagination, 10.0);
anchor.getChildren().add(pagination);
anchor.autosize();
return anchor;
}
示例6: SlidesViewer
import javafx.scene.control.Pagination; //导入依赖的package包/类
public SlidesViewer() {
pagination = new Pagination();
pagination.setOnMouseClicked(evt -> nextSlide());
pagination.setOnSwipeLeft(evt -> previousSlide());
pagination.setOnSwipeRight(evt -> nextSlide());
pagination.setOnScrollStarted(evt -> {
if (evt.getTotalDeltaX() > 0) {
nextSlide();
} else {
previousSlide();
}
});
pagination.setOnKeyTyped(evt -> {
switch (evt.getCode()) {
case LEFT:
previousSlide();
break;
case RIGHT:
case SPACE:
nextSlide();
break;
}
});
stackPane = new StackPane();
titleImageView = new ImageView(SlidesViewer.class.getResource("/title.png").toExternalForm());
titleImageView.fitWidthProperty().bind(stackPane.widthProperty());
titleImageView.fitHeightProperty().bind(stackPane.heightProperty());
titleImageView.setPreserveRatio(true);
stackPane.getChildren().addAll(pagination, titleImageView);
stackPane.getStyleClass().add("container");
stackPane.setPrefSize(0, 0);
Scene scene = new Scene(stackPane);
scene.getStylesheets().add(SlidesViewer.class.getResource("/slides-viewer.css").toExternalForm());
stage = new Stage();
stage.setScene(scene);
stage.setWidth(960);
stage.setHeight(540);
slidesEntry.addListener(it -> updateViewer());
}
示例7: start
import javafx.scene.control.Pagination; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
Pagination pagination = new Pagination(100);
pagination.setPageFactory(new Callback<Integer, Node>() {
@Override
public Node call(Integer param) {
return new ListView<>();
}
});
primaryStage.setScene(new Scene(pagination));
primaryStage.show();
}
示例8: CPagenationSkin
import javafx.scene.control.Pagination; //导入依赖的package包/类
public CPagenationSkin(final Pagination pagination) {
super(pagination, new PaginationBehavior(pagination));
// setManaged(false);
clipRect = new Rectangle();
getSkinnable().setClip(clipRect);
this.pagination = pagination;
this.currentStackPane = new StackPane();
currentStackPane.getStyleClass().add("page");
this.nextStackPane = new StackPane();
nextStackPane.getStyleClass().add("page");
nextStackPane.setVisible(false);
resetIndexes(true);
this.navigation = new NavigationControl();
// BorderPane navigationArea = new BorderPane(this.navigation);
getChildren().addAll(currentStackPane, nextStackPane, navigation);
pagination.maxPageIndicatorCountProperty().addListener(o -> {
resetIndiciesAndNav();
});
registerChangeListener(pagination.widthProperty(), "WIDTH");
registerChangeListener(pagination.heightProperty(), "HEIGHT");
registerChangeListener(pagination.pageCountProperty(), "PAGE_COUNT");
registerChangeListener(pagination.pageFactoryProperty(), "PAGE_FACTORY");
initializeSwipeAndTouchHandlers();
}
示例9: resetIndexes
import javafx.scene.control.Pagination; //导入依赖的package包/类
private void resetIndexes(boolean usePageIndex) {
maxPageIndicatorCount = getMaxPageIndicatorCount();
// Used to indicate that we can change a set of pages.
pageCount = getPageCount();
if (pageCount > maxPageIndicatorCount) {
pageCount = maxPageIndicatorCount;
}
fromIndex = 0;
previousIndex = 0;
currentIndex = usePageIndex ? getCurrentPageIndex() : 0;
toIndex = pageCount - 1;
if (pageCount == Pagination.INDETERMINATE && maxPageIndicatorCount == Pagination.INDETERMINATE) {
// We do not know how many indicators can fit. Let the layout pass compute it.
toIndex = 0;
}
boolean isAnimate = animate;
if (isAnimate) {
animate = false;
}
// Remove the children in the pane before we create a new page.
currentStackPane.getChildren().clear();
nextStackPane.getChildren().clear();
pagination.setCurrentPageIndex(currentIndex);
createPage(currentStackPane, currentIndex);
if (isAnimate) {
animate = true;
}
}
示例10: checkIndexCorrectness
import javafx.scene.control.Pagination; //导入依赖的package包/类
private void checkIndexCorrectness(int index) {
if (testedPagination.getPageCount() != Pagination.INDETERMINATE) {
if ((index < 0) || (index > Math.max(testedPagination.getPageCount() - 1, 0))) {
throw new IllegalArgumentException("Incorrect index : " + index);
}
}
}
示例11: MultiChart
import javafx.scene.control.Pagination; //导入依赖的package包/类
public MultiChart(final Circos ... charts){
final HBox hbox = new HBox(20);
final Font captionFont = new Font(20);
pagination = new Pagination(charts.length);
pagination.getStyleClass().add(Pagination.STYLE_CLASS_BULLET);
pagination.setPageFactory(new Callback<Integer, Node>() {
@Override
public Node call(Integer pageIndex) {
VBox box = new VBox();
box.setAlignment(Pos.CENTER);
Label label = new Label(charts[pageIndex].getTitle());
label.setFont(captionFont);
label.setAlignment(Pos.CENTER);
label.prefWidthProperty().bind(box.widthProperty());
box.getChildren().addAll(label, charts[pageIndex]);
return box;
}
});
pagination.currentPageIndexProperty().bindBidirectional(displayedPage);
// Patch: avoid pagination to spread too much
pagination.setMaxWidth(600);
hbox.getChildren().add(pagination);
for (Circos chart: charts){
chart.prefHeightProperty().bind(hbox.heightProperty());
chart.prefWidthProperty().bind(hbox.widthProperty());
}
hbox.prefHeightProperty().bind(this.heightProperty());
hbox.prefWidthProperty().bind(this.widthProperty());
this.getChildren().add(hbox);
}
示例12: exampleSelectionChaned
import javafx.scene.control.Pagination; //导入依赖的package包/类
public void exampleSelectionChaned(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
if (newValue.intValue() >= 0 && newValue.intValue() < examplesComboBox.getItems().size()) {
ExamplePages egPages = examplesComboBox.getItems().get(newValue.intValue());
checkSaveRequired(true);
modelPagination.setPageCount(Pagination.INDETERMINATE);
perspective.newModel(egPages);
}
}
示例13: openModel
import javafx.scene.control.Pagination; //导入依赖的package包/类
@FXML
private void openModel(ActionEvent ae) {
checkSaveRequired(true);
File selectedFile = praiseFileChooser.showOpenDialog(mainStage);
if (selectedFile != null) {
modelPagination.setPageCount(Pagination.INDETERMINATE);
perspective.newModel(selectedFile);
// Want to indicate that we are not using a particular example after a new model is instantiated.
examplesComboBox.getSelectionModel().select(-1);
}
}
示例14: newModel
import javafx.scene.control.Pagination; //导入依赖的package包/类
private void newModel(String contents, List<String> defaultQueries) {
checkSaveRequired(true);
modelPagination.setPageCount(Pagination.INDETERMINATE);
perspective.newModel(contents, defaultQueries);
// Want to indicate that we are not using a particular example after a new model is instantiated.
examplesComboBox.getSelectionModel().select(-1);
}
示例15: testGetPaginationAdjuster
import javafx.scene.control.Pagination; //导入依赖的package包/类
@Test
public void testGetPaginationAdjuster() {
Adjuster adjuster = Adjuster.getAdjuster(Pagination.class);
assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}