|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WWidget
eu.webtoolkit.jwt.WWebWidget
eu.webtoolkit.jwt.WInteractWidget
eu.webtoolkit.jwt.WImage
public class WImage
A widget that displays an image.
The image may be specified either as a URL, or may be dynamically generated
by a WResource.
You may listen to events by attaching event listeners to signals such as
WInteractWidget#clicked(). Since mouse
events pass the coordinates through a WMouseEvent object, it is
possible to react to clicks in specific parts of the image. An alternative is
to define interactive areas on the image using
addArea(), which in addition
allows to have customized tool tips for certain image areas (using
WAbstractArea#setToolTip()).
WImage is an inline widget.
The widget corresponds to the HTML <img> tag and does not
provide styling. It can be styled using inline or external CSS as
appropriate.
WResource,
WPaintedWidget| Constructor Summary | |
|---|---|
WImage()
Creates an empty image widget. |
|
WImage(java.lang.String imageRef)
Creates an image widget with given image URL (deprecated). |
|
WImage(java.lang.String imageRef,
java.lang.CharSequence altText)
Creates an image widget with given image URL and alternate text (deprecated). |
|
WImage(java.lang.String imageRef,
java.lang.CharSequence altText,
WContainerWidget parent)
Deprecated. Use WImage() instead. |
|
WImage(java.lang.String imageRef,
WContainerWidget parent)
Deprecated. Use WImage() instead. |
|
WImage(WContainerWidget parent)
Creates an empty image widget. |
|
WImage(WLink link)
Creates an image widget with a given image link. |
|
WImage(WLink link,
java.lang.CharSequence altText)
Creates an image widget with a given image link and alternate text. |
|
WImage(WLink link,
java.lang.CharSequence altText,
WContainerWidget parent)
Creates an image widget with a given image link and alternate text. |
|
WImage(WLink link,
WContainerWidget parent)
Creates an image widget with a given image link. |
|
WImage(WResource resource,
java.lang.CharSequence altText)
Creates an image widget with given image resource and alternate text (deprecated). |
|
WImage(WResource resource,
java.lang.CharSequence altText,
WContainerWidget parent)
Deprecated. Use WImage() instead. |
|
| Method Summary | |
|---|---|
void |
addArea(WAbstractArea area)
Adds an interactive area. |
WString |
getAlternateText()
Returns the alternate text. |
WAbstractArea |
getArea(int index)
Returns the interactive area at the given index. |
java.util.List<WAbstractArea> |
getAreas()
Returns the interactive areas set for this widget. |
WLink |
getImageLink()
Returns the image link. |
java.lang.String |
getImageRef()
Deprecated. Use getImageLink() instead. |
WResource |
getResource()
Deprecated. Use setImageLink()
instead. |
EventSignal |
imageLoaded()
Event emitted when the image was loaded. |
void |
insertArea(int index,
WAbstractArea area)
Inserts an interactive area. |
void |
remove()
Destructor. |
void |
removeArea(WAbstractArea area)
Removes an interactive area. |
void |
setAlternateText(java.lang.CharSequence text)
Sets an alternate text. |
void |
setImageLink(WLink link)
Sets the image link. |
void |
setImageRef(java.lang.String ref)
Deprecated. Use setImageLink()
instead. |
void |
setResource(WResource resource)
Deprecated. Use setImageLink()
instead. |
| Methods inherited from class eu.webtoolkit.jwt.WInteractWidget |
|---|
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, propagateSetEnabled, setDraggable, setDraggable, setDraggable, setDraggable, touchEnded, touchMoved, touchStarted |
| Methods inherited from class eu.webtoolkit.jwt.WWidget |
|---|
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, layoutSizeChanged, positionAt, positionAt, removeStyleClass, resize, setClearSides, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getObjectName, setObjectName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WImage(WContainerWidget parent)
public WImage()
Calls this((WContainerWidget)null)
public WImage(WLink link,
WContainerWidget parent)
The imageLink may link to a URL or resource.
public WImage(WLink link)
Calls this(link,
(WContainerWidget)null)
public WImage(WLink link,
java.lang.CharSequence altText,
WContainerWidget parent)
The imageLink may link to a URL or resource.
public WImage(WLink link,
java.lang.CharSequence altText)
Calls
this(link, altText, (WContainerWidget)null)
public WImage(java.lang.String imageRef,
WContainerWidget parent)
WImage() instead.
public WImage(java.lang.String imageRef)
Calls this(imageRef, (WContainerWidget)null)
public WImage(java.lang.String imageRef,
java.lang.CharSequence altText,
WContainerWidget parent)
WImage() instead.
public WImage(java.lang.String imageRef,
java.lang.CharSequence altText)
Calls
this(imageRef, altText, (WContainerWidget)null)
public WImage(WResource resource,
java.lang.CharSequence altText,
WContainerWidget parent)
WImage() instead.
public WImage(WResource resource,
java.lang.CharSequence altText)
Calls
this(resource, altText, (WContainerWidget)null)
| Method Detail |
|---|
public void remove()
WWidgetDeletes a widget and all children (recursively). If the widget is contained in another widget, it is removed first.
remove in class WInteractWidgetWContainerWidget.removeWidget(WWidget widget)public void setAlternateText(java.lang.CharSequence text)
The alternate text should provide a fallback for browsers that do not display an image. If no sensible fallback text can be provided, an empty text is preferred over nonsense.
This should not be confused with WWebWidget#getToolTip() text, which provides additional information that
is displayed when the mouse hovers over the image.
The default alternate text is an empty text ("").
getAlternateText()public WString getAlternateText()
setAlternateText(CharSequence text)public void setImageLink(WLink link)
The image may be specified as a URL or as a resource. A resource specifies application-dependent content, which may be used to generate an image on demand.
public WLink getImageLink()
public void setImageRef(java.lang.String ref)
setImageLink()
instead.
public java.lang.String getImageRef()
getImageLink() instead.
When the image is specified as a resource, this returns the current resource URL.
public void setResource(WResource resource)
setImageLink()
instead.
public WResource getResource()
setImageLink()
instead.
Returns null if no image resource was set.
public void addArea(WAbstractArea area)
Adds the area which listens to events in a specific region
of the image. Areas are organized in an indexed list, to which the given
area is appended. When areas overlap, the area with the
lowest index receives the event.
Ownership of the area is transferred to the image.
insertArea(int index, WAbstractArea area)
public void insertArea(int index,
WAbstractArea area)
Inserts the area which listens to events in the coresponding
area of the image. Areas are organized in a list, and the area is
inserted at index index. When areas overlap, the area with
the lowest index receives the event.
Ownership of the area is transferred to the image.
addArea(WAbstractArea area)public void removeArea(WAbstractArea area)
Removes the area from this widget, and also returns the
ownership.
addArea(WAbstractArea area)public WAbstractArea getArea(int index)
Returns null if index was invalid.
insertArea(int index, WAbstractArea area)public java.util.List<WAbstractArea> getAreas()
addArea(WAbstractArea area)public EventSignal imageLoaded()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||