IDEMPIERE-231 Zk6: Improve the tablet experience. Fixed ClientInfo NPE when user refresh browser.

This commit is contained in:
Heng Sin Low 2012-04-26 15:11:16 +08:00
parent 581f458ddf
commit e813293d21
1 changed files with 10 additions and 1 deletions

View File

@ -87,7 +87,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
private IDesktop appDesktop;
private ClientInfo clientInfo;
private ClientInfo clientInfo = new ClientInfo();
private String langSession;
@ -98,6 +98,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
public static final String EXECUTION_CARRYOVER_SESSION_KEY = "execution.carryover";
public static final String ZK_DESKTOP_SESSION_KEY = "zk.desktop";
private static final String CLIENT_INFO = "client.info";
public AdempiereWebUI()
{
@ -256,6 +258,10 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
currSess.setAttribute(ZK_DESKTOP_SESSION_KEY, this.getPage().getDesktop());
ctx.put(ZK_DESKTOP_SESSION_KEY, this.getPage().getDesktop());
ClientInfo sessionClientInfo = (ClientInfo) currSess.getAttribute(CLIENT_INFO);
if (sessionClientInfo != null) {
clientInfo = sessionClientInfo;
}
} catch (Throwable t) {
//restore fail
appDesktop = null;
@ -359,6 +365,9 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
clientInfo.tablet = true;
}
}
if (getDesktop() != null && getDesktop().getSession() != null) {
getDesktop().getSession().setAttribute(CLIENT_INFO, clientInfo);
}
}
}