You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2018/10/30 17:03:09 UTC
[isis] branch master updated: ISIS-2023: backports support of
isis.viewer.wicket.themes.initial from v2 to master
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 4c95907 ISIS-2023: backports support of isis.viewer.wicket.themes.initial from v2 to master
4c95907 is described below
commit 4c95907c79f9a76045a5ae4a078a42fb915f858f
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Oct 30 17:02:41 2018 +0000
ISIS-2023: backports support of isis.viewer.wicket.themes.initial from v2 to master
also remove accidental use of jdk8 api
---
.../viewer/wicket/viewer/IsisWicketApplication.java | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
index 8b33825..b15f156 100644
--- a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
+++ b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication.java
@@ -31,6 +31,7 @@ import java.util.concurrent.Future;
import com.google.common.base.Charsets;
import com.google.common.base.Function;
+import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.io.Resources;
@@ -120,6 +121,8 @@ import de.agilecoders.wicket.core.Bootstrap;
import de.agilecoders.wicket.core.markup.html.bootstrap.behavior.BootstrapBaseBehavior;
import de.agilecoders.wicket.core.settings.BootstrapSettings;
import de.agilecoders.wicket.core.settings.IBootstrapSettings;
+import de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchTheme;
+import de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchThemeProvider;
import de.agilecoders.wicket.webjars.WicketWebjars;
import de.agilecoders.wicket.webjars.settings.IWebjarsSettings;
import de.agilecoders.wicket.webjars.settings.WebjarsSettings;
@@ -178,6 +181,8 @@ public class IsisWicketApplication
public static final String ENABLE_DEVELOPMENT_UTILITIES_KEY = "isis.viewer.wicket.developmentUtilities.enable";
public static final boolean ENABLE_DEVELOPMENT_UTILITIES_DEFAULT = false;
+ public static final BootswatchTheme BOOTSWATCH_THEME_DEFAULT = BootswatchTheme.Flatly;
+
private final IsisLoggingConfigurer loggingConfigurer = new IsisLoggingConfigurer();
@@ -436,6 +441,20 @@ public class IsisWicketApplication
} finally {
ThreadPoolSupport.getInstance().join(futures);
}
+
+ final String themeName = configuration.getString(
+ "isis.viewer.wicket.themes.initial", BOOTSWATCH_THEME_DEFAULT.name());
+ BootswatchTheme bootswatchTheme;
+ try {
+ bootswatchTheme = BootswatchTheme.valueOf(themeName);
+ } catch(Exception ex) {
+ bootswatchTheme = BOOTSWATCH_THEME_DEFAULT;
+ LOG.warn("Did not recognise configured bootswatch theme '{}', defaulting to '{}'", bootswatchTheme);
+
+ }
+ IBootstrapSettings settings = Bootstrap.getSettings();
+ settings.setThemeProvider(new BootswatchThemeProvider(bootswatchTheme));
+
}
protected List<Future<Object>> startBackgroundInitializationThreads() {
@@ -542,7 +561,7 @@ public class IsisWicketApplication
}
try {
List<String> readLines = Resources.readLines(Resources.getResource(contextClass, resourceName), Charsets.UTF_8);
- return String.join("\n", readLines);
+ return Joiner.on("\n").join(readLines);
} catch (IOException | IllegalArgumentException e) {
return fallback;
}