Top Description Fields Constructors Methods
org.controlsfx.control.spreadsheet

public Class SpreadsheetViewSelectionModel

extends Object
Class Inheritance
Imports
impl.org.controlsfx.spreadsheet.GridViewBehavior, .TableViewSpanSelectionModel, java.util.Arrays, .List, javafx.collections.ObservableList, javafx.scene.control.SelectionMode, .TablePosition, .TableView, javafx.util.Pair

This class provides basic support for common interaction on the SpreadsheetView. Due to the complexity induced by cell's span, it is not possible to give a full access to selectionModel like in the TableView.

Field Summary

Modifier and TypeField and Description
private final TableViewSpanSelectionModel
private final SpreadsheetView

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final void
clearAndSelect(int
the row index to select
row
,
SpreadsheetColumn
the column to select
column
)

Clears all selection, and then selects the cell at the given row/column intersection in the SpreadsheetView.

public final void
clearAndSelect(SpreadsheetCell
the cell to select
cell
)

Clears all selection, and then selects the given SpreadsheetCell.

public void
clearAndSelectLeftCell()

Clears the current selection and select the cell on the left of the current focused cell.

public void
clearAndSelectRightCell()

Clears the current selection and select the cell on the right of the current focused cell.

private void
clearAndSelectView(int row, SpreadsheetColumn column)

Private method for inner selection when we already have the ViewRow.

public final void
clearSelection()

Clears the selection model of all selected indices.

public final void
focus(int
the row index of the item to give focus to
row
,
SpreadsheetColumn
the column of the item to give focus to. Can be null
column
)

Causes the cell at the given index to receive the focus.

public final TablePosition<S, T>

Returns:

the position of the cell that has current focus
getFocusedCell
()

Returns the position of the cell that has current focus.

public final ObservableList<TablePosition<S, T>>

Returns:

a read-only ObservableList
getSelectedCells
()

Returns a read-only ObservableList representing the currently selected cells in this SpreadsheetView.

public SelectionMode

Returns:

the SelectionMode currently used
getSelectionMode
()

Returns the SelectionMode currently used.

public final void
select(int
the row index to select
row
,
SpreadsheetColumn
the column to select
column
)

Selects the cell at the given row/column intersection.

public final void
selectAll()

Selects all the possible cells.

public void
selectCells(List<Pair<Integer, Integer>>
the cells to select
selectedCells
)

Selects discontinuous cells.

public void
selectCells(Pair<Integer, Integer>...
the cells to select
selectedCells
)

Selects discontinuous cells.

public void
selectRange(int
the minimum row in the range
minRow
,
SpreadsheetColumn
the minimum column in the range
minColumn
,
int
the maximum row in the range
maxRow
,
SpreadsheetColumn
the maximum column in the range
maxColumn
)

Selects the cells in the range (minRow, minColumn) to (maxRow, maxColumn), inclusive.

public final void
setSelectionMode(SelectionMode
the SelectionMode to use
value
)

Specifies the selection mode to use in this selection model.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

selectionModelback to summary
private final TableViewSpanSelectionModel selectionModel
spvback to summary
private final SpreadsheetView spv

Constructor Detail

SpreadsheetViewSelectionModelback to summary
pack-priv SpreadsheetViewSelectionModel(SpreadsheetView spv, TableViewSpanSelectionModel selectionModel)

Method Detail

clearAndSelectback to summary
public final void clearAndSelect(int row, SpreadsheetColumn column)

Clears all selection, and then selects the cell at the given row/column intersection in the SpreadsheetView. This method does not consider sorting and filtering. If you want to select a SpreadsheetCell in a filtered/sorted grid, use clearAndSelect(org.controlsfx.control.spreadsheet.SpreadsheetCell) instead.

Parameters
row:int

the row index to select

column:SpreadsheetColumn

the column to select

clearAndSelectback to summary
public final void clearAndSelect(SpreadsheetCell cell)

Clears all selection, and then selects the given SpreadsheetCell. This method allow to select a cell no matter if the Grid is Filtered or sorted. Beware, this method can be time-consuming if lots of rows are present.

Parameters
cell:SpreadsheetCell

the cell to select

clearAndSelectLeftCellback to summary
public void clearAndSelectLeftCell()

Clears the current selection and select the cell on the left of the current focused cell. If the cell is the first one on a row, the last cell of the preceding row is selected.

clearAndSelectRightCellback to summary
public void clearAndSelectRightCell()

Clears the current selection and select the cell on the right of the current focused cell. If the cell is the last one on a row, the first cell of the next row is selected.

clearAndSelectViewback to summary
private void clearAndSelectView(int row, SpreadsheetColumn column)

Private method for inner selection when we already have the ViewRow.

clearSelectionback to summary
public final void clearSelection()

Clears the selection model of all selected indices.

focusback to summary
public final void focus(int row, SpreadsheetColumn column)

Causes the cell at the given index to receive the focus.

Parameters
row:int

the row index of the item to give focus to

column:SpreadsheetColumn

the column of the item to give focus to. Can be null

getFocusedCellback to summary
public final TablePosition<S, T> getFocusedCell()

Returns the position of the cell that has current focus.

Returns:TablePosition<S, T>

the position of the cell that has current focus

getSelectedCellsback to summary
public final ObservableList<TablePosition<S, T>> getSelectedCells()

Returns a read-only ObservableList representing the currently selected cells in this SpreadsheetView.

Returns:ObservableList<TablePosition<S, T>>

a read-only ObservableList

getSelectionModeback to summary
public SelectionMode getSelectionMode()

Returns the SelectionMode currently used.

Returns:SelectionMode

the SelectionMode currently used

selectback to summary
public final void select(int row, SpreadsheetColumn column)

Selects the cell at the given row/column intersection.

Parameters
row:int

the row index to select

column:SpreadsheetColumn

the column to select

selectAllback to summary
public final void selectAll()

Selects all the possible cells.

selectCellsback to summary
public void selectCells(List<Pair<Integer, Integer>> selectedCells)

Selects discontinuous cells. The Pair must contain the row index as key and the column index as value. This is useful when you want to select a great amount of cell because it will be more efficient than calling select(int, org.controlsfx.control.spreadsheet.SpreadsheetColumn).

Parameters
selectedCells:List<Pair<Integer, Integer>>

the cells to select

selectCellsback to summary
public void selectCells(Pair<Integer, Integer>... selectedCells)

Selects discontinuous cells. The Pair must contain the row index as key and the column index as value. This is useful when you want to select a great amount of cell because it will be more efficient than calling select(int, org.controlsfx.control.spreadsheet.SpreadsheetColumn).

Parameters
selectedCells:Pair<Integer, Integer>[]

the cells to select

selectRangeback to summary
public void selectRange(int minRow, SpreadsheetColumn minColumn, int maxRow, SpreadsheetColumn maxColumn)

Selects the cells in the range (minRow, minColumn) to (maxRow, maxColumn), inclusive.

Parameters
minRow:int

the minimum row in the range

minColumn:SpreadsheetColumn

the minimum column in the range

maxRow:int

the maximum row in the range

maxColumn:SpreadsheetColumn

the maximum column in the range

setSelectionModeback to summary
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#MULTIPLE.

Parameters
value:SelectionMode

the SelectionMode to use