T
- The type of the item contained in the control that can be selected.public abstract class MultipleSelectionModel<T> extends SelectionModel<T>
SelectionModel
to add API to support
multiple selection.SelectionModel
,
SelectionMode
Type | Property and Description |
---|---|
ObjectProperty<SelectionMode> |
selectionMode
Specifies the selection mode to use in this selection model.
|
selectedIndex, selectedItem
Constructor and Description |
---|
MultipleSelectionModel()
Creates a default MultipleSelectionModel instance.
|
Modifier and Type | Method and Description |
---|---|
abstract ObservableList<Integer> |
getSelectedIndices()
Returns a read-only ObservableList of all selected indices.
|
abstract ObservableList<T> |
getSelectedItems()
Returns a read-only ObservableList of all selected items.
|
SelectionMode |
getSelectionMode()
Gets the value of the property selectionMode.
|
abstract void |
selectAll()
Convenience method to select all available indices.
|
abstract void |
selectFirst()
This method will attempt to select the first index in the control.
|
abstract void |
selectIndices(int index,
int... indices)
This method allows for one or more selections to be set at the same time.
|
ObjectProperty<SelectionMode> |
selectionModeProperty()
Specifies the selection mode to use in this selection model.
|
abstract void |
selectLast()
This method will attempt to select the last index in the control.
|
void |
selectRange(int start,
int end)
Selects all indices from the given start index to the item before the
given end index.
|
void |
setSelectionMode(SelectionMode value)
Sets the value of the property selectionMode.
|
clearAndSelect, clearSelection, clearSelection, getSelectedIndex, getSelectedItem, isEmpty, isSelected, select, select, selectedIndexProperty, selectedItemProperty, selectNext, selectPrevious, setSelectedIndex, setSelectedItem
public final ObjectProperty<SelectionMode> selectionModeProperty
Specifies the selection mode to use in this selection model. The selection mode specifies how many items in the underlying data model can be selected at any one time.
By default, the selection mode is SelectionMode.SINGLE
.
public MultipleSelectionModel()
public final void setSelectionMode(SelectionMode value)
Specifies the selection mode to use in this selection model. The selection mode specifies how many items in the underlying data model can be selected at any one time.
By default, the selection mode is SelectionMode.SINGLE
.
public final SelectionMode getSelectionMode()
Specifies the selection mode to use in this selection model. The selection mode specifies how many items in the underlying data model can be selected at any one time.
By default, the selection mode is SelectionMode.SINGLE
.
public final ObjectProperty<SelectionMode> selectionModeProperty()
Specifies the selection mode to use in this selection model. The selection mode specifies how many items in the underlying data model can be selected at any one time.
By default, the selection mode is SelectionMode.SINGLE
.
public abstract ObservableList<Integer> getSelectedIndices()
Returns a read-only ObservableList of all selected indices. The
ObservableList will be updated by the selection model to always reflect
changes in selection. This can be observed by adding a
ListChangeListener
to the returned ObservableList.
public abstract ObservableList<T> getSelectedItems()
Returns a read-only ObservableList of all selected items. The
ObservableList will be updated further by the selection model to always reflect
changes in selection. This can be observed by adding a
ListChangeListener
to the returned ObservableList.
public abstract void selectIndices(int index, int... indices)
This method allows for one or more selections to be set at the same time. It will ignore any value that is not within the valid range (i.e. greater than or equal to zero, and less than the total number of items in the underlying data model). Any duplication of indices will be ignored.
If there is already one or more indices selected in this model, calling this method will not clear these selections - to do so it is necessary to first call clearSelection.
The last valid value given will become the selected index / selected item.
public void selectRange(int start, int end)
Selects all indices from the given start index to the item before the given end index. This means that the selection is inclusive of the start index, and exclusive of the end index. This method will work regardless of whether start < end or start > end: the only constant is that the index before the given end index will become the selected index.
If there is already one or more indices selected in this model, calling this method will not clear these selections - to do so it is necessary to first call clearSelection.
start
- The first index to select - this index will be selected.end
- The last index of the selection - this index will not be selected.public abstract void selectAll()
Convenience method to select all available indices.
public abstract void selectFirst()
This method will attempt to select the first index in the control. If clearSelection is not called first, this method will have the result of selecting the first index, whilst retaining the selection of any other currently selected indices.
If the first index is already selected, calling this method will have no result, and no selection event will take place.
selectFirst
in class SelectionModel<T>
public abstract void selectLast()
This method will attempt to select the last index in the control. If clearSelection is not called first, this method will have the result of selecting the last index, whilst retaining the selection of any other currently selected indices.
If the last index is already selected, calling this method will have no result, and no selection event will take place.
selectLast
in class SelectionModel<T>
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.