ChoiceBox control. Conversely, most other
controls (ListView, TreeView, TableView, etc)
require MultipleSelectionModel implementations (although
MultipleSelectionModel does still allow for single selection to be set via the
selectionMode
property).
SelectionModel, MultipleSelectionModel, SelectionMode
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | clearAndSelect(int index)
Implements abstract javafx. In the SingleSelectionModel, this method is functionally equivalent to
calling |
| public void | clearSelection()
Implements abstract javafx. Clears the selection model of all selected indices. |
| public void | clearSelection(int index)
Implements abstract javafx. Clears the selection of the given index, if it is currently selected. |
| protected abstract int | Returns: A number greater than or equal to 0.Gets the number of items available for the selection model. |
| protected abstract T | Returns: The item that exists at the given index.The position of the item in the underlying data model. index)Gets the data model item associated with a specific index. |
| public boolean | isEmpty()
Implements abstract javafx. This method is available to test whether there are any selected indices/items. |
| public boolean | Returns: True if the given index is selected, false otherwise.The index to check as to whether it is currently selected
or not. index)Implements abstract javafx. This method will return true if the given index is the currently selected index in this SingleSelectionModel. |
| public void | select(T obj)
Implements abstract javafx. Selects the index for the first instance of given object in the underlying data model. |
| public void | select(int index)
Implements abstract javafx. Selects the given index. |
| public void | selectFirst()
Implements abstract javafx. Selects the first index. |
| public void | selectLast()
Implements abstract javafx. Selects the last index. |
| public void | selectNext()
Implements abstract javafx. Selects the next index. |
| public void | selectPrevious()
Implements abstract javafx. Selects the previous index. |
| private void |
| SingleSelectionModel | back to summary |
|---|---|
| public SingleSelectionModel() Creates a default SingleSelectionModel instance. | |
| clearAndSelect | back to summary |
|---|---|
| public void clearAndSelect(int index) Implements abstract javafx. In the SingleSelectionModel, this method is functionally equivalent to
calling
| |
| clearSelection | back to summary |
|---|---|
| public void clearSelection() Implements abstract javafx. Doc from javafx. Clears the selection model of all selected indices.
| |
| clearSelection | back to summary |
|---|---|
| public void clearSelection(int index) Implements abstract javafx. Clears the selection of the given index, if it is currently selected.
| |
| getItemCount | back to summary |
|---|---|
| protected abstract int getItemCount() Gets the number of items available for the selection model. If the number of items can change dynamically, it is the responsibility of the concrete SingleSelectionModel implementation to ensure that items are selected or unselected as appropriate as the items change.
| |
| getModelItem | back to summary |
|---|---|
| protected abstract T getModelItem(int index) Gets the data model item associated with a specific index.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements abstract javafx. Doc from javafx. This method is available to test whether there are any selected indices/items. It will return true if there are no selected items, and false if there are.
| |
| isSelected | back to summary |
|---|---|
| public boolean isSelected(int index) Implements abstract javafx. This method will return true if the given index is the currently selected index in this SingleSelectionModel.
| |
| select | back to summary |
|---|---|
| public void select(T obj) Implements abstract javafx. Selects the index for the first instance of given object in the underlying data model. Since the SingleSelectionModel can only support having a single index selected at a time, this also causes any previously selected index to be unselected.
| |
| select | back to summary |
|---|---|
| public void select(int index) Implements abstract javafx. Selects the given index. Since the SingleSelectionModel can only support having a single index selected at a time, this also causes any previously selected index to be unselected.
| |
| selectFirst | back to summary |
|---|---|
| public void selectFirst() Implements abstract javafx. Selects the first index. Since the SingleSelectionModel can only support having a single index selected at a time, this also causes any previously selected index to be unselected.
| |
| selectLast | back to summary |
|---|---|
| public void selectLast() Implements abstract javafx. Selects the last index. Since the SingleSelectionModel can only support having a single index selected at a time, this also causes any previously selected index to be unselected.
| |
| selectNext | back to summary |
|---|---|
| public void selectNext() Implements abstract javafx. Selects the next index. Since the SingleSelectionModel can only support having a single index selected at a time, this also causes any previously selected index to be unselected.
| |
| selectPrevious | back to summary |
|---|---|
| public void selectPrevious() Implements abstract javafx. Selects the previous index. Since the SingleSelectionModel can only support having a single index selected at a time, this also causes any previously selected index to be unselected.
| |
| updateSelectedIndex | back to summary |
|---|---|
| private void updateSelectedIndex(int newIndex) | |