APIdia Launch Partner
Top Description Fields Constructors Methods
javafx.scene.control

public abstract Class MultipleSelectionModel<T>

extends SelectionModel<T>
Class Inheritance
Known Direct Subclasses
javafx.scene.control.MultipleSelectionModelBase
Type Parameters
<T>
The type of the item contained in the control that can be selected.
Imports
javafx.beans.property.ObjectProperty, .ObjectPropertyBase, javafx.collections.ListChangeListener, .ObservableList

An abstract class that extends SelectionModel to add API to support multiple selection.
Since
JavaFX 2.0
See Also
SelectionModel, SelectionMode

Field Summary

Modifier and TypeField and Description
private ObjectProperty<SelectionMode>
selectionMode

Specifies the selection mode to use in this selection model.

Constructor Summary

AccessConstructor and Description
public
MultipleSelectionModel()

Creates a default MultipleSelectionModel instance.

Method Summary

Modifier and TypeMethod and Description
public abstract ObservableList<Integer>

Returns:

the list of selected indices
getSelectedIndices
()

Returns a read-only ObservableList of all selected indices.

public abstract ObservableList<T>

Returns:

the list of selected items
getSelectedItems
()

Returns a read-only ObservableList of all selected items.

public final SelectionMode
public abstract void
selectAll()

Convenience method to select all available indices.

public abstract void
selectFirst()

Implements abstract javafx.scene.control.SelectionModel.selectFirst.

This method will attempt to select the first index in the control.

public abstract void
selectIndices(int
the first index to select
index
,
int...
zero or more additional indices to select
indices
)

This method allows for one or more selections to be set at the same time.

public final ObjectProperty<SelectionMode>
public abstract void
selectLast()

Implements abstract javafx.scene.control.SelectionModel.selectLast.

This method will attempt to select the last index in the control.

public void
selectRange(final int
The first index to select - this index will be selected.
start
,
final int
The last index of the selection - this index will not be selected.
end
)

Selects all indices from the given start index to the item before the given end index.

public final void
Inherited from javafx.scene.control.SelectionModel:
clearAndSelectclearSelectionclearSelectiongetSelectedIndexgetSelectedItemisEmptyisSelectedselectselectselectedIndexPropertyselectedItemPropertyselectNextselectPrevioussetSelectedIndexsetSelectedItem

Field Detail

selectionModeback to summary
private ObjectProperty<SelectionMode> selectionMode

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.

Constructor Detail

MultipleSelectionModelback to summary
public MultipleSelectionModel()

Creates a default MultipleSelectionModel instance.

Method Detail

getSelectedIndicesback to summary
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.

Returns:ObservableList<Integer>

the list of selected indices

getSelectedItemsback to summary
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.

Returns:ObservableList<T>

the list of selected items

getSelectionModeback to summary
public final SelectionMode getSelectionMode()
selectAllback to summary
public abstract void selectAll()

Convenience method to select all available indices.

selectFirstback to summary
public abstract void selectFirst()

Implements abstract javafx.scene.control.SelectionModel.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.

Annotations
@Override
selectIndicesback to summary
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.

Parameters
index:int

the first index to select

indices:int[]

zero or more additional indices to select

selectionModePropertyback to summary
public final ObjectProperty<SelectionMode> selectionModeProperty()
selectLastback to summary
public abstract void selectLast()

Implements abstract javafx.scene.control.SelectionModel.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.

Annotations
@Override
selectRangeback to summary
public void selectRange(final int start, final 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.

Parameters
start:int

The first index to select - this index will be selected.

end:int

The last index of the selection - this index will not be selected.

setSelectionModeback to summary
public final void setSelectionMode(SelectionMode value)