EchoPoint
1.0

echopoint
Class ImageMap

java.lang.Object
  extended bynextapp.echo.Component
      extended bynextapp.echo.Container
          extended byechopoint.EchoPointComponent
              extended byechopoint.ImageMap
All Implemented Interfaces:
MouseCursorable, ReflectionSetter, java.io.Serializable, ToolTipPopUpSupport, nextapp.echo.ToolTipSupport

public class ImageMap
extends EchoPointComponent

The ImageMap class provides a Component that allows a user to click on region within a provided region.
A series of ImageMap.Coords are provided that indicate what areas on the region should produce an ActionEvent.
This ImageMap.Coords are stored in a map keyed by by their ActionCommand String. This means that their can be at most one set of coordinates for a given ActionCommand.

Author:
Brad Baker
See Also:
Serialized Form

Nested Class Summary
static class ImageMap.Coords
          The Coords object is a set of co-ordinates and an ActionCommand String.
static class ImageMap.NestedStyleInfo
          Nested public static StyleInfo class.
 
Field Summary
protected  java.util.Map coordMap
           
protected  nextapp.echo.ImageReference image
           
static java.lang.String IMAGE_CHANGED_PROPERTY
          Property Change Names
static java.lang.String STYLE_IMAGE
          A style constant for the Image property.
 
Fields inherited from class echopoint.EchoPointComponent
STYLE_TOOL_TIP_TEXT, TOOL_TIP_TEXT_CHANGED_PROPERTY, toolTipPopUp
 
Fields inherited from class nextapp.echo.Component
BACKGROUND_CHANGED_PROPERTY, CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FONT_CHANGED_PROPERTY, FOREGROUND_CHANGED_PROPERTY, IDENTIFIER_CHANGED_PROPERTY, listenerList, LOCALE_CHANGED_PROPERTY, MODEL_CHANGED_PROPERTY, STYLE_BACKGROUND, STYLE_FONT, STYLE_FOREGROUND, UPDATE_PROPERTY, VISIBLE_CHANGED_PROPERTY
 
Fields inherited from interface echopoint.positionable.MouseCursorable
borderStyleSymbolics, CURSOR_AUTO, CURSOR_CROSSHAIR, CURSOR_CUSTOM_URI, CURSOR_DEFAULT, CURSOR_E_RESIZE, CURSOR_HELP, CURSOR_MOVE, CURSOR_N_RESIZE, CURSOR_NE_RESIZE, CURSOR_NW_RESIZE, CURSOR_POINTER, CURSOR_S_RESIZE, CURSOR_SE_RESIZE, CURSOR_SW_RESIZE, CURSOR_TEXT, CURSOR_W_RESIZE, CURSOR_WAIT, STYLE_MOUSE_CURSOR, STYLE_MOUSE_CURSOR_URI
 
Constructor Summary
ImageMap()
          Constructs a ImageMap with nothing in it
ImageMap(nextapp.echo.ImageReference image)
          Constructs an ImageMap using the provided image.
 
Method Summary
 void addActionListener(nextapp.echo.event.ActionListener l)
          Adds an ActionListener.
 void addCoord(ImageMap.Coords coord)
          Adds a set of co-ordinate's to the ImageMap
 void addCoord(ImageMap.Coords coord, java.lang.String actionCommand)
          Adds a set of co-ordinate's to the ImageMap and sets the co-ordinate's action command at the same time.
 void applyStyle(nextapp.echo.Style style)
          Applies the provided style to the component.
 void fireActionPerformed(nextapp.echo.event.ActionEvent e)
          Notifies all listeners that have registered for this event type.
 java.util.Set getCoords()
          Returns the set of co-ordinates in the ImageMap
 nextapp.echo.ImageReference getImage()
           
 void removeActionListener(nextapp.echo.event.ActionListener l)
          Removes an ActionListener.
 java.lang.Object set(java.lang.reflect.Field field, java.lang.Object newValue)
          Called to save the old value of a field, set in a new value and return the old value of a field.
 void setImage(nextapp.echo.ImageReference newValue)
          Sets the ImageReference of the ImageMap.
 
Methods inherited from class echopoint.EchoPointComponent
getMouseCursor, getMouseCursorURI, getToolTipPopUp, getToolTipText, set, set, set, set, set, set, set, set, set, setEnabledAllChildren, setMouseCursor, setMouseCursorURI, setToolTipText, validate
 
Methods inherited from class nextapp.echo.Component
add, add, addHierarchyListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getComponent, getComponentCount, getComponents, getEchoInstance, getFont, getForeground, getIdentifier, getLocale, getParent, indexOf, init, isAncestorOf, isEnabled, isRegistered, isShowing, isVisible, remove, remove, removeAll, removeHierarchyListener, removePropertyChangeListener, setBackground, setEnabled, setFont, setForeground, setIdentifier, setLocale, setVisible, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_IMAGE

public static final java.lang.String STYLE_IMAGE
A style constant for the Image property. Values of this key must be of type nextapp.echo.ImageReference.

See Also:
Constant Field Values

IMAGE_CHANGED_PROPERTY

public static final java.lang.String IMAGE_CHANGED_PROPERTY
Property Change Names

See Also:
Constant Field Values

image

protected nextapp.echo.ImageReference image

coordMap

protected java.util.Map coordMap
Constructor Detail

ImageMap

public ImageMap()
Constructs a ImageMap with nothing in it


ImageMap

public ImageMap(nextapp.echo.ImageReference image)
Constructs an ImageMap using the provided image.

Method Detail

addActionListener

public void addActionListener(nextapp.echo.event.ActionListener l)
Adds an ActionListener.

Parameters:
l - The ActionListener to be added.

addCoord

public void addCoord(ImageMap.Coords coord)
Adds a set of co-ordinate's to the ImageMap


addCoord

public void addCoord(ImageMap.Coords coord,
                     java.lang.String actionCommand)
Adds a set of co-ordinate's to the ImageMap and sets the co-ordinate's action command at the same time.


applyStyle

public void applyStyle(nextapp.echo.Style style)
Applies the provided style to the component. The base nextapp.echo.Component style names can be used as well.

Specified by:
applyStyle in interface MouseCursorable
Overrides:
applyStyle in class EchoPointComponent
See Also:
Component.applyStyle(nextapp.echo.Style)

fireActionPerformed

public void fireActionPerformed(nextapp.echo.event.ActionEvent e)
Notifies all listeners that have registered for this event type.

Parameters:
e - The ActionEvent to send.

getCoords

public java.util.Set getCoords()
Returns the set of co-ordinates in the ImageMap


getImage

public nextapp.echo.ImageReference getImage()
Returns:
The ImageReference of the ImageMap.

removeActionListener

public void removeActionListener(nextapp.echo.event.ActionListener l)
Removes an ActionListener.

Parameters:
l - The ActionListener to be removed.

setImage

public void setImage(nextapp.echo.ImageReference newValue)
Sets the ImageReference of the ImageMap.
This methods fires a PropertyChangeEvent with a getPropertyName() value of ImageMap.IMAGE_CHANGED_PROPERTY


set

public java.lang.Object set(java.lang.reflect.Field field,
                            java.lang.Object newValue)
                     throws java.lang.Exception
Description copied from interface: ReflectionSetter
Called to save the old value of a field, set in a new value and return the old value of a field. This interface allows a field set operation to be "delegated" back into the class that has permission to perform the field set.

 public Object set(Field f, Object newValue) throws Exception {
      Object oldValue = f.get(this);
      f.set(this,newValue);
      return oldValue;
 }
 

Parameters:
field - - the field to be set
newValue - - the new value to be set
Returns:
the oldValue of the field
Throws:
java.lang.Exception
See Also:
ReflectionSetter.set(Field, Object)

EchoPoint
1.0