From e439471a44226e6ec3a603946486e340e5db16d8 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Tue, 27 Oct 2026 00:32:37 +0530 Subject: [PATCH 01/13] Menu not visible on small screens --- .../org/jabref/gui/frame/JabRefFrame.java | 21 +++++++++++++++---- .../jabref/gui/theme/internal/jabref-base.css | 8 +++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java index 818dbd2022c5..7ad4dd48fa7b 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java @@ -19,6 +19,7 @@ import javafx.geometry.Orientation; import javafx.scene.Node; import javafx.scene.control.ContextMenu; +import javafx.scene.control.ScrollPane; import javafx.scene.control.SeparatorMenuItem; import javafx.scene.control.SplitPane; import javafx.scene.control.Tab; @@ -26,6 +27,7 @@ import javafx.scene.control.TextInputControl; import javafx.scene.input.KeyEvent; import javafx.scene.layout.BorderPane; +import javafx.scene.layout.Region; import javafx.scene.layout.VBox; import javafx.stage.Stage; @@ -115,6 +117,7 @@ private enum PanelMode { MAIN_TABLE, MAIN_TABLE_AND_ENTRY_EDITOR } private final GuiPushToApplicationCommand pushToApplicationCommand; private final SplitPane horizontalSplit = new SplitPane(); private final SidePane sidePane; + private final ScrollPane sidePaneScroll = new ScrollPane(); private final SplitPane verticalSplit = new SplitPane(); private final TabPane tabbedPane = new TabPane(); private final EntryEditor entryEditor; @@ -271,7 +274,17 @@ private void initLayout() { horizontalSplit.getItems().addAll(verticalSplit); horizontalSplit.setOrientation(Orientation.HORIZONTAL); - SplitPane.setResizableWithParent(sidePane, false); + sidePane.setMinHeight(Region.USE_PREF_SIZE); + + sidePaneScroll.setContent(sidePane); + sidePaneScroll.setFitToWidth(true); + sidePaneScroll.setFitToHeight(true); + sidePaneScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); + sidePaneScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); + sidePaneScroll.getStyleClass().add("side-pane-scroll"); + sidePaneScroll.setMinWidth(250); + + SplitPane.setResizableWithParent(sidePaneScroll, false); sidePane.widthProperty().addListener(_ -> updateSidePane()); sidePane.getChildren().addListener((InvalidationListener) _ -> updateSidePane()); updateSidePane(); @@ -281,11 +294,11 @@ private void initLayout() { private void updateSidePane() { if (sidePane.getChildren().isEmpty()) { unsubscribeHorizontalDivider(); - horizontalSplit.getItems().remove(sidePane); + horizontalSplit.getItems().remove(sidePaneScroll); } else { - if (!horizontalSplit.getItems().contains(sidePane)) { + if (!horizontalSplit.getItems().contains(sidePaneScroll)) { horizontalSplit.setVisible(false); - horizontalSplit.getItems().addFirst(sidePane); + horizontalSplit.getItems().addFirst(sidePaneScroll); Platform.runLater(() -> { updateHorizontalDividerPosition(); horizontalSplit.setVisible(true); diff --git a/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css b/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css index fc52b7ec87ba..8ae7d6a23338 100644 --- a/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css +++ b/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css @@ -1784,3 +1784,11 @@ We want to have a look that matches our icons in the tool-bar */ .flashing-danger { -fx-background-color: -color-danger; } +.side-pane-scroll { + -fx-background-color: transparent; + -fx-padding: 0; +} + +.side-pane-scroll > .viewport { + -fx-background-color: transparent; +} From 79f8b17ae2fefb6dd17aa9169603d8d58ab44cd8 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Tue, 27 Oct 2026 01:24:43 +0530 Subject: [PATCH 02/13] Document side-pane scrolling fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24f7f1496d87..638ccc072bcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We changed saving custom entry types to ask for a restart, so the entry editor shows the changes. [#17121](https://github.com/JabRef/jabref/pull/17121) ### Fixed - +- Make the side panels scrollable when the application window has limited vertical space. [#17470](https://github.com/JabRef/jabref/issues/17470) - We fixed exports to RIS, CSV, HTML, and other template-based formats in native JabKit. [#17408](https://github.com/JabRef/jabref/issues/17408) - We fixed an issue where JabRef showed an "Executor has been shut down" error on Windows after resuming from suspend. [#17144](https://github.com/JabRef/jabref/pull/17144) - We fixed the BibTeX source dialog background in the Citation Relations tab for dark themes. [#13599](https://github.com/JabRef/jabref/issues/13599) From ae5571d6caededdeb1bdc9a0c2f7f73a8cc89d89 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Tue, 27 Oct 2026 01:42:35 +0530 Subject: [PATCH 03/13] Document side-pane scrolling fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 638ccc072bcf..5bc172d7f2c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We changed saving custom entry types to ask for a restart, so the entry editor shows the changes. [#17121](https://github.com/JabRef/jabref/pull/17121) ### Fixed + - Make the side panels scrollable when the application window has limited vertical space. [#17470](https://github.com/JabRef/jabref/issues/17470) - We fixed exports to RIS, CSV, HTML, and other template-based formats in native JabKit. [#17408](https://github.com/JabRef/jabref/issues/17408) - We fixed an issue where JabRef showed an "Executor has been shut down" error on Windows after resuming from suspend. [#17144](https://github.com/JabRef/jabref/pull/17144) From c9f305e0005606b5eb75e070d3fafa4f0186e105 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Tue, 27 Oct 2026 23:29:55 +0530 Subject: [PATCH 04/13] Document side-pane scrolling fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bc172d7f2c0..6525f8b8f481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,7 +37,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv ### Fixed -- Make the side panels scrollable when the application window has limited vertical space. [#17470](https://github.com/JabRef/jabref/issues/17470) +- - We fixed an issue where the side panels were not reachable in small windows. [#17470](https://github.com/JabRef/jabref/issues/17470) - We fixed exports to RIS, CSV, HTML, and other template-based formats in native JabKit. [#17408](https://github.com/JabRef/jabref/issues/17408) - We fixed an issue where JabRef showed an "Executor has been shut down" error on Windows after resuming from suspend. [#17144](https://github.com/JabRef/jabref/pull/17144) - We fixed the BibTeX source dialog background in the Citation Relations tab for dark themes. [#13599](https://github.com/JabRef/jabref/issues/13599) From 546a17ffb42e5b05fe48344732169ae8ab6a5c94 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Tue, 27 Oct 2026 23:41:52 +0530 Subject: [PATCH 05/13] Remove forced min width of side pane --- jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java | 1 - 1 file changed, 1 deletion(-) diff --git a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java index 7ad4dd48fa7b..2cd3c579fcce 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java @@ -282,7 +282,6 @@ private void initLayout() { sidePaneScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); sidePaneScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); sidePaneScroll.getStyleClass().add("side-pane-scroll"); - sidePaneScroll.setMinWidth(250); SplitPane.setResizableWithParent(sidePaneScroll, false); sidePane.widthProperty().addListener(_ -> updateSidePane()); From 733dda8fd40ea94a127cc490da08cf7448f6e437 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Wed, 28 Oct 2026 00:02:14 +0530 Subject: [PATCH 06/13] Fix changelog list formatting --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc8ee0e90355..e413c4a488d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,7 +38,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv ### Fixed -- - We fixed an issue where the side panels were not reachable in small windows. [#17470](https://github.com/JabRef/jabref/issues/17470) +- We fixed an issue where the side panels were not reachable in small windows. [#17470](https://github.com/JabRef/jabref/issues/17470) - We fixed exports to RIS, CSV, HTML, and other template-based formats in native JabKit. [#17408](https://github.com/JabRef/jabref/issues/17408) - We fixed an issue where JabRef showed an "Executor has been shut down" error on Windows after resuming from suspend. [#17144](https://github.com/JabRef/jabref/pull/17144) - We fixed the BibTeX source dialog background in the Citation Relations tab for dark themes. [#13599](https://github.com/JabRef/jabref/issues/13599) From e3963969711c7128eb13c213e567aab9fa91dd5c Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Fri, 30 Oct 2026 00:19:10 +0530 Subject: [PATCH 07/13] Allow horizontal scrolling in side pane when needed --- jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java index 2cd3c579fcce..dabe195183ff 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java @@ -279,7 +279,7 @@ private void initLayout() { sidePaneScroll.setContent(sidePane); sidePaneScroll.setFitToWidth(true); sidePaneScroll.setFitToHeight(true); - sidePaneScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); + sidePaneScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); sidePaneScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); sidePaneScroll.getStyleClass().add("side-pane-scroll"); From eacd8f43e9c8dc360486ebd0c4a8f3d85863b1ac Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Sat, 31 Oct 2026 15:17:10 +0530 Subject: [PATCH 08/13] Scroll side pane to top when a panel is added --- .../src/main/java/org/jabref/gui/frame/JabRefFrame.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java index dabe195183ff..56ca7ef649d8 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java @@ -286,6 +286,14 @@ private void initLayout() { SplitPane.setResizableWithParent(sidePaneScroll, false); sidePane.widthProperty().addListener(_ -> updateSidePane()); sidePane.getChildren().addListener((InvalidationListener) _ -> updateSidePane()); + sidePane.getChildren().addListener((ListChangeListener) change -> { + while (change.next()) { + if (change.wasAdded()) { + Platform.runLater(() -> sidePaneScroll.setVvalue(0)); + return; + } + } + }); updateSidePane(); setCenter(horizontalSplit); } From 2ca876b6dcd49ad0aae64dca9e42309669f4b0b4 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Sun, 1 Nov 2026 16:23:40 +0530 Subject: [PATCH 09/13] Remove side pane scroll reset --- .../src/main/java/org/jabref/gui/frame/JabRefFrame.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java index 64e9e5f7a82a..79ed8a1404b5 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java @@ -5,7 +5,6 @@ import java.util.List; import java.util.Optional; import java.util.function.Supplier; - import javafx.application.Platform; import javafx.beans.InvalidationListener; import javafx.beans.binding.Bindings; @@ -290,14 +289,6 @@ private void initLayout() { SplitPane.setResizableWithParent(sidePaneScroll, false); sidePane.widthProperty().addListener(_ -> updateSidePane()); sidePane.getChildren().addListener((InvalidationListener) _ -> updateSidePane()); - sidePane.getChildren().addListener((ListChangeListener) change -> { - while (change.next()) { - if (change.wasAdded()) { - Platform.runLater(() -> sidePaneScroll.setVvalue(0)); - return; - } - } - }); updateSidePane(); setCenter(horizontalSplit); } From db7279ffb2d1fd0887d2803837cf8c0fe9b452b6 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Mon, 2 Nov 2026 22:54:50 +0530 Subject: [PATCH 10/13] Fixed the format --- .../org/jabref/gui/frame/JabRefFrame.java | 308 ++++-------------- jablib/src/main/resources/csl-styles | 2 +- 2 files changed, 58 insertions(+), 252 deletions(-) diff --git a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java index 79ed8a1404b5..cfab896ed7a7 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Optional; import java.util.function.Supplier; + import javafx.application.Platform; import javafx.beans.InvalidationListener; import javafx.beans.binding.Bindings; @@ -130,18 +131,7 @@ private enum PanelMode { MAIN_TABLE, MAIN_TABLE_AND_ENTRY_EDITOR } private Subscription horizontalDividerSubscription; private Subscription verticalDividerSubscription; - public JabRefFrame(Stage mainStage, - DialogService dialogService, - FileUpdateMonitor fileUpdateMonitor, - GuiPreferences preferences, - AiService aiService, - StateManager stateManager, - BibEntryTypesManager entryTypesManager, - ClipBoardManager clipBoardManager, - TaskExecutor taskExecutor, - GitHandlerRegistry gitHandlerRegistry, - JournalAbbreviationRepository journalAbbreviationRepository, - OAuthSessionRegistry oAuthSessionRegistry) { + public JabRefFrame(Stage mainStage, DialogService dialogService, FileUpdateMonitor fileUpdateMonitor, GuiPreferences preferences, AiService aiService, StateManager stateManager, BibEntryTypesManager entryTypesManager, ClipBoardManager clipBoardManager, TaskExecutor taskExecutor, GitHandlerRegistry gitHandlerRegistry, JournalAbbreviationRepository journalAbbreviationRepository, OAuthSessionRegistry oAuthSessionRegistry) { this.mainStage = mainStage; this.dialogService = dialogService; this.fileUpdateMonitor = fileUpdateMonitor; @@ -158,61 +148,23 @@ public JabRefFrame(Stage mainStage, setId("frame"); // Create components - this.viewModel = new JabRefFrameViewModel( - preferences, - aiService, - stateManager, - dialogService, - this, - this::getOpenDatabaseAction, - entryTypesManager, - fileUpdateMonitor, - clipBoardManager, - taskExecutor); + this.viewModel = new JabRefFrameViewModel(preferences, aiService, stateManager, dialogService, this, this::getOpenDatabaseAction, entryTypesManager, fileUpdateMonitor, clipBoardManager, taskExecutor); Injector.setModelOrService(UiMessageHandler.class, this); - FrameDndHandler frameDndHandler = new FrameDndHandler( - tabbedPane, - mainStage::getScene, - this::getOpenDatabaseAction, - stateManager); + FrameDndHandler frameDndHandler = new FrameDndHandler(tabbedPane, mainStage::getScene, this::getOpenDatabaseAction, stateManager); - this.globalSearchBar = new GlobalSearchBar( - this, - stateManager, - this.preferences, - dialogService, - SearchType.NORMAL_SEARCH); + this.globalSearchBar = new GlobalSearchBar(this, stateManager, this.preferences, dialogService, SearchType.NORMAL_SEARCH); this.entryEditor = new EntryEditor(this::getCurrentLibraryTab, // Actions are recreated here since this avoids passing more parameters and the amount of additional memory consumption is neglegtable. - new UndoAction(dialogService, stateManager), - new RedoAction(dialogService, stateManager)); + new UndoAction(dialogService, stateManager), new RedoAction(dialogService, stateManager)); Injector.setModelOrService(EntryEditor.class, entryEditor); - this.sidePane = new SidePane( - this, - this.preferences, - journalAbbreviationRepository, - taskExecutor, - dialogService, - aiService, - stateManager, - fileUpdateMonitor, - entryTypesManager, - clipBoardManager, - gitHandlerRegistry); - - this.pushToApplicationCommand = new GuiPushToApplicationCommand( - stateManager, - dialogService, - this.preferences, - taskExecutor); - - this.fileHistory = new FileHistoryMenu( - this.preferences.getLastFilesOpenedPreferences().getFileHistory(), - dialogService, - getOpenDatabaseAction()); + this.sidePane = new SidePane(this, this.preferences, journalAbbreviationRepository, taskExecutor, dialogService, aiService, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, gitHandlerRegistry); + + this.pushToApplicationCommand = new GuiPushToApplicationCommand(stateManager, dialogService, this.preferences, taskExecutor); + + this.fileHistory = new FileHistoryMenu(this.preferences.getLastFilesOpenedPreferences().getFileHistory(), dialogService, getOpenDatabaseAction()); fileHistory.disableProperty().bind(Bindings.isEmpty(fileHistory.getItems())); @@ -231,41 +183,9 @@ public JabRefFrame(Stage mainStage, } private void initLayout() { - MainToolBar mainToolBar = new MainToolBar( - this, - pushToApplicationCommand, - globalSearchBar, - dialogService, - stateManager, - preferences, - aiService, - fileUpdateMonitor, - taskExecutor, - entryTypesManager, - clipBoardManager, - journalAbbreviationRepository, - gitHandlerRegistry); - - MainMenu mainMenu = new MainMenu( - this, - fileHistory, - sidePane, - pushToApplicationCommand, - preferences, - stateManager, - fileUpdateMonitor, - taskExecutor, - dialogService, - journalAbbreviationRepository, - entryTypesManager, - clipBoardManager, - this::getOpenDatabaseAction, - aiService, - entryEditor, - gitHandlerRegistry, - journalAbbreviationRepository, - oAuthSessionRegistry - ); + MainToolBar mainToolBar = new MainToolBar(this, pushToApplicationCommand, globalSearchBar, dialogService, stateManager, preferences, aiService, fileUpdateMonitor, taskExecutor, entryTypesManager, clipBoardManager, journalAbbreviationRepository, gitHandlerRegistry); + + MainMenu mainMenu = new MainMenu(this, fileHistory, sidePane, pushToApplicationCommand, preferences, stateManager, fileUpdateMonitor, taskExecutor, dialogService, journalAbbreviationRepository, entryTypesManager, clipBoardManager, this::getOpenDatabaseAction, aiService, entryEditor, gitHandlerRegistry, journalAbbreviationRepository, oAuthSessionRegistry); VBox head = new VBox(0, mainMenu, mainToolBar); setTop(head); @@ -330,15 +250,13 @@ public void updateHorizontalDividerPosition() { return; } horizontalSplit.setDividerPositions(preferences.getGuiPreferences().getHorizontalDividerPosition()); - horizontalDividerSubscription = EasyBind.valueAt(horizontalSplit.getDividers(), 0) - .mapObservable(SplitPane.Divider::positionProperty) - .listenToValues((_, newValue) -> { - double position = newValue.doubleValue(); - // 0 and 1 occur while the pane is added or removed, not as a user's choice - if (position > 0 && position < 1) { - preferences.getGuiPreferences().setHorizontalDividerPosition(position); - } - }); + horizontalDividerSubscription = EasyBind.valueAt(horizontalSplit.getDividers(), 0).mapObservable(SplitPane.Divider::positionProperty).listenToValues((_, newValue) -> { + double position = newValue.doubleValue(); + // 0 and 1 occur while the pane is added or removed, not as a user's choice + if (position > 0 && position < 1) { + preferences.getGuiPreferences().setHorizontalDividerPosition(position); + } + }); } private void unsubscribeHorizontalDivider() { @@ -351,11 +269,7 @@ private void unsubscribeHorizontalDivider() { public void updateVerticalDividerPosition() { if (mainStage.isShowing() && panelMode.get() == PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR) { verticalSplit.setDividerPositions(preferences.getGuiPreferences().getVerticalDividerPosition()); - verticalDividerSubscription = EasyBind.valueAt(verticalSplit.getDividers(), 0) - .mapObservable(SplitPane.Divider::positionProperty) - .listenToValues((_, newValue) -> - preferences.getGuiPreferences() - .setVerticalDividerPosition(newValue.doubleValue())); + verticalDividerSubscription = EasyBind.valueAt(verticalSplit.getDividers(), 0).mapObservable(SplitPane.Divider::positionProperty).listenToValues((_, newValue) -> preferences.getGuiPreferences().setVerticalDividerPosition(newValue.doubleValue())); } } @@ -437,15 +351,13 @@ private void initKeyBindings() { new NewEntryAction(StandardEntryType.InProceedings, this::getCurrentLibraryTab, dialogService, preferences, stateManager).execute(); break; case BACK: - if (!(getScene().getFocusOwner() instanceof TextInputControl) - && !(getScene().getFocusOwner() instanceof CodeArea)) { + if (!(getScene().getFocusOwner() instanceof TextInputControl) && !(getScene().getFocusOwner() instanceof CodeArea)) { Optional.ofNullable(getCurrentLibraryTab()).ifPresent(LibraryTab::back); event.consume(); } break; case FORWARD: - if (!(getScene().getFocusOwner() instanceof TextInputControl) - && !(getScene().getFocusOwner() instanceof CodeArea)) { + if (!(getScene().getFocusOwner() instanceof TextInputControl) && !(getScene().getFocusOwner() instanceof CodeArea)) { Optional.ofNullable(getCurrentLibraryTab()).ifPresent(LibraryTab::forward); event.consume(); } @@ -488,8 +400,7 @@ private void initBindings() { }); // Wait for the scene to be created, otherwise focusOwnerProperty is not provided - Platform.runLater(() -> stateManager.focusOwnerProperty().bind( - EasyBind.map(mainStage.getScene().focusOwnerProperty(), Optional::ofNullable))); + Platform.runLater(() -> stateManager.focusOwnerProperty().bind(EasyBind.map(mainStage.getScene().focusOwnerProperty(), Optional::ofNullable))); EasyBind.subscribe(tabbedPane.getSelectionModel().selectedItemProperty(), selectedTab -> { if (selectedTab instanceof LibraryTab libraryTab) { @@ -518,18 +429,13 @@ private void initBindings() { Platform.runLater(() -> libraryTab.getMainTable().requestFocus()); // Set window title dynamically - mainStage.titleProperty().bind(Bindings.createStringBinding( - () -> libraryTab.textProperty().getValue() + " – " + FRAME_TITLE, // not a minus, but codepoint 2013 + mainStage.titleProperty().bind(Bindings.createStringBinding(() -> libraryTab.textProperty().getValue() + " – " + FRAME_TITLE, // not a minus, but codepoint 2013 libraryTab.textProperty())); } else { // Check if the previously active database was closed if (stateManager.getActiveDatabase().isPresent()) { String activeUID = stateManager.getActiveDatabase().get().getUid(); - boolean wasClosed = tabbedPane.getTabs().stream() - .filter(tab -> tab instanceof LibraryTab) - .noneMatch(ltab -> ((LibraryTab) ltab).getBibDatabaseContext() - .getUid() - .equals(activeUID)); + boolean wasClosed = tabbedPane.getTabs().stream().filter(tab -> tab instanceof LibraryTab).noneMatch(ltab -> ((LibraryTab) ltab).getBibDatabaseContext().getUid().equals(activeUID)); if (wasClosed) { tabbedPane.getSelectionModel().selectNext(); } @@ -546,9 +452,7 @@ private void initBindings() { } }); - BindingsHelper.bindBidirectional((ObservableValue) stateManager.getEditorShowing(), panelMode, - mode -> stateManager.getEditorShowing().setValue(mode == PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR), - showing -> panelMode.setValue(showing ? PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR : PanelMode.MAIN_TABLE)); + BindingsHelper.bindBidirectional((ObservableValue) stateManager.getEditorShowing(), panelMode, mode -> stateManager.getEditorShowing().setValue(mode == PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR), showing -> panelMode.setValue(showing ? PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR : PanelMode.MAIN_TABLE)); EasyBind.subscribe(panelMode, mode -> { updateEditorPane(); @@ -562,21 +466,9 @@ private void initBindings() { tabbedPane.getTabs().addListener((ListChangeListener) _ -> updateTabBarVisible()); preferences.getWorkspacePreferences().hideTabBarProperty().addListener((_, _, _) -> updateTabBarVisible()); - stateManager.canGoBackProperty().bind( - stateManager.activeTabProperty().flatMap( - optionalTab -> optionalTab - .map(LibraryTab::canGoBackProperty) - .orElse(new SimpleBooleanProperty(false)) - ) - ); - - stateManager.canGoForwardProperty().bind( - stateManager.activeTabProperty().flatMap( - optionalTab -> optionalTab - .map(LibraryTab::canGoForwardProperty) - .orElse(new SimpleBooleanProperty(false)) - ) - ); + stateManager.canGoBackProperty().bind(stateManager.activeTabProperty().flatMap(optionalTab -> optionalTab.map(LibraryTab::canGoBackProperty).orElse(new SimpleBooleanProperty(false)))); + + stateManager.canGoForwardProperty().bind(stateManager.activeTabProperty().flatMap(optionalTab -> optionalTab.map(LibraryTab::canGoForwardProperty).orElse(new SimpleBooleanProperty(false)))); } /// Closes the selected tab if it is no [LibraryTab] (the welcome tab): [CloseDatabaseAction] only knows library tabs, so the close shortcut would do nothing there. @@ -620,8 +512,7 @@ private void updateTabBarVisible() { /// Returns the currently viewed LibraryTab. public LibraryTab getCurrentLibraryTab() { - if (tabbedPane.getSelectionModel().getSelectedItem() == null - || !(tabbedPane.getSelectionModel().getSelectedItem() instanceof LibraryTab)) { + if (tabbedPane.getSelectionModel().getSelectedItem() == null || !(tabbedPane.getSelectionModel().getSelectedItem() instanceof LibraryTab)) { return null; } return (LibraryTab) tabbedPane.getSelectionModel().getSelectedItem(); @@ -641,21 +532,7 @@ public void showWelcomeTab() { } // WelcomeTab not found - WelcomeTab welcomeTab = new WelcomeTab( - Injector.instantiateModelOrService(Stage.class), - this, - preferences, - aiService, - dialogService, - stateManager, - fileUpdateMonitor, - entryTypesManager, - clipBoardManager, - taskExecutor, - gitHandlerRegistry, - fileHistory, - Injector.instantiateModelOrService(BuildInfo.class), - preferences.getWorkspacePreferences()); + WelcomeTab welcomeTab = new WelcomeTab(Injector.instantiateModelOrService(Stage.class), this, preferences, aiService, dialogService, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, taskExecutor, gitHandlerRegistry, fileHistory, Injector.instantiateModelOrService(BuildInfo.class), preferences.getWorkspacePreferences()); tabbedPane.getTabs().add(welcomeTab); tabbedPane.getSelectionModel().select(welcomeTab); } @@ -664,18 +541,7 @@ public void showWelcomeTab() { /// Asynchronous loading is done at [LibraryTab#createLibraryTab]. /// Similar method: [OpenDatabaseAction#openTheFile(Path)] public void addTab(@NonNull BibDatabaseContext databaseContext, boolean raisePanel) { - LibraryTab libraryTab = LibraryTab.createLibraryTab( - databaseContext, - this, - dialogService, - aiService, - preferences, - stateManager, - fileUpdateMonitor, - entryTypesManager, - clipBoardManager, - taskExecutor, - gitHandlerRegistry); + LibraryTab libraryTab = LibraryTab.createLibraryTab(databaseContext, this, dialogService, aiService, preferences, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, taskExecutor, gitHandlerRegistry); addTab(libraryTab, raisePanel); } @@ -693,48 +559,32 @@ public void addTab(@NonNull LibraryTab libraryTab, boolean raisePanel) { @Override public void removeSharedDatabaseErrorTabFor(BibDatabaseContext databaseContext) { // Only a shared database carries a synchronizer, so its absence already rules out a matching placeholder. - Optional.ofNullable(databaseContext.getDBMSSynchronizer()) - .map(DatabaseSynchronizer::getConnectionProperties) - .ifPresent(this::removeSharedDatabaseErrorTabsFor); + Optional.ofNullable(databaseContext.getDBMSSynchronizer()).map(DatabaseSynchronizer::getConnectionProperties).ifPresent(this::removeSharedDatabaseErrorTabsFor); } /// Matches by database, not by `equals`: a retry entered in expert mode or with other SSL settings still targets /// the database the placeholder stands for. private void removeSharedDatabaseErrorTabsFor(DatabaseConnectionProperties connectionProperties) { - tabbedPane.getTabs().removeIf(tab -> (tab instanceof SharedDatabaseErrorTab errorTab) - && DBMSConnectionProperties.isSameDatabase(errorTab.getConnectionProperties(), connectionProperties)); + tabbedPane.getTabs().removeIf(tab -> (tab instanceof SharedDatabaseErrorTab errorTab) && DBMSConnectionProperties.isSameDatabase(errorTab.getConnectionProperties(), connectionProperties)); } private ContextMenu createTabContextMenuFor(LibraryTab tab) { ContextMenu contextMenu = new ContextMenu(); ActionFactory factory = new ActionFactory(); - contextMenu.getItems().addAll( - factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, - new LibraryPropertiesAction(tab::getBibDatabaseContext, stateManager)), - factory.createMenuItem(StandardActions.OPEN_DATABASE_FOLDER, - new OpenDatabaseFolder(dialogService, stateManager, preferences, tab::getBibDatabaseContext)), - factory.createMenuItem(StandardActions.OPEN_CONSOLE, - new OpenConsoleAction(() -> { - LibraryTab currentTab = getCurrentLibraryTab(); - return (currentTab == null) ? null : currentTab.getBibDatabaseContext(); - }, stateManager, preferences, dialogService)), - factory.createMenuItem(StandardActions.SORT_TABS_ALPHABETICALLY, new SimpleCommand() { - @Override - public void execute() { - tabbedPane.getTabs().sort((tab1, tab2) -> { - String text1 = tab1.getText() != null ? tab1.getText() : ""; - String text2 = tab2.getText() != null ? tab2.getText() : ""; - return text1.compareToIgnoreCase(text2); - }); - } - }), - new SeparatorMenuItem(), - factory.createMenuItem(StandardActions.CLOSE_LIBRARY, - new CloseDatabaseAction(this, tab, stateManager)), - factory.createMenuItem(StandardActions.CLOSE_OTHER_LIBRARIES, - new CloseOthersDatabaseAction(tab)) - ); + contextMenu.getItems().addAll(factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(tab::getBibDatabaseContext, stateManager)), factory.createMenuItem(StandardActions.OPEN_DATABASE_FOLDER, new OpenDatabaseFolder(dialogService, stateManager, preferences, tab::getBibDatabaseContext)), factory.createMenuItem(StandardActions.OPEN_CONSOLE, new OpenConsoleAction(() -> { + LibraryTab currentTab = getCurrentLibraryTab(); + return (currentTab == null) ? null : currentTab.getBibDatabaseContext(); + }, stateManager, preferences, dialogService)), factory.createMenuItem(StandardActions.SORT_TABS_ALPHABETICALLY, new SimpleCommand() { + @Override + public void execute() { + tabbedPane.getTabs().sort((tab1, tab2) -> { + String text1 = tab1.getText() != null ? tab1.getText() : ""; + String text2 = tab2.getText() != null ? tab2.getText() : ""; + return text1.compareToIgnoreCase(text2); + }); + } + }), new SeparatorMenuItem(), factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction(this, tab, stateManager)), factory.createMenuItem(StandardActions.CLOSE_OTHER_LIBRARIES, new CloseOthersDatabaseAction(tab))); return contextMenu; } @@ -749,10 +599,7 @@ public boolean closeTab(LibraryTab tab) { public boolean closeTabs(@NonNull List tabs, boolean showWelcomeTab) { // Only accept library tabs that are shown in the tab container - List toClose = tabs.stream() - .distinct() - .filter(getLibraryTabs()::contains) - .toList(); + List toClose = tabs.stream().distinct().filter(getLibraryTabs()::contains).toList(); if (toClose.isEmpty()) { // Nothing to do @@ -784,17 +631,7 @@ public boolean closeTabs(@NonNull List tabs, boolean showWelcomeTab) } private OpenDatabaseAction getOpenDatabaseAction() { - return new OpenDatabaseAction( - this, - preferences, - aiService, - dialogService, - stateManager, - fileUpdateMonitor, - entryTypesManager, - clipBoardManager, - taskExecutor, - gitHandlerRegistry); + return new OpenDatabaseAction(this, preferences, aiService, dialogService, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, taskExecutor, gitHandlerRegistry); } /// Refreshes the ui after preferences changes @@ -830,21 +667,7 @@ private void reconnectSharedDatabase(SharedDatabaseSessionService sessionService BibDatabaseContext dummyContext = manager.createDummyContext(reconnection.connectionProperties()); // The id keeps the database remembered if JabRef quits while this tab is still loading dummyContext.getDatabase().setSharedDatabaseID(reconnection.sharedDatabaseId()); - LibraryTab newTab = LibraryTab.createLibraryTab( - () -> manager.connect(reconnection.connectionProperties()), - dummyContext, - dialogService, - aiService, - preferences, - stateManager, - this, - fileUpdateMonitor, - entryTypesManager, - clipBoardManager, - taskExecutor, - gitHandlerRegistry, - (tab, bibDatabaseContext) -> handleSharedDatabaseReconnectionSuccess(sessionService, reconnection, tab, bibDatabaseContext), - exception -> handleSharedDatabaseReconnectionFailure(sessionService, reconnection, exception)); + LibraryTab newTab = LibraryTab.createLibraryTab(() -> manager.connect(reconnection.connectionProperties()), dummyContext, dialogService, aiService, preferences, stateManager, this, fileUpdateMonitor, entryTypesManager, clipBoardManager, taskExecutor, gitHandlerRegistry, (tab, bibDatabaseContext) -> handleSharedDatabaseReconnectionSuccess(sessionService, reconnection, tab, bibDatabaseContext), exception -> handleSharedDatabaseReconnectionFailure(sessionService, reconnection, exception)); Optional reservedTab = SharedDatabaseUIManager.reserveTab(this, reconnection.connectionProperties(), newTab); if (reservedTab.isPresent()) { showLibraryTab(reservedTab.orElseThrow()); @@ -854,10 +677,7 @@ private void reconnectSharedDatabase(SharedDatabaseSessionService sessionService newTab.startDataLoadingTask(); } - private void handleSharedDatabaseReconnectionSuccess(SharedDatabaseSessionService sessionService, - SharedDatabaseSessionService.Reconnection reconnection, - LibraryTab tab, - BibDatabaseContext bibDatabaseContext) { + private void handleSharedDatabaseReconnectionSuccess(SharedDatabaseSessionService sessionService, SharedDatabaseSessionService.Reconnection reconnection, LibraryTab tab, BibDatabaseContext bibDatabaseContext) { if (!mainStage.isShowing()) { closeTab(tab); return; @@ -867,9 +687,7 @@ private void handleSharedDatabaseReconnectionSuccess(SharedDatabaseSessionServic /// The failed loading tab has already closed itself; a [SharedDatabaseErrorTab] takes its place instead of a dialog, /// so the connection can be retried and stays remembered for the next session. - private void handleSharedDatabaseReconnectionFailure(SharedDatabaseSessionService sessionService, - SharedDatabaseSessionService.Reconnection reconnection, - Exception exception) { + private void handleSharedDatabaseReconnectionFailure(SharedDatabaseSessionService sessionService, SharedDatabaseSessionService.Reconnection reconnection, Exception exception) { LOGGER.error("Could not reconnect to shared database {}", reconnection.sharedDatabaseId(), exception); if (!mainStage.isShowing()) { return; @@ -888,12 +706,7 @@ private void handleSharedDatabaseReconnectionFailure(SharedDatabaseSessionServic @Override public void showSharedDatabaseErrorTab(SharedDatabaseErrorTab errorTab) { // Keep the remembered id while retrying with the settings from the latest attempt. - Optional remembered = tabbedPane.getTabs().stream() - .filter(SharedDatabaseErrorTab.class::isInstance) - .map(SharedDatabaseErrorTab.class::cast) - .filter(existing -> DBMSConnectionProperties.isSameDatabase(existing.getConnectionProperties(), errorTab.getConnectionProperties())) - .filter(existing -> existing.getSharedDatabaseId().isPresent()) - .findFirst(); + Optional remembered = tabbedPane.getTabs().stream().filter(SharedDatabaseErrorTab.class::isInstance).map(SharedDatabaseErrorTab.class::cast).filter(existing -> DBMSConnectionProperties.isSameDatabase(existing.getConnectionProperties(), errorTab.getConnectionProperties())).filter(existing -> existing.getSharedDatabaseId().isPresent()).findFirst(); if (remembered.isPresent()) { SharedDatabaseErrorTab rememberedTab = remembered.orElseThrow(); rememberedTab.updateFailure(errorTab); @@ -920,10 +733,7 @@ static void addSharedDatabaseErrorTab(TabPane tabbedPane, SharedDatabaseErrorTab @Override public List getUnconnectedSharedDatabaseIds() { - return tabbedPane.getTabs().stream() - .filter(SharedDatabaseErrorTab.class::isInstance) - .flatMap(tab -> ((SharedDatabaseErrorTab) tab).getSharedDatabaseId().stream()) - .toList(); + return tabbedPane.getTabs().stream().filter(SharedDatabaseErrorTab.class::isInstance).flatMap(tab -> ((SharedDatabaseErrorTab) tab).getSharedDatabaseId().stream()).toList(); } @Override @@ -997,11 +807,7 @@ public CloseOthersDatabaseAction(LibraryTab libraryTab) { @Override public void execute() { LibraryTab toKeepLibraryTab = Optional.of(libraryTab).get(); - List libraryTabs = tabbedPane.getTabs().stream() - .filter(LibraryTab.class::isInstance) - .map(LibraryTab.class::cast) - .filter(tab -> tab != toKeepLibraryTab) - .toList(); + List libraryTabs = tabbedPane.getTabs().stream().filter(LibraryTab.class::isInstance).map(LibraryTab.class::cast).filter(tab -> tab != toKeepLibraryTab).toList(); for (LibraryTab tab : libraryTabs) { Platform.runLater(() -> closeTab(tab)); } diff --git a/jablib/src/main/resources/csl-styles b/jablib/src/main/resources/csl-styles index d2cc4207b650..ffd2a7b91280 160000 --- a/jablib/src/main/resources/csl-styles +++ b/jablib/src/main/resources/csl-styles @@ -1 +1 @@ -Subproject commit d2cc4207b65000f5c2bdc0c44d7a26ed18ab6606 +Subproject commit ffd2a7b91280d84c9237ae97f9e5fd1f5abbe756 From d7debb84b67cb9c39415ca8ab684a9da9abc2258 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Thu, 5 Nov 2026 16:45:00 +0530 Subject: [PATCH 11/13] Retrigger CI From 9277398c77abf7bdafff394b8586f16dd541da55 Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Mon, 9 Nov 2026 12:17:39 +0530 Subject: [PATCH 12/13] Remove formatting changes, keep side pane scroll --- .../org/jabref/gui/frame/JabRefFrame.java | 327 ++++++++++++++---- .../gui/sidepane/SidePaneComponent.java | 9 + .../jabref/gui/theme/internal/jabref-base.css | 8 + 3 files changed, 272 insertions(+), 72 deletions(-) diff --git a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java index fb6f7b1761e1..9c003f61fdd2 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java @@ -19,7 +19,6 @@ import javafx.geometry.Orientation; import javafx.scene.Node; import javafx.scene.control.ContextMenu; -import javafx.scene.control.ScrollPane; import javafx.scene.control.SeparatorMenuItem; import javafx.scene.control.SplitPane; import javafx.scene.control.Tab; @@ -27,7 +26,6 @@ import javafx.scene.control.TextInputControl; import javafx.scene.input.KeyEvent; import javafx.scene.layout.BorderPane; -import javafx.scene.layout.Region; import javafx.scene.layout.VBox; import javafx.stage.Stage; @@ -121,7 +119,6 @@ private enum PanelMode { MAIN_TABLE, MAIN_TABLE_AND_ENTRY_EDITOR } private final GuiPushToApplicationCommand pushToApplicationCommand; private final SplitPane horizontalSplit = new SplitPane(); private final SidePane sidePane; - private final ScrollPane sidePaneScroll = new ScrollPane(); private final SplitPane verticalSplit = new SplitPane(); private final TabPane tabbedPane = new TabPane(); private final EntryEditor entryEditor; @@ -131,7 +128,18 @@ private enum PanelMode { MAIN_TABLE, MAIN_TABLE_AND_ENTRY_EDITOR } private Subscription horizontalDividerSubscription; private Subscription verticalDividerSubscription; - public JabRefFrame(Stage mainStage, DialogService dialogService, FileUpdateMonitor fileUpdateMonitor, GuiPreferences preferences, AiService aiService, StateManager stateManager, BibEntryTypesManager entryTypesManager, ClipBoardManager clipBoardManager, TaskExecutor taskExecutor, GitHandlerRegistry gitHandlerRegistry, JournalAbbreviationRepository journalAbbreviationRepository, OAuthSessionRegistry oAuthSessionRegistry) { + public JabRefFrame(Stage mainStage, + DialogService dialogService, + FileUpdateMonitor fileUpdateMonitor, + GuiPreferences preferences, + AiService aiService, + StateManager stateManager, + BibEntryTypesManager entryTypesManager, + ClipBoardManager clipBoardManager, + TaskExecutor taskExecutor, + GitHandlerRegistry gitHandlerRegistry, + JournalAbbreviationRepository journalAbbreviationRepository, + OAuthSessionRegistry oAuthSessionRegistry) { this.mainStage = mainStage; this.dialogService = dialogService; this.fileUpdateMonitor = fileUpdateMonitor; @@ -148,23 +156,61 @@ public JabRefFrame(Stage mainStage, DialogService dialogService, FileUpdateMonit setId("frame"); // Create components - this.viewModel = new JabRefFrameViewModel(preferences, aiService, stateManager, dialogService, this, this::getOpenDatabaseAction, entryTypesManager, fileUpdateMonitor, clipBoardManager, taskExecutor); + this.viewModel = new JabRefFrameViewModel( + preferences, + aiService, + stateManager, + dialogService, + this, + this::getOpenDatabaseAction, + entryTypesManager, + fileUpdateMonitor, + clipBoardManager, + taskExecutor); Injector.setModelOrService(UiMessageHandler.class, this); - FrameDndHandler frameDndHandler = new FrameDndHandler(tabbedPane, mainStage::getScene, this::getOpenDatabaseAction, stateManager); + FrameDndHandler frameDndHandler = new FrameDndHandler( + tabbedPane, + mainStage::getScene, + this::getOpenDatabaseAction, + stateManager); - this.globalSearchBar = new GlobalSearchBar(this, stateManager, this.preferences, dialogService, SearchType.NORMAL_SEARCH); + this.globalSearchBar = new GlobalSearchBar( + this, + stateManager, + this.preferences, + dialogService, + SearchType.NORMAL_SEARCH); this.entryEditor = new EntryEditor(this::getCurrentLibraryTab, // Actions are recreated here since this avoids passing more parameters and the amount of additional memory consumption is neglegtable. - new UndoAction(dialogService, stateManager), new RedoAction(dialogService, stateManager)); + new UndoAction(dialogService, stateManager), + new RedoAction(dialogService, stateManager)); Injector.setModelOrService(EntryEditor.class, entryEditor); - this.sidePane = new SidePane(this, this.preferences, journalAbbreviationRepository, taskExecutor, dialogService, aiService, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, gitHandlerRegistry); - - this.pushToApplicationCommand = new GuiPushToApplicationCommand(stateManager, dialogService, this.preferences, taskExecutor); - - this.fileHistory = new FileHistoryMenu(this.preferences.getLastFilesOpenedPreferences().getFileHistory(), dialogService, getOpenDatabaseAction()); + this.sidePane = new SidePane( + this, + this.preferences, + journalAbbreviationRepository, + taskExecutor, + dialogService, + aiService, + stateManager, + fileUpdateMonitor, + entryTypesManager, + clipBoardManager, + gitHandlerRegistry); + + this.pushToApplicationCommand = new GuiPushToApplicationCommand( + stateManager, + dialogService, + this.preferences, + taskExecutor); + + this.fileHistory = new FileHistoryMenu( + this.preferences.getLastFilesOpenedPreferences().getFileHistory(), + dialogService, + getOpenDatabaseAction()); fileHistory.disableProperty().bind(Bindings.isEmpty(fileHistory.getItems())); @@ -183,9 +229,41 @@ public JabRefFrame(Stage mainStage, DialogService dialogService, FileUpdateMonit } private void initLayout() { - MainToolBar mainToolBar = new MainToolBar(this, pushToApplicationCommand, globalSearchBar, dialogService, stateManager, preferences, aiService, fileUpdateMonitor, taskExecutor, entryTypesManager, clipBoardManager, journalAbbreviationRepository, gitHandlerRegistry); - - MainMenu mainMenu = new MainMenu(this, fileHistory, sidePane, pushToApplicationCommand, preferences, stateManager, fileUpdateMonitor, taskExecutor, dialogService, journalAbbreviationRepository, entryTypesManager, clipBoardManager, this::getOpenDatabaseAction, aiService, entryEditor, gitHandlerRegistry, journalAbbreviationRepository, oAuthSessionRegistry); + MainToolBar mainToolBar = new MainToolBar( + this, + pushToApplicationCommand, + globalSearchBar, + dialogService, + stateManager, + preferences, + aiService, + fileUpdateMonitor, + taskExecutor, + entryTypesManager, + clipBoardManager, + journalAbbreviationRepository, + gitHandlerRegistry); + + MainMenu mainMenu = new MainMenu( + this, + fileHistory, + sidePane, + pushToApplicationCommand, + preferences, + stateManager, + fileUpdateMonitor, + taskExecutor, + dialogService, + journalAbbreviationRepository, + entryTypesManager, + clipBoardManager, + this::getOpenDatabaseAction, + aiService, + entryEditor, + gitHandlerRegistry, + journalAbbreviationRepository, + oAuthSessionRegistry + ); VBox head = new VBox(0, mainMenu, mainToolBar); setTop(head); @@ -197,16 +275,7 @@ private void initLayout() { horizontalSplit.getItems().addAll(verticalSplit); horizontalSplit.setOrientation(Orientation.HORIZONTAL); - sidePane.setMinHeight(Region.USE_PREF_SIZE); - - sidePaneScroll.setContent(sidePane); - sidePaneScroll.setFitToWidth(true); - sidePaneScroll.setFitToHeight(true); - sidePaneScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); - sidePaneScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); - sidePaneScroll.getStyleClass().add("side-pane-scroll"); - - SplitPane.setResizableWithParent(sidePaneScroll, false); + SplitPane.setResizableWithParent(sidePane, false); sidePane.widthProperty().addListener(_ -> updateSidePane()); sidePane.getChildren().addListener((InvalidationListener) _ -> updateSidePane()); updateSidePane(); @@ -216,11 +285,11 @@ private void initLayout() { private void updateSidePane() { if (sidePane.getChildren().isEmpty()) { unsubscribeHorizontalDivider(); - horizontalSplit.getItems().remove(sidePaneScroll); + horizontalSplit.getItems().remove(sidePane); } else { - if (!horizontalSplit.getItems().contains(sidePaneScroll)) { + if (!horizontalSplit.getItems().contains(sidePane)) { horizontalSplit.setVisible(false); - horizontalSplit.getItems().addFirst(sidePaneScroll); + horizontalSplit.getItems().addFirst(sidePane); Platform.runLater(() -> { updateHorizontalDividerPosition(); horizontalSplit.setVisible(true); @@ -250,13 +319,15 @@ public void updateHorizontalDividerPosition() { return; } horizontalSplit.setDividerPositions(preferences.getGuiPreferences().getHorizontalDividerPosition()); - horizontalDividerSubscription = EasyBind.valueAt(horizontalSplit.getDividers(), 0).mapObservable(SplitPane.Divider::positionProperty).listenToValues((_, newValue) -> { - double position = newValue.doubleValue(); - // 0 and 1 occur while the pane is added or removed, not as a user's choice - if (position > 0 && position < 1) { - preferences.getGuiPreferences().setHorizontalDividerPosition(position); - } - }); + horizontalDividerSubscription = EasyBind.valueAt(horizontalSplit.getDividers(), 0) + .mapObservable(SplitPane.Divider::positionProperty) + .listenToValues((_, newValue) -> { + double position = newValue.doubleValue(); + // 0 and 1 occur while the pane is added or removed, not as a user's choice + if (position > 0 && position < 1) { + preferences.getGuiPreferences().setHorizontalDividerPosition(position); + } + }); } private void unsubscribeHorizontalDivider() { @@ -269,7 +340,11 @@ private void unsubscribeHorizontalDivider() { public void updateVerticalDividerPosition() { if (mainStage.isShowing() && panelMode.get() == PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR) { verticalSplit.setDividerPositions(preferences.getGuiPreferences().getVerticalDividerPosition()); - verticalDividerSubscription = EasyBind.valueAt(verticalSplit.getDividers(), 0).mapObservable(SplitPane.Divider::positionProperty).listenToValues((_, newValue) -> preferences.getGuiPreferences().setVerticalDividerPosition(newValue.doubleValue())); + verticalDividerSubscription = EasyBind.valueAt(verticalSplit.getDividers(), 0) + .mapObservable(SplitPane.Divider::positionProperty) + .listenToValues((_, newValue) -> + preferences.getGuiPreferences() + .setVerticalDividerPosition(newValue.doubleValue())); } } @@ -351,13 +426,15 @@ private void initKeyBindings() { new NewEntryAction(StandardEntryType.InProceedings, this::getCurrentLibraryTab, dialogService, preferences, stateManager).execute(); break; case BACK: - if (!(getScene().getFocusOwner() instanceof TextInputControl) && !(getScene().getFocusOwner() instanceof CodeArea)) { + if (!(getScene().getFocusOwner() instanceof TextInputControl) + && !(getScene().getFocusOwner() instanceof CodeArea)) { Optional.ofNullable(getCurrentLibraryTab()).ifPresent(LibraryTab::back); event.consume(); } break; case FORWARD: - if (!(getScene().getFocusOwner() instanceof TextInputControl) && !(getScene().getFocusOwner() instanceof CodeArea)) { + if (!(getScene().getFocusOwner() instanceof TextInputControl) + && !(getScene().getFocusOwner() instanceof CodeArea)) { Optional.ofNullable(getCurrentLibraryTab()).ifPresent(LibraryTab::forward); event.consume(); } @@ -400,7 +477,8 @@ private void initBindings() { }); // Wait for the scene to be created, otherwise focusOwnerProperty is not provided - Platform.runLater(() -> stateManager.focusOwnerProperty().bind(EasyBind.map(mainStage.getScene().focusOwnerProperty(), Optional::ofNullable))); + Platform.runLater(() -> stateManager.focusOwnerProperty().bind( + EasyBind.map(mainStage.getScene().focusOwnerProperty(), Optional::ofNullable))); EasyBind.subscribe(tabbedPane.getSelectionModel().selectedItemProperty(), selectedTab -> { if (selectedTab instanceof LibraryTab libraryTab) { @@ -429,13 +507,18 @@ private void initBindings() { Platform.runLater(() -> libraryTab.getMainTable().requestFocus()); // Set window title dynamically - mainStage.titleProperty().bind(Bindings.createStringBinding(() -> libraryTab.textProperty().getValue() + " – " + FRAME_TITLE, // not a minus, but codepoint 2013 + mainStage.titleProperty().bind(Bindings.createStringBinding( + () -> libraryTab.textProperty().getValue() + " – " + FRAME_TITLE, // not a minus, but codepoint 2013 libraryTab.textProperty())); } else { // Check if the previously active database was closed if (stateManager.getActiveDatabase().isPresent()) { String activeUID = stateManager.getActiveDatabase().get().getUid(); - boolean wasClosed = tabbedPane.getTabs().stream().filter(tab -> tab instanceof LibraryTab).noneMatch(ltab -> ((LibraryTab) ltab).getBibDatabaseContext().getUid().equals(activeUID)); + boolean wasClosed = tabbedPane.getTabs().stream() + .filter(tab -> tab instanceof LibraryTab) + .noneMatch(ltab -> ((LibraryTab) ltab).getBibDatabaseContext() + .getUid() + .equals(activeUID)); if (wasClosed) { tabbedPane.getSelectionModel().selectNext(); } @@ -452,7 +535,9 @@ private void initBindings() { } }); - BindingsHelper.bindBidirectional((ObservableValue) stateManager.getEditorShowing(), panelMode, mode -> stateManager.getEditorShowing().setValue(mode == PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR), showing -> panelMode.setValue(showing ? PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR : PanelMode.MAIN_TABLE)); + BindingsHelper.bindBidirectional((ObservableValue) stateManager.getEditorShowing(), panelMode, + mode -> stateManager.getEditorShowing().setValue(mode == PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR), + showing -> panelMode.setValue(showing ? PanelMode.MAIN_TABLE_AND_ENTRY_EDITOR : PanelMode.MAIN_TABLE)); EasyBind.subscribe(panelMode, mode -> { updateEditorPane(); @@ -466,9 +551,21 @@ private void initBindings() { tabbedPane.getTabs().addListener((ListChangeListener) _ -> updateTabBarVisible()); preferences.getWorkspacePreferences().hideTabBarProperty().addListener((_, _, _) -> updateTabBarVisible()); - stateManager.canGoBackProperty().bind(stateManager.activeTabProperty().flatMap(optionalTab -> optionalTab.map(LibraryTab::canGoBackProperty).orElse(new SimpleBooleanProperty(false)))); - - stateManager.canGoForwardProperty().bind(stateManager.activeTabProperty().flatMap(optionalTab -> optionalTab.map(LibraryTab::canGoForwardProperty).orElse(new SimpleBooleanProperty(false)))); + stateManager.canGoBackProperty().bind( + stateManager.activeTabProperty().flatMap( + optionalTab -> optionalTab + .map(LibraryTab::canGoBackProperty) + .orElse(new SimpleBooleanProperty(false)) + ) + ); + + stateManager.canGoForwardProperty().bind( + stateManager.activeTabProperty().flatMap( + optionalTab -> optionalTab + .map(LibraryTab::canGoForwardProperty) + .orElse(new SimpleBooleanProperty(false)) + ) + ); } /// Closes the selected tab if it is no [LibraryTab] (the welcome tab): [CloseDatabaseAction] only knows library tabs, so the close shortcut would do nothing there. @@ -512,7 +609,8 @@ private void updateTabBarVisible() { /// Returns the currently viewed LibraryTab. public LibraryTab getCurrentLibraryTab() { - if (tabbedPane.getSelectionModel().getSelectedItem() == null || !(tabbedPane.getSelectionModel().getSelectedItem() instanceof LibraryTab)) { + if (tabbedPane.getSelectionModel().getSelectedItem() == null + || !(tabbedPane.getSelectionModel().getSelectedItem() instanceof LibraryTab)) { return null; } return (LibraryTab) tabbedPane.getSelectionModel().getSelectedItem(); @@ -532,7 +630,21 @@ public void showWelcomeTab() { } // WelcomeTab not found - WelcomeTab welcomeTab = new WelcomeTab(Injector.instantiateModelOrService(Stage.class), this, preferences, aiService, dialogService, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, taskExecutor, gitHandlerRegistry, fileHistory, Injector.instantiateModelOrService(BuildInfo.class), preferences.getWorkspacePreferences()); + WelcomeTab welcomeTab = new WelcomeTab( + Injector.instantiateModelOrService(Stage.class), + this, + preferences, + aiService, + dialogService, + stateManager, + fileUpdateMonitor, + entryTypesManager, + clipBoardManager, + taskExecutor, + gitHandlerRegistry, + fileHistory, + Injector.instantiateModelOrService(BuildInfo.class), + preferences.getWorkspacePreferences()); tabbedPane.getTabs().add(welcomeTab); tabbedPane.getSelectionModel().select(welcomeTab); } @@ -541,7 +653,18 @@ public void showWelcomeTab() { /// Asynchronous loading is done at [LibraryTab#createLibraryTab]. /// Similar method: [OpenDatabaseAction#openTheFile(Path)] public void addTab(@NonNull BibDatabaseContext databaseContext, boolean raisePanel) { - LibraryTab libraryTab = LibraryTab.createLibraryTab(databaseContext, this, dialogService, aiService, preferences, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, taskExecutor, gitHandlerRegistry); + LibraryTab libraryTab = LibraryTab.createLibraryTab( + databaseContext, + this, + dialogService, + aiService, + preferences, + stateManager, + fileUpdateMonitor, + entryTypesManager, + clipBoardManager, + taskExecutor, + gitHandlerRegistry); addTab(libraryTab, raisePanel); } @@ -559,32 +682,48 @@ public void addTab(@NonNull LibraryTab libraryTab, boolean raisePanel) { @Override public void removeSharedDatabaseErrorTabFor(BibDatabaseContext databaseContext) { // Only a shared database carries a synchronizer, so its absence already rules out a matching placeholder. - Optional.ofNullable(databaseContext.getDBMSSynchronizer()).map(DatabaseSynchronizer::getConnectionProperties).ifPresent(this::removeSharedDatabaseErrorTabsFor); + Optional.ofNullable(databaseContext.getDBMSSynchronizer()) + .map(DatabaseSynchronizer::getConnectionProperties) + .ifPresent(this::removeSharedDatabaseErrorTabsFor); } /// Matches by database, not by `equals`: a retry entered in expert mode or with other SSL settings still targets /// the database the placeholder stands for. private void removeSharedDatabaseErrorTabsFor(DatabaseConnectionProperties connectionProperties) { - tabbedPane.getTabs().removeIf(tab -> (tab instanceof SharedDatabaseErrorTab errorTab) && DBMSConnectionProperties.isSameDatabase(errorTab.getConnectionProperties(), connectionProperties)); + tabbedPane.getTabs().removeIf(tab -> (tab instanceof SharedDatabaseErrorTab errorTab) + && DBMSConnectionProperties.isSameDatabase(errorTab.getConnectionProperties(), connectionProperties)); } private ContextMenu createTabContextMenuFor(LibraryTab tab) { ContextMenu contextMenu = new ContextMenu(); ActionFactory factory = new ActionFactory(); - contextMenu.getItems().addAll(factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(tab::getBibDatabaseContext, stateManager)), factory.createMenuItem(StandardActions.OPEN_DATABASE_FOLDER, new OpenDatabaseFolder(dialogService, stateManager, preferences, tab::getBibDatabaseContext)), factory.createMenuItem(StandardActions.OPEN_CONSOLE, new OpenConsoleAction(() -> { - LibraryTab currentTab = getCurrentLibraryTab(); - return (currentTab == null) ? null : currentTab.getBibDatabaseContext(); - }, stateManager, preferences, dialogService)), factory.createMenuItem(StandardActions.SORT_TABS_ALPHABETICALLY, new SimpleCommand() { - @Override - public void execute() { - tabbedPane.getTabs().sort((tab1, tab2) -> { - String text1 = tab1.getText() != null ? tab1.getText() : ""; - String text2 = tab2.getText() != null ? tab2.getText() : ""; - return text1.compareToIgnoreCase(text2); - }); - } - }), new SeparatorMenuItem(), factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction(this, tab, stateManager)), factory.createMenuItem(StandardActions.CLOSE_OTHER_LIBRARIES, new CloseOthersDatabaseAction(tab))); + contextMenu.getItems().addAll( + factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, + new LibraryPropertiesAction(tab::getBibDatabaseContext, stateManager)), + factory.createMenuItem(StandardActions.OPEN_DATABASE_FOLDER, + new OpenDatabaseFolder(dialogService, stateManager, preferences, tab::getBibDatabaseContext)), + factory.createMenuItem(StandardActions.OPEN_CONSOLE, + new OpenConsoleAction(() -> { + LibraryTab currentTab = getCurrentLibraryTab(); + return (currentTab == null) ? null : currentTab.getBibDatabaseContext(); + }, stateManager, preferences, dialogService)), + factory.createMenuItem(StandardActions.SORT_TABS_ALPHABETICALLY, new SimpleCommand() { + @Override + public void execute() { + tabbedPane.getTabs().sort((tab1, tab2) -> { + String text1 = tab1.getText() != null ? tab1.getText() : ""; + String text2 = tab2.getText() != null ? tab2.getText() : ""; + return text1.compareToIgnoreCase(text2); + }); + } + }), + new SeparatorMenuItem(), + factory.createMenuItem(StandardActions.CLOSE_LIBRARY, + new CloseDatabaseAction(this, tab, stateManager)), + factory.createMenuItem(StandardActions.CLOSE_OTHER_LIBRARIES, + new CloseOthersDatabaseAction(tab)) + ); return contextMenu; } @@ -599,7 +738,10 @@ public boolean closeTab(LibraryTab tab) { public boolean closeTabs(@NonNull List tabs, boolean showWelcomeTab) { // Only accept library tabs that are shown in the tab container - List toClose = tabs.stream().distinct().filter(getLibraryTabs()::contains).toList(); + List toClose = tabs.stream() + .distinct() + .filter(getLibraryTabs()::contains) + .toList(); if (toClose.isEmpty()) { // Nothing to do @@ -631,7 +773,17 @@ public boolean closeTabs(@NonNull List tabs, boolean showWelcomeTab) } private OpenDatabaseAction getOpenDatabaseAction() { - return new OpenDatabaseAction(this, preferences, aiService, dialogService, stateManager, fileUpdateMonitor, entryTypesManager, clipBoardManager, taskExecutor, gitHandlerRegistry); + return new OpenDatabaseAction( + this, + preferences, + aiService, + dialogService, + stateManager, + fileUpdateMonitor, + entryTypesManager, + clipBoardManager, + taskExecutor, + gitHandlerRegistry); } /// Refreshes the ui after preferences changes @@ -667,7 +819,21 @@ private void reconnectSharedDatabase(SharedDatabaseSessionService sessionService BibDatabaseContext dummyContext = manager.createDummyContext(reconnection.connectionProperties()); // The id keeps the database remembered if JabRef quits while this tab is still loading dummyContext.getDatabase().setSharedDatabaseID(reconnection.sharedDatabaseId()); - LibraryTab newTab = LibraryTab.createLibraryTab(() -> manager.connect(reconnection.connectionProperties()), dummyContext, dialogService, aiService, preferences, stateManager, this, fileUpdateMonitor, entryTypesManager, clipBoardManager, taskExecutor, gitHandlerRegistry, (tab, bibDatabaseContext) -> handleSharedDatabaseReconnectionSuccess(sessionService, reconnection, tab, bibDatabaseContext), exception -> handleSharedDatabaseReconnectionFailure(sessionService, reconnection, exception)); + LibraryTab newTab = LibraryTab.createLibraryTab( + () -> manager.connect(reconnection.connectionProperties()), + dummyContext, + dialogService, + aiService, + preferences, + stateManager, + this, + fileUpdateMonitor, + entryTypesManager, + clipBoardManager, + taskExecutor, + gitHandlerRegistry, + (tab, bibDatabaseContext) -> handleSharedDatabaseReconnectionSuccess(sessionService, reconnection, tab, bibDatabaseContext), + exception -> handleSharedDatabaseReconnectionFailure(sessionService, reconnection, exception)); Optional reservedTab = SharedDatabaseUIManager.reserveTab(this, reconnection.connectionProperties(), newTab); if (reservedTab.isPresent()) { showLibraryTab(reservedTab.orElseThrow()); @@ -677,7 +843,10 @@ private void reconnectSharedDatabase(SharedDatabaseSessionService sessionService newTab.startDataLoadingTask(); } - private void handleSharedDatabaseReconnectionSuccess(SharedDatabaseSessionService sessionService, SharedDatabaseSessionService.Reconnection reconnection, LibraryTab tab, BibDatabaseContext bibDatabaseContext) { + private void handleSharedDatabaseReconnectionSuccess(SharedDatabaseSessionService sessionService, + SharedDatabaseSessionService.Reconnection reconnection, + LibraryTab tab, + BibDatabaseContext bibDatabaseContext) { if (!mainStage.isShowing()) { closeTab(tab); return; @@ -687,7 +856,9 @@ private void handleSharedDatabaseReconnectionSuccess(SharedDatabaseSessionServic /// The failed loading tab has already closed itself; a [SharedDatabaseErrorTab] takes its place instead of a dialog, /// so the connection can be retried and stays remembered for the next session. - private void handleSharedDatabaseReconnectionFailure(SharedDatabaseSessionService sessionService, SharedDatabaseSessionService.Reconnection reconnection, Exception exception) { + private void handleSharedDatabaseReconnectionFailure(SharedDatabaseSessionService sessionService, + SharedDatabaseSessionService.Reconnection reconnection, + Exception exception) { LOGGER.error("Could not reconnect to shared database {}", reconnection.sharedDatabaseId(), exception); if (!mainStage.isShowing()) { return; @@ -706,7 +877,12 @@ private void handleSharedDatabaseReconnectionFailure(SharedDatabaseSessionServic @Override public void showSharedDatabaseErrorTab(SharedDatabaseErrorTab errorTab) { // Keep the remembered id while retrying with the settings from the latest attempt. - Optional remembered = tabbedPane.getTabs().stream().filter(SharedDatabaseErrorTab.class::isInstance).map(SharedDatabaseErrorTab.class::cast).filter(existing -> DBMSConnectionProperties.isSameDatabase(existing.getConnectionProperties(), errorTab.getConnectionProperties())).filter(existing -> existing.getSharedDatabaseId().isPresent()).findFirst(); + Optional remembered = tabbedPane.getTabs().stream() + .filter(SharedDatabaseErrorTab.class::isInstance) + .map(SharedDatabaseErrorTab.class::cast) + .filter(existing -> DBMSConnectionProperties.isSameDatabase(existing.getConnectionProperties(), errorTab.getConnectionProperties())) + .filter(existing -> existing.getSharedDatabaseId().isPresent()) + .findFirst(); if (remembered.isPresent()) { SharedDatabaseErrorTab rememberedTab = remembered.orElseThrow(); rememberedTab.updateFailure(errorTab); @@ -733,7 +909,10 @@ static void addSharedDatabaseErrorTab(TabPane tabbedPane, SharedDatabaseErrorTab @Override public List getUnconnectedSharedDatabaseIds() { - return tabbedPane.getTabs().stream().filter(SharedDatabaseErrorTab.class::isInstance).flatMap(tab -> ((SharedDatabaseErrorTab) tab).getSharedDatabaseId().stream()).toList(); + return tabbedPane.getTabs().stream() + .filter(SharedDatabaseErrorTab.class::isInstance) + .flatMap(tab -> ((SharedDatabaseErrorTab) tab).getSharedDatabaseId().stream()) + .toList(); } @Override @@ -807,7 +986,11 @@ public CloseOthersDatabaseAction(LibraryTab libraryTab) { @Override public void execute() { LibraryTab toKeepLibraryTab = Optional.of(libraryTab).get(); - List libraryTabs = tabbedPane.getTabs().stream().filter(LibraryTab.class::isInstance).map(LibraryTab.class::cast).filter(tab -> tab != toKeepLibraryTab).toList(); + List libraryTabs = tabbedPane.getTabs().stream() + .filter(LibraryTab.class::isInstance) + .map(LibraryTab.class::cast) + .filter(tab -> tab != toKeepLibraryTab) + .toList(); for (LibraryTab tab : libraryTabs) { Platform.runLater(() -> closeTab(tab)); } diff --git a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneComponent.java b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneComponent.java index a90a9e43e842..633947437075 100644 --- a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneComponent.java +++ b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneComponent.java @@ -7,6 +7,7 @@ import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; +import javafx.scene.layout.Region; import javafx.scene.layout.VBox; import org.jabref.gui.actions.SimpleCommand; @@ -42,6 +43,14 @@ private void initialize() { setTop(createHeaderView()); setCenter(contentFactory.create(sidePaneType)); VBox.setVgrow(this, sidePaneType == SidePaneType.GROUPS ? Priority.ALWAYS : Priority.NEVER); + + if (sidePaneType == SidePaneType.GROUPS) { + // keep a few rows visible; the groups list scrolls inside this height + setMinHeight(150); + } else { + // never squeeze or cut off the other panels + setMinHeight(Region.USE_PREF_SIZE); + } } private Node createHeaderView() { diff --git a/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css b/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css index 4728818eb200..6e8ebd718ef4 100644 --- a/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css +++ b/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css @@ -1824,3 +1824,11 @@ We want to have a look that matches our icons in the tool-bar */ .side-pane-scroll > .viewport { -fx-background-color: transparent; } +.side-pane-scroll > .scroll-bar:vertical { + -fx-pref-width: 6; + -fx-padding: 0 0 0 6; + -fx-opacity: 0.6; +} +.side-pane-scroll > .scroll-bar:vertical > .track { + -fx-background-color: transparent; +} From 9ba84fd1a602eb4722f245b48855707cfe9e703d Mon Sep 17 00:00:00 2001 From: yash-dev07 Date: Mon, 9 Nov 2026 15:45:38 +0530 Subject: [PATCH 13/13] Simplify side pane scrolling --- .../java/org/jabref/gui/frame/JabRefFrame.java | 17 +++++++++++++---- .../jabref/gui/sidepane/SidePaneComponent.java | 4 +--- .../jabref/gui/theme/internal/jabref-base.css | 12 ++---------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java index 9c003f61fdd2..38de0e93217c 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java @@ -19,6 +19,7 @@ import javafx.geometry.Orientation; import javafx.scene.Node; import javafx.scene.control.ContextMenu; +import javafx.scene.control.ScrollPane; import javafx.scene.control.SeparatorMenuItem; import javafx.scene.control.SplitPane; import javafx.scene.control.Tab; @@ -119,6 +120,7 @@ private enum PanelMode { MAIN_TABLE, MAIN_TABLE_AND_ENTRY_EDITOR } private final GuiPushToApplicationCommand pushToApplicationCommand; private final SplitPane horizontalSplit = new SplitPane(); private final SidePane sidePane; + private final ScrollPane sidePaneScroll = new ScrollPane(); private final SplitPane verticalSplit = new SplitPane(); private final TabPane tabbedPane = new TabPane(); private final EntryEditor entryEditor; @@ -275,7 +277,14 @@ private void initLayout() { horizontalSplit.getItems().addAll(verticalSplit); horizontalSplit.setOrientation(Orientation.HORIZONTAL); - SplitPane.setResizableWithParent(sidePane, false); + sidePaneScroll.setContent(sidePane); + sidePaneScroll.setFitToWidth(true); + sidePaneScroll.setFitToHeight(true); + sidePaneScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); + sidePaneScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); + sidePaneScroll.getStyleClass().add("side-pane-scroll"); + + SplitPane.setResizableWithParent(sidePaneScroll, false); sidePane.widthProperty().addListener(_ -> updateSidePane()); sidePane.getChildren().addListener((InvalidationListener) _ -> updateSidePane()); updateSidePane(); @@ -285,11 +294,11 @@ private void initLayout() { private void updateSidePane() { if (sidePane.getChildren().isEmpty()) { unsubscribeHorizontalDivider(); - horizontalSplit.getItems().remove(sidePane); + horizontalSplit.getItems().remove(sidePaneScroll); } else { - if (!horizontalSplit.getItems().contains(sidePane)) { + if (!horizontalSplit.getItems().contains(sidePaneScroll)) { horizontalSplit.setVisible(false); - horizontalSplit.getItems().addFirst(sidePane); + horizontalSplit.getItems().addFirst(sidePaneScroll); Platform.runLater(() -> { updateHorizontalDividerPosition(); horizontalSplit.setVisible(true); diff --git a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneComponent.java b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneComponent.java index 633947437075..3493ca927a59 100644 --- a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneComponent.java +++ b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneComponent.java @@ -45,10 +45,8 @@ private void initialize() { VBox.setVgrow(this, sidePaneType == SidePaneType.GROUPS ? Priority.ALWAYS : Priority.NEVER); if (sidePaneType == SidePaneType.GROUPS) { - // keep a few rows visible; the groups list scrolls inside this height - setMinHeight(150); + setMinHeight(220); } else { - // never squeeze or cut off the other panels setMinHeight(Region.USE_PREF_SIZE); } } diff --git a/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css b/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css index 6e8ebd718ef4..280f5c077bb2 100644 --- a/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css +++ b/jabgui/src/main/resources/org/jabref/gui/theme/internal/jabref-base.css @@ -1816,19 +1816,11 @@ We want to have a look that matches our icons in the tool-bar */ .flashing-danger { -fx-background-color: -color-danger; } + .side-pane-scroll { - -fx-background-color: transparent; -fx-padding: 0; } -.side-pane-scroll > .viewport { - -fx-background-color: transparent; -} .side-pane-scroll > .scroll-bar:vertical { - -fx-pref-width: 6; - -fx-padding: 0 0 0 6; - -fx-opacity: 0.6; -} -.side-pane-scroll > .scroll-bar:vertical > .track { - -fx-background-color: transparent; + -fx-padding: 0 4 0 4; }