Package org.pepstock.charba.client.utils
Class Window
- java.lang.Object
-
- org.pepstock.charba.client.utils.Window
-
@JsType(isNative=true, namespace="<global>", name="window") public final class Window extends Object
The window object represents an open window in a browser.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
alert(String message)
Displays an alert box with a specified message and an OK button.static String
atob(String encoded)
Decode a base-64 encoded stringstatic String
btoa(String str)
Encodes a string in base-64.static void
cancelAnimationFrame(int handle)
Cancels an animation frame request previously scheduled through a call to #requestAnimationFrame(RequestAnimationCallback)
.static void
enableResizeOnBeforePrint()
CSS media queries allow changing styles when printing a page.static double
getDevicePixelRatio()
Returns the device pixel ratiostatic int
getInnerHeight()
The innerHeight property returns the inner height of a window's content area.static int
getInnerWidth()
The innerWidth property returns the inner width of a window's content area.static int
getOuterHeight()
The outerHeight property returns the outer height of a window, including all interface elements (like toolbars/scrollbars).static int
getOuterWidth()
The outerWidth property returns the outer width of a window, including all interface elements (like toolbars/scrollbars).static int
requestAnimationFrame(RequestAnimationCallback callback)
Tells the browser that you wish to perform an animation and requests that the browser calls a specified function to update an animation right before the next repaint.
The method takes a callback as an argument to be invoked before the repaint.static <T> T
undefined()
Returns anundefined
instance.
-
-
-
Method Detail
-
undefined
@JsProperty(name="undefined") public static <T> T undefined()
Returns anundefined
instance.- Type Parameters:
T
- type of result object- Returns:
- the
undefined
instance
-
getDevicePixelRatio
@JsProperty public static double getDevicePixelRatio()
Returns the device pixel ratio- Returns:
- The device pixel ratio
-
getInnerWidth
@JsProperty public static int getInnerWidth()
The innerWidth property returns the inner width of a window's content area.- Returns:
- The inner width of a window's content area.
-
getInnerHeight
@JsProperty public static int getInnerHeight()
The innerHeight property returns the inner height of a window's content area.- Returns:
- The inner height of a window's content area.
-
getOuterWidth
@JsProperty public static int getOuterWidth()
The outerWidth property returns the outer width of a window, including all interface elements (like toolbars/scrollbars).- Returns:
- The outer width of a window, including all interface elements (like toolbars/scrollbars).
-
getOuterHeight
@JsProperty public static int getOuterHeight()
The outerHeight property returns the outer height of a window, including all interface elements (like toolbars/scrollbars).- Returns:
- The outer height of a window, including all interface elements (like toolbars/scrollbars).
-
alert
public static void alert(String message)
Displays an alert box with a specified message and an OK button.- Parameters:
message
- The text to display in the alert box
-
atob
public static String atob(String encoded)
Decode a base-64 encoded string- Parameters:
encoded
- Required. The string which has been encoded by the btoa() method- Returns:
- Decoded a base-64 encoded string
-
btoa
public static String btoa(String str)
Encodes a string in base-64. This method uses the "A-Z", "a-z", "0-9", "+", "/" and "=" characters to encode the string.- Parameters:
str
- Required. The string to be encoded- Returns:
- A String, representing the base-64 encoded string
-
cancelAnimationFrame
public static void cancelAnimationFrame(int handle)
Cancels an animation frame request previously scheduled through a call to #requestAnimationFrame(RequestAnimationCallback)
.- Parameters:
handle
- The ID value returned by the call torequestAnimationFrame(RequestAnimationCallback)
that requested the callback.
-
enableResizeOnBeforePrint
@JsOverlay public static void enableResizeOnBeforePrint()
CSS media queries allow changing styles when printing a page. The CSS applied from these media queries may cause charts to need to resize. However, the resize won't happen automatically. To support resizing charts when printing, one needs to hook theonbeforeprint
event and manually trigger resizing of each chart.
-
requestAnimationFrame
@JsOverlay public static int requestAnimationFrame(RequestAnimationCallback callback)
Tells the browser that you wish to perform an animation and requests that the browser calls a specified function to update an animation right before the next repaint.
The method takes a callback as an argument to be invoked before the repaint.- Parameters:
callback
- the function to call when it's time to update your animation for the next repaint.- Returns:
- A integer integer value, the request id, that uniquely identifies the entry in the callback list.
This is a non-zero value, but you may not make any other assumptions about its value.
You can pass this value tocancelAnimationFrame(int)
to cancel the refresh callback request.
-
-