|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.gwt.user.client.ui.AbstractImagePrototype
public abstract class AbstractImagePrototype
An opaque representation of a particular image such that the image can be
accessed either as an HTML fragment or as an Image
object. An image
prototype can be thought of as an abstract image factory with additional
capabilities.
The applyTo(Image)
method provides an efficient way to replace the
contents of an existing Image
. This is useful in cases where an
image changes its appearance based on a user's action. Instead of creating
two Image
objects then alternately hiding/showing them, one can
use the applyTo(Image)
method of two
AbstractImagePrototype
objects to transform a single
Image
object between two (or more) visual representations. The
use of AbstractImagePrototypes
results in an cleaner and more
efficient implementation.
This class also provide methods for working with raw elements, using
createElement()
and applyTo(ImagePrototypeElement)
.
This class is also a useful way to encapsulate complex HTML that represents
an image without actually instantiating Image
objects. When
constructing large HTML fragments, especially those that contain many images,
getHTML()
can be much more efficient.
Nested Class Summary | |
---|---|
static class |
AbstractImagePrototype.ImagePrototypeElement
This corresponds to the top Element of the DOM structure created by createElement() . |
Constructor Summary | |
---|---|
AbstractImagePrototype()
|
Method Summary | |
---|---|
void |
applyTo(AbstractImagePrototype.ImagePrototypeElement imageElement)
Transforms an existing AbstractImagePrototype.ImagePrototypeElement into the image
represented by this prototype. |
abstract void |
applyTo(Image image)
Transforms an existing Image into the image represented by this
prototype. |
static AbstractImagePrototype |
create(ImageResource resource)
Create an AbstractImagePrototype backed by a ClientBundle ImageResource. |
AbstractImagePrototype.ImagePrototypeElement |
createElement()
Creates a new AbstractImagePrototype.ImagePrototypeElement based on the image represented by this
prototype. |
abstract Image |
createImage()
Creates a new Image instance based on the image represented by this
prototype. |
java.lang.String |
getHTML()
Gets an HTML fragment that displays the image represented by this prototype. |
SafeHtml |
getSafeHtml()
Gets an HTML fragment that displays the image represented by this prototype. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractImagePrototype()
Method Detail |
---|
public static AbstractImagePrototype create(ImageResource resource)
resource
- an ImageResource produced by a ClientBundle
public abstract void applyTo(Image image)
Image
into the image represented by this
prototype.
image
- the instance to be transformed to match this prototypepublic void applyTo(AbstractImagePrototype.ImagePrototypeElement imageElement)
AbstractImagePrototype.ImagePrototypeElement
into the image
represented by this prototype.
imageElement
- an ImagePrototypeElement
created by
createElement()
public AbstractImagePrototype.ImagePrototypeElement createElement()
AbstractImagePrototype.ImagePrototypeElement
based on the image represented by this
prototype. The DOM structure may not necessarily a simple
<img>
element. It may be a more complex structure that
should be treated opaquely.
ImagePrototypeElement
corresponding to the image
represented by this prototypepublic abstract Image createImage()
Image
instance based on the image represented by this
prototype.
Image
based on this prototypepublic java.lang.String getHTML()
<img>
element. It may be a more complex structure that
should be treated opaquely.
The default implementation calls getSafeHtml()
.
public SafeHtml getSafeHtml()
<img>
element. It may be a more complex structure that
should be treated opaquely.
The default implementation throws an UnsupportedOperationException
.
|
GWT 2.7.0 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |