|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.smartgwt.client.util.Page
public class Page
Provides information about the page you're loaded in. We define "page" here to be roughly equivalent to the browser window or frame the libraries have been loaded in.
Constructor Summary | |
---|---|
Page()
|
Method Summary | |
---|---|
static void |
checkBrowserAndRedirect()
Check whether the browser is supported by the Isomorphic SmartGWT system. |
static void |
checkBrowserAndRedirect(java.lang.String URL)
Check whether the browser is supported by the Isomorphic SmartGWT system. |
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 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 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. If the page scrolls, this may be larger than the page.getHeight(). |
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. If the page scrolls, this may be larger than the page.getWidth(). |
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 |
getUnsupportedBrowserPromptString()
Returns the text for the prompt shown to user from checkBrowserAndRedirect()
if they are accessing this page in an unsupported
browser and com.smartgwt.client.util.Page#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 |
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)
Fire some action when the Page recieves a keyPress event from a certain key. |
static void |
registerKey(java.lang.String keyName,
KeyCallback callback)
Fire some action when the Page recieves 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 |
setAppFilesDir()
Specify the directory for miscellaneous app-specific files other than images, such as contentsURL , ViewLoader ,
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 contentsURL , ViewLoader ,
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. |
static void |
setIsomorphicDir(java.lang.String URL)
Specify the root directory for Isomorphic-supplied files. |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Page()
Method Detail |
---|
public static java.lang.Boolean isLoaded()
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 setAppImgDir()
This becomes the default location where any SmartGWT 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 SmartGWT 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 java.lang.String getAppImgDir()
public static void setAppFilesDir()
contentsURL
, ViewLoader
,
XML or JSON flat data files, videos, etc.
This URL also becomes available via the prefix "[APPFILES]" for actionURL
.
Defaults to the value of getAppDir()
, that is, the current directory.
public static void setAppFilesDir(java.lang.String URL)
contentsURL
, ViewLoader
,
XML or JSON flat data files, videos, etc.
This URL also becomes available via the prefix "[APPFILES]" for actionURL
.
Defaults to the value of getAppDir()
, that is, the current directory.
URL
- New app files URL.public static void getAppFilesDir()
public static void getAppFilesDir(java.lang.String URL)
URL
- New app files URL.public static void setIsomorphicDir()
public static void setIsomorphicDir(java.lang.String URL)
URL
- New IsomorphicDir URL.public static java.lang.String getIsomorphicDir()
public static void setSkinDir()
public static void setSkinDir(java.lang.String URL)
URL
- New skinDir URLpublic 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/"
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 getAppImgDir()
.
src
- Local file name for the image.
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 getAppImgDir()
.
src
- Local file name for the image.imgDir
- User-specified image directory, local to
public static java.lang.String getURL(java.lang.String fileName)
For images, use getImgURL(java.lang.String)
instead.
fileName
- Local file name for the image.
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.
styleSheetURL
- URL to the stylesheet.public static void resizeTo(int width, int height)
width
- new width for the windowheight
- new height for the windowpublic static void moveTo(int left, int top)
left
- new left coordinate for windowtop
- new top coordinate for windowpublic static void scrollTo(int left, int top)
left
- new left coordinate for windowtop
- new top coordinate for windowpublic static int getScrollWidth()
public static int getScrollHeight()
public static int getScrollLeft()
public static int getScrollTop()
public static void checkBrowserAndRedirect()
com.smartgwt.client.util.Page#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 URLcom.smartgwt.client.util.Page#defaultUnsupportedBrowserURL
.
This method is commonly called as part of the 'skinning'
logic after page
load.
public static void checkBrowserAndRedirect(java.lang.String URL)
com.smartgwt.client.util.Page#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 URLcom.smartgwt.client.util.Page#defaultUnsupportedBrowserURL
.
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].public static java.lang.String getUnsupportedBrowserPromptString()
checkBrowserAndRedirect()
if they are accessing this page in an unsupported
browser and com.smartgwt.client.util.Page#unsupportedBrowserAction
is set to "confirm"
. May be
overridden to return a different message.
public static void registerKey(java.lang.String keyName, KeyCallback callback)
keyName
- the key namecallback
- the callback functionpublic static void registerKey(KeyIdentifier keyIdentifier, KeyCallback callback)
keyIdentifier
- the key identifiercallback
- the callback functionpublic 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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |