9
9
import javafx .scene .control .MenuItem ;
10
10
import javafx .scene .control .ScrollPane ;
11
11
import javafx .scene .control .Tab ;
12
+ import javafx .scene .layout .BorderPane ;
12
13
import javafx .scene .layout .HBox ;
14
+ import javafx .scene .layout .Priority ;
13
15
import javafx .scene .layout .StackPane ;
14
16
import javafx .scene .layout .VBox ;
15
17
18
+ import org .jabref .gui .actions .StandardActions ;
19
+ import org .jabref .gui .edit .OpenBrowserAction ;
16
20
import org .jabref .gui .frame .FileHistoryMenu ;
21
+ import org .jabref .gui .icon .IconTheme ;
17
22
import org .jabref .gui .importer .NewDatabaseAction ;
18
23
import org .jabref .gui .importer .actions .OpenDatabaseAction ;
19
24
import org .jabref .gui .preferences .GuiPreferences ;
20
25
import org .jabref .gui .undo .CountingUndoManager ;
21
26
import org .jabref .logic .ai .AiService ;
22
27
import org .jabref .logic .l10n .Localization ;
28
+ import org .jabref .logic .util .BuildInfo ;
23
29
import org .jabref .logic .util .TaskExecutor ;
24
30
import org .jabref .model .entry .BibEntryTypesManager ;
25
31
import org .jabref .model .util .FileUpdateMonitor ;
@@ -38,6 +44,7 @@ public class WelcomeTab extends Tab {
38
44
private final ClipBoardManager clipBoardManager ;
39
45
private final TaskExecutor taskExecutor ;
40
46
private final FileHistoryMenu fileHistoryMenu ;
47
+ private final BuildInfo buildInfo ;
41
48
42
49
public WelcomeTab (LibraryTabContainer tabContainer ,
43
50
GuiPreferences preferences ,
@@ -49,7 +56,8 @@ public WelcomeTab(LibraryTabContainer tabContainer,
49
56
CountingUndoManager undoManager ,
50
57
ClipBoardManager clipBoardManager ,
51
58
TaskExecutor taskExecutor ,
52
- FileHistoryMenu fileHistoryMenu ) {
59
+ FileHistoryMenu fileHistoryMenu ,
60
+ BuildInfo buildInfo ) {
53
61
54
62
super (Localization .lang ("Welcome" ));
55
63
setClosable (true );
@@ -65,6 +73,7 @@ public WelcomeTab(LibraryTabContainer tabContainer,
65
73
this .clipBoardManager = clipBoardManager ;
66
74
this .taskExecutor = taskExecutor ;
67
75
this .fileHistoryMenu = fileHistoryMenu ;
76
+ this .buildInfo = buildInfo ;
68
77
69
78
this .recentLibrariesBox = new VBox (5 );
70
79
@@ -94,7 +103,14 @@ public WelcomeTab(LibraryTabContainer tabContainer,
94
103
welcomePageContainer .getChildren ().addAll (welcomeBox , startBox , recentBox );
95
104
welcomeMainContainer .getChildren ().add (welcomePageContainer );
96
105
97
- setContent (welcomeMainContainer );
106
+ BorderPane rootLayout = new BorderPane ();
107
+ rootLayout .setCenter (welcomeMainContainer );
108
+ rootLayout .setBottom (createFooter ());
109
+
110
+ VBox container = new VBox ();
111
+ container .getChildren ().add (rootLayout );
112
+ VBox .setVgrow (rootLayout , Priority .ALWAYS );
113
+ setContent (container );
98
114
}
99
115
100
116
private VBox createWelcomeBox () {
@@ -159,4 +175,76 @@ private VBox createVBoxContainer(Node... nodes) {
159
175
box .getChildren ().addAll (nodes );
160
176
return box ;
161
177
}
178
+
179
+ private VBox createFooter () {
180
+ Label communityLabel = new Label (Localization .lang ("Community" ));
181
+ communityLabel .getStyleClass ().add ("welcome-footer-label" );
182
+
183
+ HBox iconLinksContainer = new HBox (15 );
184
+ iconLinksContainer .setAlignment (Pos .CENTER );
185
+
186
+ Hyperlink onlineHelpLink = createFooterLink (Localization .lang ("Online help" ), StandardActions .HELP , IconTheme .JabRefIcons .HELP );
187
+ Hyperlink forumLink = createFooterLink (Localization .lang ("Forum for support" ), StandardActions .OPEN_FORUM , IconTheme .JabRefIcons .FORUM );
188
+ Hyperlink mastodonLink = createFooterLink (Localization .lang ("Mastodon" ), StandardActions .OPEN_MASTODON , IconTheme .JabRefIcons .MASTODON );
189
+ Hyperlink linkedInLink = createFooterLink (Localization .lang ("LinkedIn" ), StandardActions .OPEN_LINKEDIN , IconTheme .JabRefIcons .LINKEDIN );
190
+ Hyperlink donationLink = createFooterLink (Localization .lang ("Donation" ), StandardActions .DONATE , IconTheme .JabRefIcons .DONATE );
191
+
192
+ iconLinksContainer .getChildren ().addAll (onlineHelpLink , forumLink , mastodonLink , linkedInLink , donationLink );
193
+
194
+ HBox textLinksContainer = new HBox (15 );
195
+ textLinksContainer .setAlignment (Pos .CENTER );
196
+
197
+ Hyperlink devVersionLink = createFooterLink (Localization .lang ("Download Development version" ), StandardActions .OPEN_DEV_VERSION_LINK , null );
198
+ Hyperlink changelogLink = createFooterLink (Localization .lang ("CHANGELOG" ), StandardActions .OPEN_CHANGELOG , null );
199
+
200
+ textLinksContainer .getChildren ().addAll (devVersionLink , changelogLink );
201
+
202
+ HBox versionContainer = new HBox (15 );
203
+ versionContainer .setAlignment (Pos .CENTER );
204
+ Label versionLabel = new Label (Localization .lang ("Current JabRef Version: " ) + buildInfo .version );
205
+ versionLabel .getStyleClass ().add ("welcome-footer-version" );
206
+ versionContainer .getChildren ().add (versionLabel );
207
+
208
+ VBox footerBox = new VBox (10 );
209
+ footerBox .setAlignment (Pos .CENTER );
210
+ footerBox .getChildren ().addAll (communityLabel , iconLinksContainer , textLinksContainer , versionContainer );
211
+ footerBox .setPadding (new Insets (10 , 0 , 10 , 0 ));
212
+ footerBox .getStyleClass ().add ("welcome-footer-container" );
213
+
214
+ return footerBox ;
215
+ }
216
+
217
+ private Hyperlink createFooterLink (String text , StandardActions action , IconTheme .JabRefIcons icon ) {
218
+ Hyperlink link = new Hyperlink (text );
219
+ link .getStyleClass ().add ("welcome-footer-link" );
220
+
221
+ String url = switch (action ) {
222
+ case HELP ->
223
+ "https://help.jabref.org/" ;
224
+ case OPEN_FORUM ->
225
+ "https://discourse.jabref.org/" ;
226
+ case OPEN_MASTODON ->
227
+ "https://foojay.social/@jabref" ;
228
+ case OPEN_LINKEDIN ->
229
+ "https://linkedin.com/company/jabref/" ;
230
+ case DONATE ->
231
+ "https://donate.jabref.org" ;
232
+ case OPEN_DEV_VERSION_LINK ->
233
+ "https://builds.jabref.org/master/" ;
234
+ case OPEN_CHANGELOG ->
235
+ "https://github.com/JabRef/jabref/blob/main/CHANGELOG.md" ;
236
+ default ->
237
+ null ;
238
+ };
239
+
240
+ if (url != null ) {
241
+ link .setOnAction (e -> new OpenBrowserAction (url , dialogService , preferences .getExternalApplicationsPreferences ()).execute ());
242
+ }
243
+
244
+ if (icon != null ) {
245
+ link .setGraphic (icon .getGraphicNode ());
246
+ }
247
+
248
+ return link ;
249
+ }
162
250
}
0 commit comments