< prev index next >

modules/javafx.controls/src/main/java/javafx/scene/control/Pagination.java

Print this page
rev 10598 : 8185767: Fix broken links in Javadocs


  95  *           return box;
  96  *       }
  97  *   });
  98  * }</pre>
  99  * @since JavaFX 2.2
 100  */
 101 @DefaultProperty("pages")
 102 public class Pagination extends Control {
 103 
 104     private static final int DEFAULT_MAX_PAGE_INDICATOR_COUNT = 10;
 105 
 106     /**
 107      * The style class to change the numeric page indicators to
 108      * bullet indicators.
 109      */
 110     public static final String STYLE_CLASS_BULLET = "bullet";
 111 
 112     /**
 113      * Value for indicating that the page count is indeterminate.
 114      *
 115      * @see #setPageCount
 116      */
 117     public static final int INDETERMINATE = Integer.MAX_VALUE;
 118 
 119     /**
 120      * Constructs a new Pagination control with the specified page count
 121      * and page index.
 122      *
 123      * @param pageCount the number of pages for the pagination control
 124      * @param pageIndex the index of the first page.
 125      *
 126      */
 127     public Pagination(int pageCount, int pageIndex) {
 128         getStyleClass().setAll(DEFAULT_STYLE_CLASS);
 129         setAccessibleRole(AccessibleRole.PAGINATION);
 130         setPageCount(pageCount);
 131         setCurrentPageIndex(pageIndex);
 132     }
 133 
 134     /**
 135      * Constructs a new Pagination control with the specified page count.


 159     private IntegerProperty maxPageIndicatorCount;
 160 
 161     /**
 162      * Sets the maximum number of page indicators.
 163      *
 164      * @param value the number of page indicators.  The default is 10.
 165      */
 166     public final void setMaxPageIndicatorCount(int value) { maxPageIndicatorCountProperty().set(value); }
 167 
 168     /**
 169      * Returns the maximum number of page indicators.
 170      * @return the maximum number of page indicators
 171      */
 172     public final int getMaxPageIndicatorCount() {
 173         return maxPageIndicatorCount == null ? DEFAULT_MAX_PAGE_INDICATOR_COUNT : maxPageIndicatorCount.get();
 174     }
 175 
 176     /**
 177      * The maximum number of page indicators to use for this pagination control.
 178      * The maximum number of pages indicators will remain unchanged if the value is less than 1
 179      * or greater than the {@link #pageCount}.  The number of page indicators will be
 180      * reduced to fit the control if the {@code maxPageIndicatorCount} cannot fit.
 181      *
 182      * The default is 10 page indicators.
 183      * @return the maximum number of page indicators to use for this pagination control
 184      */
 185     public final IntegerProperty maxPageIndicatorCountProperty() {
 186         if (maxPageIndicatorCount == null) {
 187             maxPageIndicatorCount = new StyleableIntegerProperty(DEFAULT_MAX_PAGE_INDICATOR_COUNT) {
 188 
 189                 @Override protected void invalidated() {
 190                     if (!maxPageIndicatorCount.isBound()) {
 191                         if (getMaxPageIndicatorCount() < 1 || getMaxPageIndicatorCount() > getPageCount()) {
 192                             setMaxPageIndicatorCount(oldMaxPageIndicatorCount);
 193                         }
 194                         oldMaxPageIndicatorCount = getMaxPageIndicatorCount();
 195                     }
 196                 }
 197 
 198                 @Override
 199                 public CssMetaData<Pagination,Number> getCssMetaData() {


 264         public void bind(ObservableValue<? extends Number> rawObservable) {
 265             throw new UnsupportedOperationException("currentPageIndex supports only bidirectional binding");
 266         }
 267     };
 268 
 269     /**
 270      * Sets the current page index.
 271      * @param value the current page index.
 272      */
 273     public final void setCurrentPageIndex(int value) { currentPageIndex.set(value); }
 274 
 275     /**
 276      * Returns the current page index.
 277      * @return the current page index
 278      */
 279     public final int getCurrentPageIndex() { return currentPageIndex.get(); }
 280 
 281     /**
 282      * The current page index to display for this pagination control.  The first page will be
 283      * the current page if the value is less than 0.  Similarly the last page
 284      * will be the current page if the value is greater than the {@link #pageCount}
 285      *
 286      * The default is 0 for the first page.
 287      * <p>
 288      * Because the page indicators set the current page index, the currentPageIndex property permits only
 289      * bidirectional binding.
 290      * The {@link javafx.beans.property.IntegerProperty#bind(javafx.beans.value.ObservableValue) bind} method
 291      * throws an UnsupportedOperationException.
 292      * </p>
 293      * @return the current page index property
 294      */
 295     public final IntegerProperty currentPageIndexProperty() { return currentPageIndex; }
 296 
 297     private ObjectProperty<Callback<Integer, Node>> pageFactory =
 298             new SimpleObjectProperty<Callback<Integer, Node>>(this, "pageFactory");
 299 
 300     /**
 301      * Sets the page factory callback function.
 302      * @param value the page factory callback function
 303      */
 304     public final void setPageFactory(Callback<Integer, Node> value) { pageFactory.set(value); }




  95  *           return box;
  96  *       }
  97  *   });
  98  * }</pre>
  99  * @since JavaFX 2.2
 100  */
 101 @DefaultProperty("pages")
 102 public class Pagination extends Control {
 103 
 104     private static final int DEFAULT_MAX_PAGE_INDICATOR_COUNT = 10;
 105 
 106     /**
 107      * The style class to change the numeric page indicators to
 108      * bullet indicators.
 109      */
 110     public static final String STYLE_CLASS_BULLET = "bullet";
 111 
 112     /**
 113      * Value for indicating that the page count is indeterminate.
 114      *
 115      * @see #setPageCount(int)
 116      */
 117     public static final int INDETERMINATE = Integer.MAX_VALUE;
 118 
 119     /**
 120      * Constructs a new Pagination control with the specified page count
 121      * and page index.
 122      *
 123      * @param pageCount the number of pages for the pagination control
 124      * @param pageIndex the index of the first page.
 125      *
 126      */
 127     public Pagination(int pageCount, int pageIndex) {
 128         getStyleClass().setAll(DEFAULT_STYLE_CLASS);
 129         setAccessibleRole(AccessibleRole.PAGINATION);
 130         setPageCount(pageCount);
 131         setCurrentPageIndex(pageIndex);
 132     }
 133 
 134     /**
 135      * Constructs a new Pagination control with the specified page count.


 159     private IntegerProperty maxPageIndicatorCount;
 160 
 161     /**
 162      * Sets the maximum number of page indicators.
 163      *
 164      * @param value the number of page indicators.  The default is 10.
 165      */
 166     public final void setMaxPageIndicatorCount(int value) { maxPageIndicatorCountProperty().set(value); }
 167 
 168     /**
 169      * Returns the maximum number of page indicators.
 170      * @return the maximum number of page indicators
 171      */
 172     public final int getMaxPageIndicatorCount() {
 173         return maxPageIndicatorCount == null ? DEFAULT_MAX_PAGE_INDICATOR_COUNT : maxPageIndicatorCount.get();
 174     }
 175 
 176     /**
 177      * The maximum number of page indicators to use for this pagination control.
 178      * The maximum number of pages indicators will remain unchanged if the value is less than 1
 179      * or greater than the {@link #pageCountProperty() pageCount}.  The number of page indicators will be
 180      * reduced to fit the control if the {@code maxPageIndicatorCount} cannot fit.
 181      *
 182      * The default is 10 page indicators.
 183      * @return the maximum number of page indicators to use for this pagination control
 184      */
 185     public final IntegerProperty maxPageIndicatorCountProperty() {
 186         if (maxPageIndicatorCount == null) {
 187             maxPageIndicatorCount = new StyleableIntegerProperty(DEFAULT_MAX_PAGE_INDICATOR_COUNT) {
 188 
 189                 @Override protected void invalidated() {
 190                     if (!maxPageIndicatorCount.isBound()) {
 191                         if (getMaxPageIndicatorCount() < 1 || getMaxPageIndicatorCount() > getPageCount()) {
 192                             setMaxPageIndicatorCount(oldMaxPageIndicatorCount);
 193                         }
 194                         oldMaxPageIndicatorCount = getMaxPageIndicatorCount();
 195                     }
 196                 }
 197 
 198                 @Override
 199                 public CssMetaData<Pagination,Number> getCssMetaData() {


 264         public void bind(ObservableValue<? extends Number> rawObservable) {
 265             throw new UnsupportedOperationException("currentPageIndex supports only bidirectional binding");
 266         }
 267     };
 268 
 269     /**
 270      * Sets the current page index.
 271      * @param value the current page index.
 272      */
 273     public final void setCurrentPageIndex(int value) { currentPageIndex.set(value); }
 274 
 275     /**
 276      * Returns the current page index.
 277      * @return the current page index
 278      */
 279     public final int getCurrentPageIndex() { return currentPageIndex.get(); }
 280 
 281     /**
 282      * The current page index to display for this pagination control.  The first page will be
 283      * the current page if the value is less than 0.  Similarly the last page
 284      * will be the current page if the value is greater than the {@link #pageCountProperty() pageCount}
 285      *
 286      * The default is 0 for the first page.
 287      * <p>
 288      * Because the page indicators set the current page index, the currentPageIndex property permits only
 289      * bidirectional binding.
 290      * The {@link javafx.beans.property.IntegerProperty#bind(javafx.beans.value.ObservableValue) bind} method
 291      * throws an UnsupportedOperationException.
 292      * </p>
 293      * @return the current page index property
 294      */
 295     public final IntegerProperty currentPageIndexProperty() { return currentPageIndex; }
 296 
 297     private ObjectProperty<Callback<Integer, Node>> pageFactory =
 298             new SimpleObjectProperty<Callback<Integer, Node>>(this, "pageFactory");
 299 
 300     /**
 301      * Sets the page factory callback function.
 302      * @param value the page factory callback function
 303      */
 304     public final void setPageFactory(Callback<Integer, Node> value) { pageFactory.set(value); }


< prev index next >