diff --git a/src/main/java/org/zkoss/theme/atlantic/AtlanticThemeProvider.java b/src/main/java/org/zkoss/theme/atlantic/AtlanticThemeProvider.java new file mode 100755 index 00000000..5d4a0164 --- /dev/null +++ b/src/main/java/org/zkoss/theme/atlantic/AtlanticThemeProvider.java @@ -0,0 +1,25 @@ +package org.zkoss.theme.atlantic; + +import java.util.Collection; +import java.util.List; + +import org.zkoss.html.StyleSheet; +import org.zkoss.lang.Library; +import org.zkoss.zk.ui.Execution; +import org.zkoss.zul.theme.StandardThemeProvider; + +public class AtlanticThemeProvider extends StandardThemeProvider { + + /** Library property key. */ + private static final String DONT_USE_GOOGLE_FONT = "org.zkoss.theme.atlantic.useGoogleFont.disabled"; + + @Override + public Collection getThemeURIs(Execution exec, List uris) { + if (!Boolean.parseBoolean(Library.getProperty(DONT_USE_GOOGLE_FONT))) { //false by default + //ZK-2931 can't start the url with "//", encodeURL will prepend + //current context path if no scheme were given + uris.add(new StyleSheet(exec.getScheme() + "://fonts.googleapis.com/css?family=Open+Sans", "text/css")); + } + return super.getThemeURIs(exec, uris); + } +} diff --git a/src/main/java/org/zkoss/theme/atlantic/AtlanticThemeWebAppInit.java b/src/main/java/org/zkoss/theme/atlantic/AtlanticThemeWebAppInit.java index 499ed172..981362d1 100644 --- a/src/main/java/org/zkoss/theme/atlantic/AtlanticThemeWebAppInit.java +++ b/src/main/java/org/zkoss/theme/atlantic/AtlanticThemeWebAppInit.java @@ -13,11 +13,12 @@ public class AtlanticThemeWebAppInit implements WebAppInit { private final static int ATLANTIC_PRIORITY = 1000; public void init(WebApp wapp) throws Exception { + //ZK-2931 custom theme provider and library property for turning on/off the usage of google font + wapp.getConfiguration().setThemeProvider(new AtlanticThemeProvider()); Themes.register(ATLANTIC_NAME, ATLANTIC_DISPLAY, ATLANTIC_PRIORITY); String edition = WebApps.getEdition(); if ("EE".equals(edition)) { Themes.register(ResponsiveThemeRegistry.TABLET_PREFIX + ATLANTIC_NAME, ATLANTIC_DISPLAY, ATLANTIC_PRIORITY); } } - } diff --git a/src/main/resources/web/atlantic/zul/less/norm.less b/src/main/resources/web/atlantic/zul/less/norm.less index 45ec185a..304f8c6f 100644 --- a/src/main/resources/web/atlantic/zul/less/norm.less +++ b/src/main/resources/web/atlantic/zul/less/norm.less @@ -2,8 +2,6 @@ @import "~./zul/less/_reset.less"; // Font-Awesome 3.1.1 @import "~./zul/less/font/_all.less"; -// Google Font -@import ~"url(//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700)"; html, body { height: 100%; diff --git a/zkdoc/release-note b/zkdoc/release-note index fda1cad8..b589de7c 100644 --- a/zkdoc/release-note +++ b/zkdoc/release-note @@ -1,7 +1,8 @@ -------- Atlantic 1.0.7 * Features: - + ZK-2931: Atlantic theme @import google fonts + * Bugs: * Upgrade Notes: