Package com.storedobject.ui
Class ImageMap
java.lang.Object
com.vaadin.flow.component.Component
com.storedobject.ui.ImageMap
- All Implemented Interfaces:
- com.vaadin.flow.component.AttachNotifier,- com.vaadin.flow.component.DetachNotifier,- com.vaadin.flow.component.HasElement,- com.vaadin.flow.component.HasStyle,- Serializable
@Tag("div")
public class ImageMap
extends com.vaadin.flow.component.Component
An image component with clickable rectangular areas.
- Author:
- Syam (Original version was written by Leif Åstrand of Vaadin)
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classA clickable rectangular area in an image map.static classEvent fired when an area is clicked.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddArea(int x, int y, int width, int height) Adds a clickable rectangle area to this image map.com.vaadin.flow.shared.RegistrationaddClickHandler(ClickHandler clickHandler) Add click handler.getAlt()Gets the alternate text for the image.voidremoveArea(ImageMap.Area area) Removes an Area that was added earlier.voidSets the alternate text for the image.voidsetAreaBackground(String areaBackground) Sets the default CSS background definition to use for areas that are not hovered.voidsetAreaBorder(String areaBorder) Sets the default CSS border definition to use for areas that are not hovered.voidsetHoverBackground(String hoverBackground) Sets the default CSS background definition to use for hovered areas.voidsetHoverBorder(String hoverBorder) Sets the default CSS border definition to use for hovered areas.voidsetSource(com.vaadin.flow.server.AbstractStreamResource source) Sets the image URL with the URL of the givenStreamResource.voidSets the image URL.Methods inherited from class com.vaadin.flow.component.ComponentaddListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifieraddAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifieraddDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyleaddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
- 
Constructor Details- 
ImageMappublic ImageMap()Creates an empty image map.
- 
ImageMapCreates an empty image map with the given image URL and alt text.- Parameters:
- source- The image URL to use, not- null
 
- 
ImageMappublic ImageMap(com.vaadin.flow.server.AbstractStreamResource source) Creates an empty image map with the given image resource and alt text.- Parameters:
- source- The image resource to use, not- null
 
 
- 
- 
Method Details- 
addAreaAdds a clickable rectangle area to this image map. The area coordinates are relative to the upper left corner of the image map.- Parameters:
- x- The x coordinate of the area, in pixels
- y- The y coordinate of the area, in pixels
- width- The area width, in pixels
- height- The area height, in pixels
- Returns:
- the created area, not null
 
- 
removeAreaRemoves an Area that was added earlier.- Parameters:
- area- Area to be removed
 
- 
addClickHandlerAdd click handler.- Parameters:
- clickHandler- Click handler
- Returns:
- Registration.
 
- 
setSource
- 
setSourcepublic void setSource(com.vaadin.flow.server.AbstractStreamResource source) Sets the image URL with the URL of the givenStreamResource.- Parameters:
- source- The resource value, not null
 
- 
setAltSets the alternate text for the image.- Parameters:
- alt- The alternate text
 
- 
getAlt
- 
setHoverBackgroundSets the default CSS background definition to use for hovered areas. The setting can be overridden on a per-area basis usingImageMap.Area.setHoverBackground(String). By default, black with 90% transparency is used (defined asrgba(0,0,0,0.1)).- Parameters:
- hoverBackground- The CSS background definition, or- nullto clear any set value and use the default
 
- 
setHoverBorderSets the default CSS border definition to use for hovered areas. The setting can be overridden on a per-area basis usingImageMap.Area.setHoverBorder(String). By default, no border is used- Parameters:
- hoverBorder- The CSS border definition, or- nullto clear any set value and use the default
 
- 
setAreaBackgroundSets the default CSS background definition to use for areas that are not hovered. The setting can be overridden on a per-area basis usingImageMap.Area.setBackground(String). By default, no background is used.- Parameters:
- areaBackground- The CSS background definition, or- nullto clear any set value and use the default
 
- 
setAreaBorderSets the default CSS border definition to use for areas that are not hovered. The setting can be overridden on a per-area basis usingImageMap.Area.setBorder(String). By default, no border is used.- Parameters:
- areaBorder- The CSS border definition, or- nullto clear any set value and use the default
 
 
-