Top Description Inners Fields Constructors Methods
javafx.scene.control

pack-priv abstract Class MultipleSelectionModelBase<T>

extends MultipleSelectionModel<T>
Class Inheritance
Known Direct Subclasses
javafx.scene.control.TableSelectionModel, javafx.scene.control.TreeView.TreeViewBitSetSelectionModel, javafx.scene.control.ListView.ListViewBitSetSelectionModel
Type Parameters
<T>
The type of the underlying data model for the UI control.
Imports
com.sun.javafx.collections.NonIterableChange, java.util.*, java.util.stream.Collectors, .IntStream, com.sun.javafx.scene.control.MultipleAdditionAndRemovedChange, .ReadOnlyUnbackedObservableList, .SelectedItemsReadOnlyObservableList, javafx.collections.ListChangeListener, .ObservableList, .ObservableListBase, javafx.util.Callback, .Pair

An abstract class that implements more of the abstract MultipleSelectionModel abstract class. However, this class is package-protected and not intended for public use.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final MultipleSelectionModelBase<T>.SelectedIndicesList
pack-priv ListChangeListener.Change<E>
private final ObservableListBase<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
clearAndSelect(int
The index that should be the only selected index in this selection model.
row
)

Implements abstract javafx.scene.control.SelectionModel.clearAndSelect.

A method that clears any selection prior to setting the selection to the given index.

public void
clearSelection(int
The selected item to deselect.
index
)

Implements abstract javafx.scene.control.SelectionModel.clearSelection.

This method will clear the selection of the item in the given index.

public void
clearSelection()

Implements abstract javafx.scene.control.SelectionModel.clearSelection.

Clears the selection model of all selected indices.

private void
doShift(Pair<Integer, Integer> shiftPair, final Callback<MultipleSelectionModelBase.ShiftParams, Void> callback, int[] perm)

protected abstract void
focus(int
the index of the item to be focused
index
)

Focuses the item at the given index.

protected abstract int

Returns:

the index of the focused item
getFocusedIndex
()

Gets the index of the focused item.

protected abstract int

Returns:

the number of items in the data model that underpins the control
getItemCount
()

Returns the number of items in the data model that underpins the control.

protected abstract T

Returns:

Returns null if the index is out of bounds, or an element of type T that is related to the given index.
getModelItem
(int
The index of the item that is requested from the underlying data model.
index
)

Returns the item at the given index.

public ObservableList<Integer>
getSelectedIndices()

Implements abstract javafx.scene.control.MultipleSelectionModel.getSelectedIndices.

Returns a read-only ObservableList of all selected indices.

public ObservableList<T>
getSelectedItems()

Implements abstract javafx.scene.control.MultipleSelectionModel.getSelectedItems.

Returns a read-only ObservableList of all selected items.

pack-priv boolean
public boolean
isEmpty()

Implements abstract javafx.scene.control.SelectionModel.isEmpty.

This method is available to test whether there are any selected indices/items.

public boolean
isSelected(int
The index to check as to whether it is currently selected or not.
index
)

Implements abstract javafx.scene.control.SelectionModel.isSelected.

This method tests whether the given index is currently selected in this SelectionModel.

private void
public void
select(int
The position of the item to select in the selection model.
row
)

Implements abstract javafx.scene.control.SelectionModel.select.

This will select the given index in the selection model, assuming the index is 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).

public void
select(T
The object to attempt to select in the underlying data model.
obj
)

Implements abstract javafx.scene.control.SelectionModel.select.

This method will attempt to select the index that contains the given object.

public void
selectAll()

Implements abstract javafx.scene.control.MultipleSelectionModel.selectAll.

Convenience method to select all available indices.

public void
selectFirst()

Implements abstract javafx.scene.control.MultipleSelectionModel.selectFirst.

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

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

Implements abstract javafx.scene.control.MultipleSelectionModel.selectIndices.

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

public void
selectLast()

Implements abstract javafx.scene.control.MultipleSelectionModel.selectLast.

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

public void
selectNext()

Implements abstract javafx.scene.control.SelectionModel.selectNext.

This method will attempt to select the index directly after the current focused index.

public void
selectPrevious()

Implements abstract javafx.scene.control.SelectionModel.selectPrevious.

This method will attempt to select the index directly before the current focused index.

pack-priv void
shiftSelection(int position, int shift, final Callback<MultipleSelectionModelBase.ShiftParams, Void> callback)

pack-priv void
pack-priv void
pack-priv void
Inherited from javafx.scene.control.MultipleSelectionModel:
getSelectionModeselectionModePropertyselectRangesetSelectionMode

Field Detail

selectedIndicesback to summary
pack-priv final MultipleSelectionModelBase<T>.SelectedIndicesList selectedIndices
selectedItemChangeback to summary
pack-priv ListChangeListener.Change<E> selectedItemChange
selectedItemsback to summary
private final ObservableListBase<T> selectedItems

Constructor Detail

MultipleSelectionModelBaseback to summary
public MultipleSelectionModelBase()

Method Detail

clearAndSelectback to summary
public void clearAndSelect(int row)

Implements abstract javafx.scene.control.SelectionModel.clearAndSelect.

Doc from javafx.scene.control.SelectionModel.clearAndSelect.

A method that clears any selection prior to setting the selection to the given index. The purpose of this method is to avoid having to call clearSelection() first, meaning that observers that are listening to the selected index property will not see the selected index being temporarily set to -1.

Parameters
row:int

The index that should be the only selected index in this selection model.

Annotations
@Override
clearSelectionback to summary
public void clearSelection(int index)

Implements abstract javafx.scene.control.SelectionModel.clearSelection.

Doc from javafx.scene.control.SelectionModel.clearSelection.

This method will clear the selection of the item in the given index. If the given index is not selected, nothing will happen.

Parameters
index:int

The selected item to deselect.

Annotations
@Override
clearSelectionback to summary
public void clearSelection()

Implements abstract javafx.scene.control.SelectionModel.clearSelection.

Doc from javafx.scene.control.SelectionModel.clearSelection.

Clears the selection model of all selected indices.

Annotations
@Override
doShiftback to summary
private void doShift(Pair<Integer, Integer> shiftPair, final Callback<MultipleSelectionModelBase.ShiftParams, Void> callback, int[] perm)
focusback to summary
protected abstract void focus(int index)

Focuses the item at the given index.

Parameters
index:int

the index of the item to be focused

getFocusedIndexback to summary
protected abstract int getFocusedIndex()

Gets the index of the focused item.

Returns:int

the index of the focused item

getItemCountback to summary
protected abstract int getItemCount()

Returns the number of items in the data model that underpins the control. An example would be that a ListView selection model would likely return listView.getItems().size(). The valid range of selectable indices is between 0 and whatever is returned by this method.

Returns:int

the number of items in the data model that underpins the control

getModelItemback to summary
protected abstract T getModelItem(int index)

Returns the item at the given index. An example using ListView would be listView.getItems().get(index).

Parameters
index:int

The index of the item that is requested from the underlying data model.

Returns:T

Returns null if the index is out of bounds, or an element of type T that is related to the given index.

getSelectedIndicesback to summary
public ObservableList<Integer> getSelectedIndices()

Implements abstract javafx.scene.control.MultipleSelectionModel.getSelectedIndices.

Doc from javafx.scene.control.MultipleSelectionModel.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

Annotations
@Override
getSelectedItemsback to summary
public ObservableList<T> getSelectedItems()

Implements abstract javafx.scene.control.MultipleSelectionModel.getSelectedItems.

Doc from javafx.scene.control.MultipleSelectionModel.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

Annotations
@Override
isAtomicback to summary
pack-priv boolean isAtomic()
isEmptyback to summary
public boolean isEmpty()

Implements abstract javafx.scene.control.SelectionModel.isEmpty.

Doc from javafx.scene.control.SelectionModel.isEmpty.

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.

Returns:boolean

Will return true if there are no selected items, and false if there are.

Annotations
@Override
isSelectedback to summary
public boolean isSelected(int index)

Implements abstract javafx.scene.control.SelectionModel.isSelected.

Doc from javafx.scene.control.SelectionModel.isSelected.

This method tests whether the given index is currently selected in this SelectionModel.

Parameters
index:int

The index to check as to whether it is currently selected or not.

Returns:boolean

True if the given index is selected, false otherwise.

Annotations
@Override
quietClearSelectionback to summary
private void quietClearSelection()
selectback to summary
public void select(int row)

Implements abstract javafx.scene.control.SelectionModel.select.

Doc from javafx.scene.control.SelectionModel.select.

This will select the given index in the selection model, assuming the index is 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).

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().

If the index is already selected, it will not be selected again, or unselected. However, if multiple selection is implemented, then calling select on an already selected index will have the effect of making the index the new selected index (as returned by getSelectedIndex().

Parameters
row:int

The position of the item to select in the selection model.

Annotations
@Override
selectback to summary
public void select(T obj)

Implements abstract javafx.scene.control.SelectionModel.select.

Doc from javafx.scene.control.SelectionModel.select.

This method will attempt to select the index that contains the given object. It will iterate through the underlying data model until it finds an item whose value is equal to the given object. At this point it will stop iterating - this means that this method will not select multiple indices.

Parameters
obj:T

The object to attempt to select in the underlying data model.

Annotations
@Override
selectAllback to summary
public void selectAll()

Implements abstract javafx.scene.control.MultipleSelectionModel.selectAll.

Doc from javafx.scene.control.MultipleSelectionModel.selectAll.

Convenience method to select all available indices.

Annotations
@Override
selectFirstback to summary
public void selectFirst()

Implements abstract javafx.scene.control.MultipleSelectionModel.selectFirst.

Doc from javafx.scene.control.MultipleSelectionModel.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 void selectIndices(int row, int... rows)

Implements abstract javafx.scene.control.MultipleSelectionModel.selectIndices.

Doc from javafx.scene.control.MultipleSelectionModel.selectIndices.

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
row:int

the first index to select

rows:int[]

zero or more additional indices to select

Annotations
@Override
selectLastback to summary
public void selectLast()

Implements abstract javafx.scene.control.MultipleSelectionModel.selectLast.

Doc from javafx.scene.control.MultipleSelectionModel.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
selectNextback to summary
public void selectNext()

Implements abstract javafx.scene.control.SelectionModel.selectNext.

Doc from javafx.scene.control.SelectionModel.selectNext.

This method will attempt to select the index directly after the current focused index. If clearSelection is not called first, this method will have the result of selecting the next index, whilst retaining the selection of any other currently selected indices.

Calling this method will only succeed if:

  • There is currently a lead/focused index.
  • The lead/focus index is not the last index in the control.
  • The next index is not already selected.

If any of these conditions is false, no selection event will take place.

Annotations
@Override
selectPreviousback to summary
public void selectPrevious()

Implements abstract javafx.scene.control.SelectionModel.selectPrevious.

Doc from javafx.scene.control.SelectionModel.selectPrevious.

This method will attempt to select the index directly before the current focused index. If clearSelection is not called first, this method will have the result of selecting the previous index, whilst retaining the selection of any other currently selected indices.

Calling this method will only succeed if:

  • There is currently a lead/focused index.
  • The lead/focus index is not the first index in the control.
  • The previous index is not already selected.

If any of these conditions is false, no selection event will take place.

Annotations
@Override
shiftSelectionback to summary
pack-priv void shiftSelection(int position, int shift, final Callback<MultipleSelectionModelBase.ShiftParams, Void> callback)
shiftSelectionback to summary
pack-priv void shiftSelection(List<Pair<Integer, Integer>> shifts, final Callback<MultipleSelectionModelBase.ShiftParams, Void> callback)
startAtomicback to summary
pack-priv void startAtomic()
stopAtomicback to summary
pack-priv void stopAtomic()
javafx.scene.control back to summary

pack-priv Class MultipleSelectionModelBase.SelectedIndicesList

extends ReadOnlyUnbackedObservableList<Integer>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private final BitSet
private int
private int
private int

Constructor Summary

AccessConstructor and Description
public
SelectedIndicesList()

Constructs a new instance of SelectedIndicesList

public
SelectedIndicesList(BitSet
Bitset to be used.
bitset
)

Constructs a new instance of SelectedIndicesList from the provided BitSet.

Method Summary

Modifier and TypeMethod and Description
public void
public void
public final void
public final void
public final void
public final void
public final void
public final void
public final void
public int
bitsetSize()

Returns the number of bits reserved in the BitSet

public void
clear()

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.clear.

Implements java.util.List.clear, java.util.Collection.clear.

Removes all of the elements from this list (optional operation).

public void
clear(int index)

public boolean
contains(Object
element whose presence in this list is to be tested
o
)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.contains.

Implements java.util.List.contains, java.util.Collection.contains.

Returns true if this list contains the specified element.

public Integer
get(int
index of the element to return
index
)

Implements abstract com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.

public int
indexOf(Object
element to search for
obj
)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.indexOf.

Implements java.util.List.indexOf.

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

pack-priv boolean
public boolean
isNotSelected(int index)

public boolean
isSelected(int index)

private boolean
isValidIndex(int index)

public void
public void
set(int index)

public void
set(int
index of the element to replace
index
,
boolean
element to be stored at the specified position
isSet
)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.set.

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element (optional operation).

public void
set(int index, int end, boolean isSet)

public void
set(int
index of the element to replace
index
,
int...
element to be stored at the specified position
indices
)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.set.

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element (optional operation).

public int
size()

Implements abstract com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.size.

Implements java.util.List.size, java.util.Collection.size.

Returns number of true bits in BitSet

pack-priv void
pack-priv void
Inherited from com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList:
_nextRemoveaddaddaddAlladdAlladdAllcallObserverscontainsAllfireChangeisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveremoveremoveremoveAllremoveAllretainAllretainAllsetAllsetAllsubListtoArraytoArraytoString

Field Detail

atomicityCountback to summary
private int atomicityCount
bitsetback to summary
private final BitSet bitset
lastGetIndexback to summary
private int lastGetIndex
lastGetValueback to summary
private int lastGetValue
sizeback to summary
private int size

Constructor Detail

SelectedIndicesListback to summary
public SelectedIndicesList()

Constructs a new instance of SelectedIndicesList

SelectedIndicesListback to summary
public SelectedIndicesList(BitSet bitset)

Constructs a new instance of SelectedIndicesList from the provided BitSet. The underlying source BitSet shouldn't be modified once it has been passed to the constructor.

Parameters
bitset:BitSet

Bitset to be used.

Method Detail

_beginChangeback to summary
public void _beginChange()

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._beginChange.

Annotations
@Override
_endChangeback to summary
public void _endChange()

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._endChange.

Annotations
@Override
_nextAddback to summary
public final void _nextAdd(int from, int to)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._nextAdd.

Annotations
@Override
_nextPermutationback to summary
public final void _nextPermutation(int from, int to, int[] perm)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._nextPermutation.

Annotations
@Override
_nextRemoveback to summary
public final void _nextRemove(int idx, List<? extends Integer> removed)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._nextRemove, com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._nextRemove.

Annotations
@Override
_nextRemoveback to summary
public final void _nextRemove(int idx, Integer removed)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._nextRemove.

Annotations
@Override
_nextReplaceback to summary
public final void _nextReplace(int from, int to, List<? extends Integer> removed)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._nextReplace.

Annotations
@Override
_nextSetback to summary
public final void _nextSet(int idx, Integer old)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._nextSet.

Annotations
@Override
_nextUpdateback to summary
public final void _nextUpdate(int pos)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList._nextUpdate.

Annotations
@Override
bitsetSizeback to summary
public int bitsetSize()

Returns the number of bits reserved in the BitSet

clearback to summary
public void clear()

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.clear.

Implements java.util.List.clear, java.util.Collection.clear.

Doc from java.util.List.clear.

Removes all of the elements from this list (optional operation). The list will be empty after this call returns.

Annotations
@Override
clearback to summary
public void clear(int index)
containsback to summary
public boolean contains(Object o)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.contains.

Implements java.util.List.contains, java.util.Collection.contains.

Doc from java.util.List.contains.

Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that Objects.equals(o, e).

Parameters
o:Object

element whose presence in this list is to be tested

Returns:boolean

true if this list contains the specified element

Annotations
@Override
getback to summary
public Integer get(int index)

Implements abstract com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.get.

Implements java.util.List.get.

Doc from java.util.List.get.

Returns the element at the specified position in this list.

Parameters
index:int

index of the element to return

Returns:Integer

the element at the specified position in this list

Annotations
@Override
indexOfback to summary
public int indexOf(Object obj)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.indexOf.

Implements java.util.List.indexOf.

Doc from java.util.List.indexOf.

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that Objects.equals(o, get(i)), or -1 if there is no such index.

Parameters
obj:Object

element to search for

Returns:int

the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element

Annotations
@Override
isAtomicback to summary
pack-priv boolean isAtomic()
isNotSelectedback to summary
public boolean isNotSelected(int index)
isSelectedback to summary
public boolean isSelected(int index)
isValidIndexback to summary
private boolean isValidIndex(int index)
resetback to summary
public void reset()
setback to summary
public void set(int index)
setback to summary
public void set(int index, boolean isSet)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.set.

Implements java.util.List.set.

Doc from java.util.List.set.

Replaces the element at the specified position in this list with the specified element (optional operation).

Parameters
index:int

index of the element to replace

isSet:boolean

element to be stored at the specified position

Returns:void

the element previously at the specified position

setback to summary
public void set(int index, int end, boolean isSet)
setback to summary
public void set(int index, int... indices)

Overrides com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.set.

Implements java.util.List.set.

Doc from java.util.List.set.

Replaces the element at the specified position in this list with the specified element (optional operation).

Parameters
index:int

index of the element to replace

indices:int[]

element to be stored at the specified position

Returns:void

the element previously at the specified position

sizeback to summary
public int size()

Implements abstract com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.size.

Implements java.util.List.size, java.util.Collection.size.

Returns number of true bits in BitSet

Returns:int

Doc from java.util.List.size.

the number of elements in this list

Annotations
@Override
startAtomicback to summary
pack-priv void startAtomic()
stopAtomicback to summary
pack-priv void stopAtomic()
javafx.scene.control back to summary

pack-priv Class MultipleSelectionModelBase.ShiftParams

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int
private final boolean
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
ShiftParams(int clearIndex, int setIndex, boolean selected)

Method Summary

Modifier and TypeMethod and Description
public final int
public final int
public final boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clearIndexback to summary
private final int clearIndex
selectedback to summary
private final boolean selected
setIndexback to summary
private final int setIndex

Constructor Detail

ShiftParamsback to summary
pack-priv ShiftParams(int clearIndex, int setIndex, boolean selected)

Method Detail

getClearIndexback to summary
public final int getClearIndex()
getSetIndexback to summary
public final int getSetIndex()
isSelectedback to summary
public final boolean isSelected()