Skip to content

Commit

Permalink
Update Darklaf: 1.4.3.1 -> 2.0.2 (apache#582)
Browse files Browse the repository at this point in the history
Darklaf 2 brings HighContrast Light and Dark themes
  • Loading branch information
vlsi authored and kkalinin committed Mar 11, 2021
1 parent f419b80 commit f580c0d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ commons-math3.version=3.6.1
commons-net.version=3.6
commons-pool2.version=2.8.0
commons-text.version=1.8
darklaf.version=1.4.3.1
darklaf.version=2.0.2
dec.version=0.1.2
dnsjava.version=2.1.9
equalsverifier.version=3.1.13
Expand Down
1 change: 1 addition & 0 deletions src/bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ dependencies {
apiv("com.github.ben-manes.caffeine:caffeine")
apiv("com.github.tomakehurst:wiremock-jre8")
apiv("com.github.weisj:darklaf-core", "darklaf")
apiv("com.github.weisj:darklaf-theme", "darklaf")
apiv("com.github.weisj:darklaf-property-loader", "darklaf")
apiv("com.helger:ph-commons")
apiv("com.helger:ph-css")
Expand Down
1 change: 1 addition & 0 deletions src/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ dependencies {
implementation("com.formdev:svgSalamander")
implementation("com.github.ben-manes.caffeine:caffeine")
implementation("com.github.weisj:darklaf-core")
implementation("com.github.weisj:darklaf-theme")
implementation("com.github.weisj:darklaf-property-loader")
implementation("com.miglayout:miglayout-swing")
implementation("commons-codec:commons-codec") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@

import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.theme.DarculaTheme;
import com.github.weisj.darklaf.theme.HighContrastDarkTheme;
import com.github.weisj.darklaf.theme.HighContrastLightTheme;
import com.github.weisj.darklaf.theme.IntelliJTheme;
import com.github.weisj.darklaf.theme.OneDarkTheme;
import com.github.weisj.darklaf.theme.SolarizedDarkTheme;
import com.github.weisj.darklaf.theme.SolarizedLightTheme;
import com.github.weisj.darklaf.theme.Theme;
Expand Down Expand Up @@ -97,7 +100,12 @@ private static MenuItem ofDarklafTheme(Class<? extends Theme> lafTheme) {
}

static {
System.setProperty("darklaf.decorations", "false");
if (System.getProperty("darklaf.decorations") == null) {
System.setProperty("darklaf.decorations", "false");
}
if (System.getProperty("darklaf.allowNativeCode") == null) {
System.setProperty("darklaf.allowNativeCode", "false");
}
UIManager.installLookAndFeel(JMeterMenuBar.DARKLAF_LAF, JMeterMenuBar.DARKLAF_LAF_CLASS);

List<MenuItem> items = new ArrayList<>();
Expand All @@ -108,8 +116,11 @@ private static MenuItem ofDarklafTheme(Class<? extends Theme> lafTheme) {
}
items.add(MenuItem.ofDarklafTheme(DarculaTheme.class));
items.add(MenuItem.ofDarklafTheme(IntelliJTheme.class));
items.add(MenuItem.ofDarklafTheme(OneDarkTheme.class));
items.add(MenuItem.ofDarklafTheme(SolarizedDarkTheme.class));
items.add(MenuItem.ofDarklafTheme(SolarizedLightTheme.class));
items.add(MenuItem.ofDarklafTheme(HighContrastDarkTheme.class));
items.add(MenuItem.ofDarklafTheme(HighContrastLightTheme.class));
}
items.sort(Comparator.comparing(MenuItem::getTitle));
for (MenuItem item : items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void updateUI() {
// For instance, https://github.com/weisJ/darklaf/issues/84
setFocusable(false);
setRolloverEnabled(true);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_SHADOW);
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_BORDERLESS);
putClientProperty(DarkButtonUI.KEY_THIN, true);
}
};
Expand Down
20 changes: 20 additions & 0 deletions src/dist/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -515,4 +515,24 @@ val runGui by tasks.registering(JavaExec::class) {
jvmArgs("-Dapple.laf.useScreenMenuBar=true")
jvmArgs("-Dapple.eawt.quitStrategy=CLOSE_ALL_WINDOWS")
}

fun passProperty(name: String, default: String? = null) {
val value = System.getProperty(name) ?: default
value?.let { systemProperty(name, it) }
}

passProperty("java.awt.headless")

val props = System.getProperties()
@Suppress("UNCHECKED_CAST")
for (e in props.propertyNames() as `java.util`.Enumeration<String>) {
// Pass -Djmeter.* and -Ddarklaf.* properties to the JMeter process
if (e.startsWith("jmeter.") || e.startsWith("darklaf.")) {
passProperty(e)
}
if (e == "darklaf.native") {
systemProperty("darklaf.decorations", "true")
systemProperty("darklaf.allowNativeCode", "true")
}
}
}
4 changes: 4 additions & 0 deletions xdocs/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ Added <a href="https://github.com/weisJ/darklaf">Darklaf</a> look and feel that
<figure width="224" height="247" image="changes/5.3/tree_theme_darcula.png">JMeter tree with Darklaf Darcula theme</figure>
<figure width="223" height="246" image="changes/5.3/tree_theme_intellij.png">JMeter tree with Darklaf IntelliJ theme</figure>

<p>New look and feel themes. Light: IntellJ, Solarized Light, HighContrast Light.
Dark: OneDark, Solarized Dark, HighContrast Light.
</p>

<p>When an element in tree is disabled, all its descendants are shown in gray.
For instance, <code>While Contoller</code> is disabled in the following tree, so its children
are gray. It is purely a UI change, and the behavior is not altered.
Expand Down

0 comments on commit f580c0d

Please sign in to comment.