Package org.zkoss.stateless.sul
Interface IImagemap
-
- All Superinterfaces:
IAnyGroup<IImagemap>
,IChildable<IImagemap,IArea>
,IComponent<IImagemap>
,IHtmlBasedComponent<IImagemap>
,IImageBase<IImagemap>
,IXulElement<IImagemap>
public interface IImagemap extends IImageBase<IImagemap>, IChildable<IImagemap,IArea>, IAnyGroup<IImagemap>
ImmutableImagemap
componentAn
IImagemap
component is a special image. It accepts whatever attribute anIImage
component accepts. However, unlikeIImage
, it supportIArea
as its children. TheIImagemap
component will translate the mouse pointer coordinates into a logical name, which is the id of theIArea
that user clicked. For example:@
RichletMapping
("/example") public IComponent example() { return IImagemap.of( IArea.ofId("left").withCoords("0, 0, 45, 80"), IArea.ofId("right").withCoords("46, 0, 90, 80") ).withSrc("/stateless/ZK-Logo.gif").withAction(this::doClick); } @Action
(type = Events.ON_CLICK) public void doClick(MouseData mouseData) { Clients.log(mouseData.getArea()); }The above example shows how to use
Imagemap
withIArea
. The ZK-Logo.gif is a 90x80 image, we divide the image into 2 parts left and right by usingIArea.withCoords(String)
. Once you clicked on the area ofImagemap
, you can get the id of theIArea
throughMouseData
. Note: Don't try to use CSS background as your image, the image map need a real image or it won't work.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
IImagemap.Builder
Builds instances of typeIImagemap
.static class
IImagemap.Updater
Builds an updater of typeIImagemap
forUiAgent.smartUpdate(Locator, SmartUpdater)
.
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default java.lang.String
getWidgetClass()
Returns the client widget class.static <I extends IArea>
IImagemapof(I... areas)
Returns the instance with the givenareas
.static <I extends IArea>
IImagemapof(java.lang.Iterable<? extends I> areas)
Returns the instance with the givenareas
.static IImagemap
of(java.lang.String src)
Returns the instance with the givensrc
.static IImagemap
ofId(java.lang.String id)
Returns the instance with the given id.static IImagemap
ofSize(java.lang.String width, java.lang.String height)
Returns the instance with the givenwidth
andheight
.-
Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildren
-
Methods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverrides
-
Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex
-
Methods inherited from interface org.zkoss.stateless.sul.IImageBase
getContent, getHover, getSrc, isPreloadImage, withContent, withContent, withHover, withPreloadImage, withSrc
-
Methods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
-
-
-
Field Detail
-
DEFAULT
static final IImagemap DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Detail
-
getWidgetClass
default java.lang.String getWidgetClass()
Returns the client widget class.Default:
"zul.wgt.Imagemap"
- Specified by:
getWidgetClass
in interfaceIComponent<IImagemap>
-
of
static IImagemap of(java.lang.String src)
Returns the instance with the givensrc
.- Parameters:
src
- The URI of the image source.
-
of
static <I extends IArea> IImagemap of(java.lang.Iterable<? extends I> areas)
Returns the instance with the givenareas
.- Parameters:
areas
- TheIArea
list as the children of this component.
-
of
static <I extends IArea> IImagemap of(I... areas)
Returns the instance with the givenareas
.- Parameters:
areas
- TheIArea
as the children of this component.
-
ofSize
static IImagemap ofSize(java.lang.String width, java.lang.String height)
Returns the instance with the givenwidth
andheight
.- Parameters:
width
- The width of the image.height
- The height of the image.
-
ofId
static IImagemap ofId(java.lang.String id)
Returns the instance with the given id.- Parameters:
id
- The id to identify this component
-
-