Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 9 additions & 2 deletions bin/jmeter.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1182,11 +1182,15 @@ cookies=cookies
#jsyntaxtextarea.wrapstyleword=true
#jsyntaxtextarea.linewrap=true
#jsyntaxtextarea.codefolding=true
#jsyntaxtextarea.highlight=true
#jsyntaxtextarea.tabsize=4
# Set 0 to disable undo feature in JSyntaxTextArea
#jsyntaxtextarea.maxundos=50
# Change the font on the (JSyntax) Text Areas. (Useful for HiDPI screens)
#jsyntaxtextarea.font.family=Hack
#jsyntaxtextarea.font.size=14
#jsyntaxtextarea.font.family=
#jsyntaxtextarea.font.size=-1
#jsyntaxtextarea.theme.default=themes/default.xml
#jsyntaxtextarea.theme.dark=themes/dark.xml

# Set this to false to disable the use of JSyntaxTextArea for the Console Logger panel
#loggerpanel.usejsyntaxtext=true
Expand Down Expand Up @@ -1388,3 +1392,6 @@ jmeter.reportgenerator.apdex_tolerated_threshold=1500
# Path to XSL file used to generate Schematic View of Test Plan
# When empty, JMeter will use the embedded one in src/core/org/apache/jmeter/gui/action/schematic.xsl
#docgeneration.schematic_xsl=

#gui Zoom In/Out ratio
zoom_scale=1.1f
1 change: 1 addition & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<trusting group="io.projectreactor"/>
<trusting group="org.springframework"/>
</trusted-key>
<trusted-key id="4AC55A85D30C3499A3219500B7E2662A7640A051" group="com.formdev"/>
<trusted-key id="4BDE772C338BA540E1057D0C8EA48D105232855D" group="com.github.jknack"/>
<trusted-key id="4C5F68D09D42BA7FAC888DF9A929EA2321FDBF8F">
<trusting group="net.sf.saxon"/>
Expand Down
14 changes: 13 additions & 1 deletion src/bom-thirdparty/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {

api("bsf:bsf:2.4.0")
api("cglib:cglib-nodep:3.3.0")
api("com.fifesoft:rsyntaxtextarea:3.6.2")
api("com.fifesoft:rsyntaxtextarea:4.0.1")
api("com.github.ben-manes.caffeine:caffeine:3.2.3")
api("com.github.weisj:darklaf-core:3.1.1")
api("com.github.weisj:darklaf-extensions-rsyntaxarea:0.4.1")
Expand Down Expand Up @@ -146,5 +146,17 @@ dependencies {
api("xalan:serializer:2.7.3")
api("xalan:xalan:2.7.3")
api("xml-apis:xml-apis:1.4.01")
//FlatLaf: https://www.formdev.com/flatlaf/native-libraries/#gradle
val flatlafVersion = "3.7.2"
api("com.formdev:flatlaf:${flatlafVersion}" )
api("com.formdev:flatlaf:${flatlafVersion}:linux-x86_64@so")
Comment on lines +149 to +152

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've filed JFormDesigner/FlatLaf#1146 to request a proper platform (BOM) from FlatLaf

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what this block would look like with a BOM from FlatLaf?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There would be one api(platform("com.formdev:flatlaf-bom:2.21.2")), and the rest would be without versions like api("com.formdev:flatlaf")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is that

  1. We use what the ecosystem uses: jackson, junit, mockito, etc have boms for platforms. I don't mention JMeter here as I am biased here
  2. Every individual FlatLaf artifact might (should) include bom constraint as well (e.g. com.formdev:flatlaf could include contraint on flatlaf-bom). That would enable automatic version alignment in case one of the artifacts comes with a newer version (e.g. updated via transitive).

api("com.formdev:flatlaf:${flatlafVersion}:macos-x86_64@dylib")
api("com.formdev:flatlaf:${flatlafVersion}:windows-x86_64@dll")
api("com.formdev:flatlaf-intellij-themes:${flatlafVersion}")
api("com.formdev:flatlaf-extras:${flatlafVersion}")
api("com.formdev:flatlaf-fonts-inter:4.1")
api("com.formdev:flatlaf-fonts-jetbrains-mono:2.304")
api("com.formdev:flatlaf-fonts-roboto:2.137")
api("com.formdev:flatlaf-fonts-roboto-mono:3.000")
}
}
3 changes: 3 additions & 0 deletions src/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ dependencies {
testFixturesApi(testFixtures(projects.src.jorphan))
testFixturesImplementation(projects.src.testkit)
testFixturesImplementation("org.junit.jupiter:junit-jupiter")

implementation("com.formdev:flatlaf")
implementation("com.formdev:flatlaf-intellij-themes")
}

val generatedVersionDir = layout.buildDirectory.dir("generated/sources/version")
Expand Down
3 changes: 2 additions & 1 deletion src/core/src/main/java/org/apache/jmeter/SplashScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;

import org.apache.jmeter.gui.action.LookAndFeelCommand;
import org.apache.jmeter.util.JMeterUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -74,7 +75,7 @@ public static JComponent loadLogo() {
log.warn("Unable to find logo {}", svgResourcePath, e);
}

if (svgUri != null) {
if (svgUri != null && LookAndFeelCommand.isDarklafTheme()) {
Icon icon = new ThemedSVGIcon(svgUri, 521, 177);
logo.setIcon(icon);
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/core/src/main/java/org/apache/jmeter/gui/LoggerPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,18 @@ private JTextArea init() { // WARNING: called from ctor so must not be overridde
JSyntaxTextArea jSyntaxTextArea = JSyntaxTextArea.getInstance(15, 80, true);
jSyntaxTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
jSyntaxTextArea.setCodeFoldingEnabled(false);
jSyntaxTextArea.setAntiAliasingEnabled(false);
jSyntaxTextArea.setEditable(false);
jSyntaxTextArea.setLineWrap(false);
jSyntaxTextArea.setAntiAliasingEnabled(true);
jSyntaxTextArea.setLanguage("text");
jSyntaxTextArea.setMargin(new Insets(2, 2, 2, 2)); // space between borders and text
areaScrollPane = JTextScrollPane.getInstance(jSyntaxTextArea);
jTextArea = jSyntaxTextArea;
} else {
// Plain text area
jTextArea = new JTextArea(15, 80);
areaScrollPane = new JScrollPane(jTextArea);
}
jTextArea.setEditable(false);
jTextArea.setLineWrap(false);
jTextArea.setMargin(new Insets(2, 2, 2, 2)); // space between borders and text

areaScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
areaScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/main/java/org/apache/jmeter/gui/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public MainFrame(TreeModel treeModel, JMeterTreeListener treeListener) {
// Shift down means "horizontal scrolling" on macOS, and we need only vertical one
if ((e.getModifiersEx() & (ctrlAltMask | InputEvent.SHIFT_DOWN_MASK)) == ctrlAltMask) {
e.consume();
final float scale = 1.1f;
final float scale = JMeterUtils.getPropDefault("zoom_scale", 1.1f);
int rotation = e.getWheelRotation();
if (rotation > 0) { // DOWN
JMeterUtils.applyScaleOnFonts(1.0f / scale);
Expand Down Expand Up @@ -642,7 +642,7 @@ private static JScrollPane createMainPanel() {
private static LoggerPanel createLoggerPanel() {
LoggerPanel loggerPanel = new LoggerPanel();
loggerPanel.setMinimumSize(new Dimension(0, 100));
loggerPanel.setPreferredSize(new Dimension(0, 150));
loggerPanel.setPreferredSize(new Dimension(0, 100));
GuiPackage guiInstance = GuiPackage.getInstance();
guiInstance.setLoggerPanel(loggerPanel);
guiInstance.getMenuItemLoggerPanel().getModel().setSelected(DISPLAY_LOGGER_PANEL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@
import org.apache.jmeter.gui.util.JMeterMenuBar;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.gui.JFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.intellijthemes.FlatAllIJThemes;
import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.theme.DarculaTheme;
import com.github.weisj.darklaf.theme.Theme;
import com.google.auto.service.AutoService;

Expand All @@ -47,6 +50,7 @@
*/
@AutoService(Command.class)
public class LookAndFeelCommand extends AbstractAction {
private static final Logger log = LoggerFactory.getLogger(LookAndFeelCommand.class);
private static final String JMETER_LAF = "jmeter.laf"; // $NON-NLS-1$

private static final Map<String, MenuItem> items = new LinkedHashMap<>();
Expand Down Expand Up @@ -106,11 +110,29 @@ private static MenuItem ofDarklafTheme(Theme theme) {
if (System.getProperty("darklaf.treeRowPopup") == null) {
System.setProperty("darklaf.treeRowPopup", "false");
}
UIManager.installLookAndFeel(JMeterMenuBar.DARCULA_LAF, JMeterMenuBar.DARCULA_LAF_CLASS);

//Add FlatLAF Themes
for (String flatLaf : new String[]{"FlatLightLaf", "FlatDarkLaf", "FlatIntelliJLaf", "FlatDarculaLaf"}) {
try {
UIManager.installLookAndFeel(flatLaf, "com.formdev.flatlaf." + flatLaf);
} catch( Exception ex ) {
log.warn("Failed to load FlatLAF theme: {}", flatLaf, ex);
}
}
for (String flatLaf : new String[]{"FlatMacDarkLaf", "FlatMacLightLaf"}) {
try {
UIManager.installLookAndFeel(flatLaf, "com.formdev.flatlaf.themes" + flatLaf);
} catch( Exception ex ) {
log.warn("Failed to load FlatLAF theme: {}", flatLaf, ex);
}
}
for (UIManager.LookAndFeelInfo lafInfo : FlatAllIJThemes.INFOS) {
UIManager.installLookAndFeel(lafInfo.getName(), lafInfo.getClassName());
}

List<MenuItem> items = new ArrayList<>();
for (UIManager.LookAndFeelInfo laf : JMeterMenuBar.getAllLAFs()) {
if (!laf.getClassName().equals(JMeterMenuBar.DARCULA_LAF_CLASS)) {
if (!laf.getClassName().equals(JMeterMenuBar.DARKLAF_LAF_CLASS)) {
items.add(MenuItem.of(laf.getName(), laf.getClassName()));
} else {
for (Theme theme : LafManager.getRegisteredThemes()) {
Expand Down Expand Up @@ -143,15 +165,10 @@ public static Collection<MenuItem> getMenuItems() {
*/
@Deprecated
public static String getJMeterLaf(){
String laf = PREFS.get(USER_PREFS_KEY, null);
if (laf != null) {
return checkLafName(laf);
}

String osName = System.getProperty("os.name") // $NON-NLS-1$
.toLowerCase(Locale.ENGLISH);
// Spaces are not allowed in property names read from files
laf = JMeterUtils.getProperty(JMETER_LAF+"."+osName.replace(' ', '_'));
String laf = JMeterUtils.getProperty(JMETER_LAF+"."+osName.replace(' ', '_'));
if (laf != null) {
return checkLafName(laf);
}
Expand All @@ -160,10 +177,7 @@ public static String getJMeterLaf(){
if (laf != null) {
return checkLafName(laf);
}
laf = JMeterUtils.getPropDefault(JMETER_LAF, JMeterMenuBar.DARCULA_LAF_CLASS);
if (laf != null) {
return checkLafName(laf);
}

return UIManager.getCrossPlatformLookAndFeelClassName();
}

Expand All @@ -174,16 +188,16 @@ public static String getJMeterLaf(){
public static String getPreferredLafCommand() {
String laf = PREFS.get(USER_PREFS_KEY, null);
if (laf != null) {
return laf;
MenuItem item = items.get(laf);
if (item == null) {
log.warn("LookAndFeel command '{}' not found in available items, falling back to default LAFs", laf);
} else {
return item.command;
}
}

String jMeterLaf = getJMeterLaf();
if (jMeterLaf.equals(JMeterMenuBar.DARCULA_LAF_CLASS)) {
// Convert old Darcula to new Darklaf-Darcula LaF
return MenuItem.ofDarklafTheme(new DarculaTheme()).command;
}

return MenuItem.of("default", jMeterLaf).command; // $NON-NLS-1$
return MenuItem.of("default", jMeterLaf).command; // $NON-NLS-1$
}

// Check if LAF is a built-in one
Expand All @@ -205,8 +219,12 @@ public static boolean isDarklafTheme() {
return LafManager.isInstalled();
}

public static boolean isFlatlafTheme() {
return UIManager.getLookAndFeel() instanceof FlatLaf;
}

public static boolean isDark() {
return isDarklafTheme() && Theme.isDark(LafManager.getTheme());
return (isDarklafTheme() && Theme.isDark(LafManager.getTheme())) || (isFlatlafTheme() && ((FlatLaf)UIManager.getLookAndFeel()).isDark());
}

public static void activateLookAndFeel(String command) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.apache.jmeter.util.LocaleChangeEvent;
import org.apache.jmeter.util.LocaleChangeListener;
import org.apache.jmeter.util.SSLManager;
import org.apache.jorphan.gui.GuiUtils;
import org.apache.jorphan.reflect.LogAndIgnoreServiceLoadExceptionHandler;
import org.apache.jorphan.util.JOrphanUtils;
import org.apache.logging.log4j.Level;
Expand Down Expand Up @@ -103,10 +104,10 @@ public class JMeterMenuBar extends JMenuBar implements LocaleChangeListener {

public static final String SYSTEM_LAF = "System"; // $NON-NLS-1$
public static final String CROSS_PLATFORM_LAF = "CrossPlatform"; // $NON-NLS-1$
public static final String DARCULA_LAF = "Darcula"; // $NON-NLS-1$
public static final String DARKLAF_LAF = "Darklaf"; // $NON-NLS-1$
public static final String DARCULA_LAF_CLASS = "com.bulenkov.darcula.DarculaLaf"; // $NON-NLS-1$
public static final String FLAT_LAF = "FlatLaf"; // $NON-NLS-1$
public static final String DARKLAF_LAF_CLASS = "com.github.weisj.darklaf.DarkLaf"; // $NON-NLS-1$
public static final String FLATLAF_LAF_CLASS = "com.formdev.flatlaf.FlatLightLaf"; // $NON-NLS-1$

public JMeterMenuBar() {
// List for recent files menu items
Expand Down Expand Up @@ -319,6 +320,7 @@ private void makeOptionsMenu() {

private static JMenu createLaFMenu() {
JMenu lafMenu = makeMenuRes("appearance", 'L');
JMenu flatLafSubMenu = new JMenu("FlatLaf Themes");
ButtonGroup lafGroup = new ButtonGroup();
String currentLafCommand = LookAndFeelCommand.getPreferredLafCommand();
for (LookAndFeelCommand.MenuItem item : LookAndFeelCommand.getMenuItems()) {
Expand All @@ -328,9 +330,16 @@ private static JMenu createLaFMenu() {
if (item.getCommand().equals(currentLafCommand)) {
menuItem.setSelected(true);
}
if (item.getCommand().startsWith("laf:com.formdev.flatlaf")) {
flatLafSubMenu.add(menuItem);
} else {
lafMenu.add(menuItem);
}
lafGroup.add(menuItem);
lafMenu.add(menuItem);
}
GuiUtils.makeScrollableMenu(flatLafSubMenu);
lafMenu.addSeparator();
lafMenu.add(flatLafSubMenu);
return lafMenu;
}

Expand Down
Loading
Loading