public abstract class FocusModel<T> extends Object
Type | Property and Description |
---|---|
ReadOnlyIntegerProperty |
focusedIndex
The index of the current item in the FocusModel which has the focus.
|
ReadOnlyObjectProperty<T> |
focusedItem
The current item in the FocusModel which has the focus.
|
Constructor and Description |
---|
FocusModel()
Creates a default FocusModel instance.
|
Modifier and Type | Method and Description |
---|---|
void |
focus(int index)
Causes the item at the given index to receive the focus.
|
ReadOnlyIntegerProperty |
focusedIndexProperty()
The index of the current item in the FocusModel which has the focus.
|
ReadOnlyObjectProperty<T> |
focusedItemProperty()
The current item in the FocusModel which has the focus.
|
void |
focusNext()
Attempts to give focus to the row after to the currently focused row.
|
void |
focusPrevious()
Attempts to give focus to the row previous to the currently focused row.
|
int |
getFocusedIndex()
Gets the value of the property focusedIndex.
|
T |
getFocusedItem()
Gets the value of the property focusedItem.
|
protected abstract int |
getItemCount()
Returns the number of items in the data model that underpins the control.
|
protected abstract T |
getModelItem(int index)
Returns the item at the given index.
|
boolean |
isFocused(int index)
Convenience method to inform if the given index is currently focused
in this SelectionModel.
|
public final ReadOnlyIntegerProperty focusedIndexProperty
getFocusedIndex()
public final ReadOnlyObjectProperty<T> focusedItemProperty
getFocusedItem()
public final ReadOnlyIntegerProperty focusedIndexProperty()
getFocusedIndex()
public final int getFocusedIndex()
public final ReadOnlyObjectProperty<T> focusedItemProperty()
getFocusedItem()
public final T getFocusedItem()
protected abstract int getItemCount()
listView.getItems().size()
. The valid range of focusable
indices is between 0 and whatever is returned by this method.protected abstract T getModelItem(int index)
listView.getItems().get(index)
.index
- The index of the item that is requested from the underlying
data model.public boolean isFocused(int index)
Convenience method to inform if the given index is currently focused in this SelectionModel. Is functionally equivalent to calling
getFocusedIndex() == index
.index
- The index to check as to whether it is currently focused
or not.public void focus(int index)
focusedIndex = -1
unless
0 <= index < model size
.index
- The index of the item to get focus.public void focusPrevious()
public void focusNext()
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.