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

public Class MainTableDataModel

extends Object
Class Inheritance
Imports
java.util.EnumSet, .HashMap, .List, .Map, .Optional, java.util.concurrent.atomic.AtomicLong, javafx.beans.binding.Bindings, javafx.beans.property.IntegerProperty, .ListProperty, .ObjectProperty, .SimpleObjectProperty, javafx.collections.ObservableList, javafx.collections.transformation.FilteredList, .SortedList, org.jabref.gui.groups.GroupViewMode, .GroupsPreferences, org.jabref.gui.preferences.GuiPreferences, org.jabref.gui.search.MatchCategory, org.jabref.gui.util.BindingsHelper, .FilteredListProxy, org.jabref.logic.search.SearchContext, .SearchPreferences, org.jabref.logic.util.BackgroundTask, .OptionalObjectProperty, .TaskExecutor, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, org.jabref.model.groups.GroupTreeNode, org.jabref.model.search.SearchDisplayMode, .SearchFlags, org.jabref.model.search.event.IndexAddedOrUpdatedEvent, .IndexStartedEvent, org.jabref.model.search.matchers.MatcherSet, .MatcherSets, org.jabref.model.search.query.SearchQuery, .SearchResults, com.google.common.eventbus.Subscribe, com.tobiasdiez.easybind.EasyBind, com.tobiasdiez.easybind.Subscription, org.jspecify.annotations.NullMarked, .Nullable, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

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

Field Summary

Modifier and TypeField and Description
private final BibDatabaseContext
private final FilteredList<BibEntryTableViewModel>
private final SortedList<BibEntryTableViewModel>
private final ObservableList<BibEntryTableViewModel>
private final ObjectProperty<MainTableFieldValueFormatter>
private Optional<MatcherSet>
private final GroupsPreferences
private final AtomicLong
private final com.tobiasdiez.easybind.Subscription
private final MainTableDataModel.SearchIndexListener
private final Logger
private final NameDisplayPreferences
private final @Nullable SearchContext
private final com.tobiasdiez.easybind.Subscription
private final SearchPreferences
private final org.jabref.logic.util.OptionalObjectProperty<SearchQuery>
private final com.tobiasdiez.easybind.Subscription
private final AtomicLong
private final com.tobiasdiez.easybind.Subscription
private final TaskExecutor

Constructor Summary

AccessConstructor and Description
public
MainTableDataModel(BibDatabaseContext context, GuiPreferences preferences, TaskExecutor taskExecutor, @Nullable SearchContext searchContext, ListProperty<GroupTreeNode> selectedGroupsProperty, org.jabref.logic.util.OptionalObjectProperty<SearchQuery> searchQueryProperty, IntegerProperty resultSizeProperty)

Method Summary

Modifier and TypeMethod and Description
private void
private void
private static MainTableDataModel.GroupMatchResult
private MainTableDataModel.IndexedEntrySearchMatch
calculateIndexedEntrySearchMatch(BibEntry entry, Optional<SearchQuery> query, long updateSequence)

private void
private static Optional<MatcherSet>
createGroupMatcher(List<GroupTreeNode> selectedGroups, EnumSet<GroupViewMode> groupViewMode)

public SortedList<BibEntryTableViewModel>
public Optional<BibEntryTableViewModel>
public Optional<BibEntryTableViewModel>
public void
refreshSearchMatches()

Refresh the current search

We need to call this when the database is switched during a fulltext search since the listener on the searchQueryProperty will not fire if the query doesn't change (this causes searchResults in FullTextResultsTab to be empty) issue 13241

public void
private static void
setEntrySearchVisibility(BibEntryTableViewModel entry, boolean isMatched, boolean isFloatingMode)

private void
public void
private void
updateEntryGroupMatch(BibEntryTableViewModel entry, Optional<MatcherSet> groupsMatcher, boolean isInvertMode, boolean isFloatingMode)

private static void
updateEntryGroupMatch(BibEntryTableViewModel entry, boolean isMatched, boolean isFloatingMode)

private static void
updateEntrySearchMatch(BibEntryTableViewModel entry, boolean isMatched, boolean isFloatingMode)

private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bibDatabaseContextback to summary
private final BibDatabaseContext bibDatabaseContext
entriesFilteredback to summary
private final FilteredList<BibEntryTableViewModel> entriesFiltered
entriesFilteredAndSortedback to summary
private final SortedList<BibEntryTableViewModel> entriesFilteredAndSorted
entriesViewModelback to summary
private final ObservableList<BibEntryTableViewModel> entriesViewModel
fieldValueFormatterback to summary
private final ObjectProperty<MainTableFieldValueFormatter> fieldValueFormatter
groupsMatcherback to summary
private Optional<MatcherSet> groupsMatcher
groupsPreferencesback to summary
private final GroupsPreferences groupsPreferences
groupUpdateSequenceback to summary
private final AtomicLong groupUpdateSequence
groupViewModeSubscriptionback to summary
private final com.tobiasdiez.easybind.Subscription groupViewModeSubscription
indexUpdatedListenerback to summary
private final MainTableDataModel.SearchIndexListener indexUpdatedListener
LOGGERback to summary
private final Logger LOGGER
nameDisplayPreferencesback to summary
private final NameDisplayPreferences nameDisplayPreferences
searchContextback to summary
private final @Nullable SearchContext searchContext
searchDisplayModeSubscriptionback to summary
private final com.tobiasdiez.easybind.Subscription searchDisplayModeSubscription
searchPreferencesback to summary
private final SearchPreferences searchPreferences
searchQueryPropertyback to summary
private final org.jabref.logic.util.OptionalObjectProperty<SearchQuery> searchQueryProperty
searchQuerySubscriptionback to summary
private final com.tobiasdiez.easybind.Subscription searchQuerySubscription
searchUpdateSequenceback to summary
private final AtomicLong searchUpdateSequence
selectedGroupsSubscriptionback to summary
private final com.tobiasdiez.easybind.Subscription selectedGroupsSubscription
taskExecutorback to summary
private final TaskExecutor taskExecutor

Constructor Detail

MainTableDataModelback to summary
public MainTableDataModel(BibDatabaseContext context, GuiPreferences preferences, TaskExecutor taskExecutor, @Nullable SearchContext searchContext, ListProperty<GroupTreeNode> selectedGroupsProperty, org.jabref.logic.util.OptionalObjectProperty<SearchQuery> searchQueryProperty, IntegerProperty resultSizeProperty)

Method Detail

applyGroupMatchesback to summary
private void applyGroupMatches(MainTableDataModel.GroupMatchResult groupMatches)
applyIndexedEntrySearchMatchback to summary
private void applyIndexedEntrySearchMatch(MainTableDataModel.IndexedEntrySearchMatch result)
calculateGroupMatchesback to summary
private static MainTableDataModel.GroupMatchResult calculateGroupMatches(List<GroupTreeNode> selectedGroups, EnumSet<GroupViewMode> groupViewMode, List<BibEntryTableViewModel> entries)
calculateIndexedEntrySearchMatchback to summary
private MainTableDataModel.IndexedEntrySearchMatch calculateIndexedEntrySearchMatch(BibEntry entry, Optional<SearchQuery> query, long updateSequence)
clearSearchMatchesback to summary
private void clearSearchMatches()
createGroupMatcherback to summary
private static Optional<MatcherSet> createGroupMatcher(List<GroupTreeNode> selectedGroups, EnumSet<GroupViewMode> groupViewMode)
getEntriesFilteredAndSortedback to summary
public SortedList<BibEntryTableViewModel> getEntriesFilteredAndSorted()
getViewModelByCitationKeyback to summary
public Optional<BibEntryTableViewModel> getViewModelByCitationKey(String citationKey)
getViewModelByIndexback to summary
public Optional<BibEntryTableViewModel> getViewModelByIndex(int index)
refreshSearchMatchesback to summary
public void refreshSearchMatches()

Refresh the current search

We need to call this when the database is switched during a fulltext search since the listener on the searchQueryProperty will not fire if the query doesn't change (this causes searchResults in FullTextResultsTab to be empty) issue 13241

resetFieldFormatterback to summary
public void resetFieldFormatter()
setEntrySearchVisibilityback to summary
private static void setEntrySearchVisibility(BibEntryTableViewModel entry, boolean isMatched, boolean isFloatingMode)
setSearchMatchesback to summary
private void setSearchMatches(SearchResults results)
unbindback to summary
public void unbind()
updateEntryGroupMatchback to summary
private void updateEntryGroupMatch(BibEntryTableViewModel entry, Optional<MatcherSet> groupsMatcher, boolean isInvertMode, boolean isFloatingMode)
updateEntryGroupMatchback to summary
private static void updateEntryGroupMatch(BibEntryTableViewModel entry, boolean isMatched, boolean isFloatingMode)
updateEntrySearchMatchback to summary
private static void updateEntrySearchMatch(BibEntryTableViewModel entry, boolean isMatched, boolean isFloatingMode)
updateGroupMatchesback to summary
private void updateGroupMatches(ObservableList<GroupTreeNode> groups)
updateSearchDisplayModeback to summary
private void updateSearchDisplayMode(SearchDisplayMode mode)
updateSearchMatchesback to summary
private void updateSearchMatches(Optional<SearchQuery> query)
org.jabref.gui.maintable back to summary

private final Record MainTableDataModel.GroupMatchResult

extends Record
Class Inheritance
Annotations
@NullMarked
Record Components
matcher:Optional<MatcherSet> 
matches:Map<BibEntryTableViewModel, Boolean> 
isFloatingMode:boolean 

Field Summary

Modifier and TypeField and Description
private final boolean
isFloatingMode

Record Component accessed by isFloatingMode().

private final Optional<MatcherSet>
matcher

Record Component accessed by matcher().

private final Map<BibEntryTableViewModel, Boolean>
matches

Record Component accessed by matches().

Constructor Summary

AccessConstructor and Description
private
GroupMatchResult(Optional<MatcherSet> matcher, Map<BibEntryTableViewModel, Boolean> matches, boolean isFloatingMode)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public boolean
isFloatingMode()

Record Component getter of isFloatingMode.

public Optional<MatcherSet>
matcher()

Record Component getter of matcher.

public Map<BibEntryTableViewModel, Boolean>
matches()

Record Component getter of matches.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

isFloatingModeback to summary
private final boolean isFloatingMode

Record Component accessed by isFloatingMode().

matcherback to summary
private final Optional<MatcherSet> matcher

Record Component accessed by matcher().

matchesback to summary
private final Map<BibEntryTableViewModel, Boolean> matches

Record Component accessed by matches().

Constructor Detail

GroupMatchResultback to summary
private GroupMatchResult(Optional<MatcherSet> matcher, Map<BibEntryTableViewModel, Boolean> matches, boolean isFloatingMode)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

isFloatingModeback to summary
public boolean isFloatingMode()

Record Component getter of isFloatingMode.

matcherback to summary
public Optional<MatcherSet> matcher()

Record Component getter of matcher.

matchesback to summary
public Map<BibEntryTableViewModel, Boolean> matches()

Record Component getter of matches.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

org.jabref.gui.maintable back to summary

private final Record MainTableDataModel.IndexedEntrySearchMatch

extends Record
Class Inheritance
Annotations
@NullMarked
Record Components
entry:BibEntry 
updateSequence:long 
isMatchedBySearch:boolean 
hasFullTextResults:boolean 

Field Summary

Modifier and TypeField and Description
private final BibEntry
entry

Record Component accessed by entry().

private final boolean
hasFullTextResults

Record Component accessed by hasFullTextResults().

private final boolean
isMatchedBySearch

Record Component accessed by isMatchedBySearch().

private final long
updateSequence

Record Component accessed by updateSequence().

Constructor Summary

AccessConstructor and Description
private
IndexedEntrySearchMatch(BibEntry entry, long updateSequence, boolean isMatchedBySearch, boolean hasFullTextResults)

Method Summary

Modifier and TypeMethod and Description
public BibEntry
entry()

Record Component getter of entry.

public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public boolean
hasFullTextResults()

Record Component getter of hasFullTextResults.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public boolean
isMatchedBySearch()

Record Component getter of isMatchedBySearch.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

public long
updateSequence()

Record Component getter of updateSequence.

Field Detail

entryback to summary
private final BibEntry entry

Record Component accessed by entry().

hasFullTextResultsback to summary
private final boolean hasFullTextResults

Record Component accessed by hasFullTextResults().

isMatchedBySearchback to summary
private final boolean isMatchedBySearch

Record Component accessed by isMatchedBySearch().

updateSequenceback to summary
private final long updateSequence

Record Component accessed by updateSequence().

Constructor Detail

IndexedEntrySearchMatchback to summary
private IndexedEntrySearchMatch(BibEntry entry, long updateSequence, boolean isMatchedBySearch, boolean hasFullTextResults)

Method Detail

entryback to summary
public BibEntry entry()

Record Component getter of entry.

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hasFullTextResultsback to summary
public boolean hasFullTextResults()

Record Component getter of hasFullTextResults.

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

isMatchedBySearchback to summary
public boolean isMatchedBySearch()

Record Component getter of isMatchedBySearch.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

updateSequenceback to summary
public long updateSequence()

Record Component getter of updateSequence.

org.jabref.gui.maintable back to summary

pack-priv Class MainTableDataModel.SearchIndexListener

extends Object
Class Inheritance
  • java.lang.Object
  • org.jabref.gui.maintable.MainTableDataModel.SearchIndexListener

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
listen(IndexAddedOrUpdatedEvent indexAddedOrUpdatedEvent)

public void
listen(IndexStartedEvent indexStartedEvent)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SearchIndexListenerback to summary
pack-priv SearchIndexListener()

Method Detail

listenback to summary
public void listen(IndexAddedOrUpdatedEvent indexAddedOrUpdatedEvent)
Annotations
@Subscribe
listenback to summary
public void listen(IndexStartedEvent indexStartedEvent)
Annotations
@Subscribe