Package com.saperion.ngc.util
Class ClientInfoUtil
java.lang.Object
com.saperion.ngc.util.ClientInfoUtil
- All Implemented Interfaces:
org.zkoss.zk.ui.event.EventListener
The 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic intReturns the viewport height.static intstatic intstatic TimeZoneReturns the current timezone of the browser.static intgetWidth()Returns the viewport width.static booleanDetects if the browser is a 64-bit browser.static booleanis64BitBrowser(jakarta.servlet.http.HttpServletRequest request) Detects if the browser is a 64-bit browser.static booleanChecks if the client is an Internet Explorer browser by checking if the user-agent header contains "MSIE".static booleanisInternetExplorer(jakarta.servlet.http.HttpServletRequest request) Checks if the client is an Internet Explorer browser by checking if the user-agent header contains "MSIE".static booleanChecks 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(TimeZone timezone) Sets the timezone.static voidsetWidth(int width) Sets the viewport width.
-
Constructor Details
-
ClientInfoUtil
public ClientInfoUtil()
-
-
Method Details
-
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
Returns the current timezone of the browser.- Returns:
- timeZone The current set timezone of the browser.
-
setTimezone
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(jakarta.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
- Specified by:
onEventin interfaceorg.zkoss.zk.ui.event.EventListener- Throws:
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(jakarta.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
-