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

public Class NavigationHistory

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List, .Objects, .Optional, org.jabref.model.entry.BibEntry

Manages the navigation history of viewed entries using two stacks. This class encapsulates the logic of moving back and forward by maintaining a "back" stack for past entries and a "forward" stack for future entries.

Field Summary

Modifier and TypeField and Description
private BibEntry
private final List<BibEntry>
private final List<BibEntry>

Constructor Summary

AccessConstructor and Description

Method Summary

Modifier and TypeMethod and Description
public void
add(BibEntry
The BibEntry to add to the history.
entry
)

Sets a new entry as the current one, clearing the forward history.

public Optional<BibEntry>

Returns:

An Optional containing the previous BibEntry, or an empty Optional if there's no history to go back to.
back
()

Moves to the previous entry in the history.

public boolean
public boolean
public Optional<BibEntry>

Returns:

An Optional containing the next BibEntry, or an empty Optional if there is no "forward" history.
forward
()

Moves to the next entry in the history.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentEntryback to summary
private BibEntry currentEntry
nextEntriesback to summary
private final List<BibEntry> nextEntries
previousEntriesback to summary
private final List<BibEntry> previousEntries

Constructor Detail

Method Detail

addback to summary
public void add(BibEntry entry)

Sets a new entry as the current one, clearing the forward history. The previously current entry is moved to the back stack.

Parameters
entry:BibEntry

The BibEntry to add to the history.

backback to summary
public Optional<BibEntry> back()

Moves to the previous entry in the history. The current entry is pushed to the forward stack, and the last entry from the back stack becomes current.

Returns:Optional<BibEntry>

An Optional containing the previous BibEntry, or an empty Optional if there's no history to go back to.

canGoBackback to summary
public boolean canGoBack()
canGoForwardback to summary
public boolean canGoForward()
forwardback to summary
public Optional<BibEntry> forward()

Moves to the next entry in the history. The current entry is pushed to the back stack, and the last entry from the forward stack becomes current.

Returns:Optional<BibEntry>

An Optional containing the next BibEntry, or an empty Optional if there is no "forward" history.