EchoPoint API - 3.0.0b5
App Webcontainer

echopoint
Class ImageMap

java.lang.Object
  extended by nextapp.echo.app.Component
      extended by echopoint.internal.AbstractContainer
          extended by echopoint.internal.AbstractImage
              extended by echopoint.ImageMap
All Implemented Interfaces:
Serializable, RenderIdSupport

public class ImageMap
extends AbstractImage

The ImageMap class provides a Component that allows a user to click on region(s) within a provided region.

A series of MapSection instances are specified that indicate what areas on the region should produce an ActionEvent.

The MapSection instances are stored in a map keyed by by their MapSection.actionCommand string. This means that there can be at most one set of coordinates for a given MapSection.actionCommand.

Note: Development of this component was sponsored by TCN Broadcasting. We are grateful for their support and sponsorship.

The following shows sample usage of this component:

   import echopoint.ImageMap;
   import echopoint.model.Point;
   import echopoint.model.MapSection;
   import echopoint.model.CircleSection;
   import echopoint.model.RectangleSection;

     ...
     final Column column = new Column();
     final String url = "image/imagemap.gif";
     final ImageMap map = new ImageMap( url );
     map.addActionListener( ... );

     final Collection<MapSection> sections = new ArrayList<MapSection>();
     sections.add( new CircleSection( new Point( 10, 10 ), 25, "circle" );
     sections.add( new RectangleSection( new Point( 10, 10 ),
        new Point( 25, 25 ), "rectangle", "Rectangular area" );
     map.addSections( sections );

     column.add( map );
 

Version:
$Id: ImageMap.java 262 2009-12-18 21:29:16Z sptrakesh $
Author:
Rakesh 2008-10-19, Brad Baker (originally for EPNG)
See Also:
Serialized Form

Field Summary
protected  String actionCommand
          The action command that was triggered by user interaction with map.
static String PROPERTY_SECTIONS
          The map of MapSection instances that represents the clickable sections in the map.
 
Fields inherited from class echopoint.internal.AbstractImage
PROPERTY_ACTION_COMMAND, PROPERTY_CURSOR, PROPERTY_IMAGE, PROPERTY_TEXT, PROPERTY_TOOL_TIP_TEXT
 
Fields inherited from class echopoint.internal.AbstractContainer
ACTION_COMMAND_PROPERTY, ACTION_LISTENERS_CHANGED_PROPERTY, INPUT_ACTION, PROPERTY_ALIGNMENT, PROPERTY_BACKGROUND_IMAGE, PROPERTY_BORDER, PROPERTY_HEIGHT, PROPERTY_INSETS, PROPERTY_WIDTH
 
Fields inherited from class nextapp.echo.app.Component
CHILD_VISIBLE_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_NEXT_ID_CHANGED_PROPERTY, FOCUS_PREVIOUS_ID_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Constructor Summary
ImageMap()
          Default constructor.
ImageMap(ImageReference image)
          Create a new image map using the specified image to use as the region.
ImageMap(String url)
          Create a new image map using the image from the specified URL.
 
Method Summary
 void addSection(MapSection section)
          Add the specified clickable section to the image map.
 void addSections(Collection<MapSection> sections)
          Add the specified collection of sections to the image map.
 Map<String,MapSection> getSections()
          Return the value of the PROPERTY_SECTIONS property.
 void processInput(String name, Object value)
          
 void removeAllSections()
          Remove all the clickable sections from the image map.
 void removeSection(MapSection section)
          Remove the specified clickable section from the image map.
 void setSections(Map<String,MapSection> sections)
          Set the value of the PROPERTY_SECTIONS property.
 
Methods inherited from class echopoint.internal.AbstractImage
addActionListener, fireActionPerformed, getActionCommand, getCursor, getImage, getText, getToolTipText, hasActionListeners, removeActionListener, setActionCommand, setBackgroundImage, setCursor, setImage, setImage, setText, setToolTipText
 
Methods inherited from class echopoint.internal.AbstractContainer
fireActionPerformed, getAlignment, getBackgroundImage, getBorder, getHeight, getInsets, getWidth, setAlignment, setBorder, setHeight, setInsets, setWidth
 
Methods inherited from class nextapp.echo.app.Component
add, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, get, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusNextId, getFocusPreviousId, getFont, getForeground, getId, getIndex, getLayoutData, getLayoutDirection, getLocale, getLocalStyle, getParent, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidChild, isValidParent, isVisible, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, set, setBackground, setComponents, setEnabled, setFocusNextId, setFocusPreviousId, setFocusTraversalParticipant, setFont, setForeground, setId, setIndex, setLayoutData, setLayoutDirection, setLocale, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_SECTIONS

public static final String PROPERTY_SECTIONS
The map of MapSection instances that represents the clickable sections in the map. Note that this property is to be treated as read-only.

See Also:
Constant Field Values

actionCommand

protected String actionCommand
The action command that was triggered by user interaction with map.

Constructor Detail

ImageMap

public ImageMap()
Default constructor.


ImageMap

public ImageMap(ImageReference image)
Create a new image map using the specified image to use as the region.

Parameters:
image - The image to use as the map region.

ImageMap

public ImageMap(String url)
Create a new image map using the image from the specified URL.

Parameters:
url - The url to use as the source of the image to use in the map.
Method Detail

getSections

public Map<String,MapSection> getSections()
Return the value of the PROPERTY_SECTIONS property.

Returns:
A read-only view of the sections of the map configured for actions.

setSections

public void setSections(Map<String,MapSection> sections)
Set the value of the PROPERTY_SECTIONS property.

Parameters:
sections - The image to use as the map region.
See Also:
addSections(java.util.Collection), addSection(echopoint.model.MapSection)

addSections

public void addSections(Collection<MapSection> sections)
Add the specified collection of sections to the image map.

Parameters:
sections - The collection of sections to be added.

addSection

public void addSection(MapSection section)
Add the specified clickable section to the image map.

Parameters:
section - The section that is to be added.

removeSection

public void removeSection(MapSection section)
Remove the specified clickable section from the image map.

Parameters:
section - The section that is to be deleted.

removeAllSections

public void removeAllSections()
Remove all the clickable sections from the image map.


processInput

public void processInput(String name,
                         Object value)

Overrides:
processInput in class AbstractImage
See Also:
AbstractImage.fireActionPerformed()

EchoPoint API - 3.0.0b5
App Webcontainer