Class RectObj

java.lang.Object
  |
  +--java.awt.Component
        |
        +--DrawObj
              |
              +--RectObj
Direct Known Subclasses:
EllipseObj

public class RectObj
extends DrawObj
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener

Used to draw a rectangle. The submit string is a XY coordinate . Using this object the user could draw an xor rectangle. When he release the button, the operation is automaticaly commit and the map is notify.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
protected  boolean bInit
          Use to know if the rectangle is already initialize.
protected  int height
          Heigth of the current rectangle
protected  int knDeltaInit
          This constant is used to know the initial distance before drawing
(package private)  Map m_map
          Parent object.
protected  java.awt.Point pAnchor
          Used for initial drawing and resizing
protected  java.awt.Point pMoveAnchor
          Used for moving
protected  int width
          Width of the current rectangle
protected  int x
          X coordinate at the left top rectangle
protected  int y
          Y coordinate at the left top rectangle
 
Fields inherited from class DrawObj
color, g
 
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
RectObj(Map parent)
          Constructor.
 
Method Summary
(package private)  void computeNewRect(java.awt.Point p)
          Compute the new rectangle using the mouse coordinate.
 void destroyEvent()
          Destroy the mouse listener and the motion listener.
 void draw()
          Draw the rectangle.
 java.lang.String getSubmitValue()
          Create a submit string.
 void initPaint()
          Draw the initial rectangle.
 void mouseClicked(java.awt.event.MouseEvent evt)
          Do nothing
 void mouseDragged(java.awt.event.MouseEvent evt)
          Called when the user drag the rectangle.
 void mouseEntered(java.awt.event.MouseEvent evt)
          Do nothing
 void mouseExited(java.awt.event.MouseEvent evt)
          Do nothing
 void mouseMoved(java.awt.event.MouseEvent evt)
          Do nothing
 void mousePressed(java.awt.event.MouseEvent evt)
          Start the drawing rectangle.
 void mouseReleased(java.awt.event.MouseEvent evt)
          Destroy the event and notify the map.
 void resize(java.awt.Point p)
          Resize and redraw the new rectangle.
 void setAnchor(java.awt.Point pt)
          Set the initial point.
 
Methods inherited from class DrawObj
getColor, paint, setColor
 
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, getGraphics, 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

knDeltaInit

protected final int knDeltaInit
This constant is used to know the initial distance before drawing

pAnchor

protected java.awt.Point pAnchor
Used for initial drawing and resizing

pMoveAnchor

protected java.awt.Point pMoveAnchor
Used for moving

x

protected int x
X coordinate at the left top rectangle

y

protected int y
Y coordinate at the left top rectangle

width

protected int width
Width of the current rectangle

height

protected int height
Heigth of the current rectangle

bInit

protected boolean bInit
Use to know if the rectangle is already initialize.

m_map

Map m_map
Parent object.
Constructor Detail

RectObj

public RectObj(Map parent)
Constructor. Add listeners and initialize the members.
Method Detail

getSubmitValue

public java.lang.String getSubmitValue()
Create a submit string. The left top coordinate and right bottom coordinate is send separate by ;
Overrides:
getSubmitValue in class DrawObj
Tags copied from class: DrawObj
Returns:
String containing the submit value.
See Also:
Rosa applet parameters

setAnchor

public void setAnchor(java.awt.Point pt)
Set the initial point.
Parameters:
Point - in the mouse click.

draw

public void draw()
Draw the rectangle.
Overrides:
draw in class DrawObj

resize

public void resize(java.awt.Point p)
Resize and redraw the new rectangle.
Overrides:
resize in class DrawObj
Tags copied from class: DrawObj
Parameters:
p - new coordinate.

initPaint

public void initPaint()
Draw the initial rectangle.

computeNewRect

void computeNewRect(java.awt.Point p)
Compute the new rectangle using the mouse coordinate.
Parameters:
Mouse - location.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent evt)
Called when the user drag the rectangle. For each event, the rectangle will be draw twice.
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

destroyEvent

public void destroyEvent()
Destroy the mouse listener and the motion listener.
Overrides:
destroyEvent in class DrawObj

mousePressed

public void mousePressed(java.awt.event.MouseEvent evt)
Start the drawing rectangle.
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent evt)
Destroy the event and notify the map.
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent evt)
Do nothing
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent evt)
Do nothing
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent evt)
Do nothing
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent evt)
Do nothing
Specified by:
mouseClicked in interface java.awt.event.MouseListener