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

public Class AllFieldsTab

extends FieldsEditorTab
Class Inheritance
Annotations
@NullMarked
Imports
java.util.Comparator, .EnumMap, .HashMap, .HashSet, .LinkedHashMap, .LinkedHashSet, .List, .Locale, .Map, .Optional, .SequencedCollection, .SequencedSet, .Set, java.util.regex.Pattern, javafx.application.Platform, javafx.beans.binding.Bindings, javafx.beans.value.ObservableValue, javafx.geometry.Insets, .Pos, .VPos, javafx.scene.Node, .Parent, javafx.scene.control.Button, .ComboBox, .Hyperlink, .Label, .TextField, .TitledPane, .Tooltip, javafx.scene.layout.ColumnConstraints, .FlowPane, .GridPane, .HBox, .Pane, .Priority, .Region, .StackPane, .VBox, org.jabref.gui.StateManager, org.jabref.gui.externalfiles.AutoSetFileLinksUtil, org.jabref.gui.fieldeditors.EditorTextArea, .FieldEditorFX, .LinkedFilesEditor, .TagsEditor, org.jabref.gui.icon.IconTheme, org.jabref.gui.preferences.GuiPreferences, org.jabref.gui.preview.PreviewPanel, org.jabref.gui.theme.StyleClasses, org.jabref.gui.undo.RedoAction, .UndoAction, org.jabref.gui.util.FieldsUtil, .NodeTraversalUtils, org.jabref.gui.walkthrough.declarative.WalkthroughNodeIds, org.jabref.logic.journals.JournalAbbreviationRepository, org.jabref.logic.l10n.Localization, org.jabref.logic.util.BackgroundTask, .TaskExecutor, org.jabref.logic.util.strings.StringUtil, org.jabref.model.database.BibDatabaseContext, .BibDatabaseMode, org.jabref.model.entry.BibEntry, .BibEntryTypesManager, org.jabref.model.entry.event.FieldChangedEvent, org.jabref.model.entry.field.Field, .FieldFactory, .InternalField, .OrFields, .StandardField, .UserSpecificCommentField, org.jabref.model.undo.UndoableFieldChange, com.airhacks.afterburner.injection.Injector, com.google.common.eventbus.Subscribe, org.jspecify.annotations.NullMarked, .Nullable, org.slf4j.Logger, .LoggerFactory

The single scroll-list tab ("Main") showing all fields of an entry (issue #12711): the citation key, all required fields (even when unset), and every set field. Multiline editors grow with their text, capped at a few rows until focused. Replaces the classic category tabs (required / optional / other / …) and the former "Abstract" tab.

Below the main fields sits a chip bar for adding unset optional fields ("Show more" reveals the secondary-optional ones). The identifiers, files & links, bibliometrics, comments, and meta groups are always-present collapsible sections — collapsed when empty — each with its own add-chips for its unset member fields. A free-form field-name box at the bottom adds arbitrary fields.

Field Summary

Modifier and TypeField and Description
private static final int
COLLAPSED_MULTILINE_ROWS

Rows a multiline editor shows before it is focused for the first time (a long abstract must not push the other fields out of view just by being selected).

private static final List<Field>
COMMON_CHIP_FIELDS

Chips offered after the entry type's important optional fields, for every entry type.

private @Nullable BibEntry
private final BibEntryTypesManager
private final Set<Field>
expandedFields

Multiline fields the user has focused (and thereby expanded) while editing the current entry; editors are rebuilt for the same entry, so the expansion must outlive them.

private Set<Field>
extractedCustomTabFields

Fields extracted by the configured custom tabs ("Extract field" checked in the preferences); the Main tab shows no editor and no add-chip for these.

private final GuiPreferences
private static final double
HEIGHT_PER_WEIGHT

Pixels of preferred height granted per weight unit for editors with weight > 1 (e.g. the linked-files list), since percent-height rows do not exist in the scroll list.

private final VBox
listContainer

Scroll content: main grid + chip bar + section panes + free-form add row.

private static final Logger
private static final Pattern
NON_ALPHANUMERIC

Characters not allowed in the user-specific comment field name.

private final Set<Field>
requiredFields

Required fields of the current entry's type, refreshed on every determineFieldsToShow; used to keep the remove-field button (see wrapWithRemoveButton) off required rows.

private final Map<FieldListSections.SectionType, Boolean>
sectionExpandOverrides

Manual expand/collapse decisions per section, kept across rebuilds for the current entry (cleared on entry switch).

private final Map<FieldListSections.SectionType, TitledPane>
sectionPanes

Tracks the TitledPane created for each section type, so we can expand a collapsed section on demand (e.g. when jump-to-field targets a field inside it).

private boolean
showSecondaryOptionalChips

Sticky per tab instance: whether the secondary-optional chips are expanded.

private Optional<BibEntry>
subscribedEntry

The entry whose event bus this tab is currently subscribed to (for live refresh when fields are set/unset from outside, e.g. Source tab, fetchers, undo).

private final Map<Field, Double>
textAreaWidths

Last laid-out width of each field's growing text area (see normalizeInputHeights).

private final Set<Field>
userAddedFields

Fields the user added via chip / free-form box that are still empty: they are not part of BibEntry#getFields() yet, but must stay visible while this entry is edited.

private final UserSpecificCommentField
userSpecificCommentField

The current user's personal comment field (derived from the default-owner preference).

Inherited from org.jabref.gui.entryeditor.FieldsEditorTab:
editorsgridPane

Constructor Summary

AccessConstructor and Description
public
AllFieldsTab(UndoAction undoAction, RedoAction redoAction, GuiPreferences preferences, BibEntryTypesManager entryTypesManager, JournalAbbreviationRepository journalAbbreviationRepository, StateManager stateManager, PreviewPanel previewPanel)

Method Summary

Modifier and TypeMethod and Description
private BibDatabaseContext
public void
private void
addFieldRows(GridPane grid, SequencedCollection<Field> fields, Map<Field, Label> labelForField, BibDatabaseContext bibDatabaseContext, BibEntry entry)

Label/editor rows with natural heights, label column as narrow as its content.

private void
addFreeFormField(BibDatabaseContext bibDatabaseContext, BibEntry entry, @Nullable String fieldName)

private void
protected void
private Button
createAddChip(BibDatabaseContext bibDatabaseContext, BibEntry entry, Field field)

private Node
private Node
createMainChipBar(BibDatabaseContext bibDatabaseContext, BibEntry entry)

Chips for the entry type's unset optional fields that belong to the main section (identifier/file/comment fields get their chips inside their own section), followed by the COMMON_CHIP_FIELDS; "Show more" reveals the secondary-optional ones.

private TitledPane
createSectionPane(FieldListSections.SectionType type, SequencedSet<Field> shownFields, Map<Field, Label> labelForField, BibDatabaseContext bibDatabaseContext, BibEntry entry)

An always-present collapsible section: its shown fields as rows plus add-chips for its unset member fields.

protected SequencedSet<Field>
determineFieldsToShow(BibEntry entry)

Implements abstract org.jabref.gui.entryeditor.FieldsEditorTab.determineFieldsToShow.

Order: citation key, required fields (entry-type order), set optional fields (important first, then detail; each in entry-type order), then all remaining set fields sorted by name, then still-empty user-added fields.

protected void
dispose()

Overrides org.jabref.gui.entryeditor.EntryEditorTab.dispose.

Releases listeners owned by this tab before it is discarded.

pack-priv BibDatabaseMode
protected Node
getEditorContent()

Overrides org.jabref.gui.entryeditor.FieldsEditorTab.getEditorContent.

The node placed inside the tab's ScrollPane.

private boolean
isFilesAndLinksSectionOpen(SequencedSet<Field> shownFields)

An open files-and-links section always shows the file editor: its own buttons (add / search / download) are what a "+ File" chip could only reach by popping up a file dialog.

protected void
layoutEditors(BibDatabaseContext bibDatabaseContext, BibEntry entry, boolean compressed, List<Label> labels)

Overrides org.jabref.gui.entryeditor.FieldsEditorTab.layoutEditors.

Main fields as a grid with natural row heights, then the optional-field chip bar, then the always-present collapsible sections (identifiers / files & links / bibliometrics / comments / meta, collapsed when empty) each with its own add-chips, then the free-form add row.

public void
listen(FieldChangedEvent event)

Refreshes the list when a field is set or unset from outside this tab (Source tab, fetchers, undo, …).

private void
normalizeInputHeights(Field field, Node node)

The classic stretch layout lets text inputs fill their percent-height rows by setting an infinite pref height (org.jabref.gui.fieldeditors.EditorTextField); in the natural-height list that blows up the rows' preferred heights, so reset text fields to their computed size and let text areas grow with their content.

private static Optional<StackPane>
overlayInsideTextInput(Node editorNode, Button button)

Re-parents the editor's primary text input into a StackPane (in the input's own parent, preserving its HBox grow priority) and overlays button on it.

private void
populateSectionContent(VBox content, FieldListSections.SectionType type, SequencedSet<Field> shownFields, Map<Field, Label> labelForField, BibDatabaseContext bibDatabaseContext, BibEntry entry)

private void
rebuildPanel(BibDatabaseContext bibDatabaseContext, BibEntry entry)

private void
private void
removeFieldRow(BibDatabaseContext bibDatabaseContext, BibEntry entry, Field field)

Hides a still-empty, user-added field row again (reachable only for non-required, currently blank fields; see wrapWithRemoveButton).

public void
private SequencedSet<Field>
sectionMemberFields(FieldListSections.SectionType type)

All member fields of a section offered as add-chips; the comments section offers the general comment plus the current user's personal comment field (if enabled).

private void
showFieldEditor(BibDatabaseContext bibDatabaseContext, BibEntry entry, Field field)

Makes an editor for field visible in the list (adding it as still-empty user-added field if necessary) and focuses it.

private void
showFileFieldIfAutoLinkFindsFiles(BibEntry entry)

Only set fields get an editor, so an entry without a file field has no LinkedFilesEditor — whose view model is what searches the file directories and shows not-yet-linked files as auto-found suggestions (issue https://github.com/JabRef/jabref/issues/16737).

protected boolean
stretchContentToTabHeight()

Overrides org.jabref.gui.entryeditor.FieldsEditorTab.stretchContentToTabHeight.

true (default): content fills the tab height, rows share the space (classic category tabs).

private Node
wrapWithRemoveButton(BibDatabaseContext bibDatabaseContext, BibEntry entry, Field field)

Overlays a gray "remove field" icon button on the top-right corner inside the field's text input, shown only while the editor is focused and currently blank (never for the citation key or a required field of the current entry type — those can never be removed this way).

Inherited from org.jabref.gui.entryeditor.FieldsEditorTab:
createLabelAndEditorgetShownFieldshandleFocusremovePreviewPanelFromThisTabsetCompressedRowLayoutsetupPanel

Field Detail

COLLAPSED_MULTILINE_ROWSback to summary
private static final int COLLAPSED_MULTILINE_ROWS

Rows a multiline editor shows before it is focused for the first time (a long abstract must not push the other fields out of view just by being selected).

COMMON_CHIP_FIELDSback to summary
private static final List<Field> COMMON_CHIP_FIELDS

Chips offered after the entry type's important optional fields, for every entry type. The abstract is no optional field of any type, so it would otherwise only be reachable through the free-form field-name box.

entryOfUserAddedFieldsback to summary
private @Nullable BibEntry entryOfUserAddedFields
entryTypesManagerback to summary
private final BibEntryTypesManager entryTypesManager
expandedFieldsback to summary
private final Set<Field> expandedFields

Multiline fields the user has focused (and thereby expanded) while editing the current entry; editors are rebuilt for the same entry, so the expansion must outlive them.

extractedCustomTabFieldsback to summary
private Set<Field> extractedCustomTabFields

Fields extracted by the configured custom tabs ("Extract field" checked in the preferences); the Main tab shows no editor and no add-chip for these. Recomputed in determineFieldsToShow — which every rebuild runs first — and reused by the chip-building paths, so the custom-tab regexes are evaluated once per rebuild instead of once per chip bar.

guiPreferencesback to summary
private final GuiPreferences guiPreferences
HEIGHT_PER_WEIGHTback to summary
private static final double HEIGHT_PER_WEIGHT

Pixels of preferred height granted per weight unit for editors with weight > 1 (e.g. the linked-files list), since percent-height rows do not exist in the scroll list.

listContainerback to summary
private final VBox listContainer

Scroll content: main grid + chip bar + section panes + free-form add row.

LOGGERback to summary
private static final Logger LOGGER

Hides org.jabref.gui.entryeditor.FieldsEditorTab.LOGGER.

NON_ALPHANUMERICback to summary
private static final Pattern NON_ALPHANUMERIC

Characters not allowed in the user-specific comment field name.

requiredFieldsback to summary
private final Set<Field> requiredFields

Required fields of the current entry's type, refreshed on every determineFieldsToShow; used to keep the remove-field button (see wrapWithRemoveButton) off required rows.

sectionExpandOverridesback to summary
private final Map<FieldListSections.SectionType, Boolean> sectionExpandOverrides

Manual expand/collapse decisions per section, kept across rebuilds for the current entry (cleared on entry switch). Without an override, a section is expanded iff it contains at least one shown field.

sectionPanesback to summary
private final Map<FieldListSections.SectionType, TitledPane> sectionPanes

Tracks the TitledPane created for each section type, so we can expand a collapsed section on demand (e.g. when jump-to-field targets a field inside it).

showSecondaryOptionalChipsback to summary
private boolean showSecondaryOptionalChips

Sticky per tab instance: whether the secondary-optional chips are expanded.

subscribedEntryback to summary
private Optional<BibEntry> subscribedEntry

The entry whose event bus this tab is currently subscribed to (for live refresh when fields are set/unset from outside, e.g. Source tab, fetchers, undo).

textAreaWidthsback to summary
private final Map<Field, Double> textAreaWidths

Last laid-out width of each field's growing text area (see normalizeInputHeights).

userAddedFieldsback to summary
private final Set<Field> userAddedFields

Fields the user added via chip / free-form box that are still empty: they are not part of BibEntry#getFields() yet, but must stay visible while this entry is edited.

userSpecificCommentFieldback to summary
private final UserSpecificCommentField userSpecificCommentField

The current user's personal comment field (derived from the default-owner preference).

Constructor Detail

AllFieldsTabback to summary
public AllFieldsTab(UndoAction undoAction, RedoAction redoAction, GuiPreferences preferences, BibEntryTypesManager entryTypesManager, JournalAbbreviationRepository journalAbbreviationRepository, StateManager stateManager, PreviewPanel previewPanel)

Method Detail

activeDatabaseContextback to summary
private BibDatabaseContext activeDatabaseContext()
addFieldAndFocusback to summary
public void addFieldAndFocus(Field field)
addFieldRowsback to summary
private void addFieldRows(GridPane grid, SequencedCollection<Field> fields, Map<Field, Label> labelForField, BibDatabaseContext bibDatabaseContext, BibEntry entry)

Label/editor rows with natural heights, label column as narrow as its content.

addFreeFormFieldback to summary
private void addFreeFormField(BibDatabaseContext bibDatabaseContext, BibEntry entry, @Nullable String fieldName)
applyNaturalHeightback to summary
private void applyNaturalHeight(Field field, FieldEditorFX editor)
bindToEntryback to summary
protected void bindToEntry(BibEntry entry)

Overrides org.jabref.gui.entryeditor.FieldsEditorTab.bindToEntry.

Annotations
@Override
createAddChipback to summary
private Button createAddChip(BibDatabaseContext bibDatabaseContext, BibEntry entry, Field field)
createFreeFormAddRowback to summary
private Node createFreeFormAddRow(BibDatabaseContext bibDatabaseContext, BibEntry entry)
createMainChipBarback to summary
private Node createMainChipBar(BibDatabaseContext bibDatabaseContext, BibEntry entry)

Chips for the entry type's unset optional fields that belong to the main section (identifier/file/comment fields get their chips inside their own section), followed by the COMMON_CHIP_FIELDS; "Show more" reveals the secondary-optional ones.

createSectionPaneback to summary
private TitledPane createSectionPane(FieldListSections.SectionType type, SequencedSet<Field> shownFields, Map<Field, Label> labelForField, BibDatabaseContext bibDatabaseContext, BibEntry entry)

An always-present collapsible section: its shown fields as rows plus add-chips for its unset member fields. Collapsed by default when it contains no field; a manual expand/collapse survives rebuilds until another entry is opened.

determineFieldsToShowback to summary
protected SequencedSet<Field> determineFieldsToShow(BibEntry entry)

Implements abstract org.jabref.gui.entryeditor.FieldsEditorTab.determineFieldsToShow.

Order: citation key, required fields (entry-type order), set optional fields (important first, then detail; each in entry-type order), then all remaining set fields sorted by name, then still-empty user-added fields.

Annotations
@Override
disposeback to summary
protected void dispose()

Overrides org.jabref.gui.entryeditor.EntryEditorTab.dispose.

Doc from org.jabref.gui.entryeditor.EntryEditorTab.dispose.

Releases listeners owned by this tab before it is discarded.

Annotations
@Override
getDatabaseModeback to summary
pack-priv BibDatabaseMode getDatabaseMode()
getEditorContentback to summary
protected Node getEditorContent()

Overrides org.jabref.gui.entryeditor.FieldsEditorTab.getEditorContent.

Doc from org.jabref.gui.entryeditor.FieldsEditorTab.getEditorContent.

The node placed inside the tab's ScrollPane. By default the field grid itself; subclasses may wrap gridPane in a larger structure (e.g. with collapsible sections) and return that instead. Called once from initPanel().

Annotations
@Override
isFilesAndLinksSectionOpenback to summary
private boolean isFilesAndLinksSectionOpen(SequencedSet<Field> shownFields)

An open files-and-links section always shows the file editor: its own buttons (add / search / download) are what a "+ File" chip could only reach by popping up a file dialog. Decided from the fields the section would show anyway — required ones included, so an entry type requiring url (BibLaTeX Online) counts even while that field is unset — which is the same set createSectionPane derives its expanded state from, so the two cannot disagree.

layoutEditorsback to summary
protected void layoutEditors(BibDatabaseContext bibDatabaseContext, BibEntry entry, boolean compressed, List<Label> labels)

Overrides org.jabref.gui.entryeditor.FieldsEditorTab.layoutEditors.

Main fields as a grid with natural row heights, then the optional-field chip bar, then the always-present collapsible sections (identifiers / files & links / bibliometrics / comments / meta, collapsed when empty) each with its own add-chips, then the free-form add row. The whole column scrolls instead of stretching to the tab height.

Annotations
@Override
listenback to summary
public void listen(FieldChangedEvent event)

Refreshes the list when a field is set or unset from outside this tab (Source tab, fetchers, undo, …). Rebuilds only when the set of shown fields actually changes, so typing inside a visible editor never rebuilds or steals focus.

Annotations
@Subscribe
normalizeInputHeightsback to summary
private void normalizeInputHeights(Field field, Node node)

The classic stretch layout lets text inputs fill their percent-height rows by setting an infinite pref height (org.jabref.gui.fieldeditors.EditorTextField); in the natural-height list that blows up the rows' preferred heights, so reset text fields to their computed size and let text areas grow with their content.

overlayInsideTextInputback to summary
private static Optional<StackPane> overlayInsideTextInput(Node editorNode, Button button)

Re-parents the editor's primary text input into a StackPane (in the input's own parent, preserving its HBox grow priority) and overlays button on it. Returns the new overlay pane, or empty if the editor exposes no plain text input to overlay onto.

populateSectionContentback to summary
private void populateSectionContent(VBox content, FieldListSections.SectionType type, SequencedSet<Field> shownFields, Map<Field, Label> labelForField, BibDatabaseContext bibDatabaseContext, BibEntry entry)
rebuildPanelback to summary
private void rebuildPanel(BibDatabaseContext bibDatabaseContext, BibEntry entry)
refreshShownFieldsIfNeededback to summary
private void refreshShownFieldsIfNeeded(FieldChangedEvent event)
removeFieldRowback to summary
private void removeFieldRow(BibDatabaseContext bibDatabaseContext, BibEntry entry, Field field)

Hides a still-empty, user-added field row again (reachable only for non-required, currently blank fields; see wrapWithRemoveButton).

requestFocusback to summary
public void requestFocus(Field fieldName)

Overrides org.jabref.gui.entryeditor.FieldsEditorTab.requestFocus.

Annotations
@Override
sectionMemberFieldsback to summary
private SequencedSet<Field> sectionMemberFields(FieldListSections.SectionType type)

All member fields of a section offered as add-chips; the comments section offers the general comment plus the current user's personal comment field (if enabled).

showFieldEditorback to summary
private void showFieldEditor(BibDatabaseContext bibDatabaseContext, BibEntry entry, Field field)

Makes an editor for field visible in the list (adding it as still-empty user-added field if necessary) and focuses it.

showFileFieldIfAutoLinkFindsFilesback to summary
private void showFileFieldIfAutoLinkFindsFiles(BibEntry entry)

Only set fields get an editor, so an entry without a file field has no LinkedFilesEditor — whose view model is what searches the file directories and shows not-yet-linked files as auto-found suggestions (issue https://github.com/JabRef/jabref/issues/16737). Probe for such files here and, on a hit, show the (empty) file editor; its own bind then re-runs the search and renders the suggestion rows. An existing editor already scans on its own, so the guard below is what keeps the two searches from running side by side.

stretchContentToTabHeightback to summary
protected boolean stretchContentToTabHeight()

Overrides org.jabref.gui.entryeditor.FieldsEditorTab.stretchContentToTabHeight.

Doc from org.jabref.gui.entryeditor.FieldsEditorTab.stretchContentToTabHeight.

true (default): content fills the tab height, rows share the space (classic category tabs). false: content keeps its natural height and the tab scrolls vertically (single-list tab).

Annotations
@Override
wrapWithRemoveButtonback to summary
private Node wrapWithRemoveButton(BibDatabaseContext bibDatabaseContext, BibEntry entry, Field field)

Overlays a gray "remove field" icon button on the top-right corner inside the field's text input, shown only while the editor is focused and currently blank (never for the citation key or a required field of the current entry type — those can never be removed this way). Overlaying inside the input keeps it left of any trailing option buttons the editor draws itself (identifier/URL fetch icons, ICORE lookup, …), so it never collides.