This is the preferences-to-table direction. The opposite direction is ColumnPreferencesRecorder.
Both directions compare columns by ColumnPreferencesRecorder#toPersistedModels(List). Each change is
applied with a single setAll, so that the write-back of the table equals the preferences and ends the round trip.
All main tables share the same preferences. Hence, reordering, adding, removing or sorting columns in one library tab is applied to the main tables of all other open library tabs as well. This is intended: the column preferences are global, so all tables show the state that will be restored at the next start.
New columns are created from the model instances held by the preferences. Resized widths are persisted only
because table and preferences share these instances (see ColumnPreferences).
| Modifier and Type | Field and Description |
|---|---|
| private final MainTableColumnFactory | |
| private final ListChangeListener | |
| private final MainTablePreferences | |
| private final ChangeListener | |
| private final ListChangeListener | |
| private final TableView |
| Access | Constructor and Description |
|---|---|
| pack-priv | ColumnPreferencesApplier(TableView<BibEntryTableViewModel> table, MainTableColumnFactory columnFactory, MainTablePreferences mainTablePreferences)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| pack-priv void | |
| pack-priv void | |
| private static List | |
| private Optional | |
| private Optional | |
| pack-priv void | unbind()
The preferences outlive the table, so the listeners have to be removed when the library tab closes. |
| columnFactory | back to summary |
|---|---|
| private final MainTableColumnFactory columnFactory | |
| columnsListener | back to summary |
|---|---|
| private final ListChangeListener<MainTableColumnModel> columnsListener | |
| mainTablePreferences | back to summary |
|---|---|
| private final MainTablePreferences mainTablePreferences | |
| resizeColumnsListener | back to summary |
|---|---|
| private final ChangeListener<Boolean> resizeColumnsListener | |
| sortOrderListener | back to summary |
|---|---|
| private final ListChangeListener<MainTableColumnModel> sortOrderListener | |
| table | back to summary |
|---|---|
| private final TableView<BibEntryTableViewModel> table | |
| ColumnPreferencesApplier | back to summary |
|---|---|
| pack-priv ColumnPreferencesApplier(TableView<BibEntryTableViewModel> table, MainTableColumnFactory columnFactory, MainTablePreferences mainTablePreferences) | |
| applyColumns | back to summary |
|---|---|
| private void applyColumns() | |
| applyResizePolicy | back to summary |
|---|---|
| private void applyResizePolicy(boolean resizeColumnsToFit) | |
| applySortOrder | back to summary |
|---|---|
| pack-priv void applySortOrder() | |
| bind | back to summary |
|---|---|
| pack-priv void bind() Creates the columns, applies the resize policy and follows later changes of the preferences. The initial sort order is not applied here, because sorting a large library is expensive. The caller decides
when to call | |
| configured | back to summary |
|---|---|
| private static List | |
| findColumn | back to summary |
|---|---|
| private Optional | |
| findMatchCategoryColumn | back to summary |
|---|---|
| private Optional | |
| unbind | back to summary |
|---|---|
| pack-priv void unbind() The preferences outlive the table, so the listeners have to be removed when the library tab closes. | |