As discussed in BrowserSupport, developers are recommended to consider which browsers
they wish to support within their specific application rather than relying on framework supported browser detection.

As discussed in BrowserSupport, developers are recommended to consider which browsers
they wish to support within their specific application rather than relying on framework supported browser detection.

Methods inherited from class java.lang.Object

Constructor Detail

Page

public Page()

Method Detail

checkBrowserAndRedirect

public static void checkBrowserAndRedirect()

Deprecated.As discussed in BrowserSupport, developers are recommended to consider which browsers
they wish to support within their specific application rather than relying on framework supported browser detection.

Check whether the browser is supported by the Isomorphic Smart GWT system. Behavior depends upon the value of unsupportedBrowserAction:

"continue" Load
the page without notifying the user of potential issues

"confirm" Notify the user via a standard
confirm dialog that their browser is not supported. Provide options to continue anyway, or redirect to another page.
Text of the confirm dialog is retrieved by calling getUnsupportedBrowserPromptString().

"redirect" Automatically redirect to the another URL

If redirecting to another page is
necessary, and no explicit URL is provided we will use defaultUnsupportedBrowserURL.

This method is commonly called as part of the skinning logic after page load.

checkBrowserAndRedirect

public static void checkBrowserAndRedirect(java.lang.String URL)

Deprecated.As discussed in BrowserSupport, developers are recommended to consider which browsers
they wish to support within their specific application rather than relying on framework supported browser detection.

Check whether the browser is supported by the Isomorphic Smart GWT system. Behavior depends upon the value of unsupportedBrowserAction:

"continue" Load
the page without notifying the user of potential issues

"confirm" Notify the user via a standard
confirm dialog that their browser is not supported. Provide options to continue anyway, or redirect to another page.
Text of the confirm dialog is retrieved by calling getUnsupportedBrowserPromptString().

"redirect" Automatically redirect to the another URL

If redirecting to another page is
necessary, and no explicit URL is provided we will use defaultUnsupportedBrowserURL.

This method is commonly called as part of the skinning logic after page load.

Parameters:

URL - URL of redirect page. May include Isomorphic special directories such as [SKIN].

getAppDir

public static java.lang.String getAppDir()

Returns the base URL of the application, which is the page URL minus the last non-directory path component. For
example, if the page is loaded from http://foo.com/bar/zoo.jsp, appDir will be
http://foo.com/bar/.

If other page-wide URLs such as setIsomorphicDir() are specified as relative paths, they are considered
relative to this URL.

Returns:

URL for page-specific files.

getAppFilesDir

public static void getAppFilesDir()

Returns the directory for application-specific files (other than images).

getAppFilesDir

public static void getAppFilesDir(java.lang.String URL)

Returns the directory for application-specific files (other than images).

Parameters:

URL - New app files URL.

getAppImgDir

public static java.lang.String getAppImgDir()

Return the directory for app-specific images.

Returns:

URL for page-specific images.

getDevicePixelRatio

public static void getDevicePixelRatio()

Returns the current ratio of the resolution in physical pixels to the resolution in CSS pixels in the browser, known as
the device pixel
ratio. The ratio reflects the combination of OS-level zoom, browser-level zoom, and device/OS defaults.

When
this value isn't 1, some browser bugs manifest, so it can be useful to check it as an indicator that certain issues may
be present and, in turn, whether workarounds fom them must run. However, note that on Safari it's not useful as the
value is identically 1.

A specific application of this function is to check whether any zoom is present after a
resize event so that the user can be informed that a page reload might be required for proper rendering. For that you'd
want to follow these steps:

When your module's EntryPoint is called, store the current device pixel
ratio

Then add a window resize handler (see Window.addResizeHandler()) that checks whether the ratio has transitioned away from one.

If
zooming has been introduced, call notify() to let the user know a page resize
may be needed.

getImgURL

public static java.lang.String getImgURL(java.lang.String src)

Return the full URL for app-specific or skin image.

To use a skin image, start the URL with "[SKIN]". Any other
relative URL is assumed relative to the appImgDir.

getOrientation

Is the current page wider than it is tall ("landscape" orientation) or the reverse ("portrait" orientation). Note that
the orientationChange page event will be fired whenever the page orientation
changes.

This method is typically useful for apps developed for display on mobile devices, though it will also
return a valid value when running against a desktop browser. See also this discussion on building applications for mobile devices

Returns:

current page orientation

getScrollHeight

public static int getScrollHeight()

Get the height of the window contents as they have been drawn. If the page scrolls, this may be larger than the getHeight().

Returns:

height of the page as drawn

getScrollLeft

public static int getScrollLeft()

Get the amount that the browser window has been scrolled horizontally.

Returns:

horizontal scroll amount

getScrollTop

public static int getScrollTop()

Get the amount that the browser window has been scrolled vertically.

Returns:

vertical scroll amount

getScrollWidth

public static int getScrollWidth()

Get the width of the window contents as they have been drawn. If the page scrolls, this may be larger than the getWidth().

Returns:

width of the page as drawn

getSkinDir

public static java.lang.String getSkinDir()

Return the directory for media that's part of the skin

Returns:

base URL for skin media

getSkinImgDir

public static java.lang.String getSkinImgDir()

Return the directory for a skin image.

Returns:

URL for page-specific images.

getSkinImgDir

public static java.lang.String getSkinImgDir(java.lang.String imgDir)

Return the directory for a skin image.

Parameters:

imgDir - Partial URL (relative to Page._skinDir) where the image lives. If not supplied, will use "images/".
See URL

Returns:

URL for page-specific images.

getToolsImgDir

public static java.lang.String getToolsImgDir()

Return the images directory used by Isomorphic-supplied tools.

Returns:

ToolsImgDir URL.

getUnsupportedBrowserPromptString

public static java.lang.String getUnsupportedBrowserPromptString()

Returns the text for the prompt shown to user from checkBrowserAndRedirect() if they are accessing this page in an unsupported browser and unsupportedBrowserAction is set to "confirm". May
be overridden to return a different message.

setIsomorphicToolsDir

Note that this property is
commonly specified directly in the bootstrap HTML file by setting window.isomorphicToolsDir before loading
the Smart GWT library files. If unset, it defaults to $isomorphicDir/../tools/

setIsomorphicToolsDir

Note that this property is
commonly specified directly in the bootstrap HTML file by setting window.isomorphicToolsDir before loading
the Smart GWT library files. If unset, it defaults to $isomorphicDir/../tools/

Parameters:

URL - New IsomorphicToolsDir URL.

setSkinDir

public static void setSkinDir()

Specify the URL for media that's part of the skin

setSkinDir

public static void setSkinDir(java.lang.String URL)

Specify the URL for media that's part of the skin

Parameters:

URL - New skinDir URL

registerKey

Fire some action when the Page receives a keyPress event from a certain key.
Note that if a widget has keyboard focus, this action will fire only after any widget-level
keyPress handlers have fired and bubbled the event up to the top of their ancestor chain.
Multiple actions can be registered to fire on a single keyPress using this method.
This differs from calling Page.setEvent() with the "keyPress" events registered via setEvent() will fire before widget
level handlers respond to the event, and will fire for every keyPress event, not just those triggered by some specific
key or key-combination.

Parameters:

keyName - the key name

callback - the callback function

registerKey

Fire some action when the Page receives a keyPress event from a certain key.
Note that if a widget has keyboard focus, this action will fire only after any widget-level
keyPress handlers have fired and bubbled the event up to the top of their ancestor chain.
Multiple actions can be registered to fire on a single keyPress using this method.
This differs from calling Page.setEvent() with the "keyPress" events registered via setEvent() will fire before widget
level handlers respond to the event, and will fire for every keyPress event, not just those triggered by some specific
key or key-combination.

Parameters:

keyIdentifier - the key identifier

callback - the callback function

registerKey

Fire some action when the Page receives a keyPress event from a certain key.
Note that if a widget has keyboard focus, this action will fire only after any widget-level
keyPress handlers have fired and bubbled the event up to the top of their ancestor chain.
Multiple actions can be registered to fire on a single keyPress using this method.
This differs from calling Page.setEvent() with the "keyPress" events registered via
setEvent() will fire before widget level handlers respond to the event, and will fire for
every keyPress event, not just those triggered by some specific key or key-combination.
To attempt to cancel the native behavior of a browser-level event, call cancel() on the
PageKeyHandler. Note, however, that not all browsers support cancelling all native
actions, and that cancelling certain native key shortcuts can be annoying to end users
(like cancelling a key shortcut used to create a new bookmark, for example).

Parameters:

keyName - the key name

callback - a cancellable PageKeyHandler instance

registerKey

Fire some action when the Page receives a keyPress event from a certain key.
Note that if a widget has keyboard focus, this action will fire only after any widget-level
keyPress handlers have fired and bubbled the event up to the top of their ancestor chain.
Multiple actions can be registered to fire on a single keyPress using this method.
This differs from calling Page.setEvent() with the "keyPress" events registered via
setEvent() will fire before widget level handlers respond to the event, and will fire for
every keyPress event, not just those triggered by some specific key or key-combination.
To attempt to cancel the native behavior of a browser-level event, call cancel() on the
PageKeyHandler. Note, however, that not all browsers support cancelling all native
actions, and that cancelling certain native key shortcuts can be annoying to end users
(like cancelling a key shortcut used to create a new bookmark, for example).

updateViewport

This method only applies to browsers who support the special viewport meta html tag such as Safari running on the
iPhone.

This method will dynamically change the viewport configuration, allowing you to set an initial size or scale
level and enable / disable user-scaling. Typically this method will be called with a value for scale, width or height
rather than passing in values for all three properties. See the apple documentation about configuring the viewport
for more information:

Parameters:

scale - Desired scale level where 1 indicates no scaling (each CSS pixel will be displayed using 1px on the physical device).
Pass in null to avoid setting this property.

width - Desired viewport width in pixels. This indicates how many pixels should fit within the device screen. Pass in null to
avoid setting this property.

height - Desired viewport height in pixels. This indicates how many pixels should fit within the device screen. Pass in null to
avoid setting this property.

scalable - Should the user be able to scale the application (using pinch gestures, double tapping, rotating the device, etc.)?