java.lang.Object | |||
↳ | com.google.gwt.user.client.ui.UIObject | ||
↳ | com.google.gwt.user.client.ui.Widget | ||
↳ | com.google.gwt.user.client.ui.Image |
A widget that displays the image at a given URL. The image can be in 'unclipped' mode (the default) or 'clipped' mode. In clipped mode, a viewport is overlaid on top of the image so that a subset of the image will be displayed. In unclipped mode, there is no viewport - the entire image will be visible. Whether an image is in clipped or unclipped mode depends on how the image is constructed, and how it is transformed after construction. Methods will operate differently depending on the mode that the image is in. These differences are detailed in the documentation for each method.
If an image transitions between clipped mode and unclipped mode, any
Element
-specific attributes added by the user (including style
attributes, style names, and style modifiers), except for event listeners,
will be lost.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.user.client.ui.UIObject
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates an empty image.
| |||||||||||
Creates an image whose size and content are defined by an ImageResource.
| |||||||||||
Creates an image with a specified URL.
| |||||||||||
Creates a clipped image with a specified URL and visibility rectangle.
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This constructor may be used by subclasses to explicitly use an existing
element.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds a
ClickEvent handler. | |||||||||||
This method is deprecated.
Use
addClickHandler(ClickHandler) instead
| |||||||||||
Adds a
DoubleClickEvent handler. | |||||||||||
Adds an
ErrorEvent handler. | |||||||||||
Adds a
GestureChangeEvent handler. | |||||||||||
Adds a
GestureEndEvent handler. | |||||||||||
Adds a
GestureStartEvent handler. | |||||||||||
Adds a
LoadEvent handler. | |||||||||||
This method is deprecated.
use
LoadHandler and
ErrorHandler instead
| |||||||||||
Adds a
MouseDownEvent handler. | |||||||||||
This method is deprecated.
Use
addMouseOverHandler(MouseOverHandler) addMouseMoveHandler(MouseMoveHandler) ,
addMouseDownHandler(MouseDownHandler) , addMouseUpHandler(MouseUpHandler) and
addMouseOutHandler(MouseOutHandler) instead
| |||||||||||
Adds a
MouseMoveEvent handler. | |||||||||||
Adds a
MouseOutEvent handler. | |||||||||||
Adds a
MouseOverEvent handler. | |||||||||||
Adds a
MouseUpEvent handler. | |||||||||||
Adds a
MouseWheelEvent handler. | |||||||||||
This method is deprecated.
Use
addMouseWheelHandler(MouseWheelHandler) instead
| |||||||||||
Adds a
TouchCancelEvent handler. | |||||||||||
Adds a
TouchEndEvent handler. | |||||||||||
Adds a
TouchMoveEvent handler. | |||||||||||
Adds a
TouchStartEvent handler. | |||||||||||
Gets the alternate text for the image.
| |||||||||||
Gets the height of the image.
| |||||||||||
Gets the horizontal co-ordinate of the upper-left vertex of the image's
visibility rectangle.
| |||||||||||
Gets the vertical co-ordinate of the upper-left vertex of the image's
visibility rectangle.
| |||||||||||
Gets the URL of the image.
| |||||||||||
Gets the width of the image.
| |||||||||||
Fired whenever a browser event is received.
| |||||||||||
Causes the browser to pre-fetch the image at a given URL.
| |||||||||||
This method is deprecated.
Use the
removeHandler() method on the
object returned by addClickHandler(ClickHandler) instead
| |||||||||||
This method is deprecated.
Use the
removeHandler() method on the
object returned by an add*Handler method instead
| |||||||||||
This method is deprecated.
Use the
removeHandler() method on the
object returned by an add*Handler method instead
| |||||||||||
This method is deprecated.
Use the
removeHandler() method on the
object returned by addMouseWheelHandler(MouseWheelHandler) instead
| |||||||||||
Sets the alternate text of the image for user agents that can't render the
image.
| |||||||||||
Sets the url and the visibility rectangle for the image at the same time,
based on an ImageResource instance.
| |||||||||||
Sets the URL of the image to be displayed.
| |||||||||||
Sets the url and the visibility rectangle for the image at the same time.
| |||||||||||
Sets the visibility rectangle of an image.
| |||||||||||
Creates a Image widget that wraps an existing <img> element.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is called immediately after a widget becomes attached to the
browser's document.
|
Creates an empty image.
Creates an image whose size and content are defined by an ImageResource.
resource | the ImageResource to be displayed |
---|
Creates an image with a specified URL. The load event will be fired once the image at the given URL has been retrieved by the browser.
url | the URL of the image to be displayed |
---|
Creates a clipped image with a specified URL and visibility rectangle. The visibility rectangle is declared relative to the the rectangle which encompasses the entire image, which has an upper-left vertex of (0,0). The load event will be fired immediately after the object has been constructed (i.e. potentially before the image has been loaded in the browser). Since the width and height are specified explicitly by the user, this behavior will not cause problems with retrieving the width and height of a clipped image in a load event handler.
url | the URL of the image to be displayed |
---|---|
left | the horizontal co-ordinate of the upper-left vertex of the visibility rectangle |
top | the vertical co-ordinate of the upper-left vertex of the visibility rectangle |
width | the width of the visibility rectangle |
height | the height of the visibility rectangle |
This constructor may be used by subclasses to explicitly use an existing element. This element must be an <img> element.
element | the element to be used |
---|
Adds a ClickEvent
handler.
handler | the click handler |
---|
HandlerRegistration
used to remove this handler
This method is deprecated.
Use addClickHandler(ClickHandler)
instead
Adds a listener interface to receive click events.
listener | the listener interface to add |
---|
Adds a DoubleClickEvent
handler.
handler | the double click handler |
---|
HandlerRegistration
used to remove this handler
Adds an ErrorEvent
handler.
handler | the error handler |
---|
HandlerRegistration
used to remove this handler
Adds a GestureChangeEvent
handler.
handler | the mouse down handler |
---|
HandlerRegistration
used to remove this handler
Adds a GestureEndEvent
handler.
handler | the mouse down handler |
---|
HandlerRegistration
used to remove this handler
Adds a GestureStartEvent
handler.
handler | the mouse down handler |
---|
HandlerRegistration
used to remove this handler
Adds a LoadEvent
handler.
handler | the load handler |
---|
HandlerRegistration
used to remove this handler
This method is deprecated.
use LoadHandler
and
ErrorHandler
instead
Adds a listener interface to receive load events.
listener | the listener interface to add |
---|
Adds a MouseDownEvent
handler.
handler | the mouse down handler |
---|
HandlerRegistration
used to remove this handler
This method is deprecated.
Use addMouseOverHandler(MouseOverHandler)
addMouseMoveHandler(MouseMoveHandler)
,
addMouseDownHandler(MouseDownHandler)
, addMouseUpHandler(MouseUpHandler)
and
addMouseOutHandler(MouseOutHandler)
instead
Adds a listener interface to receive mouse events.
listener | the listener interface to add |
---|
Adds a MouseMoveEvent
handler.
handler | the mouse move handler |
---|
HandlerRegistration
used to remove this handler
Adds a MouseOutEvent
handler.
handler | the mouse out handler |
---|
HandlerRegistration
used to remove this handler
Adds a MouseOverEvent
handler.
handler | the mouse over handler |
---|
HandlerRegistration
used to remove this handler
Adds a MouseUpEvent
handler.
handler | the mouse up handler |
---|
HandlerRegistration
used to remove this handler
Adds a MouseWheelEvent
handler.
handler | the mouse wheel handler |
---|
HandlerRegistration
used to remove this handler
Adds a TouchCancelEvent
handler.
handler | the mouse down handler |
---|
HandlerRegistration
used to remove this handler
Adds a TouchEndEvent
handler.
handler | the mouse down handler |
---|
HandlerRegistration
used to remove this handler
Adds a TouchMoveEvent
handler.
handler | the mouse down handler |
---|
HandlerRegistration
used to remove this handler
Adds a TouchStartEvent
handler.
handler | the mouse down handler |
---|
HandlerRegistration
used to remove this handler
Gets the alternate text for the image.
Gets the height of the image. When the image is in the unclipped state, the height of the image is not known until the image has been loaded (i.e. load event has been fired for the image).
Gets the horizontal co-ordinate of the upper-left vertex of the image's visibility rectangle. If the image is in the unclipped state, then the visibility rectangle is assumed to be the rectangle which encompasses the entire image, which has an upper-left vertex of (0,0).
Gets the vertical co-ordinate of the upper-left vertex of the image's visibility rectangle. If the image is in the unclipped state, then the visibility rectangle is assumed to be the rectangle which encompasses the entire image, which has an upper-left vertex of (0,0).
Gets the URL of the image. The URL that is returned is not necessarily the URL that was passed in by the user. It may have been transformed to an absolute URL.
Gets the width of the image. When the image is in the unclipped state, the width of the image is not known until the image has been loaded (i.e. load event has been fired for the image).
Fired whenever a browser event is received.
event | the event received |
---|
Causes the browser to pre-fetch the image at a given URL.
url | the URL of the image to be prefetched |
---|
This method is deprecated.
Use the removeHandler()
method on the
object returned by addClickHandler(ClickHandler)
instead
Removes a previously added listener interface.
listener | the listener interface to remove |
---|
This method is deprecated.
Use the removeHandler()
method on the
object returned by an add*Handler method instead
Removes a previously added listener interface.
listener | the listener interface to remove |
---|
This method is deprecated.
Use the removeHandler()
method on the
object returned by an add*Handler method instead
Removes a previously added listener interface.
listener | the listener interface to remove |
---|
This method is deprecated.
Use the removeHandler()
method on the
object returned by addMouseWheelHandler(MouseWheelHandler)
instead
Sets the alternate text of the image for user agents that can't render the image.
altText | the alternate text to set to |
---|
Sets the url and the visibility rectangle for the image at the same time, based on an ImageResource instance. A single load event will be fired if either the incoming url or visiblity rectangle co-ordinates differ from the image's current url or current visibility rectangle co-ordinates. If the image is currently in the unclipped state, a call to this method will cause a transition to the clipped state.
resource | the ImageResource to display |
---|
Sets the URL of the image to be displayed. If the image is in the clipped state, a call to this method will cause a transition of the image to the unclipped state. Regardless of whether or not the image is in the clipped or unclipped state, a load event will be fired.
url | the image URL |
---|
Sets the url and the visibility rectangle for the image at the same time. A single load event will be fired if either the incoming url or visiblity rectangle co-ordinates differ from the image's current url or current visibility rectangle co-ordinates. If the image is currently in the unclipped state, a call to this method will cause a transition to the clipped state.
url | the image URL |
---|---|
left | the horizontal coordinate of the upper-left vertex of the visibility rectangle |
top | the vertical coordinate of the upper-left vertex of the visibility rectangle |
width | the width of the visibility rectangle |
height | the height of the visibility rectangle |
Sets the visibility rectangle of an image. The visibility rectangle is declared relative to the the rectangle which encompasses the entire image, which has an upper-left vertex of (0,0). Provided that any of the left, top, width, and height parameters are different than the those values that are currently set for the image, a load event will be fired. If the image is in the unclipped state, a call to this method will cause a transition of the image to the clipped state. This transition will cause a load event to fire.
left | the horizontal coordinate of the upper-left vertex of the visibility rectangle |
---|---|
top | the vertical coordinate of the upper-left vertex of the visibility rectangle |
width | the width of the visibility rectangle |
height | the height of the visibility rectangle |
Creates a Image widget that wraps an existing <img> element.
This element must already be attached to the document. If the element is
removed from the document, you must call
detachNow(Widget)
.
element | the element to be wrapped |
---|
This method is called immediately after a widget becomes attached to the browser's document.