Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8126663

[Pagination] incorrect behavior, when page count is less then 0.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 7u6
    • 7u6
    • javafx
    • 2.2.0b15

    Description

      Actually, i want to review situation of behavior.

      I have code:


      import javafx.application.Application;
      import javafx.scene.Node;
      import javafx.scene.Scene;
      import javafx.scene.control.Pagination;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;
      import javafx.util.Callback;

      public class JavaApplication48 extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              VBox vb = new VBox();

              Pagination pg = new Pagination();
              pg.setPageCount(-5);
              pg.setPageFactory(new Callback<Integer, Node>() {

                  @Override
                  public Node call(Integer p) {
                      System.out.println("Called for " + p);
                      return null;
                  }
              });

              vb.getChildren().addAll(pg);

              Scene scene = new Scene(vb, 300, 300);
              stage.setScene(scene);
              stage.show();
          }
      }

      When I run it, I have:
      Called for 0

      This looks like incorrect, because page count is less then 0, and control cannot ask for page in such case.

      Also, click any of page navigation buttons (1, 2, 3, ...). I catch long exception:
      at com.sun.javafx.scene.control.skin.PaginationSkin$NavigationControl$4.changed(PaginationSkin.java:801)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:196)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:100)
      at javafx.beans.property.IntegerPropertyBase.fireValueChangedEvent(IntegerPropertyBase.java:123)
      at javafx.beans.property.IntegerPropertyBase.markInvalid(IntegerPropertyBase.java:130)
      at javafx.beans.property.IntegerPropertyBase.set(IntegerPropertyBase.java:163)
      at javafx.scene.control.Pagination.setCurrentPageIndex(Pagination.java:276)
      at com.sun.javafx.scene.control.skin.PaginationSkin.createPage(PaginationSkin.java:355)
      at com.sun.javafx.scene.control.skin.PaginationSkin.access$1900(PaginationSkin.java:84)
      at com.sun.javafx.scene.control.skin.PaginationSkin$NavigationControl$4.changed(PaginationSkin.java:811)
      at com.sun.javafx.scene.control.skin.PaginationSkin$NavigationControl$4.changed(PaginationSkin.java:801)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:196)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:100)
      at javafx.beans.property.IntegerPropertyBase.fireValueChangedEvent(IntegerPropertyBase.java:123)
      at javafx.beans.property.IntegerPropertyBase.markInvalid(IntegerPropertyBase.java:130)
      at javafx.beans.property.IntegerPropertyBase.set(IntegerPropertyBase.java:163)
      at javafx.scene.control.Pagination.setCurrentPageIndex(Pagination.java:276)
      at com.sun.javafx.scene.control.skin.PaginationSkin.createPage(PaginationSkin.java:355)
      at com.sun.javafx.scene.control.skin.PaginationSkin.access$1900(PaginationSkin.java:84)
      at com.sun.javafx.scene.control.skin.PaginationSkin$NavigationControl$4.changed(PaginationSkin.java:811)
      at com.sun.javafx.scene.control.skin.PaginationSkin$NavigationControl$4.changed(PaginationSkin.java:801)
      at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:196)
      at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:100)

      Of cource, issue can be closed, if it is an expected behavior.

      Attachments

        Activity

          People

            kwwong Kinsley Wong (Inactive)
            akirov Alexander Kirov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: