Module com.iamsoft.util.ui
Package com.iamsoft.util.ui.javafx.table
Class TableFindSupportBase<T extends javafx.scene.control.Control,C extends javafx.scene.control.TableColumnBase>
- java.lang.Object
-
- com.iamsoft.util.ui.javafx.table.AbstractTableFindSupport
-
- com.iamsoft.util.ui.javafx.table.TableFindSupportBase<T,C>
-
- Type Parameters:
T
- Table type.C
- Table column type.
- Direct Known Subclasses:
TableViewFindSupport
,TreeTableViewFindSupport
public abstract class TableFindSupportBase<T extends javafx.scene.control.Control,C extends javafx.scene.control.TableColumnBase> extends AbstractTableFindSupport
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
TableFindSupportBase.AbstractFindTask<T>
protected class
TableFindSupportBase.BatchFindTask
Finds all occurrences in a background thread.protected class
TableFindSupportBase.FindTask
Finds all occurrences in a background thread.protected class
TableFindSupportBase.SearchFunction
Used for finding occurrences in a text.-
Nested classes/interfaces inherited from class com.iamsoft.util.ui.javafx.table.AbstractTableFindSupport
AbstractTableFindSupport.FindStrategy, AbstractTableFindSupport.Range, AbstractTableFindSupport.SearchResult
-
-
Field Summary
Fields Modifier and Type Field Description protected static AbstractObservable
DUMMY_OBSERVABLE
-
Fields inherited from class com.iamsoft.util.ui.javafx.table.AbstractTableFindSupport
FOUND_CELL_CLASS, FOUND_CELL_STYLE, FOUND_TEXT_CLASS, FOUND_TEXT_STYLE, SEARCH_FIELD_BACKGROUND_STYLE, SEARCH_FIELD_NOT_FOUND_BACKGROUND_STYLE, TABLE_VIEW_CSS, TREE_TABLE_VIEW_CSS
-
-
Constructor Summary
Constructors Constructor Description TableFindSupportBase(FindTextFieldSupport pFindTextFieldSupport)
TableFindSupportBase(FindTextFieldSupport pFindTextFieldSupport, T pTable, boolean pSearchInBackground)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description javafx.beans.property.BooleanProperty
autoSelectProperty()
protected void
cancelCurrentFindTask()
protected TableFindSupportBase.FindTask
createFindTask()
abstract javafx.scene.control.TablePositionBase<?>
createTablePosition(T pTable, int pRow, C pColumn)
javafx.beans.property.ObjectProperty<T>
currentTableProperty()
javafx.beans.property.ReadOnlyProperty<javafx.scene.control.TableSelectionModel<?>>
currentTableSelectionModelProperty()
protected javafx.scene.control.TablePositionBase<?>
find(T pTable, javafx.scene.control.TablePositionBase<?> pFromPos, javafx.scene.control.TablePositionBase<?> pToPos, String pFindText)
protected javafx.scene.control.TablePositionBase<?>
findAndSelect(T pTable, javafx.scene.control.TablePositionBase<?> pFromPos, javafx.scene.control.TablePositionBase<?> pToPos, String pFindText)
protected javafx.scene.control.TablePositionBase<?>
findFirst(T pTable)
protected javafx.scene.control.TablePositionBase<?>
findNext(T pTable, boolean pBackwards)
protected javafx.scene.control.TablePositionBase<?>
findNext(T pTable, javafx.scene.control.TablePositionBase<?> pFromPos, boolean pBackwards)
protected javafx.scene.control.TablePositionBase<?>
findNextOccurrence(boolean pBackwards)
protected javafx.scene.control.TablePositionBase<?>
findNextOccurrence(T pTable, boolean pBackwards)
Same asfindNext(Control, boolean)
, but returnsnull
instead of throwingPatternSyntaxException
, if not in background mode.protected javafx.scene.control.TablePositionBase<?>
findNextOccurrence(T pTable, javafx.scene.control.TablePositionBase<?> pFromPos, boolean pBackwards)
Same asfindNext(Control, TablePositionBase, boolean)
, but returnsnull
instead of throwingPatternSyntaxException
, if not in background mode.protected void
fireFindSelectionChange()
protected List<javafx.beans.Observable>
getAdditionalFindObservables()
boolean
getAutoSelect()
abstract javafx.util.Callback<? extends javafx.scene.control.TableColumnBase<?,?>,? extends javafx.scene.control.IndexedCell<?>>
getCellFactory(C pColumn)
protected Map<javafx.scene.control.TableColumnBase,javafx.util.Callback>
getColToOriginalCellFactory()
abstract javafx.collections.ObservableList<C>
getColumns(T pTable)
T
getCurrentTable()
javafx.scene.control.TableSelectionModel<?>
getCurrentTableSelectionModel()
static String
getDisplayText(javafx.scene.control.TableColumnBase<?,?> pColumn, Object pItem)
protected AbstractObservable.Exposed
getFindObservable()
javafx.beans.Observable
getFindSelectionChange()
Gets an observable which fires events when the table selection changes because of an 'find' event - the previous/next buttons are clicked, selection change due to find string/type change, etc.abstract javafx.scene.control.TablePositionBase<?>
getFirstCellPos(T pTable)
Returns the first cell or row position, depending on whether cell selection is enabled, ornull
if the table is empty or has no columns.protected javafx.scene.control.TablePositionBase<?>
getFirstSelectedCell(T pTable)
int
getItemCount(T pTable)
abstract List<?>
getItems(T pTable)
abstract javafx.scene.control.TablePositionBase<?>
getLastCellPos(T pTable)
Returns the last cell or row position, depending on whether cell selection is enabled, ornull
if the table is empty or has no columns.TableFindSupportBase.SearchFunction
getSearchFunction()
javafx.collections.ObservableList<? extends javafx.scene.control.TablePositionBase>
getSelectedCells()
abstract javafx.collections.ObservableList<? extends javafx.scene.control.TablePositionBase>
getSelectedCells(T pTable)
abstract javafx.scene.control.TableSelectionModel<?>
getSelectionModel(T pTable)
protected void
handleCellSelectionModeChanges()
void
installDefaultStyles()
static void
installDefaultStyles(TableFindSupportBase<?,?> pFindSupport)
protected boolean
isInSearchState()
protected <S extends javafx.scene.control.TableColumnBase>
booleanisMatchingCell(javafx.scene.control.TablePositionBase<S> pPos, Function<String,Boolean> pIsMatch)
protected boolean
isMatchingRow(T pTable, int pRow, Function<String,Boolean> pIsMatch)
boolean
isSearchable(javafx.scene.control.TableColumnBase<?,?> pColumn)
abstract javafx.scene.control.TablePositionBase<?>
nextPosition(T pTable, javafx.scene.control.TablePositionBase<?> pPos)
Returns the position of the next cell ornull
if there is no next cell.abstract Stream<? extends javafx.scene.control.TablePositionBase<?>>
positionStream(T pTable, javafx.scene.control.TablePositionBase<?> pFrom, javafx.scene.control.TablePositionBase<?> pTo)
Returns a stream of positions frompFromPos
(inclusive) topToPos
(inclusive).abstract javafx.scene.control.TablePositionBase<?>
prevPosition(T pTable, javafx.scene.control.TablePositionBase<?> pPos)
Returns the position of the previous cell ornull
if there is no previous cell or if the specified position isnull
.javafx.beans.property.ObjectProperty<TableFindSupportBase.SearchFunction>
searchFunctionProperty()
protected boolean
searchInBackground()
javafx.beans.property.ReadOnlyProperty<javafx.scene.control.TablePositionBase<?>>
selectedPositionProperty()
Note that the returned value isnull
if multiple items are selected.protected javafx.scene.control.TablePositionBase<?>
selectNext(boolean pBackwards)
protected javafx.scene.control.TablePositionBase<?>
selectNext(T pTable, boolean pBackwards)
Returns the position of the selected cell/row, ornull
if no match occurs.protected abstract void
selectPosition(T pTable, javafx.scene.control.TablePositionBase<?> pPos)
Selects the specified cell/row and ensures that it's visible.void
setAutoSelect(boolean pAutoSelect)
abstract void
setCellFactory(C pColumn, javafx.util.Callback<? extends javafx.scene.control.TableColumnBase<?,?>,? extends javafx.scene.control.IndexedCell<?>> pCellFactory)
void
setCurrentTable(T pCurrentTable)
static <V> void
setStringConverter(javafx.scene.control.TableColumnBase<?,V> pColumn, Function<V,String> pConverter)
protected String
toLowerCase(String pFindText)
protected static <T> List<String>
toRow(T pItem, List<Function<?,String>> pToStringMappers)
protected void
updateFindObservables()
protected abstract void
updateFixedCellSize()
protected void
updateSearchFunction()
javafx.scene.control.TablePositionBase<?>
updateTableSelection()
protected javafx.scene.control.TablePositionBase<?>
updateTableSelection(T pTable)
-
Methods inherited from class com.iamsoft.util.ui.javafx.table.AbstractTableFindSupport
cellFactoryFilterProperty, cellFactoryProperty, columnFilterProperty, disabledProperty, errorMessageProperty, findStrategyProperty, getCellFactory, getCellFactoryFilter, getColumnFilter, getErrorMessage, getFindStrategy, getFindTextFieldSupport, getFoundCellClass, getFoundCellStyle, getFoundTextClass, getFoundTextStyle, getLineWrap, getMatchCase, getMatchCount, getSearchField, getSearchFieldBackgroundStyle, getSearchProgress, getSearchResult, getSearchResultInfo, getSearchResultMessage, getSelectedMatchRange, getSelectedPosition, hasNoOccurrences, hasSearchInProgress, installStylesheet, isDisabled, lineWrapProperty, matchCaseProperty, matchCountProperty, matchCountWrapper, nextBtnDisable, nextBtnDisableProperty, noOccurrences, noOccurrencesProperty, prevBtnDisable, prevBtnDisableProperty, searchFieldBackgroundStyle, searchFieldBackgroundStyleProperty, searchInProgress, searchInProgressProperty, searchProgress, searchProgressProperty, searchResultInfo, searchResultInfoProperty, searchResultMessage, searchResultMessageProperty, searchResultProperty, selectedMatchRangeProperty, selectedMatchRangeWrapper, selectedPositionWrapper, selectNext, selectPrev, setCellFactory, setCellFactoryFilter, setColumnFilter, setDisabled, setErrorMessage, setFindStrategy, setFoundCellClass, setFoundCellStyle, setFoundTextClass, setFoundTextStyle, setLineWrap, setMatchCase, setSearchResult, setupSearchField, setupSearchFieldBackgroundStyle, setupSearchResultInfo, setupSearchResultMessage, updateSearchProgress, updateSelectedMatchRange
-
-
-
-
Field Detail
-
DUMMY_OBSERVABLE
protected static final AbstractObservable DUMMY_OBSERVABLE
-
-
Constructor Detail
-
TableFindSupportBase
public TableFindSupportBase(FindTextFieldSupport pFindTextFieldSupport)
-
TableFindSupportBase
public TableFindSupportBase(FindTextFieldSupport pFindTextFieldSupport, T pTable, boolean pSearchInBackground)
-
-
Method Detail
-
getFindSelectionChange
public javafx.beans.Observable getFindSelectionChange()
Description copied from class:AbstractTableFindSupport
Gets an observable which fires events when the table selection changes because of an 'find' event - the previous/next buttons are clicked, selection change due to find string/type change, etc.- Specified by:
getFindSelectionChange
in classAbstractTableFindSupport
- Returns:
- observable
-
getColToOriginalCellFactory
protected Map<javafx.scene.control.TableColumnBase,javafx.util.Callback> getColToOriginalCellFactory()
-
getFindObservable
protected final AbstractObservable.Exposed getFindObservable()
-
searchInBackground
protected final boolean searchInBackground()
-
autoSelectProperty
public javafx.beans.property.BooleanProperty autoSelectProperty()
-
getAutoSelect
public boolean getAutoSelect()
-
setAutoSelect
public void setAutoSelect(boolean pAutoSelect)
-
currentTableProperty
public javafx.beans.property.ObjectProperty<T> currentTableProperty()
-
getCurrentTable
public T getCurrentTable()
-
setCurrentTable
public void setCurrentTable(T pCurrentTable)
-
searchFunctionProperty
public javafx.beans.property.ObjectProperty<TableFindSupportBase.SearchFunction> searchFunctionProperty()
-
getSearchFunction
public TableFindSupportBase.SearchFunction getSearchFunction()
-
currentTableSelectionModelProperty
public javafx.beans.property.ReadOnlyProperty<javafx.scene.control.TableSelectionModel<?>> currentTableSelectionModelProperty()
-
getCurrentTableSelectionModel
public javafx.scene.control.TableSelectionModel<?> getCurrentTableSelectionModel()
-
selectedPositionProperty
public javafx.beans.property.ReadOnlyProperty<javafx.scene.control.TablePositionBase<?>> selectedPositionProperty()
Description copied from class:AbstractTableFindSupport
Note that the returned value isnull
if multiple items are selected.- Overrides:
selectedPositionProperty
in classAbstractTableFindSupport
-
getCellFactory
public abstract javafx.util.Callback<? extends javafx.scene.control.TableColumnBase<?,?>,? extends javafx.scene.control.IndexedCell<?>> getCellFactory(C pColumn)
-
setCellFactory
public abstract void setCellFactory(C pColumn, javafx.util.Callback<? extends javafx.scene.control.TableColumnBase<?,?>,? extends javafx.scene.control.IndexedCell<?>> pCellFactory)
-
getSelectionModel
public abstract javafx.scene.control.TableSelectionModel<?> getSelectionModel(T pTable)
-
getSelectedCells
public abstract javafx.collections.ObservableList<? extends javafx.scene.control.TablePositionBase> getSelectedCells(T pTable)
-
getSelectedCells
public javafx.collections.ObservableList<? extends javafx.scene.control.TablePositionBase> getSelectedCells()
-
createTablePosition
public abstract javafx.scene.control.TablePositionBase<?> createTablePosition(T pTable, int pRow, C pColumn)
-
positionStream
public abstract Stream<? extends javafx.scene.control.TablePositionBase<?>> positionStream(T pTable, javafx.scene.control.TablePositionBase<?> pFrom, javafx.scene.control.TablePositionBase<?> pTo)
Returns a stream of positions frompFromPos
(inclusive) topToPos
(inclusive). IfpFromPos
is greater thanpToPos
, the elements in the stream are provided in backward order.- Throws:
IllegalArgumentException
- if any of the specified positions isnull
, or if an invalid position is specified as an argument, or if one of the specified positions is row based and the other is not.
-
getFirstCellPos
public abstract javafx.scene.control.TablePositionBase<?> getFirstCellPos(T pTable)
Returns the first cell or row position, depending on whether cell selection is enabled, ornull
if the table is empty or has no columns.
-
getLastCellPos
public abstract javafx.scene.control.TablePositionBase<?> getLastCellPos(T pTable)
Returns the last cell or row position, depending on whether cell selection is enabled, ornull
if the table is empty or has no columns.
-
prevPosition
public abstract javafx.scene.control.TablePositionBase<?> prevPosition(T pTable, javafx.scene.control.TablePositionBase<?> pPos)
Returns the position of the previous cell ornull
if there is no previous cell or if the specified position isnull
.
-
nextPosition
public abstract javafx.scene.control.TablePositionBase<?> nextPosition(T pTable, javafx.scene.control.TablePositionBase<?> pPos)
Returns the position of the next cell ornull
if there is no next cell. If the specified position isnull
and the table is not empty and there is at least one column in the table, the first cell is returned.
-
selectPosition
protected abstract void selectPosition(T pTable, javafx.scene.control.TablePositionBase<?> pPos)
Selects the specified cell/row and ensures that it's visible. The method does nothing if any of the arguments isnull
.
-
updateFixedCellSize
protected abstract void updateFixedCellSize()
-
getItemCount
public int getItemCount(T pTable)
-
createFindTask
protected TableFindSupportBase.FindTask createFindTask()
-
cancelCurrentFindTask
protected void cancelCurrentFindTask()
-
updateFindObservables
protected void updateFindObservables()
-
getAdditionalFindObservables
protected List<javafx.beans.Observable> getAdditionalFindObservables()
-
handleCellSelectionModeChanges
protected void handleCellSelectionModeChanges()
-
updateTableSelection
public javafx.scene.control.TablePositionBase<?> updateTableSelection()
-
updateTableSelection
protected javafx.scene.control.TablePositionBase<?> updateTableSelection(T pTable)
-
findNextOccurrence
protected javafx.scene.control.TablePositionBase<?> findNextOccurrence(boolean pBackwards)
-
findNextOccurrence
protected javafx.scene.control.TablePositionBase<?> findNextOccurrence(T pTable, boolean pBackwards)
Same asfindNext(Control, boolean)
, but returnsnull
instead of throwingPatternSyntaxException
, if not in background mode.
-
findNextOccurrence
protected javafx.scene.control.TablePositionBase<?> findNextOccurrence(T pTable, javafx.scene.control.TablePositionBase<?> pFromPos, boolean pBackwards)
Same asfindNext(Control, TablePositionBase, boolean)
, but returnsnull
instead of throwingPatternSyntaxException
, if not in background mode.
-
findFirst
protected javafx.scene.control.TablePositionBase<?> findFirst(T pTable)
-
findNext
protected javafx.scene.control.TablePositionBase<?> findNext(T pTable, boolean pBackwards)
- Returns:
- the position of the cell/row (without selecting it),
or
null
if no match occurs. - Throws:
PatternSyntaxException
- if not in background mode and invalid regex pattern is provided.
-
findNext
protected javafx.scene.control.TablePositionBase<?> findNext(T pTable, javafx.scene.control.TablePositionBase<?> pFromPos, boolean pBackwards)
- Returns:
- the position of the cell/row (without selecting it),
or
null
if no match occurs. - Throws:
PatternSyntaxException
- if not in background mode and invalid regex pattern is provided.
-
find
protected javafx.scene.control.TablePositionBase<?> find(T pTable, javafx.scene.control.TablePositionBase<?> pFromPos, javafx.scene.control.TablePositionBase<?> pToPos, String pFindText)
- Throws:
PatternSyntaxException
- if not in background mode and invalid regex pattern is provided.
-
findAndSelect
protected javafx.scene.control.TablePositionBase<?> findAndSelect(T pTable, javafx.scene.control.TablePositionBase<?> pFromPos, javafx.scene.control.TablePositionBase<?> pToPos, String pFindText)
- Throws:
PatternSyntaxException
- if invalid regex pattern is provided.
-
selectNext
protected javafx.scene.control.TablePositionBase<?> selectNext(boolean pBackwards)
- Specified by:
selectNext
in classAbstractTableFindSupport
-
selectNext
protected javafx.scene.control.TablePositionBase<?> selectNext(T pTable, boolean pBackwards)
Returns the position of the selected cell/row, ornull
if no match occurs.- Throws:
PatternSyntaxException
- if not in background mode and invalid regex pattern is provided.
-
isSearchable
public boolean isSearchable(javafx.scene.control.TableColumnBase<?,?> pColumn)
-
isMatchingRow
protected boolean isMatchingRow(T pTable, int pRow, Function<String,Boolean> pIsMatch)
- Returns:
true
if it's a matching row.
-
isMatchingCell
protected <S extends javafx.scene.control.TableColumnBase> boolean isMatchingCell(javafx.scene.control.TablePositionBase<S> pPos, Function<String,Boolean> pIsMatch)
-
getFirstSelectedCell
protected javafx.scene.control.TablePositionBase<?> getFirstSelectedCell(T pTable)
-
updateSearchFunction
protected void updateSearchFunction()
-
isInSearchState
protected boolean isInSearchState()
-
fireFindSelectionChange
protected void fireFindSelectionChange()
-
getDisplayText
public static String getDisplayText(javafx.scene.control.TableColumnBase<?,?> pColumn, Object pItem)
-
setStringConverter
public static <V> void setStringConverter(javafx.scene.control.TableColumnBase<?,V> pColumn, Function<V,String> pConverter)
-
installDefaultStyles
public void installDefaultStyles()
-
installDefaultStyles
public static void installDefaultStyles(TableFindSupportBase<?,?> pFindSupport)
-
-