Skip to content

Commit 858c4a8

Browse files
committed
Use SVG icon for splashscreen
1 parent 8eec476 commit 858c4a8

File tree

6 files changed

+86
-27
lines changed

6 files changed

+86
-27
lines changed

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ commons-math3.version=3.6.1
6666
commons-net.version=3.6
6767
commons-pool2.version=2.8.0
6868
commons-text.version=1.8
69-
darklaf-core.version=1.4.2.0
69+
darklaf.version=1.4.2.0
7070
dec.version=0.1.2
7171
dnsjava.version=2.1.9
7272
equalsverifier.version=3.1.12
@@ -113,6 +113,7 @@ Saxon-HE.version=9.9.1-7
113113
slf4j.version=1.7.30
114114
spock-core.version=1.2-groovy-2.4
115115
springframework.version=4.3.17.RELEASE
116+
svgSalamander.version=1.1.2.1
116117
tika.version=1.23
117118
xalan.version=2.7.2
118119
xercesImpl.version=2.12.0

src/bom/build.gradle.kts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ dependencies {
4848
// dependency on it during compilation
4949
runtimev("org.apache.tika:tika-parsers", "tika")
5050
runtimev("org.ow2.asm:asm")
51-
apiv("com.github.weisj:darklaf-core")
5251

5352
// activemq-all should not be used as it provides secondary slf4j binding
5453
runtimev("org.apache.activemq:activemq-broker", "activemq")
@@ -63,8 +62,11 @@ dependencies {
6362
apiv("com.fasterxml.jackson.core:jackson-core", "jackson")
6463
apiv("com.fasterxml.jackson.core:jackson-databind", "jackson-databind")
6564
apiv("com.fifesoft:rsyntaxtextarea")
65+
apiv("com.formdev:svgSalamander")
6666
apiv("com.github.ben-manes.caffeine:caffeine")
6767
apiv("com.github.tomakehurst:wiremock-jre8")
68+
apiv("com.github.weisj:darklaf-core", "darklaf")
69+
apiv("com.github.weisj:darklaf-property-loader", "darklaf")
6870
apiv("com.helger:ph-commons")
6971
apiv("com.helger:ph-css")
7072
apiv("com.jayway.jsonpath:json-path")

src/core/build.gradle.kts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ dependencies {
2424
api(project(":src:jorphan"))
2525
testCompile(project(":src:jorphan", "testClasses"))
2626

27-
implementation("com.github.weisj:darklaf-core")
2827
api("bsf:bsf") {
2928
because("protected BSFManager BSFTestElement#getManager()")
3029
}
@@ -62,23 +61,22 @@ dependencies {
6261
because("Groovy is a default JSR232 engine")
6362
}
6463

65-
implementation("org.slf4j:jcl-over-slf4j")
66-
implementation("commons-codec:commons-codec") {
67-
because("DigestUtils")
68-
}
69-
implementation("commons-collections:commons-collections")
70-
implementation("com.github.ben-manes.caffeine:caffeine")
7164
implementation("com.fasterxml.jackson.core:jackson-annotations")
7265
implementation("com.fasterxml.jackson.core:jackson-core")
7366
implementation("com.fasterxml.jackson.core:jackson-databind")
67+
implementation("com.formdev:svgSalamander")
68+
implementation("com.github.ben-manes.caffeine:caffeine")
69+
implementation("com.github.weisj:darklaf-core")
70+
implementation("com.github.weisj:darklaf-property-loader")
7471
implementation("com.miglayout:miglayout-swing")
75-
implementation("org.freemarker:freemarker")
76-
implementation("org.mozilla:rhino")
77-
implementation("org.apache.xmlgraphics:xmlgraphics-commons")
78-
implementation("org.apache.commons:commons-text")
72+
implementation("commons-codec:commons-codec") {
73+
because("DigestUtils")
74+
}
75+
implementation("commons-collections:commons-collections")
7976
implementation("org.apache.commons:commons-math3") {
8077
because("Mean, DescriptiveStatistics")
8178
}
79+
implementation("org.apache.commons:commons-text")
8280
// For some reason JMeter bundles just tika-core and tika-parsers without transitive
8381
// dependencies. So we exclude those
8482
implementation("org.apache.tika:tika-core") {
@@ -87,8 +85,12 @@ dependencies {
8785
runtimeOnly("org.apache.tika:tika-parsers") {
8886
isTransitive = false
8987
}
88+
implementation("org.apache.xmlgraphics:xmlgraphics-commons")
89+
implementation("org.freemarker:freemarker")
9090
implementation("org.jodd:jodd-core")
9191
implementation("org.jodd:jodd-props")
92+
implementation("org.mozilla:rhino")
93+
implementation("org.slf4j:jcl-over-slf4j")
9294
// TODO: JMeter bundles Xerces, however the reason is unknown
9395
runtimeOnly("xerces:xercesImpl")
9496
runtimeOnly("xml-apis:xml-apis")
@@ -119,3 +121,9 @@ val versionClass by tasks.registering(Sync::class) {
119121
ide {
120122
generatedJavaSources(versionClass.get(), generatedVersionDir)
121123
}
124+
125+
tasks.jar {
126+
into("org/apache/jmeter/images") {
127+
from("$rootDir/xdocs/images/logo.svg")
128+
}
129+
}

src/core/src/main/java/org/apache/jmeter/SplashScreen.java

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,73 @@
1818
package org.apache.jmeter;
1919

2020
import java.awt.BorderLayout;
21+
import java.net.URI;
22+
import java.net.URISyntaxException;
23+
import java.net.URL;
2124

25+
import javax.swing.Icon;
26+
import javax.swing.JComponent;
2227
import javax.swing.JLabel;
2328
import javax.swing.JProgressBar;
2429
import javax.swing.JWindow;
2530
import javax.swing.SwingUtilities;
2631
import javax.swing.border.EmptyBorder;
2732

2833
import org.apache.jmeter.util.JMeterUtils;
34+
import org.slf4j.Logger;
35+
import org.slf4j.LoggerFactory;
36+
37+
import com.github.weisj.darklaf.icons.ThemedSVGIcon;
2938

3039
/**
3140
* Splash Screen
3241
* @since 3.2
3342
*/
3443
public class SplashScreen extends JWindow {
44+
private static final Logger log = LoggerFactory.getLogger(SplashScreen.class);
3545

3646
private static final long serialVersionUID = 1L;
37-
private BorderLayout borderLayout = new BorderLayout();
38-
private JLabel imageLabel = new JLabel();
39-
private JProgressBar progressBar = new JProgressBar(0, 100);
47+
private final JProgressBar progressBar = new JProgressBar(0, 100);
4048

4149
/**
4250
* Constructor
4351
*/
4452
public SplashScreen() {
45-
imageLabel.setIcon(JMeterUtils.getImage("jmeter.png"));
46-
imageLabel.setBorder(new EmptyBorder(10, 10, 10, 10));
47-
setLayout(borderLayout);
48-
add(imageLabel, BorderLayout.CENTER);
53+
setLayout(new BorderLayout());
54+
add(loadLogo(), BorderLayout.CENTER);
4955
add(progressBar, BorderLayout.SOUTH);
5056
pack();
5157
setLocationRelativeTo(null);
5258
}
5359

60+
public static JComponent loadLogo() {
61+
JLabel logo = new JLabel();
62+
logo.setBorder(new EmptyBorder(10, 10, 10, 10));
63+
URI svgUri = null;
64+
String svgResourcePath = "/org/apache/jmeter/images/logo.svg";
65+
try {
66+
URL svgUrl = JMeterUtils.class.getResource(svgResourcePath);
67+
if (svgUrl != null) {
68+
svgUri = svgUrl.toURI();
69+
}
70+
} catch (URISyntaxException e) {
71+
log.warn("Unable to find logo " + svgResourcePath, e);
72+
}
73+
74+
if (svgUri != null) {
75+
Icon icon = new ThemedSVGIcon(svgUri, 521, 177);
76+
logo.setIcon(icon);
77+
} else {
78+
// Fallback logo
79+
logo.setText("<html>" +
80+
"<span style=\"font-size:30px;color:#D11123\">&nbsp;&nbsp;APACHE<br></span>" +
81+
"<span style=\"font-size:100px;font-weight:bold\">" +
82+
"<span style=\"color:#D11123\">J</span>Meter" +
83+
"<span style=\"color:#4d4d4d\">™</span></span></html>");
84+
}
85+
return logo;
86+
}
87+
5488
/**
5589
* Show screen
5690
*/

src/core/src/main/java/org/apache/jmeter/gui/action/AboutCommand.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
package org.apache.jmeter.gui.action;
1919

2020
import java.awt.BorderLayout;
21-
import java.awt.Color;
2221
import java.awt.Container;
22+
import java.awt.Cursor;
2323
import java.awt.Dimension;
2424
import java.awt.GridLayout;
2525
import java.awt.Point;
@@ -37,6 +37,7 @@
3737
import javax.swing.SwingConstants;
3838
import javax.swing.border.EmptyBorder;
3939

40+
import org.apache.jmeter.SplashScreen;
4041
import org.apache.jmeter.gui.GuiPackage;
4142
import org.apache.jmeter.gui.util.EscapeDialog;
4243
import org.apache.jmeter.util.JMeterUtils;
@@ -109,11 +110,11 @@ public void mouseClicked(MouseEvent e) {
109110
}
110111
});
111112

112-
JLabel jmeterLogo = new JLabel(JMeterUtils.getImage("jmeter.png"));
113113
JLabel copyright = new JLabel(JMeterUtils.getJMeterCopyright(), SwingConstants.CENTER);
114114
JLabel rights = new JLabel("All Rights Reserved.", SwingConstants.CENTER);
115115
JLabel version = new JLabel("Apache JMeter Version " + JMeterUtils.getJMeterVersion(), SwingConstants.CENTER);
116116
JLabel releaseNotes = new JLabel("<html><a href=\"https://jmeter.apache.org/changes.html\">Release notes</a></html>", SwingConstants.CENTER);
117+
releaseNotes.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
117118
releaseNotes.addMouseListener(new MouseAdapter() {
118119
@Override
119120
public void mouseClicked(MouseEvent e) {
@@ -133,8 +134,7 @@ public void mouseClicked(MouseEvent e) {
133134
infos.add(releaseNotes);
134135
Container panel = about.getContentPane();
135136
panel.setLayout(new BorderLayout());
136-
panel.setBackground(Color.white);
137-
panel.add(jmeterLogo, BorderLayout.NORTH);
137+
panel.add(SplashScreen.loadLogo(), BorderLayout.NORTH);
138138
panel.add(infos, BorderLayout.SOUTH);
139139
about.pack();
140140
return about;

xdocs/images/logo.svg

Lines changed: 17 additions & 3 deletions
Loading

0 commit comments

Comments
 (0)