Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a welcome screen if no database is open #12461

Merged
merged 70 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
08ec5d8
Fix #12272 - Show a welcome screen if no database is open
oops-shlok Feb 4, 2025
684f7df
Fix #12272 - Fix missing localisation keys for WelcomePage
oops-shlok Feb 4, 2025
3759e24
Fix #12272 - Fix missing localisation keys for WelcomePage
oops-shlok Feb 4, 2025
9fc595d
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 5, 2025
4e576e9
Fix #12272 - Addressed 1st Review Changes
oops-shlok Feb 5, 2025
52409bd
Fix #12272 - Checkstyle issue fix in ExportCommand file
oops-shlok Feb 5, 2025
f130244
Reverted csl-styles submodule changes
oops-shlok Feb 5, 2025
2559f22
Reverted abbrv.jabref.org submodule changes
oops-shlok Feb 5, 2025
0d240c9
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 6, 2025
cb05ec7
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 11, 2025
0489da1
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 13, 2025
669083d
Integrated WelcomePage in WelcomeTab and code changes
oops-shlok Feb 13, 2025
cf3188e
Implemented Review Changes 5
oops-shlok Feb 14, 2025
e5a4840
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 14, 2025
d4332c6
Fix #12272 - Localization key fix in JabRef_en.properties
oops-shlok Feb 14, 2025
c11ca80
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 17, 2025
5c0b6ee
Implemented Open Welcome tab in help menu option and open welcome tab…
oops-shlok Feb 17, 2025
f97be18
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 18, 2025
cdc1977
Implemented Review Changes 6
oops-shlok Feb 18, 2025
7db3b81
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 23, 2025
4de4651
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Feb 25, 2025
815ba53
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Feb 26, 2025
c401e67
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 4, 2025
dea3f05
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
oops-shlok Mar 4, 2025
40c4ca3
Reverted Interface changes and fixed save as and save for welcome tab
oops-shlok Mar 4, 2025
a8ee2c8
Fixed checkstyle import issue
oops-shlok Mar 4, 2025
f048c4b
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 4, 2025
0e5ed41
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 6, 2025
76b1aba
Simplify and fix casting
calixtus Mar 6, 2025
970d7e8
Fix casting
calixtus Mar 6, 2025
fbf3405
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 7, 2025
5e199c4
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
oops-shlok Mar 7, 2025
e373b34
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 8, 2025
fc78dc5
Fixed Responsiveness
oops-shlok Mar 8, 2025
66ccb58
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 10, 2025
1e24223
Undo newlines in MainToolBar.java
calixtus Mar 10, 2025
8efa826
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 11, 2025
5196593
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
oops-shlok Mar 11, 2025
afa8b54
Added Footer for Welcome Tab
oops-shlok Mar 11, 2025
d920d6c
Fixed Localization issues
oops-shlok Mar 11, 2025
5aa63d2
Merge branch 'main' of https://github.com/JabRef/jabref into fix-for-…
oops-shlok Mar 17, 2025
fcc5be3
Fixed Recents Library issue
oops-shlok Mar 17, 2025
a6d50e2
Fixed Tragbot review for Footer
oops-shlok Mar 17, 2025
2f9811f
Refactored the code as suggested in review comments
oops-shlok Mar 17, 2025
8885b4d
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
721a77f
Introduced URLs Util
oops-shlok Mar 17, 2025
6744ec2
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
22347f8
Fixed Localization issues
oops-shlok Mar 17, 2025
a8ac3e5
Fixed Localization issues
oops-shlok Mar 17, 2025
cc78bbe
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
cd11463
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
efc4767
Fixed Localization issues
oops-shlok Mar 17, 2025
c0a4696
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
oops-shlok Mar 17, 2025
8aed6f7
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 17, 2025
7ba378d
Fixed missing Localization in WelcomeTab
oops-shlok Mar 17, 2025
95a93eb
Fixed missing Localization in WelcomeTab
oops-shlok Mar 17, 2025
0e786cc
Fixed Review changes
oops-shlok Mar 17, 2025
f6a5587
Added Changelog entry
oops-shlok Mar 17, 2025
ba1ad6f
Update src/main/java/org/jabref/gui/frame/JabRefFrame.java
koppor Mar 19, 2025
23891b6
Update src/main/java/org/jabref/gui/WelcomeTab.java
koppor Mar 19, 2025
4bc74b6
Update src/main/java/org/jabref/gui/frame/JabRefFrame.java
koppor Mar 19, 2025
0076919
Fixed Localization issue
oops-shlok Mar 19, 2025
a71d9fb
Merge branch 'main' into fix-for-issue-#12272
oops-shlok Mar 19, 2025
3c14ba8
Fix position of showing welcome tab
koppor Mar 19, 2025
c94fb15
Streamline wording
koppor Mar 19, 2025
c695f5b
Merge branch 'fix-for-issue-#12272' of https://github.com/oops-shlok/…
koppor Mar 19, 2025
5115579
Remove obsolete strings
koppor Mar 19, 2025
f7c0c3b
Fix obsolete code
koppor Mar 19, 2025
5d84d89
Fix comment
koppor Mar 19, 2025
37e24d2
Fix localization
koppor Mar 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv

### Added

- We added a new Welcome tab which shows a welcome screen if no database is open. [#12272](https://github.com/JabRef/jabref/issues/12272)
- We added <kbd>F5</kbd> as a shortcut key for fetching data and <kbd>Alt+F</kbd> as a shortcut for looking up data using DOI. [#11802](https://github.com/JabRef/jabref/issues/11802)
- We added a feature to rename the subgroup, with the keybinding (<kbd>F2</kbd>) for quick access. [#11896](https://github.com/JabRef/jabref/issues/11896)
- We added a new functionality that displays a drop-down list of matching suggestions when typing a citation key pattern. [#12502](https://github.com/JabRef/jabref/issues/12502)
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ public void processArguments() {
uiCommands.add(new UiCommand.OpenDatabases(loaded));
}

if (cli.isBlank() && loaded.isEmpty()) {
uiCommands.add(new UiCommand.BlankWorkspace());
}

if (cli.isCheckConsistency()) {
checkConsistency(cliPreferences, entryTypesManager);
}
Expand Down
61 changes: 61 additions & 0 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,67 @@ We want to have a look that matches our icons in the tool-bar */
-fx-effect: dropshadow(three-pass-box, rgba(0, 0, 0, 0.6), 8, 0.0, 0, 0);
}

.welcome-label {
-fx-font-size: 2.75em;
-fx-text-fill: -jr-theme-text;
-fx-font-family: "Arial";
}

.welcome-description-label {
-fx-font-size: 1.75em;
-fx-font-family: "Arial";
}

.welcome-header-label {
-fx-font-size: 1.5em;
-fx-font-weight: bold;
-fx-font-family: "Arial";
}

.welcome-no-recent-label {
-fx-font-size: 1.25em;
-fx-text-fill: -jr-theme;
-fx-font-family: "Arial";
}

.welcome-hyperlink {
-fx-font-size: 1.25em;
-fx-text-fill: -jr-theme;
}

.welcome-hyperlink:visited {
-fx-text-fill: -jr-theme;
}

.welcome-footer-container {
-fx-padding: 15px;
-fx-alignment: center;
-fx-spacing: 15px;
}

.welcome-footer-label {
-fx-font-size: 2.25em;
-fx-text-fill: -jr-theme-text;
-fx-font-family: "Arial";
}

.welcome-footer-link {
-fx-font-size: 1.2em;
-fx-text-fill: -jr-theme;
-fx-font-family: "Arial";
}

.welcome-footer-link:hover {
-fx-underline: true;
-fx-text-fill: derive(-jr-theme, -20%);
}

.welcome-footer-version {
-fx-font-size: 1.2em;
-fx-text-fill: -jr-theme;
-fx-font-family: "Arial";
}

/* AboutDialog */
#aboutDialog .about-heading {
-fx-font-size: 30;
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ private void openWindow() {
LOGGER.debug("frame initialized");

Platform.runLater(() -> mainFrame.handleUiCommands(uiCommands));

// Lifecycle note: after this method, #onShowing will be called
}

public void onShowing(WindowEvent event) {
Expand All @@ -270,6 +272,13 @@ public void onShowing(WindowEvent event) {
&& preferences.getWorkspacePreferences().shouldOpenLastEdited()) {
mainFrame.openLastEditedDatabases();
}

Platform.runLater(() -> {
// We need to check at this point, because here, all libraries are loaded (e.g., load previously opened libraries) and all UI commands (e.g., load libraries, blank workspace, ...) are handled.
if (stateManager.getOpenDatabases().isEmpty()) {
mainFrame.showWelcomeTab();
}
});
}

public void onCloseRequest(WindowEvent event) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@ private void onClosed(Event event) {
if (tableModel != null) {
tableModel.unbind();
}

// clean up the groups map
stateManager.clearSelectedGroups(bibDatabaseContext);
}
Expand Down
261 changes: 261 additions & 0 deletions src/main/java/org/jabref/gui/WelcomeTab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
package org.jabref.gui;

import javafx.collections.ListChangeListener;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Tab;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;

import org.jabref.gui.actions.StandardActions;
import org.jabref.gui.edit.OpenBrowserAction;
import org.jabref.gui.frame.FileHistoryMenu;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.importer.NewDatabaseAction;
import org.jabref.gui.importer.actions.OpenDatabaseAction;
import org.jabref.gui.preferences.GuiPreferences;
import org.jabref.gui.undo.CountingUndoManager;
import org.jabref.gui.util.URLs;
import org.jabref.logic.ai.AiService;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.BuildInfo;
import org.jabref.logic.util.TaskExecutor;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.util.FileUpdateMonitor;

public class WelcomeTab extends Tab {

private final VBox recentLibrariesBox;
private final LibraryTabContainer tabContainer;
private final GuiPreferences preferences;
private final AiService aiService;
private final DialogService dialogService;
private final StateManager stateManager;
private final FileUpdateMonitor fileUpdateMonitor;
private final BibEntryTypesManager entryTypesManager;
private final CountingUndoManager undoManager;
private final ClipBoardManager clipBoardManager;
private final TaskExecutor taskExecutor;
private final FileHistoryMenu fileHistoryMenu;
private final BuildInfo buildInfo;

public WelcomeTab(LibraryTabContainer tabContainer,
GuiPreferences preferences,
AiService aiService,
DialogService dialogService,
StateManager stateManager,
FileUpdateMonitor fileUpdateMonitor,
BibEntryTypesManager entryTypesManager,
CountingUndoManager undoManager,
ClipBoardManager clipBoardManager,
TaskExecutor taskExecutor,
FileHistoryMenu fileHistoryMenu,
BuildInfo buildInfo) {

super(Localization.lang("Welcome"));
setClosable(true);

this.tabContainer = tabContainer;
this.preferences = preferences;
this.aiService = aiService;
this.dialogService = dialogService;
this.stateManager = stateManager;
this.fileUpdateMonitor = fileUpdateMonitor;
this.entryTypesManager = entryTypesManager;
this.undoManager = undoManager;
this.clipBoardManager = clipBoardManager;
this.taskExecutor = taskExecutor;
this.fileHistoryMenu = fileHistoryMenu;
this.buildInfo = buildInfo;

this.recentLibrariesBox = new VBox(10);

VBox welcomeBox = createWelcomeBox();
VBox startBox = createWelcomeStartBox();
VBox recentBox = createWelcomeRecentBox();

VBox welcomePageContainer = new VBox(10);
welcomePageContainer.setAlignment(Pos.CENTER);
welcomePageContainer.getChildren().addAll(welcomeBox, startBox, recentBox);

HBox welcomeMainContainer = new HBox(10);
welcomeMainContainer.setAlignment(Pos.CENTER);
welcomeMainContainer.setPadding(new Insets(10, 10, 10, 50));

welcomeMainContainer.getChildren().add(welcomePageContainer);

BorderPane rootLayout = new BorderPane();
rootLayout.setCenter(welcomeMainContainer);
rootLayout.setBottom(createFooter());

VBox container = new VBox();
container.getChildren().add(rootLayout);
VBox.setVgrow(rootLayout, Priority.ALWAYS);
setContent(container);
}

private VBox createWelcomeBox() {
Label welcomeLabel = new Label(Localization.lang("Welcome to JabRef"));
welcomeLabel.getStyleClass().add("welcome-label");

Label descriptionLabel = new Label(Localization.lang("Stay on top of your literature"));
descriptionLabel.getStyleClass().add("welcome-description-label");

return createVBoxContainer(welcomeLabel, descriptionLabel);
}

private VBox createWelcomeStartBox() {
Label startLabel = new Label(Localization.lang("Start"));
startLabel.getStyleClass().add("welcome-header-label");

Hyperlink newLibraryLink = new Hyperlink(Localization.lang("New library"));
newLibraryLink.getStyleClass().add("welcome-hyperlink");
newLibraryLink.setOnAction(e -> new NewDatabaseAction(tabContainer, preferences).execute());

Hyperlink openLibraryLink = new Hyperlink(Localization.lang("Open library"));
openLibraryLink.getStyleClass().add("welcome-hyperlink");
openLibraryLink.setOnAction(e -> new OpenDatabaseAction(tabContainer, preferences, aiService, dialogService,
stateManager, fileUpdateMonitor, entryTypesManager, undoManager, clipBoardManager,
taskExecutor).execute());

return createVBoxContainer(startLabel, newLibraryLink, openLibraryLink);
}

private VBox createWelcomeRecentBox() {
Label recentLabel = new Label(Localization.lang("Recent"));
recentLabel.getStyleClass().add("welcome-header-label");

recentLibrariesBox.setAlignment(Pos.TOP_LEFT);
updateWelcomeRecentLibraries();

fileHistoryMenu.getItems().addListener((ListChangeListener<MenuItem>) change -> updateWelcomeRecentLibraries());

return createVBoxContainer(recentLabel, recentLibrariesBox);
}

private void updateWelcomeRecentLibraries() {
if (fileHistoryMenu.getItems().isEmpty()) {
displayNoRecentLibrariesMessage();
return;
}

recentLibrariesBox.getChildren().clear();
fileHistoryMenu.disableProperty().unbind();
fileHistoryMenu.setDisable(false);

for (MenuItem item : fileHistoryMenu.getItems()) {
Hyperlink recentLibraryLink = new Hyperlink(item.getText());
recentLibraryLink.getStyleClass().add("welcome-hyperlink");
recentLibraryLink.setOnAction(item.getOnAction());
recentLibrariesBox.getChildren().add(recentLibraryLink);
}
}

private void displayNoRecentLibrariesMessage() {
recentLibrariesBox.getChildren().clear();
Label noRecentLibrariesLabel = new Label(Localization.lang("No recent libraries"));
noRecentLibrariesLabel.getStyleClass().add("welcome-no-recent-label");
recentLibrariesBox.getChildren().add(noRecentLibrariesLabel);

fileHistoryMenu.disableProperty().unbind();
fileHistoryMenu.setDisable(true);
}

private VBox createVBoxContainer(Node... nodes) {
VBox box = new VBox(10);
box.setAlignment(Pos.TOP_LEFT);
box.getChildren().addAll(nodes);
return box;
}

private VBox createFooter() {
// Heading for the footer area
Label communityLabel = createFooterLabel(Localization.lang("Community"));

HBox iconLinksContainer = createIconLinksContainer();
HBox textLinksContainer = createTextLinksContainer();
HBox versionContainer = createVersionContainer();

VBox footerBox = new VBox(10);
footerBox.setAlignment(Pos.CENTER);
footerBox.getChildren().addAll(communityLabel, iconLinksContainer, textLinksContainer, versionContainer);
footerBox.setPadding(new Insets(10, 0, 10, 0));
footerBox.getStyleClass().add("welcome-footer-container");

return footerBox;
}

private Label createFooterLabel(String text) {
Label label = new Label(text);
label.getStyleClass().add("welcome-footer-label");
return label;
}

private HBox createIconLinksContainer() {
HBox container = new HBox(10);
container.setAlignment(Pos.CENTER);

Hyperlink onlineHelpLink = createFooterLink(Localization.lang("Online help"), StandardActions.HELP, IconTheme.JabRefIcons.HELP);
Hyperlink forumLink = createFooterLink(Localization.lang("Community forum"), StandardActions.OPEN_FORUM, IconTheme.JabRefIcons.FORUM);
Hyperlink mastodonLink = createFooterLink(Localization.lang("Mastodon"), StandardActions.OPEN_MASTODON, IconTheme.JabRefIcons.MASTODON);
Hyperlink linkedInLink = createFooterLink(Localization.lang("LinkedIn"), StandardActions.OPEN_LINKEDIN, IconTheme.JabRefIcons.LINKEDIN);
Hyperlink donationLink = createFooterLink(Localization.lang("Donation"), StandardActions.DONATE, IconTheme.JabRefIcons.DONATE);

container.getChildren().addAll(onlineHelpLink, forumLink, mastodonLink, linkedInLink, donationLink);
return container;
}

private HBox createTextLinksContainer() {
HBox container = new HBox(10);
container.setAlignment(Pos.CENTER);

Hyperlink devVersionLink = createFooterLink(Localization.lang("Download development version"), StandardActions.OPEN_DEV_VERSION_LINK, null);
Hyperlink changelogLink = createFooterLink(Localization.lang("CHANGELOG"), StandardActions.OPEN_CHANGELOG, null);

container.getChildren().addAll(devVersionLink, changelogLink);
return container;
}

private Hyperlink createFooterLink(String text, StandardActions action, IconTheme.JabRefIcons icon) {
Hyperlink link = new Hyperlink(text);
link.getStyleClass().add("welcome-footer-link");

String url = switch (action) {
case HELP -> URLs.HELP_URL;
case OPEN_FORUM -> URLs.FORUM_URL;
case OPEN_MASTODON -> URLs.MASTODON_URL;
case OPEN_LINKEDIN -> URLs.LINKEDIN_URL;
case DONATE -> URLs.DONATE_URL;
case OPEN_DEV_VERSION_LINK -> URLs.DEV_VERSION_LINK_URL;
case OPEN_CHANGELOG -> URLs.CHANGELOG_URL;
default -> null;
};

if (url != null) {
link.setOnAction(e -> new OpenBrowserAction(url, dialogService, preferences.getExternalApplicationsPreferences()).execute());
}

if (icon != null) {
link.setGraphic(icon.getGraphicNode());
}

return link;
}

private HBox createVersionContainer() {
HBox container = new HBox(10);
container.setAlignment(Pos.CENTER);

Label versionLabel = new Label(Localization.lang("Current JabRef version: %0", buildInfo.version));
versionLabel.getStyleClass().add("welcome-footer-version");

container.getChildren().add(versionLabel);
return container;
}
}
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ public enum StandardActions implements Action {
OPEN_CHANGELOG(Localization.lang("View change log"), Localization.lang("See what has been changed in the JabRef versions")),
OPEN_GITHUB("GitHub", Localization.lang("Opens JabRef's GitHub page"), IconTheme.JabRefIcons.GITHUB),
DONATE(Localization.lang("Donate to JabRef"), Localization.lang("Donate to JabRef"), IconTheme.JabRefIcons.DONATE),
OPEN_FORUM(Localization.lang("Online help forum"), Localization.lang("Online help forum"), IconTheme.JabRefIcons.FORUM),
OPEN_FORUM(Localization.lang("Community forum"), Localization.lang("Community forum"), IconTheme.JabRefIcons.FORUM),
ERROR_CONSOLE(Localization.lang("View event log"), Localization.lang("Display all error messages")),
SEARCH_FOR_UPDATES(Localization.lang("Check for updates")),
ABOUT(Localization.lang("About JabRef"), Localization.lang("About JabRef")),
OPEN_WELCOME_TAB(Localization.lang("Open welcome tab")),

EDIT_LIST(Localization.lang("Edit"), IconTheme.JabRefIcons.EDIT),
VIEW_LIST(Localization.lang("View"), IconTheme.JabRefIcons.FILE),
Expand Down
Loading
Loading