Class Page
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic HandlerRegistrationstatic voidDeprecated.static voidDeprecated.As discussed inBrowserSupport, developers are recommended to consider which browsers they wish to support within their specific application rather than relying on framework supported browser detection.static StringReturns the base URL of the application, which is the page URL minus the last non-directory path component.static voidReturns the directory for application-specific files (other than images).static voidgetAppFilesDir(String URL) Returns the directory for application-specific files (other than images).static StringReturn the directory for app-specific images.static voidReturns 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 intGet the height of the visible portion of the window, not including browser chrome or the scrollbar area.static StringReturn the full URL for app-specific or skin image.static StringReturn the full URL for app-specific or skin image.static StringReturn the root directory for Isomorphic-specific files.static StringReturn the root directory for Isomorphic-supplied tools dir.static PageOrientationIs the current page wider than it is tall ("landscape" orientation) or the reverse ("portrait" orientation).static StringReturn the dir for Showcase-sample images which differ by skin.static StringReturn the dir for skin-specific sample-photos in the product Showcase.static StringgetSamplePhotoDir(String URL) Return the dir for skin-specific sample-photos in the product Showcase.static StringReturn the dir for skin-specific sample-thumbnails in the product Showcase.static StringReturn the dir for skin-specific sample-thumbnails in the product Showcase.static intGet the height of the user's screen, in pixels.static intGet the width of the user's screen, in pixels.static intGet the height of the window contents as they have been drawn.static intGet the amount that the browser window has been scrolled horizontally.static intGet the amount that the browser window has been scrolled vertically.static intGet the width of the window contents as they have been drawn.static StringReturn the directory for media that's part of the skinstatic StringReturn the directory for a skin image.static StringgetSkinImgDir(String imgDir) Return the directory for a skin image.static StringReturn the images directory used by Isomorphic-supplied tools.static StringReturns the text for the prompt shown to user fromcheckBrowserAndRedirect()if they are accessing this page in an unsupported browser andunsupportedBrowserActionis set to"confirm".static StringReturn a full URL for a relative path that uses a special prefix such as "[APPFILES]" or "[SKIN]".static intgetWidth()Get the width of the visible portion of the window, not including browser chrome or the scrollbar area.static BooleanReturns true if add version to skin CSS is currently turned on.static BooleanReturns true if the current skin has a dark background and light text, false otherwise.static BooleanisLoaded()Has the page finished loading?static BooleanisRTL()Return whether the page text direction is right to left.static voidloadStyleSheet(String styleSheetURL) Load a styleSheet for this application.static voidmoveTo(int left, int top) Move the window to a specified top and left in screen coordinates.static voidregisterKey(KeyIdentifier keyIdentifier, KeyCallback callback) Deprecated.in favor ofregisterKey(KeyIdentifier, PageKeyHandler)static voidregisterKey(KeyIdentifier keyIdentifier, PageKeyHandler callback) Fire some action when the Page receives a keyPress event from a certain key.static voidregisterKey(String keyName, KeyCallback callback) Deprecated.in favor ofregisterKey(String, PageKeyHandler)static voidregisterKey(String keyName, PageKeyHandler callback) Fire some action when the Page receives a keyPress event from a certain key.static voidresizeTo(int width, int height) Resize the outer portion of the window to a specific width and height.static voidscrollTo(int left, int top) Scroll the window to a specified top and left coordinate.static voidsetAddVersionToSkinCSS(Boolean addVersionToSkinCss) Setting this to true will causeloadStyleSheet()to append an "isc_version" parameter to the end of the url when loading a stylesheet.static voidSpecify the directory for miscellaneous app-specific files other than images, such asHTML fragments,loadable views, XML or JSON flat data files, videos, etc.static voidsetAppFilesDir(String URL) Specify the directory for miscellaneous app-specific files other than images, such asHTML fragments,loadable views, XML or JSON flat data files, videos, etc.static voidSpecify the directory for app-specific images.static voidsetAppImgDir(String URL) Specify the directory for app-specific images.static voidSpecify the root directory for Isomorphic-supplied files - the directory containing themodules/andsystem/subdirectories shipped as part of the Smart GWT package.static voidsetIsomorphicDir(String URL) Specify the root directory for Isomorphic-supplied files - the directory containing themodules/andsystem/subdirectories shipped as part of the Smart GWT package.static voidSpecify the root directory for Isomorphic-supplied tools.static voidSpecify the root directory for Isomorphic-supplied tools.static voidSpecify the dir for Showcase-sample images which differ by skin.static voidsetSampleImgDir(String URL) Specify the dir for Showcase-sample images which differ by skin.static voidSpecify the dir for skin-specific sample-photos in the product Showcase.static voidsetSamplePhotoDir(String URL) Specify the dir for skin-specific sample-photos in the product Showcase.static voidSpecify the dir for skin-specific sample-thumbnails in the product Showcase.static voidSpecify the dir for skin-specific sample-thumbnails in the product Showcase.static voidSpecify the URL for media that's part of the skinstatic voidsetSkinDir(String URL) Specify the URL for media that's part of the skinstatic voidSet the title of the page, which is typically shown as part of the browser window titlestatic voidunregisterKey(String keyName) Clears an action registered to fire on a specific keyPress event via theregisterKey(String, KeyCallback)method.static voidupdateViewport(Float scale, Integer width, Integer height, Boolean scalable) This method only applies to browsers who support the special viewport meta html tag such as Safari running on the iPhone.
- 
Constructor Details- 
Pagepublic Page()
 
- 
- 
Method Details- 
checkBrowserAndRedirectpublic static void checkBrowserAndRedirect()Deprecated.As discussed inBrowserSupport, 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 ofunsupportedBrowserAction:- "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
 defaultUnsupportedBrowserURL.This method is commonly called as part of the skinninglogic after page load.- See Also:
- 
- com.smartgwt.client.util.Page#unsupportedBrowserAction
- getUnsupportedBrowserPromptString()
- com.smartgwt.client.util.Page#defaultUnsupportedBrowserURL
 
 
- 
checkBrowserAndRedirectDeprecated.As discussed inBrowserSupport, 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 ofunsupportedBrowserAction:- "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
 defaultUnsupportedBrowserURL.This method is commonly called as part of the skinninglogic after page load.- Parameters:
- URL- URL of redirect page. May include Isomorphic special directories such as [SKIN].
- See Also:
- 
- com.smartgwt.client.util.Page#unsupportedBrowserAction
- getUnsupportedBrowserPromptString()
- com.smartgwt.client.util.Page#defaultUnsupportedBrowserURL
 
 
- 
getAppDirReturns 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 fromhttp://foo.com/bar/zoo.jsp, appDir will behttp://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.
 
- 
getAppFilesDirpublic static void getAppFilesDir()Returns the directory for application-specific files (other than images).
- 
getAppFilesDirReturns the directory for application-specific files (other than images).- Parameters:
- URL- New app files URL.
 
- 
getAppImgDirReturn the directory for app-specific images.- Returns:
- URL for page-specific images.
 
- 
getDevicePixelRatiopublic 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 EntryPointis 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.
 
- When your module's 
- 
getImgURLReturn 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.
- 
getImgURLReturn 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.- Parameters:
- src- Local file name for the image. See- SCImgURL
- imgDir- User-specified image directory, local to
- Returns:
- URL for the image.
 
- 
getIsomorphicDirReturn the root directory for Isomorphic-specific files.- Returns:
- IsomorphicDir URL.
 
- 
getIsomorphicToolsDirReturn the root directory for Isomorphic-supplied tools dir.- Returns:
- IsomorphicToolsDir URL.
 
- 
getOrientationIs the current page wider than it is tall ("landscape" orientation) or the reverse ("portrait" orientation). Note that theorientationChange page eventwill 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 discussionon building applications for mobile devices- Returns:
- current page orientation
 
- 
getSampleImgDirReturn the dir for Showcase-sample images which differ by skin.- Returns:
- the dir for Showcase-sample images in the current skin.
 
- 
getSamplePhotoDirReturn the dir for skin-specific sample-photos in the product Showcase.- Returns:
- URL for root directory of sample-photos.
 
- 
getSamplePhotoDirReturn the dir for skin-specific sample-photos in the product Showcase.- Parameters:
- URL- New URL for Showcase sample-photos
- Returns:
- URL for root directory of sample-photos.
 
- 
getSampleThumbnailDirReturn the dir for skin-specific sample-thumbnails in the product Showcase.- Returns:
- URL for root directory of sample-thumbnails.
 
- 
getSampleThumbnailDirReturn the dir for skin-specific sample-thumbnails in the product Showcase.- Parameters:
- URL- New URL for Showcase sample-thumbnails
- Returns:
- URL for root directory of sample-thumbnails.
 
- 
getScrollHeightpublic static int getScrollHeight()Get the height of the window contents as they have been drawn. If the page scrolls, this may be larger than thegetHeight().- Returns:
- height of the page as drawn
 
- 
getScrollLeftpublic static int getScrollLeft()Get the amount that the browser window has been scrolled horizontally.- Returns:
- horizontal scroll amount
 
- 
getScrollToppublic static int getScrollTop()Get the amount that the browser window has been scrolled vertically.- Returns:
- vertical scroll amount
 
- 
getScrollWidthpublic static int getScrollWidth()Get the width of the window contents as they have been drawn. If the page scrolls, this may be larger than thegetWidth().- Returns:
- width of the page as drawn
 
- 
getSkinDirReturn the directory for media that's part of the skin- Returns:
- base URL for skin media
 
- 
getSkinImgDirReturn the directory for a skin image.- Returns:
- URL for page-specific images.
 
- 
getSkinImgDirReturn 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.
 
- 
getToolsImgDirReturn the images directory used by Isomorphic-supplied tools.- Returns:
- ToolsImgDir URL.
 
- 
getUnsupportedBrowserPromptStringReturns the text for the prompt shown to user fromcheckBrowserAndRedirect()if they are accessing this page in an unsupported browser andunsupportedBrowserActionis set to"confirm". May be overridden to return a different message.- Returns:
- Unsupported browser message.
- See Also:
 
- 
getURLReturn a full URL for a relative path that uses a special prefix such as "[APPFILES]" or "[SKIN]".For images, use getImgURL()instead.- Parameters:
- fileName- Local file name for the image.
- Returns:
- URL for the image.
 
- 
isAddVersionToSkinCSSReturns true if add version to skin CSS is currently turned on.- Returns:
- true == add version to skin CSS is turned on
 
- 
isDarkSkinReturns true if the current skin has a dark background and light text, false otherwise.- Returns:
- true if the current skin has a dark background and light text
 
- 
isLoadedHas the page finished loading?- Returns:
- true == page is done loading
 
- 
isRTLReturn whether the page text direction is right to left. If you set "DIR=RTL" in the BODY tag of the page, then this method will return true. If you set "DIR=LTR" then this method will return false.- Returns:
- true if Page text direction is RTL, false otherwise
 
- 
loadStyleSheetLoad a styleSheet for this application. The styleSheetURL parameter can use any special directories, eg:
 Page.loadStylesheet("[SKIN]/skin_styles.css")
 or
 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. 
- 
moveTopublic static void moveTo(int left, int top) Move the window to a specified top and left in screen coordinates.- Parameters:
- left- new left coordinate for window
- top- new top coordinate for window
 
- 
resizeTopublic static void resizeTo(int width, int height) Resize the outer portion of the window to a specific width and height.- Parameters:
- width- new width for the window
- height- new height for the window
 
- 
scrollTopublic static void scrollTo(int left, int top) Scroll the window to a specified top and left coordinate.- Parameters:
- left- new left coordinate for window
- top- new top coordinate for window
 
- 
setAddVersionToSkinCSSSetting this to true will causeloadStyleSheet()to append an "isc_version" parameter to the end of the url when loading a stylesheet.- Parameters:
- addVersionToSkinCss- pass in true to turn on automatic adding of version parameter to css urls.
 
- 
setAppFilesDirpublic static void setAppFilesDir()Specify the directory for miscellaneous app-specific files other than images, such asHTML 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.
- 
setAppFilesDirSpecify the directory for miscellaneous app-specific files other than images, such asHTML 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.- Parameters:
- URL- New app files URL.
 
- 
setAppImgDirpublic static void setAppImgDir()Specify the directory for app-specific images.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/" 
- 
setAppImgDirSpecify the directory for app-specific images.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/" - Parameters:
- URL- New imgDir URL.
 
- 
setIsomorphicDirpublic static void setIsomorphicDir()Specify the root directory for Isomorphic-supplied files - the directory containing themodules/andsystem/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.isomorphicDirbefore loading the Smart GWT library files.
- 
setIsomorphicDirSpecify the root directory for Isomorphic-supplied files - the directory containing themodules/andsystem/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.isomorphicDirbefore loading the Smart GWT library files.- Parameters:
- URL- New IsomorphicDir URL.
 
- 
setIsomorphicToolsDirpublic static void setIsomorphicToolsDir()Specify the root directory for Isomorphic-supplied tools. Typicall tools/ under webRoot.Note that this property is commonly specified directly in the bootstrap HTML file by setting window.isomorphicToolsDirbefore loading the Smart GWT library files. If unset, it defaults to $isomorphicDir/../tools/
- 
setIsomorphicToolsDirSpecify the root directory for Isomorphic-supplied tools. Typicall tools/ under webRoot.Note that this property is commonly specified directly in the bootstrap HTML file by setting window.isomorphicToolsDirbefore loading the Smart GWT library files. If unset, it defaults to $isomorphicDir/../tools/- Parameters:
- URL- New IsomorphicToolsDir URL.
 
- 
setSampleImgDirpublic static void setSampleImgDir()Specify the dir for Showcase-sample images which differ by skin.
- 
setSampleImgDirSpecify the dir for Showcase-sample images which differ by skin.- Parameters:
- URL- New URL for Showcase-sample images in the current skin
 
- 
setSamplePhotoDirpublic static void setSamplePhotoDir()Specify the dir for skin-specific sample-photos in the product Showcase.
- 
setSamplePhotoDirSpecify the dir for skin-specific sample-photos in the product Showcase.- Parameters:
- URL- New URL for Showcase sample-photos
 
- 
setSampleThumbnailDirpublic static void setSampleThumbnailDir()Specify the dir for skin-specific sample-thumbnails in the product Showcase.
- 
setSampleThumbnailDirSpecify the dir for skin-specific sample-thumbnails in the product Showcase.- Parameters:
- URL- New URL for Showcase sample thumbnails
 
- 
setSkinDirpublic static void setSkinDir()Specify the URL for media that's part of the skin
- 
setSkinDirSpecify the URL for media that's part of the skin- Parameters:
- URL- New skinDir URL
 
- 
registerKeyDeprecated.in favor ofregisterKey(String, PageKeyHandler)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
 
- 
registerKeyDeprecated.in favor ofregisterKey(KeyIdentifier, PageKeyHandler)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
 
- 
registerKeyFire 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
 
- 
registerKeyFire 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:
- keyIdentifier- the key identifier
- callback- a cancellable PageKeyHandler instance
 
- 
unregisterKeyClears an action registered to fire on a specific keyPress event via theregisterKey(String, KeyCallback)method.- Parameters:
- keyName- name of key to clear registry entries for
 
- 
setTitleSet the title of the page, which is typically shown as part of the browser window title- Parameters:
- title- the page title
 
- 
getWidthpublic static int getWidth()Get the width of the visible portion of the window, not including browser chrome or the scrollbar area.- Returns:
- the width of the page
 
- 
getHeightpublic static int getHeight()Get the height of the visible portion of the window, not including browser chrome or the scrollbar area.- Returns:
- the height of the page
 
- 
getScreenWidthpublic static int getScreenWidth()Get the width of the user's screen, in pixels.- Returns:
- the screen width
 
- 
getScreenHeightpublic static int getScreenHeight()Get the height of the user's screen, in pixels.- Returns:
- the screen height
 
- 
updateViewportThis 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.)?
 
- 
addOrientationChangeHandler
 
- 
BrowserSupport, developers are recommended to consider which browsers they wish to support within their specific application rather than relying on framework supported browser detection.