Verified Owner
Top Description Fields Constructors Methods
org.jabref.gui.maintable

public Class ColumnPreferencesRecorder

extends Object
Class Inheritance
Imports
java.util.List, java.util.stream.Collectors, javafx.beans.InvalidationListener, javafx.collections.ListChangeListener, javafx.scene.control.TableColumn, .TableView, org.jabref.gui.maintable.columns.MainTableColumn, org.slf4j.Logger, .LoggerFactory

Keep track of changes made to the columns (reordering, resorting, resizing).

This is the table-to-preferences direction. The opposite direction is ColumnPreferencesApplier.

Resizing and changing the sort type need no listener here: the preferences receive the column models of the table itself, and ColumnPreferences reports changes of their properties.

Field Summary

Modifier and TypeField and Description
private final InvalidationListener
private static final Logger
protected final ColumnPreferences
private final ListChangeListener<TableColumn<BibEntryTableViewModel, ?>>
protected final TableView<BibEntryTableViewModel>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
bind()

pack-priv static List<MainTableColumnModel>
toPersistedModels(List<? extends TableColumn<BibEntryTableViewModel, ?>> columns)

Returns the models of the given columns as they are stored in the preferences.

public void
private void
updateColumns()

Stores shown columns, their width and their TableColumn.SortType in preferences.

private void
updateSortOrder()

Stores the SortOrder of the Table in the preferences.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnsListenerback to summary
private final InvalidationListener columnsListener
LOGGERback to summary
private static final Logger LOGGER
preferencesback to summary
protected final ColumnPreferences preferences
sortOrderListenerback to summary
private final ListChangeListener<TableColumn<BibEntryTableViewModel, ?>> sortOrderListener
tableback to summary
protected final TableView<BibEntryTableViewModel> table

Constructor Detail

ColumnPreferencesRecorderback to summary
public ColumnPreferencesRecorder(TableView<BibEntryTableViewModel> table, ColumnPreferences preferences)

Method Detail

bindback to summary
public void bind()
toPersistedModelsback to summary
pack-priv static List<MainTableColumnModel> toPersistedModels(List<? extends TableColumn<BibEntryTableViewModel, ?>> columns)

Returns the models of the given columns as they are stored in the preferences.

ColumnPreferencesApplier compares with the same projection. If both directions used different ones, a change written by one direction would be reverted by the other.

unbindback to summary
public void unbind()
updateColumnsback to summary
private void updateColumns()

Stores shown columns, their width and their TableColumn.SortType in preferences. The conversion to the "real" string in the preferences is made at org.jabref.logic.preferences.JabRefCliPreferences#getColumnSortTypesAsStringList(ColumnPreferences)

updateSortOrderback to summary
private void updateSortOrder()

Stores the SortOrder of the Table in the preferences. This includes TableColumn.SortType.

Cannot be combined with updateColumns, because JavaFX would provide just an empty list for the sort order on other changes.