Package org.zkoss.zk.ui.event

## Class ClientInfoEvent

- java.lang.Object
- - org.zkoss.zk.ui.event.Event
  - - org.zkoss.zk.ui.event.ClientInfoEvent

- All Implemented Interfaces:
    `java.io.Serializable`

      public class ClientInfoEvent
      extends Event

  The onClientInfo event is used to notify the client's information, such as time zone and screen resolutions.

  This event is sent if and only if it is registered to a root component.

  Note: the information returned by this event is not stored in the server. Thus, you might want to store in the session's attribute (`Session.setAttribute(java.lang.String, java.lang.Object)`).

  Author:
    tomyeh
  See Also:
    `Clients`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ClientInfoEvent​(java.lang.String name, int timeZoneOfs, int scrnwd, int scrnhgh, int colorDepth, int dtwd, int dthgh, int dtx, int dty, double dpr, java.lang.String orient, java.lang.String zoneId, boolean mediaMatched, java.lang.String media)` | Constructs an event to hold the client-info.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static ClientInfoEvent` | `getClientInfoEvent​(AuRequest request)` | Converts an AU request to a client-info event.
    `int` | `getColorDepth()` | Returns the maximum number of colors the client's screen supports.
    `int` | `getDesktopHeight()` | Returns the pixel height of the client's desktop.
    `int` | `getDesktopWidth()` | Returns the pixel width of the client's desktop.
    `int` | `getDesktopXOffset()` | The the current horizontal pixel location of the top-left corner of the document in the window.
    `int` | `getDesktopYOffset()` | The the current vertical pixel location of the top-left corner of the document in the window.
    `double` | `getDevicePixelRatio()` | Return the current device pixel ratio on tablet/mobile device, otherwise return 1.0 instead.
    `java.lang.String` | `getMedia()` | Returns the serialized media query list which is the value of MatchMedia annotation.
    `java.lang.String` | `getOrientation()` | Return the current orientation.
    `int` | `getScreenHeight()` | Returns the pixel height of the client's screen.
    `int` | `getScreenWidth()` | Returns the pixel width of the client's screen.
    `java.time.ZoneId` | `getZoneId()` | Returns the time-zone ID of the client.
    `boolean` | `isHorizontal()` | Utility to check if the current orientation is landscape on tablet/mobile device.
    `boolean` | `isLandscape()` | Utility to check if the current orientation is landscape on tablet/mobile device.
    `boolean` | `isMediaMatched()` | Returns true if the serialized media query list is matched
    `boolean` | `isPortrait()` | Utility to check if the current orientation is portrait on tablet/mobile device.
    `boolean` | `isVertical()` | Utility to check if the current orientation is portrait on tablet/mobile device.

    - ### Methods inherited from class org.zkoss.zk.ui.event.Event

      `getData, getEvent, getName, getPage, getTarget, isPropagatable, stopPropagation, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ClientInfoEvent

          public ClientInfoEvent​(java.lang.String name,
                                 int timeZoneOfs,
                                 int scrnwd,
                                 int scrnhgh,
                                 int colorDepth,
                                 int dtwd,
                                 int dthgh,
                                 int dtx,
                                 int dty,
                                 double dpr,
                                 java.lang.String orient,
                                 java.lang.String zoneId,
                                 boolean mediaMatched,
                                 java.lang.String media)

      Constructs an event to hold the client-info.

      Note: `Event.getTarget()` will return null. It means it is a broadcast event.

      Parameters:
        `scrnwd` - the screen's width
        `scrnhgh` - the screen's height
        `dtwd` - the desktop's width
        `dthgh` - the desktop's height
        `dtx` - the desktop's the left offset
        `dty` - the desktop's the top offset
        `dpr` - the device's devicePixelRatio
        `orient` - the device's orientation
        `zoneId` - the client's zone id

  - ### Method Detail

    - #### getClientInfoEvent

          public static final ClientInfoEvent getClientInfoEvent​(AuRequest request)

      Converts an AU request to a client-info event.
      Since:
        5.0.0

    - #### getScreenWidth

          public int getScreenWidth()

      Returns the pixel width of the client's screen.

    - #### getScreenHeight

          public int getScreenHeight()

      Returns the pixel height of the client's screen.

    - #### getColorDepth

          public int getColorDepth()

      Returns the maximum number of colors the client's screen supports.

    - #### getDesktopWidth

          public int getDesktopWidth()

      Returns the pixel width of the client's desktop.

    - #### getDesktopHeight

          public int getDesktopHeight()

      Returns the pixel height of the client's desktop.

    - #### getDesktopXOffset

          public int getDesktopXOffset()

      The the current horizontal pixel location of the top-left corner of the document in the window. It is changed by user when he scrolls the browser.

      To change it programmatically, use `Clients.scrollTo(int, int)`.

    - #### getDesktopYOffset

          public int getDesktopYOffset()

      The the current vertical pixel location of the top-left corner of the document in the window. It is changed by user when he scrolls the browser.

      To change it programmatically, use `Clients.scrollTo(int, int)`.

    - #### getDevicePixelRatio

          public double getDevicePixelRatio()

      Return the current device pixel ratio on tablet/mobile device, otherwise return 1.0 instead.
      Since:
        6.5.0

    - #### getOrientation

          public java.lang.String getOrientation()

      Return the current orientation. The orientation is portrait when the media feature height is greater than or equal to media feature width, otherwise is landscape.
      Since:
        6.5.0

    - #### isPortrait

          public boolean isPortrait()

      Utility to check if the current orientation is portrait on tablet/mobile device.
      Since:
        6.5.0

    - #### isVertical

          public boolean isVertical()

      Utility to check if the current orientation is portrait on tablet/mobile device.
      Since:
        6.5.0
      See Also:
        `isPortrait()`

    - #### isLandscape

          public boolean isLandscape()

      Utility to check if the current orientation is landscape on tablet/mobile device.
      Since:
        6.5.0

    - #### isHorizontal

          public boolean isHorizontal()

      Utility to check if the current orientation is landscape on tablet/mobile device.
      Since:
        6.5.0
      See Also:
        `isLandscape()`

    - #### getMedia

          public java.lang.String getMedia()

      Returns the serialized media query list which is the value of MatchMedia annotation.
      Since:
        8.0.2

    - #### isMediaMatched

          public boolean isMediaMatched()

      Returns true if the serialized media query list is matched
      Since:
        8.0.2

    - #### getZoneId

          public java.time.ZoneId getZoneId()

      Returns the time-zone ID of the client. The geographical region will be used as a result.
      Since:
        9.0.0