-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add welcome screen to JabRef GUI that displays when no database/library is open #12017
base: main
Are you sure you want to change the base?
Conversation
… currently doesnt do anything useful
|
||
// Title | ||
Label welcomeLabel = new Label("Welcome to JabRef!"); | ||
welcomeLabel.setFont(new Font("Arial", 40)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add all the font and color stuff to the Base.css file?
It should also look nice with dark theme and customizable by the user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I have moved the styling to Base.css
. See screenshots below for light and dark modes:
Let me know if anything further needs to be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks already good
please extract font size and color stuff etc to css
// Ensure divider position is set before rendering | ||
splitPane.setDividerPositions(0.2); | ||
|
||
// Ensure smooth transition by updating the layout immediately | ||
Platform.runLater(() -> splitPane.setDividerPositions(0.2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand that. Both values are equal. I think, only the statement on line 271 is required?
The code of org.jabref.gui.frame.JabRefFrame#updateDividerPosition
shows different values. I think you should just call
splitPane.setDividerPositions(preferences.getGuiPreferences().getSidePaneWidth() / splitPane.getWidth());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right - splitPane.setDividerPositions(preferences.getGuiPreferences().getSidePaneWidth() / splitPane.getWidth());
works fine!
updateSidePane(); | ||
|
||
// Set the preferred width and divider position explicitly | ||
sidePane.setPrefWidth(260); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
260
is a new value. Should be stored as constant in this class. - Why is sidePane
used and not SplitPane
?
|
||
// Force divider to a known position (e.g., 0.2 of the total width) | ||
LOGGER.info("Forcing divider position after adding tab."); | ||
splitPane.setDividerPositions(0.2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
setSpacing(10); | ||
|
||
// Title | ||
Label welcomeLabel = new Label("Welcome to JabRef!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not translated. You need to use Localization.lang
. See https://devdocs.jabref.org/code-howtos/localization.html#localization for details.
@InAnYan How did you do it in the AiTab with links and sentences? Did we come up with a good solution.
@HaynesCrossley-ANU I am asking for help here, because for translation, we aim for translating whole sentences. Reason: In different languages, the ordering of words within a sentence is different. (Because the grammar differs from langauge to langauge)
TextFlow openLibraryFlow = new TextFlow(orExistingDatabaseText, openLibraryLink); | ||
openLibraryFlow.setTextAlignment(TextAlignment.CENTER); | ||
|
||
// Add elements to the VBox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not add comments just stating the words of the statement. You can remove these kinds of comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted thank you - comments removed.
Hey @koppor I am in the same team as @HaynesCrossley-ANU and @surymishra. I will be contributing to this PR as well. I'm wondering whether there is a preferred way to translate sentences that have links? There are two simple solutions.
If neither approach is suitable, I'm wondering what techniques have been used in the past for this project? |
@ch, hi! You can do this: Replace link with %0, and then after you call Localization.lang replace %0 with link. You can actually use whole sentence as a link, or use a TextFlow with Text and Hyperlink |
Issue 96 review changes
@InAnYan, thank you for the response. I will apply that and update the PR once that is sorted out |
# Conflicts: # src/main/resources/l10n/JabRef_en.properties
Hey @koppor, All requested changes have been made. We would like a review and feedback if any other changes are necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | ||
* A simple Welcome Page for the JabRef application. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove JavaDoc - the class name already says this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted thanks! comments removed
I'm having trouble understanding the implementation of "after you call Localization.lang replace %0 with link". For instance doing |
Hi, I like your implementation of the WelcomePage, especially with the changes that were suggested. However: I would prefer to have the welcome page either as a placeholder (for some nice implementation ideas see https://stackoverflow.com/questions/35239420/display-label-if-tabpane-has-no-tabs ) or as a separate tab. |
Side comment: We use sentence case. A "new library" is "created", "open" is for existing libraries.
Side information - what we meant: String part1 = Localization.lang("Create a %0\nor %1");
part1 = part1.replace("%0", Localization.lang("new library");
part1 = part1.replace("%1", Localization.lang("open an existing library"); BUT we think, the terms should be the same terms as in the menu. The menu is as follows: After "Welcome to JabRef", add a heading "Start" and below two actions: "New library" and "Open library". Similar to VS.Code:
|
Closing this issue due to inactivity 💤 |
Closes https://github.com/koppor/jabref/issues/96 by implementing a 'welcome' screen when no database/library is open in Jabref.
Added:
WelcomeScreen.java
- representing the welcome screen elements which includes links to open a new library or an existing library (utilizing existing logic to handle these actions).Modified:
JabRefFrame.java
- added some logic that checks if a database is open, and then toggles the visibility of the welcome screen accordingly.Demonstration:
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)