Class Map

java.lang.Object
  |
  +--java.awt.Component
        |
        +--Map

public class Map
extends java.awt.Component
implements java.awt.event.ActionListener

Map is a class to manage the drawing map and the command apply on it. It receives the command from the button and create the drawing object associated to the command. At the end of operation, it submit the information if the command need it.

Author:
Guy Parent
See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
private  java.lang.String kstrAutoMode
          Prefix to validate the auto submit command.
private  java.lang.String kstrCoordParam
          Coordinate name parameter
private  java.lang.String kstrDistance
          Command Distance
private  java.lang.String kstrEllipse
          Command Ellipse
private  java.lang.String kstrFormParam
          Form name parameter
private  java.lang.String kstrLegend
          Command Legend
private  java.lang.String kstrMapCoordParam
          Location to draw the map
private  java.lang.String kstrPoint
          Command Point
private  java.lang.String kstrPoly
          Command Polygone
private  java.lang.String kstrRect
          Command Rectangle
private  java.lang.String kstrSubmit
          Command Submit
private  java.lang.String kstrTypeParam
          Type name parameter
private  boolean m_bAlreadyUsed
          Use to know if the current command was already used.
private  java.awt.Point m_coord
          Location of the map.
private  ButtonCtrl m_curButton
          Current button used.
private  DrawObj m_curDrawObj
          Current drawing object ( command )
private  java.awt.Graphics m_Graphics
          Graphic use for drawing
private  java.awt.Image m_ImagMap
          Image on the map
private  Rosa2000 m_parent
           
private  java.lang.String m_strCoordName
          Keep the coordinate name come from parameter
private  java.lang.String m_strFormName
          Keep the form name come from parameter
private  java.lang.String m_strTypeName
          Keep the type name come from parameter
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
Map(Rosa2000 applet, java.awt.Image map, int nWidth, int nHeight)
          Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Called by the ButtonHandler when an operation start.
protected  void centerMap()
          Center the map.
 void commitOperation()
          Prepare and submit the operation.
protected  void destroyCommand()
          Destroy the current command.
 java.awt.Graphics getGraphics()
          Return the Graphics object used to draw the map.
 java.awt.Image getImage()
          Return the Image of the map.
 DrawObj getObjectDrawer()
          Return the current drawing object.
 boolean isAutoMode()
          Check if the current command is in auto submit mode.
 void paint(java.awt.Graphics g)
          Paints this component.
protected  void readLocation()
          Read the location of the map.
protected  void readSubmitParams()
          Read Submit parameters.
 void setObjectDrawer(DrawObj drawObj)
          Set the current drawing object.
 void startAction(ButtonCtrl buttonPress)
          Start the new operation associated to the button passed in parameter.
 void submitData(JSObject form)
          Submit all data put in the form objects.
 
Methods inherited from class java.awt.Component
, action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, constructComponentName, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getHeight, getInputContext, getInputMethodRequests, getIntrinsicCursor, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, postsOldMouseEvents, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

kstrRect

private final java.lang.String kstrRect
Command Rectangle

kstrPoint

private final java.lang.String kstrPoint
Command Point

kstrEllipse

private final java.lang.String kstrEllipse
Command Ellipse

kstrPoly

private final java.lang.String kstrPoly
Command Polygone

kstrLegend

private final java.lang.String kstrLegend
Command Legend

kstrDistance

private final java.lang.String kstrDistance
Command Distance

kstrSubmit

private final java.lang.String kstrSubmit
Command Submit

kstrAutoMode

private final java.lang.String kstrAutoMode
Prefix to validate the auto submit command.

kstrFormParam

private final java.lang.String kstrFormParam
Form name parameter

kstrTypeParam

private final java.lang.String kstrTypeParam
Type name parameter

kstrCoordParam

private final java.lang.String kstrCoordParam
Coordinate name parameter

kstrMapCoordParam

private final java.lang.String kstrMapCoordParam
Location to draw the map

m_ImagMap

private java.awt.Image m_ImagMap
Image on the map

m_Graphics

private java.awt.Graphics m_Graphics
Graphic use for drawing

m_curDrawObj

private DrawObj m_curDrawObj
Current drawing object ( command )

m_curButton

private ButtonCtrl m_curButton
Current button used.

m_coord

private java.awt.Point m_coord
Location of the map.

m_bAlreadyUsed

private boolean m_bAlreadyUsed
Use to know if the current command was already used.

m_strFormName

private java.lang.String m_strFormName
Keep the form name come from parameter

m_strTypeName

private java.lang.String m_strTypeName
Keep the type name come from parameter

m_strCoordName

private java.lang.String m_strCoordName
Keep the coordinate name come from parameter

m_parent

private Rosa2000 m_parent
Constructor Detail

Map

public Map(Rosa2000 applet,
           java.awt.Image map,
           int nWidth,
           int nHeight)
Constructor. Initialize the map.
Parameters:
applet - Parent object
map - Image to hadle.
nWidth - width of the current map.
nHeight - height of the current map.
Method Detail

setObjectDrawer

public void setObjectDrawer(DrawObj drawObj)
Set the current drawing object. This object take the control on the mouse event.
Parameters:
drawObj - New drawing object.

getObjectDrawer

public DrawObj getObjectDrawer()
Return the current drawing object.

getImage

public java.awt.Image getImage()
Return the Image of the map.
See Also:
Image

isAutoMode

public boolean isAutoMode()
Check if the current command is in auto submit mode.
Returns:
true if the command is prefixed by the string "auto_"

getGraphics

public java.awt.Graphics getGraphics()
Return the Graphics object used to draw the map.
Overrides:
getGraphics in class java.awt.Component
Returns:
Graphics object.

paint

public void paint(java.awt.Graphics g)
Paints this component. This method is called when the contents of the component should be painted in response to the component first being shown or damage needing repair. The clip rectangle in the Graphics parameter will be set to the area which needs to be painted.
Overrides:
paint in class java.awt.Component
Parameters:
g - The graphics context to use for painting.
See Also:
Component.update(java.awt.Graphics)

commitOperation

public void commitOperation()
Prepare and submit the operation. This method is called when the DrawObj complet the operation. It keep the javascript info and submit the information using form. The submit will be send only in auto mode or in sumbit command. This method use LiveConnect technologies.

destroyCommand

protected void destroyCommand()
Destroy the current command.

submitData

public void submitData(JSObject form)
Submit all data put in the form objects.
Parameters:
form - Live connect object used to sumit the data. All data should be setted before call this method

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Called by the ButtonHandler when an operation start.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - ActionEvent send by the ButtonHandler

startAction

public void startAction(ButtonCtrl buttonPress)
Start the new operation associated to the button passed in parameter.
Parameters:
buttonPress - Active button pressed by the user.

readLocation

protected void readLocation()
Read the location of the map.

centerMap

protected void centerMap()
Center the map.

readSubmitParams

protected void readSubmitParams()
Read Submit parameters.