From d059ae50b00bc18398c55738d4d2f2be4986f2f0 Mon Sep 17 00:00:00 2001 From: hengsin Date: Tue, 14 Apr 2020 20:33:58 +0800 Subject: [PATCH] IDEMPIERE-4206 Session timeout shown sometimes when changing roles. Fix theme preference lost after change role. --- .../WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java | 4 ++++ .../src/org/adempiere/webui/adwindow/ADWindowToolbar.java | 5 +++-- .../WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java | 3 ++- .../WEB-INF/src/org/adempiere/webui/theme/ITheme.java | 2 ++ org.adempiere.ui.zk/theme/default/preference.zul | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index 83d6403fd2..938f23616b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -38,6 +38,7 @@ import org.adempiere.webui.desktop.FavouriteController; import org.adempiere.webui.desktop.IDesktop; import org.adempiere.webui.session.SessionContextListener; import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.theme.ITheme; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.BrowserToken; import org.adempiere.webui.util.UserPreference; @@ -525,6 +526,9 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb Env.setContext(properties, UserPreference.LANGUAGE_NAME, Env.getContext(Env.getCtx(), UserPreference.LANGUAGE_NAME)); Env.setContext(properties, Env.LANGUAGE, Env.getContext(Env.getCtx(), Env.LANGUAGE)); Env.setContext(properties, AEnv.LOCALE, Env.getContext(Env.getCtx(), AEnv.LOCALE)); + Env.setContext(properties, ITheme.ZK_TOOLBAR_BUTTON_SIZE, Env.getContext(Env.getCtx(), ITheme.ZK_TOOLBAR_BUTTON_SIZE)); + Env.setContext(properties, ITheme.USE_CSS_FOR_WINDOW_SIZE, Env.getContext(Env.getCtx(), ITheme.USE_CSS_FOR_WINDOW_SIZE)); + Env.setContext(properties, ITheme.USE_FONT_ICON_FOR_IMAGE, Env.getContext(Env.getCtx(), ITheme.USE_FONT_ICON_FOR_IMAGE)); Desktop desktop = Executions.getCurrent().getDesktop(); Locale locale = (Locale) desktop.getSession().getAttribute(Attributes.PREFERRED_LOCALE); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java index 6f6558dd94..c3242815af 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java @@ -38,6 +38,7 @@ import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.event.ToolbarListener; import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.theme.ITheme; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ZKUpdateUtil; import org.adempiere.webui.window.FDialog; @@ -356,7 +357,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener else { Executions.createComponents(ThemeManager.getPreference(), this, null); - String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size"); + String size = Env.getContext(Env.getCtx(), ITheme.ZK_TOOLBAR_BUTTON_SIZE); String suffix = "24.png"; if (!Util.isEmpty(size)) { @@ -720,7 +721,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener } else { - String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size"); + String size = Env.getContext(Env.getCtx(), ITheme.ZK_TOOLBAR_BUTTON_SIZE); String suffix = "24.png"; if (!Util.isEmpty(size)) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java index e6f17ded04..a9fa68cdad 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java @@ -28,6 +28,7 @@ import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.ZkCssHelper; import org.adempiere.webui.event.ToolbarListener; import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.theme.ITheme; import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.util.ZKUpdateUtil; import org.adempiere.webui.window.WRecordInfo; @@ -384,7 +385,7 @@ public class BreadCrumb extends Div implements EventListener { btn.setName(BTNPREFIX+name); btn.setId(name); Executions.createComponents(ThemeManager.getPreference(), this, null); - String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size"); + String size = Env.getContext(Env.getCtx(), ITheme.ZK_TOOLBAR_BUTTON_SIZE); String suffix = "24.png"; if (!Util.isEmpty(size)) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/theme/ITheme.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/theme/ITheme.java index 4795ed3050..b55d16faf1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/theme/ITheme.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/theme/ITheme.java @@ -54,4 +54,6 @@ public interface ITheme { public static final String USE_CSS_FOR_WINDOW_SIZE = "#THEME_USE_CSS_FOR_WINDOW_SIZE"; public static final String USE_FONT_ICON_FOR_IMAGE = "#THEME_USE_FONT_ICON_FOR_IMAGE"; + + public static final String ZK_TOOLBAR_BUTTON_SIZE = "#ZK_Toolbar_Button_Size"; } diff --git a/org.adempiere.ui.zk/theme/default/preference.zul b/org.adempiere.ui.zk/theme/default/preference.zul index 19eb44e2e0..78f11ec7a2 100644 --- a/org.adempiere.ui.zk/theme/default/preference.zul +++ b/org.adempiere.ui.zk/theme/default/preference.zul @@ -11,7 +11,7 @@ import org.adempiere.webui.theme.ITheme; import org.compiere.model.MSysConfig; - Env.setContext(Env.getCtx(), "#ZK_Toolbar_Button_Size", "24"); + Env.setContext(Env.getCtx(), ITheme.ZK_TOOLBAR_BUTTON_SIZE, "24"); /* Set the next variable if you want to control browser title in theme */ /* Env.setContext(Env.getCtx(), "#ZK_BROWSER_TITLE", "iDempiere"); */ Env.setContext(Env.getCtx(), ITheme.USE_CSS_FOR_WINDOW_SIZE, "Y");