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 int
Returns the viewport height.static int
static int
static TimeZone
Returns the current timezone of the browser.static int
getWidth()
Returns the viewport width.static boolean
Detects if the browser is a 64-bit browser.static boolean
is64BitBrowser
(jakarta.servlet.http.HttpServletRequest request) Detects if the browser is a 64-bit browser.static boolean
Checks if the client is an Internet Explorer browser by checking if the user-agent header contains "MSIE".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".static boolean
Checks if the client is an Internet Explorer browser using the ZK framework's integrated browser detections method.void
onEvent
(org.zkoss.zk.ui.event.Event event) static void
setHeight
(int height) Sets the viewport height.static void
setScreenHeightPx
(int screenHeightPx) Sets the height of the client's screen in pixels.static void
setScreenWidthPx
(int screenWidthPx) Sets the width of the client's screen in pixels.static void
setTimezone
(TimeZone timezone) Sets the timezone.static void
setWidth
(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:
onEvent
in 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
-