< prev index next >
modules/javafx.controls/src/main/java/javafx/scene/control/skin/VirtualFlow.java
Print this page
@@ -898,17 +898,19 @@
/**
* Sets a new cell factory to use in the VirtualFlow. This forces all old
* cells to be thrown away, and new cells to be created with
* the new cell factory.
+ * @param value the new cell factory
*/
public final void setCellFactory(Callback<VirtualFlow<T>, T> value) {
cellFactoryProperty().set(value);
}
/**
* Returns the current cell factory.
+ * @return the current cell factory
*/
public final Callback<VirtualFlow<T>, T> getCellFactory() {
return cellFactory == null ? null : cellFactory.get();
}
@@ -918,10 +920,11 @@
* VirtualFlow is responsible for reusing cells - all that is necessary
* is for the custom cell factory to return from this function a cell
* which might be usable for representing any item in the VirtualFlow.
*
* <p>Refer to the {@link Cell} class documentation for more detail.
+ * @return the cell factory property
*/
public final ObjectProperty<Callback<VirtualFlow<T>, T>> cellFactoryProperty() {
if (cellFactory == null) {
cellFactory = new SimpleObjectProperty<Callback<VirtualFlow<T>, T>>(this, "cellFactory") {
@Override protected void invalidated() {
@@ -1288,10 +1291,12 @@
/**
* Get a cell which can be used in the layout. This function will reuse
* cells from the pile where possible, and will create new cells when
* necessary.
+ * @param prefIndex the preferred index
+ * @return the available cell
*/
protected T getAvailableCell(int prefIndex) {
T cell = null;
// Fix for RT-12822. We try to retrieve the cell from the pile rather
@@ -1339,10 +1344,12 @@
* Gets a cell for the given index if the cell has been created and laid out.
* "Visible" is a bit of a misnomer, the cell might not be visible in the
* viewport (it may be clipped), but does distinguish between cells that
* have been created and are in use vs. those that are in the pile or
* not created.
+ * @param index the index
+ * @return the visible cell
*/
public T getVisibleCell(int index) {
if (cells.isEmpty()) return null;
// check the last index
@@ -1367,10 +1374,11 @@
/**
* Locates and returns the last non-empty IndexedCell that is currently
* partially or completely visible. This function may return null if there
* are no cells, or if the viewport length is 0.
+ * @return the last visible cell
*/
public T getLastVisibleCell() {
if (cells.isEmpty() || getViewportLength() <= 0) return null;
T cell;
@@ -1386,10 +1394,11 @@
/**
* Locates and returns the first non-empty IndexedCell that is partially or
* completely visible. This really only ever returns null if there are no
* cells or the viewport length is 0.
+ * @return the first visible cell
*/
public T getFirstVisibleCell() {
if (cells.isEmpty() || getViewportLength() <= 0) return null;
T cell = cells.getFirst();
return cell.isEmpty() ? null : cell;
@@ -1397,10 +1406,11 @@
/**
* Adjust the position of cells so that the specified cell
* will be positioned at the start of the viewport. The given cell must
* already be "live".
+ * @param firstCell the first cell
*/
public void scrollToTop(T firstCell) {
if (firstCell != null) {
scrollPixels(getCellPosition(firstCell));
}
@@ -1408,20 +1418,22 @@
/**
* Adjust the position of cells so that the specified cell
* will be positioned at the end of the viewport. The given cell must
* already be "live".
+ * @param lastCell the last cell
*/
public void scrollToBottom(T lastCell) {
if (lastCell != null) {
scrollPixels(getCellPosition(lastCell) + getCellLength(lastCell) - getViewportLength());
}
}
/**
* Adjusts the cells such that the selected cell will be fully visible in
* the viewport (but only just).
+ * @param cell the cell
*/
public void scrollTo(T cell) {
if (cell != null) {
final double start = getCellPosition(cell);
final double length = getCellLength(cell);
@@ -1437,10 +1449,11 @@
}
/**
* Adjusts the cells such that the cell in the given index will be fully visible in
* the viewport.
+ * @param index the index
*/
public void scrollTo(int index) {
T cell = getVisibleCell(index);
if (cell != null) {
scrollTo(cell);
@@ -1452,10 +1465,11 @@
}
/**
* Adjusts the cells such that the cell in the given index will be fully visible in
* the viewport, and positioned at the very top of the viewport.
+ * @param index the index
*/
public void scrollToTop(int index) {
boolean posSet = false;
if (index >= getCellCount() - 1) {
@@ -1484,10 +1498,12 @@
/**
* Given a delta value representing a number of pixels, this method attempts
* to move the VirtualFlow in the given direction (positive is down/right,
* negative is up/left) the given number of pixels. It returns the number of
* pixels actually moved.
+ * @param delta the delta value
+ * @return the number of pixels actually moved
*/
public double scrollPixels(final double delta) {
// Short cut this method for cases where nothing should be done
if (delta == 0) return 0;
@@ -1619,10 +1635,12 @@
/**
* Return a cell for the given index. This may be called for any cell,
* including beyond the range defined by cellCount, in which case an
* empty cell will be returned. The returned value should not be stored for
* any reason.
+ * @param index the index
+ * @return the cell
*/
public T getCell(int index) {
// If there are cells, then we will attempt to get an existing cell
if (! cells.isEmpty()) {
// First check the cells that have already been created and are
@@ -1700,10 +1718,12 @@
}
/**
* Return the index for a given cell. This allows subclasses to customise
* how cell indices are retrieved.
+ * @param cell the cell
+ * @return the index
*/
protected int getCellIndex(T cell){
return cell.getIndex();
}
< prev index next >