Directory

← Back

ImageMapWidget

Image map addon

Author

Rating

An addon that allows you to register server-side click handlers to rectangular areas on a image. The areas also support tooltips.

This addon is now mostly unneccessary since Vaadin supports server side click handlers.

Sample code

// Create the image map instance
ImageMap imageMap = new ImageMap(new ExternalResource("http://imgs.xkcd.com/comics/going_west.png"),
   new AreaClickListener() {
      @Override
      public void areaClicked(String areaId) {
         getWindow().showNotification(\"Area click",
            "Image map area '" + areaId + "' clicked",
            Notification.TYPE_TRAY_NOTIFICATION);
      }
   }
);
// Add some areas
try {
   imageMap.addArea("panel 1", "p1", 0, 0, 165, 237);
   imageMap.addArea("panel 2", "p2", 180, 0, 120, 237);
   imageMap.addArea("panel 3", "p3", 315, 0, 167, 237);
   imageMap.addArea("panel 4", "p4", 483, 0, 120, 237);
   imageMap.addArea("panel 5", "p5", 605, 0, 134, 237);
} catch (OverlappingAreasException e) {
   getWindow().showNotification("Overlapping area",
      "Trying to add a area that would overlap with an existing area",
      Notification.TYPE_ERROR_MESSAGE);
}

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Updated to Vaadin 6.3.4 and added a build script. No functional changes.

Released
2010-07-06
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.2+
Browser
Internet Explorer
Internet Explorer
Firefox
Opera
Safari
Online