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

public Class JabRefGuiStateManager

extends AbstractSrvStateManager
implements StateManager
Class Inheritance
All Implemented Interfaces
org.jabref.gui.StateManager
Imports
java.util.ArrayList, .HashMap, .List, .Map, .Optional, java.util.concurrent.ConcurrentHashMap, java.util.function.Function, javafx.beans.Observable, javafx.beans.binding.ObjectBinding, javafx.beans.property.BooleanProperty, .IntegerProperty, .SimpleBooleanProperty, .SimpleIntegerProperty, .SimpleStringProperty, .StringProperty, javafx.collections.FXCollections, .ObservableList, .ObservableMap, javafx.collections.transformation.FilteredList, javafx.concurrent.Task, javafx.scene.Node, javafx.util.Pair, org.jabref.gui.ai.chat.AiGroupChatWindow, org.jabref.gui.search.SearchType, org.jabref.gui.sidepane.SidePaneType, org.jabref.gui.undo.GuiUndoManager, .JabRefGuiUndoManager, org.jabref.gui.util.CustomLocalDragboard, .DialogWindowState, org.jabref.gui.walkthrough.Walkthrough, org.jabref.http.AbstractSrvStateManager, org.jabref.logic.command.CommandSelectionTab, org.jabref.logic.util.BackgroundTask, .OptionalObjectProperty, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, org.jabref.model.groups.GroupTreeNode, org.jabref.model.search.query.SearchQuery, com.tobiasdiez.easybind.EasyBind, com.tobiasdiez.easybind.EasyBinding, com.tobiasdiez.easybind.PreboundBinding, org.jspecify.annotations.NonNull, .NullMarked, .Nullable, org.slf4j.Logger, .LoggerFactory

This class manages the GUI-state of JabRef, including:

Field Summary

Modifier and TypeField and Description
private final org.jabref.logic.util.OptionalObjectProperty<BibDatabaseContext>
private final org.jabref.logic.util.OptionalObjectProperty<SearchQuery>
private final org.jabref.logic.util.OptionalObjectProperty<SearchQuery>
private final org.jabref.logic.util.OptionalObjectProperty<LibraryTab>
private final org.jabref.logic.util.OptionalObjectProperty<Walkthrough>
private final com.tobiasdiez.easybind.EasyBinding<Boolean>
private final ObservableList<Task<?>>
private final ObservableList<Pair<org.jabref.logic.util.BackgroundTask<?>, Task<?>>>
private final BooleanProperty
private final BooleanProperty
private final ObservableMap<String, DialogWindowState>
private final BooleanProperty
private final org.jabref.logic.util.OptionalObjectProperty<Node>
private final IntegerProperty
private final Map<String, Map<String, AiGroupChatWindow>>
groupAiChatWindows

Keyed by BibDatabaseContext#getUid() instead of BibDatabaseContext, because BibDatabaseContext#equals(Object) (and the matching BibDatabaseContext#hashCode()) change with the library content and cannot be used as HashMap keys.

private final CustomLocalDragboard
private static final Logger
private final ObservableList<BibDatabaseContext>
private final FilteredList<Task<?>>
private final ObservableList<String>
private final StringProperty
private final IntegerProperty
private final ObservableList<BibEntry>
private final ObservableMap<String, ObservableList<GroupTreeNode>>
private final Map<String, JabRefGuiUndoManager>
undoManagers

Keyed by BibDatabaseContext#getUid, as selectedGroups is: a context's hashCode changes whenever an entry is added, so a map keyed by the context itself loses its entries.

private final ObservableList<SidePaneType>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public org.jabref.logic.util.OptionalObjectProperty<BibDatabaseContext>
public org.jabref.logic.util.OptionalObjectProperty<SearchQuery>
public org.jabref.logic.util.OptionalObjectProperty<LibraryTab>
public void
addBackgroundTask(org.jabref.logic.util.BackgroundTask<?> backgroundTask, Task<?> task)

Implements org.jabref.gui.StateManager.addBackgroundTask.

public void
public BooleanProperty
public BooleanProperty
public void
public void
public org.jabref.logic.util.OptionalObjectProperty<Node>
public Optional<BibDatabaseContext>
public ObjectBinding<Optional<CommandSelectionTab>>
public Optional<Walkthrough>
public Optional<AiGroupChatWindow>
public List<String>
public com.tobiasdiez.easybind.EasyBinding<Boolean>
public ObservableList<Task<?>>
public DialogWindowState
public BooleanProperty
public Optional<Node>
public List<String>
public CustomLocalDragboard
public ObservableList<BibDatabaseContext>
public ObservableList<Task<?>>
public ObservableList<BibEntry>
getSelectedEntries()

The live selection, not a snapshot of it.

public ObservableList<GroupTreeNode>
public GuiUndoManager
getUndoManager(BibDatabaseContext context)

Implements org.jabref.gui.StateManager.getUndoManager.

Creates the journal on first use, which for a library is while its tab is being built.

public ObservableList<SidePaneType>
public ObservableList<String>
public void
public void
removeUndoManager(BibDatabaseContext context)

Implements org.jabref.gui.StateManager.removeUndoManager.

Discards the journal of a library that is closing, with the changes it holds and the entries those changes keep alive.

public void
public StringProperty
public IntegerProperty
public void
public void
public void
public void
public void
public void

Field Detail

activeDatabaseback to summary
private final org.jabref.logic.util.OptionalObjectProperty<BibDatabaseContext> activeDatabase
activeGlobalSearchQueryback to summary
private final org.jabref.logic.util.OptionalObjectProperty<SearchQuery> activeGlobalSearchQuery
activeSearchQueryback to summary
private final org.jabref.logic.util.OptionalObjectProperty<SearchQuery> activeSearchQuery
activeTabback to summary
private final org.jabref.logic.util.OptionalObjectProperty<LibraryTab> activeTab
activeWalkthroughback to summary
private final org.jabref.logic.util.OptionalObjectProperty<Walkthrough> activeWalkthrough
anyTasksThatWillNotBeRecoveredRunningback to summary
private final com.tobiasdiez.easybind.EasyBinding<Boolean> anyTasksThatWillNotBeRecoveredRunning
backgroundTasksback to summary
private final ObservableList<Task<?>> backgroundTasks
backgroundTasksPairsback to summary
private final ObservableList<Pair<org.jabref.logic.util.BackgroundTask<?>, Task<?>>> backgroundTasksPairs
canGoBackback to summary
private final BooleanProperty canGoBack
canGoForwardback to summary
private final BooleanProperty canGoForward
dialogWindowStatesback to summary
private final ObservableMap<String, DialogWindowState> dialogWindowStates
editorShowingback to summary
private final BooleanProperty editorShowing
focusOwnerback to summary
private final org.jabref.logic.util.OptionalObjectProperty<Node> focusOwner
globalSearchResultSizeback to summary
private final IntegerProperty globalSearchResultSize
groupAiChatWindowsback to summary
private final Map<String, Map<String, AiGroupChatWindow>> groupAiChatWindows

Keyed by BibDatabaseContext#getUid() instead of BibDatabaseContext, because BibDatabaseContext#equals(Object) (and the matching BibDatabaseContext#hashCode()) change with the library content and cannot be used as HashMap keys.

localDragboardback to summary
private final CustomLocalDragboard localDragboard
LOGGERback to summary
private static final Logger LOGGER
openDatabasesback to summary
private final ObservableList<BibDatabaseContext> openDatabases
runningBackgroundTasksback to summary
private final FilteredList<Task<?>> runningBackgroundTasks
searchHistoryback to summary
private final ObservableList<String> searchHistory
searchQueryPropertyback to summary
private final StringProperty searchQueryProperty
searchResultSizeback to summary
private final IntegerProperty searchResultSize
selectedEntriesback to summary
private final ObservableList<BibEntry> selectedEntries
selectedGroupsback to summary
private final ObservableMap<String, ObservableList<GroupTreeNode>> selectedGroups
undoManagersback to summary
private final Map<String, JabRefGuiUndoManager> undoManagers

Keyed by BibDatabaseContext#getUid, as selectedGroups is: a context's hashCode changes whenever an entry is added, so a map keyed by the context itself loses its entries. Concurrent because changes are recorded from background tasks as well as from the JavaFX thread.

visibleSidePanesback to summary
private final ObservableList<SidePaneType> visibleSidePanes

Constructor Detail

JabRefGuiStateManagerback to summary
public JabRefGuiStateManager()

Method Detail

activeDatabasePropertyback to summary
public org.jabref.logic.util.OptionalObjectProperty<BibDatabaseContext> activeDatabaseProperty()
Annotations
@Override
activeSearchQueryback to summary
public org.jabref.logic.util.OptionalObjectProperty<SearchQuery> activeSearchQuery(SearchType type)

Implements org.jabref.gui.StateManager.activeSearchQuery.

Annotations
@Override
activeTabPropertyback to summary
public org.jabref.logic.util.OptionalObjectProperty<LibraryTab> activeTabProperty()

Implements org.jabref.gui.StateManager.activeTabProperty.

Annotations
@Override
addBackgroundTaskback to summary
public void addBackgroundTask(org.jabref.logic.util.BackgroundTask<?> backgroundTask, Task<?> task)

Implements org.jabref.gui.StateManager.addBackgroundTask.

Annotations
@Override
addSearchHistoryback to summary
public void addSearchHistory(String search)

Implements org.jabref.gui.StateManager.addSearchHistory.

Annotations
@Override
canGoBackPropertyback to summary
public BooleanProperty canGoBackProperty()

Implements org.jabref.gui.StateManager.canGoBackProperty.

Annotations
@Override
canGoForwardPropertyback to summary
public BooleanProperty canGoForwardProperty()

Implements org.jabref.gui.StateManager.canGoForwardProperty.

Annotations
@Override
clearSearchHistoryback to summary
public void clearSearchHistory()

Implements org.jabref.gui.StateManager.clearSearchHistory.

Annotations
@Override
clearSelectedGroupsback to summary
public void clearSelectedGroups(BibDatabaseContext context)

Implements org.jabref.gui.StateManager.clearSelectedGroups.

Annotations
@Override
focusOwnerPropertyback to summary
public org.jabref.logic.util.OptionalObjectProperty<Node> focusOwnerProperty()

Implements org.jabref.gui.StateManager.focusOwnerProperty.

Annotations
@Override
getActiveDatabaseback to summary
public Optional<BibDatabaseContext> getActiveDatabase()
Annotations
@Override
getActiveSelectionTabPropertyback to summary
public ObjectBinding<Optional<CommandSelectionTab>> getActiveSelectionTabProperty()
Annotations
@Override
getActiveWalkthroughback to summary
public Optional<Walkthrough> getActiveWalkthrough()

Implements org.jabref.gui.StateManager.getActiveWalkthrough.

Annotations
@Override
getAiChatWindowForGroupback to summary
public Optional<AiGroupChatWindow> getAiChatWindowForGroup(BibDatabaseContext context, String groupName)

Implements org.jabref.gui.StateManager.getAiChatWindowForGroup.

Annotations
@Override
getAllDatabasePathsback to summary
public List<String> getAllDatabasePaths()
Annotations
@Override
getAnyTasksThatWillNotBeRecoveredRunningback to summary
public com.tobiasdiez.easybind.EasyBinding<Boolean> getAnyTasksThatWillNotBeRecoveredRunning()

Implements org.jabref.gui.StateManager.getAnyTasksThatWillNotBeRecoveredRunning.

Annotations
@Override
getBackgroundTasksback to summary
public ObservableList<Task<?>> getBackgroundTasks()

Implements org.jabref.gui.StateManager.getBackgroundTasks.

Annotations
@Override
getDialogWindowStateback to summary
public DialogWindowState getDialogWindowState(String className)

Implements org.jabref.gui.StateManager.getDialogWindowState.

Annotations
@Override
getEditorShowingback to summary
public BooleanProperty getEditorShowing()

Implements org.jabref.gui.StateManager.getEditorShowing.

Annotations
@Override
getFocusOwnerback to summary
public Optional<Node> getFocusOwner()

Implements org.jabref.gui.StateManager.getFocusOwner.

Annotations
@Override
getLastSearchHistoryback to summary
public List<String> getLastSearchHistory(int size)

Implements org.jabref.gui.StateManager.getLastSearchHistory.

Annotations
@Override
getLocalDragboardback to summary
public CustomLocalDragboard getLocalDragboard()

Implements org.jabref.gui.StateManager.getLocalDragboard.

Annotations
@Override
getOpenDatabasesback to summary
public ObservableList<BibDatabaseContext> getOpenDatabases()
Annotations
@Override
getRunningBackgroundTasksback to summary
public ObservableList<Task<?>> getRunningBackgroundTasks()

Implements org.jabref.gui.StateManager.getRunningBackgroundTasks.

Annotations
@Override
getSelectedEntriesback to summary
public ObservableList<BibEntry> getSelectedEntries()

The live selection, not a snapshot of it.

setSelectedEntries replaces the contents of this very list, which happens every time the user selects different entries or switches to another library.

Copy it before handing it to anything that reads it later, such as a background task. A task holding this list sees the selection as it is when it looks, not as it was when the task started.

Annotations
@Override
getSelectedGroupsback to summary
public ObservableList<GroupTreeNode> getSelectedGroups(BibDatabaseContext context)

Implements org.jabref.gui.StateManager.getSelectedGroups.

Annotations
@Override
getUndoManagerback to summary
public GuiUndoManager getUndoManager(BibDatabaseContext context)

Implements org.jabref.gui.StateManager.getUndoManager.

Creates the journal on first use, which for a library is while its tab is being built. A caller that names a library after it closed therefore gets a fresh journal rather than the one that was discarded; org.jabref.gui.LibraryTab#getUndoManager answers with the journal the library had instead, so that path cannot put a new one back into this map.

Annotations
@Override
getVisibleSidePaneComponentsback to summary
public ObservableList<SidePaneType> getVisibleSidePaneComponents()

Implements org.jabref.gui.StateManager.getVisibleSidePaneComponents.

Annotations
@Override
getWholeSearchHistoryback to summary
public ObservableList<String> getWholeSearchHistory()

Implements org.jabref.gui.StateManager.getWholeSearchHistory.

Annotations
@Override
removeAiChatWindowForGroupback to summary
public void removeAiChatWindowForGroup(BibDatabaseContext context, String groupName)

Implements org.jabref.gui.StateManager.removeAiChatWindowForGroup.

Annotations
@Override
removeUndoManagerback to summary
public void removeUndoManager(BibDatabaseContext context)

Implements org.jabref.gui.StateManager.removeUndoManager.

Doc from org.jabref.gui.StateManager.removeUndoManager.

Discards the journal of a library that is closing, with the changes it holds and the entries those changes keep alive.

Annotations
@Override
replaceActiveDatabaseback to summary
public void replaceActiveDatabase(@NonNull BibDatabaseContext database)
Annotations
@Override
searchQueryPropertyback to summary
public StringProperty searchQueryProperty()

Implements org.jabref.gui.StateManager.searchQueryProperty.

Annotations
@Override
searchResultSizeback to summary
public IntegerProperty searchResultSize(SearchType type)

Implements org.jabref.gui.StateManager.searchResultSize.

Annotations
@Override
setActiveDatabaseback to summary
public void setActiveDatabase(@Nullable BibDatabaseContext database)

Implements org.jabref.gui.StateManager.setActiveDatabase.

Annotations
@Override
setActiveWalkthroughback to summary
public void setActiveWalkthrough(Walkthrough walkthrough)

Implements org.jabref.gui.StateManager.setActiveWalkthrough.

Annotations
@Override
setAiChatWindowForGroupback to summary
public void setAiChatWindowForGroup(BibDatabaseContext context, String groupName, AiGroupChatWindow aiGroupChatWindow)

Implements org.jabref.gui.StateManager.setAiChatWindowForGroup.

Annotations
@Override
setDialogWindowStateback to summary
public void setDialogWindowState(String className, DialogWindowState state)

Implements org.jabref.gui.StateManager.setDialogWindowState.

Annotations
@Override
setSelectedEntriesback to summary
public void setSelectedEntries(List<BibEntry> newSelectedEntries)

Implements org.jabref.gui.StateManager.setSelectedEntries.

Annotations
@Override
setSelectedGroupsback to summary
public void setSelectedGroups(BibDatabaseContext context, List<GroupTreeNode> newSelectedGroups)

Implements org.jabref.gui.StateManager.setSelectedGroups.

Annotations
@Override
@NullMarked