public class Window
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Window.ClosingEvent
Fired just before the browser window closes or navigates to a different
site.
|
static interface |
Window.ClosingHandler
Handler for
Window.ClosingEvent events. |
static class |
Window.Location
This class provides access to the browser's location's object.
|
static class |
Window.Navigator
This class provides access to the browser's navigator object.
|
static class |
Window.ScrollEvent
Fired when the browser window is scrolled.
|
static interface |
Window.ScrollHandler
Handler for
Window.ScrollEvent events. |
Modifier and Type | Field and Description |
---|---|
(package private) static com.google.gwt.user.client.Window.WindowHandlers |
handlers |
Modifier and Type | Method and Description |
---|---|
static HandlerRegistration |
addCloseHandler(CloseHandler<Window> handler)
Adds a
CloseEvent handler. |
static HandlerRegistration |
addResizeHandler(ResizeHandler handler)
Adds a
ResizeEvent handler. |
static void |
addWindowCloseListener(WindowCloseListener listener)
Deprecated.
use
addWindowClosingHandler(ClosingHandler) and
addCloseHandler(CloseHandler) instead |
static HandlerRegistration |
addWindowClosingHandler(Window.ClosingHandler handler)
Adds a
Window.ClosingEvent handler. |
static void |
addWindowResizeListener(WindowResizeListener listener)
Deprecated.
use
addResizeHandler(ResizeHandler) instead |
static HandlerRegistration |
addWindowScrollHandler(Window.ScrollHandler handler)
Adds a
Window.ScrollEvent handler. |
static void |
addWindowScrollListener(WindowScrollListener listener)
Deprecated.
use
addWindowScrollHandler(ScrollHandler)
instead |
static void |
alert(java.lang.String msg)
Displays a message in a modal dialog box.
|
static boolean |
confirm(java.lang.String msg)
Displays a message in a modal dialog box, along with the standard 'OK' and
'Cancel' buttons.
|
static void |
enableScrolling(boolean enable)
Use this method to explicitly disable the window's scrollbars.
|
static int |
getClientHeight()
Gets the height of the browser window's client area excluding the scroll
bar.
|
static int |
getClientWidth()
Gets the width of the browser window's client area excluding the vertical
scroll bar.
|
static int |
getScrollLeft()
Gets the window's scroll left.
|
static int |
getScrollTop()
Get the window's scroll top.
|
static java.lang.String |
getTitle()
Gets the browser window's current title.
|
static void |
moveBy(int dx,
int dy)
Moves a window's left and top edge to a specified number of pixels relative
to its current coordinates.
|
static void |
moveTo(int x,
int y)
Moves a window's left and top edge to the specified coordinates.
|
(package private) static void |
onClosed() |
(package private) static java.lang.String |
onClosing() |
(package private) static void |
onResize() |
(package private) static void |
onScroll() |
static void |
open(java.lang.String url,
java.lang.String name,
java.lang.String features)
Opens a new browser window.
|
static void |
print()
Prints the document in the window, as if the user had issued a "Print"
command.
|
static java.lang.String |
prompt(java.lang.String msg,
java.lang.String initialValue)
Displays a request for information in a modal dialog box, along with the
standard 'OK' and 'Cancel' buttons.
|
static void |
removeWindowCloseListener(WindowCloseListener listener)
Deprecated.
|
static void |
removeWindowResizeListener(WindowResizeListener listener)
Deprecated.
|
static void |
removeWindowScrollListener(WindowScrollListener listener)
Deprecated.
|
static void |
resizeBy(int width,
int height)
Resizes the window by the specified width and height.
|
static void |
resizeTo(int width,
int height)
Resizes the window to the specified width and height.
|
static void |
scrollTo(int left,
int top)
Scroll the window to the specified position.
|
static void |
setMargin(java.lang.String size)
Sets the size of the margins used within the window's client area.
|
static void |
setStatus(java.lang.String status)
Sets the status text for the window, if permitted by the browser's
settings.
|
static void |
setTitle(java.lang.String title)
Sets the browser window's title.
|
public static HandlerRegistration addCloseHandler(CloseHandler<Window> handler)
CloseEvent
handler.handler
- the handlerpublic static HandlerRegistration addResizeHandler(ResizeHandler handler)
ResizeEvent
handler.handler
- the handler@Deprecated public static void addWindowCloseListener(WindowCloseListener listener)
addWindowClosingHandler(ClosingHandler)
and
addCloseHandler(CloseHandler)
insteadlistener
- the listener to be informed when the window is closingpublic static HandlerRegistration addWindowClosingHandler(Window.ClosingHandler handler)
Window.ClosingEvent
handler.handler
- the handler@Deprecated public static void addWindowResizeListener(WindowResizeListener listener)
addResizeHandler(ResizeHandler)
insteadlistener
- the listener to be informed when the window is resizedpublic static HandlerRegistration addWindowScrollHandler(Window.ScrollHandler handler)
Window.ScrollEvent
handler.handler
- the handler@Deprecated public static void addWindowScrollListener(WindowScrollListener listener)
addWindowScrollHandler(ScrollHandler)
insteadlistener
- the listener to be informed when the window is scrolledpublic static void alert(java.lang.String msg)
msg
- the message to be displayed.public static boolean confirm(java.lang.String msg)
msg
- the message to be displayed.true
if 'OK' is clicked, false
if
'Cancel' is clicked.public static void enableScrolling(boolean enable)
enable
- false
to disable window scrollingpublic static int getClientHeight()
public static int getClientWidth()
public static int getScrollLeft()
public static int getScrollTop()
public static java.lang.String getTitle()
public static void moveBy(int dx, int dy)
NOTE: In Chrome, this method only works with windows created by Window.open().
dx
- A positive or a negative number that specifies how many pixels
to move the left edge bydy
- A positive or a negative number that specifies how many
pixels to move the top edge bypublic static void moveTo(int x, int y)
NOTE: In Chrome, this method only works with windows created by Window.open().
x
- The left coordinatey
- The top coordinatepublic static void open(java.lang.String url, java.lang.String name, java.lang.String features)
url
- the URL that the new window will displayname
- the name of the window (e.g. "_blank")features
- the features to be enabled/disabled on this windowpublic static void print()
public static java.lang.String prompt(java.lang.String msg, java.lang.String initialValue)
msg
- the message to be displayedinitialValue
- the initial value in the dialog's text fieldnull
if 'Cancel' was pressed@Deprecated public static void removeWindowCloseListener(WindowCloseListener listener)
listener
- the listener to be removed@Deprecated public static void removeWindowResizeListener(WindowResizeListener listener)
listener
- the listener to be removed@Deprecated public static void removeWindowScrollListener(WindowScrollListener listener)
listener
- the listener to be removedpublic static void resizeBy(int width, int height)
NOTE: In most modern browsers, this method only works with windows created by Window.open() with a supplied width and height.
width
- A positive or a negative number that specifies how many pixels
to resize the width byheight
- A positive or a negative number that specifies how many
pixels to resize the height bypublic static void resizeTo(int width, int height)
NOTE: In most modern browsers, this method only works with windows created by Window.open() with a supplied width and height.
width
- The width of the window, in pixelsheight
- The height of the window, in pixelspublic static void scrollTo(int left, int top)
left
- the left scroll positiontop
- the top scroll positionpublic static void setMargin(java.lang.String size)
size
- the window's new margin size, in CSS units.public static void setStatus(java.lang.String status)
status
- the new message to display.public static void setTitle(java.lang.String title)
title
- the new window title.static void onClosed()
static java.lang.String onClosing()
static void onResize()
static void onScroll()