IDEMPIERE-724 Zk: Make iDempiere theme more easily customizable. Added theme preference support. Added toolbar button size preference.
This commit is contained in:
parent
c155937c9e
commit
a1fdf9420e
|
@ -43,6 +43,7 @@ import org.compiere.model.X_AD_ToolBarButton;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
import org.zkoss.image.AImage;
|
||||
import org.zkoss.zk.au.out.AuScript;
|
||||
|
@ -219,8 +220,16 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
|
|||
ToolBarButton btn = new ToolBarButton("");
|
||||
btn.setName(BTNPREFIX+name);
|
||||
btn.setId(btn.getName());
|
||||
if (image != null)
|
||||
btn.setImage(ThemeManager.getThemeResource("images/"+image + "24.png"));
|
||||
if (image != null)
|
||||
{
|
||||
String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size");
|
||||
String suffix = "24.png";
|
||||
if (!Util.isEmpty(size))
|
||||
{
|
||||
suffix = size + ".png";
|
||||
}
|
||||
btn.setImage(ThemeManager.getThemeResource("images/"+image + suffix));
|
||||
}
|
||||
btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip));
|
||||
btn.setSclass("toolbar-button");
|
||||
|
||||
|
|
|
@ -384,7 +384,13 @@ public class BreadCrumb extends Div implements EventListener<Event> {
|
|||
ToolBarButton btn = new ToolBarButton("");
|
||||
btn.setName(BTNPREFIX+name);
|
||||
btn.setId(name);
|
||||
btn.setImage(ThemeManager.getThemeResource("images/"+image + "24.png"));
|
||||
String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size");
|
||||
String suffix = "24.png";
|
||||
if (!Util.isEmpty(size))
|
||||
{
|
||||
suffix = size + ".png";
|
||||
}
|
||||
btn.setImage(ThemeManager.getThemeResource("images/"+image + suffix));
|
||||
btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip));
|
||||
btn.setSclass("breadcrumb-toolbar-button");
|
||||
|
||||
|
|
|
@ -41,17 +41,6 @@ public interface ITheme {
|
|||
public static final String LOGIN_LABEL_CLASS = "login-label";
|
||||
public static final String LOGIN_FIELD_CLASS = "login-field";
|
||||
|
||||
//optional top, bottom, left, right content for the login page
|
||||
public static final String LOGIN_NORTH_PANEL_CLASS = "login-north-panel";
|
||||
public static final String LOGIN_SOUTH_PANEL_CLASS = "login-south-panel";
|
||||
public static final String LOGIN_WEST_PANEL_CLASS = "login-west-panel";
|
||||
public static final String LOGIN_EAST_PANEL_CLASS = "login-east-panel";
|
||||
|
||||
public static final String LOGIN_TOP_PANEL_ZUL = "/login-top.zul";
|
||||
public static final String LOGIN_BOTTOM_PANEL_ZUL = "/login-bottom.zul";
|
||||
public static final String LOGIN_LEFT_PANEL_ZUL = "/login-left.zul";
|
||||
public static final String LOGIN_RIGHT_PANEL_ZUL = "/login-right.zul";
|
||||
|
||||
//logo
|
||||
public static final String LOGIN_LOGO_IMAGE = "/images/login-logo.png";
|
||||
public static final String HEADER_LOGO_IMAGE = "/images/header-logo.png";
|
||||
|
@ -60,4 +49,7 @@ public interface ITheme {
|
|||
//stylesheet url
|
||||
public static final String THEME_STYLESHEET = "/css/theme.css.dsp";
|
||||
public static final String THEME_STYLESHEET_BY_BROWSER = "/css/theme*.css.dsp*";
|
||||
|
||||
//theme preference
|
||||
public static final String THEME_PREFERENCE = "/preference.zul";
|
||||
}
|
||||
|
|
|
@ -67,6 +67,13 @@ public final class ThemeManager {
|
|||
return ITheme.THEME_PATH_PREFIX + getTheme() + ITheme.THEME_STYLESHEET_BY_BROWSER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return url of theme preference page
|
||||
*/
|
||||
public static String getPreference() {
|
||||
return ITheme.THEME_PATH_PREFIX + getTheme() + ITheme.THEME_PREFERENCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return title text for the browser window
|
||||
*/
|
||||
|
@ -74,38 +81,6 @@ public final class ThemeManager {
|
|||
return MSysConfig.getValue(MSysConfig.ZK_BROWSER_TITLE, AdempiereWebUI.APP_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return url for right panel
|
||||
*/
|
||||
public static String getLoginRightPanel() {
|
||||
String theme = getTheme();
|
||||
return ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_RIGHT_PANEL_ZUL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return url for left panel
|
||||
*/
|
||||
public static String getLoginLeftPanel() {
|
||||
String theme = getTheme();
|
||||
return ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_LEFT_PANEL_ZUL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return url for top panel
|
||||
*/
|
||||
public static String getLoginTopPanel() {
|
||||
String theme = getTheme();
|
||||
return ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_TOP_PANEL_ZUL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return url for bottom panel
|
||||
*/
|
||||
public static String getLoginBottomPanel() {
|
||||
String theme = getTheme();
|
||||
return ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_BOTTOM_PANEL_ZUL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return url for browser icon
|
||||
*/
|
||||
|
|
|
@ -11,5 +11,6 @@ Copyright (C) 2007 Ashley G Ramdass.
|
|||
<?link rel="stylesheet" type="text/css" href="${themeStyleSheetByBrowser}"?>
|
||||
<?link rel="stylesheet" type="text/css" href="css/PAPanel.css"?>
|
||||
<zk>
|
||||
<include src="${themePreference}"/>
|
||||
<window use="org.adempiere.webui.AdempiereWebUI"/>
|
||||
</zk>
|
||||
</zk>
|
||||
|
|
|
@ -2,3 +2,4 @@ import org.adempiere.webui.theme.ThemeManager;
|
|||
var themeStyleSheet = ThemeManager.getStyleSheet();
|
||||
var themeStyleSheetByBrowser = ThemeManager.getStyleSheetByBrowser();
|
||||
var browserIcon = ThemeManager.getBrowserIcon();
|
||||
var themePreference = ThemeManager.getPreference();
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<zk>
|
||||
<script defer="true">
|
||||
<![CDATA[
|
||||
adempiere.store.set("zkTimeoutURL", "sessiontimeout.zul");
|
||||
]]>
|
||||
</script>
|
||||
<zscript>
|
||||
<![CDATA[
|
||||
import org.compiere.util.Env;
|
||||
|
||||
Env.setContext(Env.getCtx(), "#ZK_Toolbar_Button_Size", "24");
|
||||
]]>
|
||||
</zscript>
|
||||
</zk>
|
Loading…
Reference in New Issue