Package com.saperion.ngc.util
Class ClientInfoUtil
- java.lang.Object
-
- com.saperion.ngc.util.ClientInfoUtil
-
- All Implemented Interfaces:
org.zkoss.zk.ui.event.EventListener
public class ClientInfoUtil extends java.lang.Object implements org.zkoss.zk.ui.event.EventListenerThe ClientInfoUtil can be used to statically store and retrieve client dependent information like the viewport resolution (height and width) and timezone.- Author:
- sts
-
-
Constructor Summary
Constructors Constructor Description ClientInfoUtil()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intgetHeight()Returns the viewport height.static intgetScreenHeightPx()static intgetScreenWidthPx()static java.util.TimeZonegetTimezone()Returns the current timezone of the browser.static intgetWidth()Returns the viewport width.static booleanis64BitBrowser()Detects if the browser is a 64-bit browser.static booleanis64BitBrowser(javax.servlet.http.HttpServletRequest request)Detects if the browser is a 64-bit browser.static booleanisInternetExplorer()Checks if the client is an Internet Explorer browser by checking if the user-agent header contains "MSIE".static booleanisInternetExplorer(javax.servlet.http.HttpServletRequest request)Checks if the client is an Internet Explorer browser by checking if the user-agent header contains "MSIE".static booleanisInternetExplorerZk()Checks if the client is an Internet Explorer browser using the ZK framework's integrated browser detections method.voidonEvent(org.zkoss.zk.ui.event.Event event)static voidsetHeight(int height)Sets the viewport height.static voidsetScreenHeightPx(int screenHeightPx)Sets the height of the client's screen in pixels.static voidsetScreenWidthPx(int screenWidthPx)Sets the width of the client's screen in pixels.static voidsetTimezone(java.util.TimeZone timezone)Sets the timezone.static voidsetWidth(int width)Sets the viewport width.
-
-
-
Method Detail
-
getHeight
public static int getHeight()
Returns the viewport height. (The height of the visible part of the html page in the browser.)- Returns:
- height The viewport height in pixels.
-
setHeight
public static void setHeight(int height)
Sets the viewport height. (The height of the visible part of the html page in the browser.)- Parameters:
height- The viewport height in pixels.
-
getWidth
public static int getWidth()
Returns the viewport width. (The width of the visible part of the html page in the browser.)- Returns:
- width The viewport width in pixels.
-
setWidth
public static void setWidth(int width)
Sets the viewport width. (The width of the visible part of the html page in the browser.)- Parameters:
width- The viewport width in pixels.
-
getTimezone
public static java.util.TimeZone getTimezone()
Returns the current timezone of the browser.- Returns:
- timeZone The current set timezone of the browser.
-
setTimezone
public static void setTimezone(java.util.TimeZone timezone)
Sets the timezone.- Parameters:
timezone- The current set timezone of the browser.
-
getScreenHeightPx
public static int getScreenHeightPx()
- Returns:
- the height of the client's sreen in pixels
-
setScreenHeightPx
public static void setScreenHeightPx(int screenHeightPx)
Sets the height of the client's screen in pixels.- Parameters:
screenHeightPx- the new height
-
getScreenWidthPx
public static int getScreenWidthPx()
- Returns:
- the width of the client's screen in pixels
-
setScreenWidthPx
public static void setScreenWidthPx(int screenWidthPx)
Sets the width of the client's screen in pixels.- Parameters:
screenWidthPx- the new width
-
is64BitBrowser
public static boolean is64BitBrowser()
Detects if the browser is a 64-bit browser. The detection uses the 'user-agent' header and a list of common 'marker' for 64-bit browser.- Returns:
- if a 64 bit browser is detected
true, otherwisefalse
-
is64BitBrowser
public static boolean is64BitBrowser(javax.servlet.http.HttpServletRequest request)
Detects if the browser is a 64-bit browser. The detection uses the 'user-agent' header and a list of common 'marker' for 64-bit browser. This method can be called from without ZK-context.- Parameters:
request- the current request- Returns:
- if a 64 bit browser is detected
true, otherwisefalse
-
onEvent
public void onEvent(org.zkoss.zk.ui.event.Event event) throws java.lang.Exception- Specified by:
onEventin interfaceorg.zkoss.zk.ui.event.EventListener- Throws:
java.lang.Exception
-
isInternetExplorer
public static boolean isInternetExplorer()
Checks if the client is an Internet Explorer browser by checking if the user-agent header contains "MSIE". This method must be called from within the ZK-context.- Returns:
- true if the user agent header contains the MSIE marker
-
isInternetExplorer
public static boolean isInternetExplorer(javax.servlet.http.HttpServletRequest request)
Checks if the client is an Internet Explorer browser by checking if the user-agent header contains "MSIE".- Parameters:
request- the current request- Returns:
- true if the user agent header contains the MSIE marker
-
isInternetExplorerZk
public static boolean isInternetExplorerZk()
Checks if the client is an Internet Explorer browser using the ZK framework's integrated browser detections method. This method must be called from within the ZK-context.- Returns:
- true if the ZK framework has detected an Internet Explorer
-
-