IDEMPIERE-4206 Session timeout shown sometimes when changing roles. Fix theme preference lost after change role.

This commit is contained in:
hengsin 2020-04-14 20:33:58 +08:00
parent bb43c4edcd
commit d059ae50b0
5 changed files with 12 additions and 4 deletions

View File

@ -38,6 +38,7 @@ import org.adempiere.webui.desktop.FavouriteController;
import org.adempiere.webui.desktop.IDesktop; import org.adempiere.webui.desktop.IDesktop;
import org.adempiere.webui.session.SessionContextListener; import org.adempiere.webui.session.SessionContextListener;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.BrowserToken; import org.adempiere.webui.util.BrowserToken;
import org.adempiere.webui.util.UserPreference; import org.adempiere.webui.util.UserPreference;
@ -525,6 +526,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
Env.setContext(properties, UserPreference.LANGUAGE_NAME, Env.getContext(Env.getCtx(), UserPreference.LANGUAGE_NAME)); 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, Env.LANGUAGE, Env.getContext(Env.getCtx(), Env.LANGUAGE));
Env.setContext(properties, AEnv.LOCALE, Env.getContext(Env.getCtx(), AEnv.LOCALE)); 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(); Desktop desktop = Executions.getCurrent().getDesktop();
Locale locale = (Locale) desktop.getSession().getAttribute(Attributes.PREFERRED_LOCALE); Locale locale = (Locale) desktop.getSession().getAttribute(Attributes.PREFERRED_LOCALE);

View File

@ -38,6 +38,7 @@ import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.event.ToolbarListener; import org.adempiere.webui.event.ToolbarListener;
import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil; import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
@ -356,7 +357,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
else else
{ {
Executions.createComponents(ThemeManager.getPreference(), this, null); 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"; String suffix = "24.png";
if (!Util.isEmpty(size)) if (!Util.isEmpty(size))
{ {
@ -720,7 +721,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
} }
else 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"; String suffix = "24.png";
if (!Util.isEmpty(size)) if (!Util.isEmpty(size))
{ {

View File

@ -28,6 +28,7 @@ import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.ZkCssHelper; import org.adempiere.webui.component.ZkCssHelper;
import org.adempiere.webui.event.ToolbarListener; import org.adempiere.webui.event.ToolbarListener;
import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.ZKUpdateUtil; import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.WRecordInfo; import org.adempiere.webui.window.WRecordInfo;
@ -384,7 +385,7 @@ public class BreadCrumb extends Div implements EventListener<Event> {
btn.setName(BTNPREFIX+name); btn.setName(BTNPREFIX+name);
btn.setId(name); btn.setId(name);
Executions.createComponents(ThemeManager.getPreference(), this, null); 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"; String suffix = "24.png";
if (!Util.isEmpty(size)) if (!Util.isEmpty(size))
{ {

View File

@ -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_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 USE_FONT_ICON_FOR_IMAGE = "#THEME_USE_FONT_ICON_FOR_IMAGE";
public static final String ZK_TOOLBAR_BUTTON_SIZE = "#ZK_Toolbar_Button_Size";
} }

View File

@ -11,7 +11,7 @@
import org.adempiere.webui.theme.ITheme; import org.adempiere.webui.theme.ITheme;
import org.compiere.model.MSysConfig; 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 */ /* 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(), "#ZK_BROWSER_TITLE", "iDempiere"); */
Env.setContext(Env.getCtx(), ITheme.USE_CSS_FOR_WINDOW_SIZE, "Y"); Env.setContext(Env.getCtx(), ITheme.USE_CSS_FOR_WINDOW_SIZE, "Y");