Java 类javafx.scene.control.Pagination 实例源码

项目:marathonv5    文件:PaginationSample.java   
@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();
}
项目:Gargoyle    文件:CPagenationSkin.java   
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;
}
项目:Gargoyle    文件:CPagenationSkin.java   
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();
    }
}
项目:openjfx-8u-dev-tests    文件:DragDropWithControlsBase.java   
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);
}
项目:DominantFreq    文件:BulkDisplay.java   
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;
}
项目:Gargoyle    文件:PagingGridPaneExam.java   
@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();
}
项目:Gargoyle    文件:CPagenationSkin.java   
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();
}
项目:Gargoyle    文件:CPagenationSkin.java   
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;
    }
}
项目:openjfx-8u-dev-tests    文件:PaginationApp.java   
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);
        }
    }
}
项目:circosFX    文件:MultiChart.java   
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);
}
项目:aic-praise    文件:PRAiSEController.java   
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);
    }
}
项目:aic-praise    文件:PRAiSEController.java   
@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);
    }
}
项目:aic-praise    文件:PRAiSEController.java   
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);
  }
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetPaginationAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(Pagination.class);

    assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
项目:jfxtables    文件:PersonTable.java   
private void initPagination() {
    int itemCount = 10;
    final Pagination pagination = new Pagination(personsService.getPersons().getValue().size() / itemCount);

    virtualizedPersons = personsService.getPersons().filtered(t -> {
        int indexOf = personsService.getPersons().indexOf(t);
        int currentItemCount = pagination.getCurrentPageIndex() * itemCount;
        if (indexOf > currentItemCount && indexOf < currentItemCount + itemCount)
            return true;
        else
            return false;
    });

    itemsProperty().bind(new SimpleListProperty<>(virtualizedPersons));
}
项目:ExtremeGuiMakeover    文件:SlidesViewer.java   
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());
}
项目:Gargoyle    文件:BigTextView.java   
public Pagination getPaginationView() {
    return this.pagination;
}
项目:Gargoyle    文件:BigTextView.java   
@FXML
public void initialize() {
    pagination = new Pagination(TOTAL_PAGE) {
        @Override
        protected Skin<?> createDefaultSkin() {
            return new CPagenationSkin(this) {
            };
        }
    };

    pagination.setCache(true);

    pagination.setPageFactory(new Callback<Integer, Node>() {

        @Override
        public Node call(Integer param) {

            //              if (isUsePageCache && pageCache.containsKey(param)) {
            //                  SimpleTextView simpleTextView = pageCache.get(param);
            //                  if (simpleTextView != null)
            //                      return simpleTextView;
            //              }

            String readContent = readPage(param);
            SimpleTextView simpleTextView = new SimpleTextView(readContent, false);
            simpleTextView.setPrefSize(TextArea.USE_COMPUTED_SIZE, Double.MAX_VALUE);

            //              if (isUsePageCache)
            //                  pageCache.put(param, simpleTextView);

            return simpleTextView;
        }
    });
    pagination.setPrefSize(Pagination.USE_COMPUTED_SIZE, Pagination.USE_COMPUTED_SIZE);
    this.setCenter(pagination);
    //
    lvFindRslt.setCellFactory(TextFieldListCell.forListView(new StringConverter<FindModel>() {

        @Override
        public String toString(FindModel object) {
            return String.format("%d   ( Count : %d )", object.getPage() + 1, object.lines.size());
        }

        @Override
        public FindModel fromString(String string) {
            return null;
        }
    }));

    lvFindRslt.setOnMouseClicked(this::lvFindRsltOnMouseClick);
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public CssMetaData<Pagination, Number> getCssMetaData() {
    return StyleableProperties.ARROW_BUTTON_GAP;
}
项目:Gargoyle    文件:CPagenationSkin.java   
private void updatePageInformation() {
    String currentPageNumber = Integer.toString(currentIndex + 1);
    String lastPageNumber = getPageCount() == Pagination.INDETERMINATE ? "..." : Integer.toString(getPageCount());
    pageInformation.setText(currentPageNumber + "/" + lastPageNumber);
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public boolean isSettable(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return skin.arrowsVisible == null || !skin.arrowsVisible.isBound();
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public StyleableProperty<Boolean> getStyleableProperty(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return (StyleableProperty<Boolean>) (WritableValue<Boolean>) skin.arrowsVisibleProperty();
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public boolean isSettable(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return skin.pageInformationVisible == null || !skin.pageInformationVisible.isBound();
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public StyleableProperty<Boolean> getStyleableProperty(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return (StyleableProperty<Boolean>) (WritableValue<Boolean>) skin.pageInformationVisibleProperty();
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public boolean isSettable(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return skin.pageInformationAlignment == null || !skin.pageInformationAlignment.isBound();
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public StyleableProperty<Side> getStyleableProperty(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return (StyleableProperty<Side>) (WritableValue<Side>) skin.pageInformationAlignmentProperty();
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public boolean isSettable(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return skin.tooltipVisible == null || !skin.tooltipVisible.isBound();
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public StyleableProperty<Boolean> getStyleableProperty(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return (StyleableProperty<Boolean>) (WritableValue<Boolean>) skin.tooltipVisibleProperty();
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public boolean isSettable(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return skin.arrowButtonGap == null || !skin.arrowButtonGap.isBound();
}
项目:Gargoyle    文件:CPagenationSkin.java   
@Override
public StyleableProperty<Number> getStyleableProperty(Pagination n) {
    final CPagenationSkin skin = (CPagenationSkin) n.getSkin();
    return (StyleableProperty<Number>) (WritableValue<Number>) skin.arrowButtonGapProperty();
}
项目:openjfx-8u-dev-tests    文件:PaginationTest.java   
@Smoke
@Test(timeout = 300000)
@Covers(value = {"com.sun.javafx.scene.control.Pagination.currentpageindex.BEHAVIOR", "com.sun.javafx.scene.control.Pagination.currentpageindex.GET", "com.sun.javafx.scene.control.Pagination.currentpageindex.BIND", "com.sun.javafx.scene.control.Pagination.currentpageindex.DEFAULT", "com.sun.javafx.scene.control.Pagination.currentpageindex.SET"}, level = Covers.Level.FULL)
public void currentPageIndexPropertyTest() throws InterruptedException {
    assertEquals(new Pagination().getCurrentPageIndex(), 0, 0);

    int pagesCount = 100;

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.maxPageIndicatorCount, 5);
    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.pageCount, pagesCount);
    setSize(200, 200);

    checkRangeOfPageIndecesVisibility(1, 5);
    checkCorrectPageContentShowing(false, 0);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.currentPageIndex, 13);
    checkTextFieldValue(Properties.currentPageIndex, 13);
    checkRangeOfPageIndecesVisibility(11, 15);
    checkCorrectPageContentShowing(false, 13);

    setPropertyBySlider(SettingType.SETTER, Properties.currentPageIndex, 96);
    checkTextFieldValue(Properties.currentPageIndex, 96);
    checkRangeOfPageIndecesVisibility(93, 97);
    checkCorrectPageContentShowing(false, 96);

    setNewFactory();
    checkTextFieldValue(Properties.currentPageIndex, 0);
    checkRangeOfPageIndecesVisibility(1, 5);
    checkCorrectPageContentShowing(true, 0);

    setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.currentPageIndex, 7);
    checkTextFieldValue(Properties.currentPageIndex, 7);
    checkRangeOfPageIndecesVisibility(4, 8);
    checkCorrectPageContentShowing(true, 7);

    switchOffBinding(SettingType.UNIDIRECTIONAL, Properties.currentPageIndex);

    navigateToPage(pagesCount, NavigationWay.MOUSE); //to right to the end.
    checkTwoArrowsVisibility(true, false);
    checkTextFieldValue(Properties.currentPageIndex, pagesCount - 1);
    checkRangeOfPageIndecesVisibility(pagesCount - 1, pagesCount);
    checkCorrectPageContentShowing(true, pagesCount - 1);

    navigateToPage(1, NavigationWay.MOUSE);//to left at the beginning.
    checkTwoArrowsVisibility(false, true);
    checkTextFieldValue(Properties.currentPageIndex, 0);
    checkRangeOfPageIndecesVisibility(1, 5);
    checkCorrectPageContentShowing(true, 0);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.pageCount, 10);
    for (SettingType settingType : EnumSet.of(SettingType.BIDIRECTIONAL, SettingType.SETTER, SettingType.UNIDIRECTIONAL)) {
        switchOffBinding(SettingType.UNIDIRECTIONAL, Properties.currentPageIndex);
        setPropertyBySlider(settingType, Properties.currentPageIndex, 15);
        setPropertyBySlider(settingType, Properties.currentPageIndex, -5);
    }
}
项目:openjfx-8u-dev-tests    文件:PaginationTest.java   
@Smoke
@Test(timeout = 300000)
@Covers(value = {"com.sun.javafx.scene.control.Pagination.pagecount.BEHAVIOR", "com.sun.javafx.scene.control.Pagination.pagecount.GET", "com.sun.javafx.scene.control.Pagination.pagecount.BIND", "com.sun.javafx.scene.control.Pagination.pagecount.DEFAULT", "com.sun.javafx.scene.control.Pagination.pagecount.SET"}, level = Covers.Level.FULL)
public void pageCountPropertyTest() throws InterruptedException {
    assertEquals(new Pagination().getPageCount(), Pagination.INDETERMINATE, 0);

    setSize(200, 200);
    setPropertyBySlider(SettingType.SETTER, Properties.maxPageIndicatorCount, 5);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.pageCount, 7);
    navigateToPage(7, NavigationWay.MOUSE);
    checkRangeOfPageIndecesVisibility(6, 7);
    checkCorrectPageContentShowing(false, 6);

    setPropertyBySlider(SettingType.SETTER, Properties.pageCount, 12);
    checkTextFieldValue(Properties.currentPageIndex, 0);
    navigateToPage(12, NavigationWay.MOUSE);
    checkRangeOfPageIndecesVisibility(11, 12);
    checkCorrectPageContentShowing(false, 11);

    setPropertyBySlider(SettingType.SETTER, Properties.maxPageIndicatorCount, 10);
    setPropertyBySlider(SettingType.SETTER, Properties.pageCount, 10);
    checkCorrectPageContentShowing(false, 0);
    navigateToPage(10, NavigationWay.MOUSE);
    checkCorrectPageContentShowing(false, 9);

    setPropertyBySlider(SettingType.UNIDIRECTIONAL, Properties.pageCount, 3);
    checkTextFieldValue(Properties.currentPageIndex, 0);
    navigateToPage(3, NavigationWay.MOUSE);
    checkRangeOfPageIndecesVisibility(1, 3);

    setNewFactory();

    checkTextFieldValue(Properties.currentPageIndex, 3);
    checkRangeOfPageIndecesVisibility(1, 3);
    checkCorrectPageContentShowing(true, 0);

    switchOffBinding(SettingType.UNIDIRECTIONAL, Properties.pageCount);

    setPropertyBySlider(SettingType.BIDIRECTIONAL, Properties.maxPageIndicatorCount, 5);
    for (SettingType settingType : EnumSet.of(SettingType.BIDIRECTIONAL, SettingType.SETTER, SettingType.UNIDIRECTIONAL)) {
        switchOffBinding(SettingType.UNIDIRECTIONAL, Properties.pageCount);

        setPropertyBySlider(settingType, Properties.pageCount, 10);
        checkTextFieldValue(Properties.pageCount, 10);
        checkRangeOfPageIndecesVisibility(1, 5);
        checkCorrectPageContentShowing(true, 0);

        switchOffBinding(SettingType.UNIDIRECTIONAL, Properties.pageCount);
        setPropertyBySlider(settingType, Properties.pageCount, -5);
        if (settingType.equals(SettingType.BIDIRECTIONAL)) {
            setPropertyBySlider(settingType, Properties.pageCount, 10);
        } else {
            setPropertyBySlider(settingType, Properties.pageCount, -5);
        }
        checkRangeOfPageIndecesVisibility(1, 5);
        checkCorrectPageContentShowing(true, 0);
        testedControl.keyboard().pushKey(KeyboardButtons.LEFT);
        testedControl.keyboard().pushKey(KeyboardButtons.RIGHT);
    }
}
项目:openjfx-8u-dev-tests    文件:PaginationTest.java   
@Smoke
@Test(timeout = 300000)
@Covers(value = {"com.sun.javafx.scene.control.Pagination.pagefactory.BEHAVIOR", "com.sun.javafx.scene.control.Pagination.pagefactory.GET", "com.sun.javafx.scene.control.Pagination.pagefactory.DEFAULT", "com.sun.javafx.scene.control.Pagination.pagefactory.SET"}, level = Covers.Level.FULL)
public void factoryChangingTest() throws InterruptedException {
    assertTrue((new Pagination().getPageFactory()) == null);
    setSize(200, 200);

    setPropertyBySlider(SettingType.SETTER, Properties.pageCount, 15);
    setPropertyBySlider(SettingType.SETTER, Properties.maxPageIndicatorCount, 7);
    setPropertyBySlider(SettingType.SETTER, Properties.currentPageIndex, 5);

    checkTextFieldValue(Properties.currentPageIndex, 5);
    checkTextFieldValue(Properties.pageCount, 15);
    checkTextFieldValue(Properties.maxPageIndicatorCount, 7);

    checkCorrectPageContentShowing(false, 5);

    for (int i = 1; i < 30; i++) {
        setNewFactory();

        checkTextFieldValue(Properties.currentPageIndex, 0);
        checkCorrectPageContentShowing(true, 0);

        setPropertyBySlider(SettingType.SETTER, Properties.currentPageIndex, 8);
        checkTextFieldValue(Properties.currentPageIndex, 8);
        checkCorrectPageContentShowing(true, 8);

        setOldFactory();

        checkTextFieldValue(Properties.currentPageIndex, 0);
        checkCorrectPageContentShowing(false, 0);
    }

    //These values should not be changed.
    checkTextFieldValue(Properties.pageCount, 15);
    checkTextFieldValue(Properties.maxPageIndicatorCount, 7);
    checkRangeOfPageIndecesVisibility(1, 5);

    //And now, after playing with factory, let's play with control.
    setPropertyBySlider(SettingType.SETTER, Properties.pageCount, 20);
    checkTextFieldValue(Properties.pageCount, 20);
    checkTextFieldValue(Properties.currentPageIndex, 0);
    navigateToPage(20, NavigationWay.MOUSE);
    checkCorrectPageContentShowing(false, 19);
    checkTwoArrowsVisibility(true, false);
    navigateToPage(1, NavigationWay.MOUSE);
    checkCorrectPageContentShowing(false, 0);
    checkTwoArrowsVisibility(false, true);
}
项目:openjfx-8u-dev-tests    文件:TestBase.java   
protected void initWrappers() {
    scene = Root.ROOT.lookup().wrap();
    parent = scene.as(Parent.class, Node.class);

    testedControl = (Wrap<? extends Pagination>) parent.lookup(Pagination.class, new ByID<Pagination>(TESTED_PAGINATION_ID)).wrap();
}
项目:aptasuite    文件:AptamerPoolRootController.java   
private void initializePagination() {

    // Pagination properties
    pagination = new Pagination((this.max_items_int / rows_per_page.getValue() + 1), 0);
    pagination.setPageFactory(this::createPage);
    this.rows_per_page.addListener( (e) -> pagination.setPageCount(max_items_int / rows_per_page.get() ) );

    Platform.runLater(()->{

        // Remove any previous elements
        this.poolTableViewStackPane.getChildren().clear();

        this.poolTableViewStackPane.getChildren().add(pagination);          

    });

}
项目:game-of-life-java    文件:PresetHandler.java   
public AnchorPane loadPresets(FlowPane base) {

    File dir = new File("Presets");
    File[] selectedFiles = dir.listFiles(new FileFilter() {
        @Override
        public boolean accept(File pathname) {
            if (pathname.getName().endsWith(".gofb")){
                presetCount++;
                return true;}
            return false;
        }
    });
    int pr = 0;
    presets = new String[presetCount];
    for (File selectedFile : selectedFiles) {
        presets[pr] = selectedFile.getName().substring(0, selectedFile.getName().length() - 5);
        pr++;
    }

    Pagination presetsPagination = new Pagination(presets.length, 0);
    //pagination.setStyle("-fx-border-color:red;");
    presetsPagination.setPageFactory(new Callback<Integer, Node>() {
        @Override
        public Node call(Integer pageIndex) {
            if (pageIndex >= presets.length) {
                return null;
            } else {
                return createPresetPage(pageIndex, base);
            }
        }
    });

    AnchorPane anchor = new AnchorPane();
    AnchorPane.setTopAnchor(presetsPagination, 10.0);
    AnchorPane.setRightAnchor(presetsPagination, 10.0);
    AnchorPane.setBottomAnchor(presetsPagination, 10.0);
    AnchorPane.setLeftAnchor(presetsPagination, 10.0);
    anchor.getChildren().addAll(presetsPagination);

    return anchor;
}