public class Page
extends java.lang.Object
Constructor and Description |
---|
Page() |
Modifier and Type | Method and Description |
---|---|
static com.google.gwt.event.shared.HandlerRegistration |
addOrientationChangeHandler(OrientationChangeHandler handler) |
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. |
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. |
static java.lang.String |
getAppDir()
Returns the base URL of the application, which is the page URL minus the last non-directory path component.
|
static void |
getAppFilesDir()
Returns the directory for application-specific files (other than images).
|
static void |
getAppFilesDir(java.lang.String URL)
Returns the directory for application-specific files (other than images).
|
static java.lang.String |
getAppImgDir()
Return the directory for app-specific images.
|
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.
|
static int |
getHeight()
Get the height of the visible portion of the window, not including browser chrome or the scrollbar area.
|
static java.lang.String |
getImgURL(java.lang.String src)
Return the full URL for app-specific or skin image.
|
static java.lang.String |
getImgURL(java.lang.String src,
java.lang.String imgDir)
Return the full URL for app-specific or skin image.
|
static java.lang.String |
getIsomorphicDir()
Return the root directory for Isomorphic-specific files.
|
static java.lang.String |
getIsomorphicToolsDir()
Return the root directory for Isomorphic-supplied tools dir.
|
static PageOrientation |
getOrientation()
Is the current page wider than it is tall ("landscape" orientation) or the reverse ("portrait" orientation).
|
static java.lang.String |
getSampleImgDir()
Return the dir for Showcase-sample images which differ by skin.
|
static java.lang.String |
getSamplePhotoDir()
Return the dir for skin-specific sample-photos in the product Showcase.
|
static java.lang.String |
getSamplePhotoDir(java.lang.String URL)
Return the dir for skin-specific sample-photos in the product Showcase.
|
static java.lang.String |
getSampleThumbnailDir()
Return the dir for skin-specific sample-thumbnails in the product Showcase.
|
static java.lang.String |
getSampleThumbnailDir(java.lang.String URL)
Return the dir for skin-specific sample-thumbnails in the product Showcase.
|
static int |
getScreenHeight()
Get the height of the user's screen, in pixels.
|
static int |
getScreenWidth()
Get the width of the user's screen, in pixels.
|
static int |
getScrollHeight()
Get the height of the window contents as they have been drawn.
|
static int |
getScrollLeft()
Get the amount that the browser window has been scrolled horizontally.
|
static int |
getScrollTop()
Get the amount that the browser window has been scrolled vertically.
|
static int |
getScrollWidth()
Get the width of the window contents as they have been drawn.
|
static java.lang.String |
getSkinDir()
Return the directory for media that's part of the skin
|
static java.lang.String |
getSkinImgDir()
Return the directory for a skin image.
|
static java.lang.String |
getSkinImgDir(java.lang.String imgDir)
Return the directory for a skin image.
|
static java.lang.String |
getToolsImgDir()
Return the images directory used by Isomorphic-supplied tools.
|
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" . |
static java.lang.String |
getURL(java.lang.String fileName)
Return a full URL for a relative path that uses a special prefix such as "[APPFILES]" or "[SKIN]".
|
static int |
getWidth()
Get the width of the visible portion of the window, not including browser chrome or the scrollbar area.
|
static java.lang.Boolean |
isAddVersionToSkinCSS()
Returns true if add version to skin CSS is currently turned on.
|
static java.lang.Boolean |
isLoaded()
Has the page finished loading?
|
static java.lang.Boolean |
isRTL()
Return whether the page text direction is right to left.
|
static void |
loadStyleSheet(java.lang.String styleSheetURL)
Load a styleSheet for this application.
|
static void |
moveTo(int left,
int top)
Move the window to a specified top and left in screen coordinates.
|
static void |
registerKey(KeyIdentifier keyIdentifier,
KeyCallback callback)
Deprecated.
in favor of
registerKey(KeyIdentifier, PageKeyHandler) |
static void |
registerKey(KeyIdentifier keyIdentifier,
PageKeyHandler callback)
Fire some action when the Page receives a keyPress event from a certain key.
|
static void |
registerKey(java.lang.String keyName,
KeyCallback callback)
Deprecated.
in favor of
registerKey(String, PageKeyHandler) |
static void |
registerKey(java.lang.String keyName,
PageKeyHandler callback)
Fire some action when the Page receives a keyPress event from a certain key.
|
static void |
resizeTo(int width,
int height)
Resize the outer portion of the window to a specific width and height.
|
static void |
scrollTo(int left,
int top)
Scroll the window to a specified top and left coordinate.
|
static void |
setAddVersionToSkinCSS(java.lang.Boolean addVersionToSkinCss)
Setting this to true will cause
loadStyleSheet() to append an
"isc_version" parameter to the end of the url when loading a stylesheet. |
static void |
setAppFilesDir()
Specify the directory for miscellaneous app-specific files other than images, such as
HTML fragments , loadable views , XML or JSON flat data files, videos, etc. |
static void |
setAppFilesDir(java.lang.String URL)
Specify the directory for miscellaneous app-specific files other than images, such as
HTML fragments , loadable views , XML or JSON flat data files, videos, etc. |
static void |
setAppImgDir()
Specify the directory for app-specific images.
|
static void |
setAppImgDir(java.lang.String URL)
Specify the directory for app-specific images.
|
static void |
setIsomorphicDir()
Specify the root directory for Isomorphic-supplied files - the directory containing the
modules/ and
system/ subdirectories shipped as part of the Smart GWT package. |
static void |
setIsomorphicDir(java.lang.String URL)
Specify the root directory for Isomorphic-supplied files - the directory containing the
modules/ and
system/ subdirectories shipped as part of the Smart GWT package. |
static void |
setIsomorphicToolsDir()
Specify the root directory for Isomorphic-supplied tools.
|
static void |
setIsomorphicToolsDir(java.lang.String URL)
Specify the root directory for Isomorphic-supplied tools.
|
static void |
setSampleImgDir()
Specify the dir for Showcase-sample images which differ by skin.
|
static void |
setSampleImgDir(java.lang.String URL)
Specify the dir for Showcase-sample images which differ by skin.
|
static void |
setSamplePhotoDir()
Specify the dir for skin-specific sample-photos in the product Showcase.
|
static void |
setSamplePhotoDir(java.lang.String URL)
Specify the dir for skin-specific sample-photos in the product Showcase.
|
static void |
setSampleThumbnailDir()
Specify the dir for skin-specific sample-thumbnails in the product Showcase.
|
static void |
setSampleThumbnailDir(java.lang.String URL)
Specify the dir for skin-specific sample-thumbnails in the product Showcase.
|
static void |
setSkinDir()
Specify the URL for media that's part of the skin
|
static void |
setSkinDir(java.lang.String URL)
Specify the URL for media that's part of the skin
|
static void |
setTitle(java.lang.String title)
Set the title of the page, which is typically shown as part of the browser window title
|
static void |
unregisterKey(java.lang.String keyName)
Clears an action registered to fire on a specific keyPress event via the
registerKey(String, KeyCallback) method. |
static void |
updateViewport(java.lang.Float scale,
java.lang.Integer width,
java.lang.Integer height,
java.lang.Boolean scalable)
This method only applies to browsers who support the special viewport meta html tag such as Safari running on the
iPhone.
|
public static void checkBrowserAndRedirect()
BrowserSupport
, developers are recommended to consider which browsers
they wish to support within their specific application rather than relying on framework supported browser detection.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 URLdefaultUnsupportedBrowserURL
. This method is commonly called as part of the skinning
logic after page load.
com.smartgwt.client.util.Page#unsupportedBrowserAction
,
getUnsupportedBrowserPromptString()
,
com.smartgwt.client.util.Page#defaultUnsupportedBrowserURL
public static void checkBrowserAndRedirect(java.lang.String URL)
BrowserSupport
, developers are recommended to consider which browsers
they wish to support within their specific application rather than relying on framework supported browser detection.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 URLdefaultUnsupportedBrowserURL
. This method is commonly called as part of the skinning
logic after page load.
URL
- URL of redirect page. May include Isomorphic special directories such as [SKIN].com.smartgwt.client.util.Page#unsupportedBrowserAction
,
getUnsupportedBrowserPromptString()
,
com.smartgwt.client.util.Page#defaultUnsupportedBrowserURL
public static java.lang.String getAppDir()
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.
public static void getAppFilesDir()
public static void getAppFilesDir(java.lang.String URL)
URL
- New app files URL.public static java.lang.String getAppImgDir()
public static void getDevicePixelRatio()
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:
EntryPoint
is called, store the current device pixel
ratio notify()
to let the user know a page resize
may be needed. public static java.lang.String getImgURL(java.lang.String src)
To use a skin image, start the URL with "[SKIN]". Any other
relative URL is assumed relative to the appImgDir
.
public static java.lang.String getImgURL(java.lang.String src, java.lang.String imgDir)
To use a skin image, start the URL with "[SKIN]". Any other
relative URL is assumed relative to the appImgDir
.
src
- Local file name for the image.
See SCImgURL
imgDir
- User-specified image directory, local topublic static java.lang.String getIsomorphicDir()
public static java.lang.String getIsomorphicToolsDir()
public static PageOrientation getOrientation()
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
public static java.lang.String getSampleImgDir()
public static java.lang.String getSamplePhotoDir()
public static java.lang.String getSamplePhotoDir(java.lang.String URL)
URL
- New URL for Showcase sample-photospublic static java.lang.String getSampleThumbnailDir()
public static java.lang.String getSampleThumbnailDir(java.lang.String URL)
URL
- New URL for Showcase sample-thumbnailspublic static int getScrollHeight()
getHeight()
.public static int getScrollLeft()
public static int getScrollTop()
public static int getScrollWidth()
getWidth()
.public static java.lang.String getSkinDir()
public static java.lang.String getSkinImgDir()
public static java.lang.String getSkinImgDir(java.lang.String imgDir)
imgDir
- Partial URL (relative to Page._skinDir) where the image lives. If not supplied, will use "images/".
See URL
public static java.lang.String getToolsImgDir()
public static java.lang.String getUnsupportedBrowserPromptString()
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.checkBrowserAndRedirect()
public static java.lang.String getURL(java.lang.String fileName)
For images, use
getImgURL()
instead.
fileName
- Local file name for the image.public static java.lang.Boolean isAddVersionToSkinCSS()
public static java.lang.Boolean isLoaded()
public static java.lang.Boolean isRTL()
public static void loadStyleSheet(java.lang.String styleSheetURL)
Page.loadStylesheet("[SKIN]/skin_styles.css")
Page.loadStylesheet("[APP]/app_styles.css")
. If you don't specify a special directory, the app directory will be assumed.
Note: If the document's ONLOAD handler has already fired, this will have no effect.
public static void moveTo(int left, int top)
left
- new left coordinate for windowtop
- new top coordinate for windowpublic static void resizeTo(int width, int height)
width
- new width for the windowheight
- new height for the windowpublic static void scrollTo(int left, int top)
left
- new left coordinate for windowtop
- new top coordinate for windowpublic static void setAddVersionToSkinCSS(java.lang.Boolean addVersionToSkinCss)
loadStyleSheet()
to append an
"isc_version" parameter to the end of the url when loading a stylesheet.addVersionToSkinCss
- pass in true to turn on automatic adding of version parameter to css urls.public static void setAppFilesDir()
HTML fragments
, loadable views
, XML or JSON flat data files, videos, etc. This URL also becomes available via the prefix
"[APPFILES]" for RPCRequest.actionURL
.
Defaults to the value
of getAppDir()
, that is, the current directory.
public static void setAppFilesDir(java.lang.String URL)
HTML fragments
, loadable views
, XML or JSON flat data files, videos, etc. This URL also becomes available via the prefix
"[APPFILES]" for RPCRequest.actionURL
.
Defaults to the value
of getAppDir()
, that is, the current directory.
URL
- New app files URL.public static void setAppImgDir()
This becomes the default location where any Smart GWT component will load images from unless the special "[SKIN]" prefix is used to indicate that an image is part of a skin.
Default is "[APP]images/"
public static void setAppImgDir(java.lang.String URL)
This becomes the default location where any Smart GWT component will load images from unless the special "[SKIN]" prefix is used to indicate that an image is part of a skin.
Default is "[APP]images/"
URL
- New imgDir URL.public static void setIsomorphicDir()
modules/
and
system/
subdirectories shipped as part of the Smart GWT package. Note that this property is commonly
specified directly in the bootstrap HTML file by setting window.isomorphicDir
before loading the Smart GWT
library files.
public static void setIsomorphicDir(java.lang.String URL)
modules/
and
system/
subdirectories shipped as part of the Smart GWT package. Note that this property is commonly
specified directly in the bootstrap HTML file by setting window.isomorphicDir
before loading the Smart GWT
library files.
URL
- New IsomorphicDir URL.public static void 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/
public static void setIsomorphicToolsDir(java.lang.String URL)
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/
URL
- New IsomorphicToolsDir URL.public static void setSampleImgDir()
public static void setSampleImgDir(java.lang.String URL)
URL
- New URL for Showcase-sample images in the current skinpublic static void setSamplePhotoDir()
public static void setSamplePhotoDir(java.lang.String URL)
URL
- New URL for Showcase sample-photospublic static void setSampleThumbnailDir()
public static void setSampleThumbnailDir(java.lang.String URL)
URL
- New URL for Showcase sample thumbnailspublic static void setSkinDir()
public static void setSkinDir(java.lang.String URL)
URL
- New skinDir URLpublic static void registerKey(java.lang.String keyName, KeyCallback callback)
registerKey(String, PageKeyHandler)
keyName
- the key namecallback
- the callback functionpublic static void registerKey(KeyIdentifier keyIdentifier, KeyCallback callback)
registerKey(KeyIdentifier, PageKeyHandler)
keyIdentifier
- the key identifiercallback
- the callback functionpublic static void registerKey(java.lang.String keyName, PageKeyHandler callback)
keyName
- the key namecallback
- a cancellable PageKeyHandler instancepublic static void registerKey(KeyIdentifier keyIdentifier, PageKeyHandler callback)
keyIdentifier
- the key identifiercallback
- a cancellable PageKeyHandler instancepublic static void unregisterKey(java.lang.String keyName)
registerKey(String, KeyCallback)
method.keyName
- name of key to clear registry entries forpublic static void setTitle(java.lang.String title)
title
- the page titlepublic static int getWidth()
public static int getHeight()
public static int getScreenWidth()
public static int getScreenHeight()
public static void updateViewport(java.lang.Float scale, java.lang.Integer width, java.lang.Integer height, java.lang.Boolean scalable)
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:
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.)?public static com.google.gwt.event.shared.HandlerRegistration addOrientationChangeHandler(OrientationChangeHandler handler)