Class DeviceInfo

java.lang.Object
io.jmix.ui.deviceinfo.DeviceInfo

public class DeviceInfo extends Object
Class that represents information about the web browser the user is using. Provides information such as browser name and version, screen resolution and IP address.
  • Constructor Details

    • DeviceInfo

      public DeviceInfo()
  • Method Details

    • getScreenHeight

      public int getScreenHeight()
      Gets the height of the screen in pixels. This is the full screen resolution and not the height available for the application.
      Returns:
      the height of the screen in pixels.
    • setScreenHeight

      public void setScreenHeight(int screenHeight)
    • getScreenWidth

      public int getScreenWidth()
      Gets the width of the screen in pixels. This is the full screen resolution and not the width available for the application.
      Returns:
      the width of the screen in pixels.
    • setScreenWidth

      public void setScreenWidth(int screenWidth)
    • getBrowserApplication

      public String getBrowserApplication()
      Get the browser user-agent string.
      Returns:
      The raw browser userAgent string
    • setBrowserApplication

      public void setBrowserApplication(String browserApplication)
    • getLocale

      public Locale getLocale()
      Get the default locate of the browser.
    • setLocale

      public void setLocale(Locale locale)
    • getTimeZone

      public TimeZone getTimeZone()
      Get the default timezone of the browser.
    • setTimeZone

      public void setTimeZone(TimeZone timeZone)
    • isSecureConnection

      public boolean isSecureConnection()
      Is the connection made using HTTPS?
    • setSecureConnection

      public void setSecureConnection(boolean secureConnection)
    • isFirefox

      public boolean isFirefox()
      Tests whether the user is using Firefox.
      Returns:
      true if the user is using Firefox, false if the user is not using Firefox or if no information on the browser is present
    • setFirefox

      public void setFirefox(boolean firefox)
    • isIE

      public boolean isIE()
      Tests whether the user is using Internet Explorer.
      Returns:
      true if the user is using Internet Explorer, false if the user is not using Internet Explorer or if no information on the browser is present
    • setIE

      public void setIE(boolean IE)
    • isEdge

      public boolean isEdge()
      Tests whether the user is using Edge.
      Returns:
      true if the user is using Edge, false if the user is not using Edge or if no information on the browser is present
    • setEdge

      public void setEdge(boolean edge)
    • isSafari

      public boolean isSafari()
      Tests whether the user is using Safari.
      Returns:
      true if the user is using Safari, false if the user is not using Safari or if no information on the browser is present
    • setSafari

      public void setSafari(boolean safari)
    • isOpera

      public boolean isOpera()
      Tests whether the user is using Opera.
      Returns:
      true if the user is using Opera, false if the user is not using Opera or if no information on the browser is present
    • setOpera

      public void setOpera(boolean opera)
    • isChrome

      public boolean isChrome()
      Tests whether the user is using Chrome.
      Returns:
      true if the user is using Chrome, false if the user is not using Chrome or if no information on the browser is present
    • setChrome

      public void setChrome(boolean chrome)
    • isChromeFrame

      public boolean isChromeFrame()
      Tests whether the user is using Chrome Frame.
      Returns:
      true if the user is using Chrome Frame, false if the user is not using Chrome or if no information on the browser is present
    • setChromeFrame

      public void setChromeFrame(boolean chromeFrame)
    • isChromeFrameCapable

      public boolean isChromeFrameCapable()
      Tests whether the user's browser is Chrome Frame capable.
      Returns:
      true if the user can use Chrome Frame, false if the user can not or if no information on the browser is present
    • setChromeFrameCapable

      public void setChromeFrameCapable(boolean chromeFrameCapable)
    • getBrowserMajorVersion

      public int getBrowserMajorVersion()
      Gets the major version of the browser the user is using.

      Note that Internet Explorer in IE7 compatibility mode might return 8 in some cases even though it should return 7.

      Returns:
      The major version of the browser or -1 if not known.
    • setBrowserMajorVersion

      public void setBrowserMajorVersion(int browserMajorVersion)
    • getBrowserMinorVersion

      public int getBrowserMinorVersion()
      Gets the minor version of the browser the user is using.
      Returns:
      The minor version of the browser or -1 if not known.
      See Also:
    • setBrowserMinorVersion

      public void setBrowserMinorVersion(int browserMinorVersion)
    • isLinux

      public boolean isLinux()
      Tests whether the user is using Linux.
      Returns:
      true if the user is using Linux, false if the user is not using Linux or if no information on the browser is present
    • isMacOSX

      public boolean isMacOSX()
      Tests whether the user is using Mac OS X.
      Returns:
      true if the user is using Mac OS X, false if the user is not using Mac OS X or if no information on the browser is present
    • isWindows

      public boolean isWindows()
      Tests whether the user is using Windows.
      Returns:
      true if the user is using Windows, false if the user is not using Windows or if no information on the browser is present
    • isWindowsPhone

      public boolean isWindowsPhone()
      Tests whether the user is using Windows Phone.
      Returns:
      true if the user is using Windows Phone, false if the user is not using Windows Phone or if no information on the browser is present
    • setWindowsPhone

      public void setWindowsPhone(boolean windowsPhone)
    • isAndroid

      public boolean isAndroid()
      Tests if the browser is run on Android.
      Returns:
      true if run on Android false if the user is not using Android or if no information on the browser is present
    • isIOS

      public boolean isIOS()
      Tests if the browser is run in iOS.
      Returns:
      true if run in iOS false if the user is not using iOS or if no information on the browser is present
    • isIPhone

      public boolean isIPhone()
      Tests if the browser is run on IPhone.
      Returns:
      true if run on IPhone false if the user is not using IPhone or if no information on the browser is present
    • setIPhone

      public void setIPhone(boolean IPhone)
    • isIPad

      public boolean isIPad()
      Tests if the browser is run on IPad.
      Returns:
      true if run on IPad false if the user is not using IPad or if no information on the browser is present
    • setIPad

      public void setIPad(boolean IPad)
    • isTouchDevice

      public boolean isTouchDevice()
      Returns:
      true if the browser is detected to support touch events
    • setTouchDevice

      public void setTouchDevice(boolean touchDevice)
    • getAddress

      public String getAddress()
      Gets the IP-address of the web browser.
    • setAddress

      public void setAddress(String address)
    • getOperatingSystem

      public DeviceInfo.OperatingSystem getOperatingSystem()
      Returns:
      operating system of device, one of DeviceInfo.OperatingSystem
    • setOperatingSystem

      public void setOperatingSystem(DeviceInfo.OperatingSystem operatingSystem)
    • getAspectRatio

      public double getAspectRatio()
      Returns:
      aspect ratio of device view port
    • getMaximumDimension

      public double getMaximumDimension()
      Returns:
      maximum of getScreenHeight() and getScreenWidth()
    • getMinimumDimension

      public double getMinimumDimension()
      Returns:
      minimum of getScreenHeight() and getScreenWidth()