com.bbn.openmap.omGraphics
Class EditableOMGraphic

java.lang.Object
  extended by com.bbn.openmap.event.MapMouseAdapter
      extended by com.bbn.openmap.omGraphics.EditableOMGraphic
All Implemented Interfaces:
MapMouseListener
Direct Known Subclasses:
EditableOMAbstractLine, EditableOMCircle, EditableOMGraphicList, EditableOMPoint, EditableOMRect, EditableOMScalingRaster, EditableOMText

public abstract class EditableOMGraphic
extends MapMouseAdapter

The EditableOMGraphic is a shell that controls actions to edit or create a graphic. This class contains a state machine that defines how mouse events will be interpreted to modify the OMGraphic contained within. Any class that extends this one is responsible for assigning the appropriate state machine and OMGraphic to itself. Also, an EditableOMGraphic has a notion of a list of GrabPoints, which can be used as handles to the OMGraphic to provide controlled modifications.


Nested Class Summary
static class EditableOMGraphic.OMGraphicUndoEvent
          Generic undo event for basic OMGraphics.
 
Field Summary
protected  int actionMask
          Action mask for this graphic.
protected  boolean canGrabGraphic
          Flag to let states know if the edges of the graphic can be grabbed directly, for movement or manipulation, as opposed to just allowing those actions through the grab points.
protected  boolean DEBUG
           
protected  boolean DEBUG_DETAIL
           
protected  GrabPoint[] gPoints
          The array of GrabPoints.
static java.lang.String GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE
          If the grab points should be rendered differently than the default, the DrawingAttributes should be stored in the edited OMGraphic under this attribute key.
protected  DrawingAttributes holder
          A DrawingAttributes object used to hold OMGraphic settings while it is being moved.
protected  I18n i18n
           
protected  java.awt.event.MouseEvent lastMouseEvent
           
protected  EOMGListenerSupport listeners
           
protected  java.lang.String[] mouseModeServiceList
          This is here for the MapMouseListener interface.
protected  GrabPoint movingPoint
          This GrabPoint is one that has been grabbed by the mouse, and is being moved.
protected  boolean popupIsUp
          A little flag to let the EOMG that a popup menu is up on the map.
protected  Projection projection
          The projection of the map.
static java.lang.String SELECTED_GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE
          If the EditableOMGraphic supports the notion of a selected GrabPoint (to highlight a node), and that selection should change the appearance of a GrabPoint, the DrawingAttributes for that selection appearance should be stored in the edited OMGraphic attributes under this attribute key.
protected  boolean showGUI
          Flag to indicate whether a GUI for this EOMG should be presented to allow edits to it's attributes.
protected  EOMGStateMachine stateMachine
          The state machine that interprets the mouse events (and other events) and modifies the OMGraphics accordingly.
protected  UndoStack undoStack
          The component to notify for changes made to the OMGraphic, so they can be undone if desired.
protected  boolean xorRendering
           
 
Constructor Summary
protected EditableOMGraphic()
           
 
Method Summary
 GrabPoint _getMovingPoint(java.awt.event.MouseEvent e)
          Given a MouseEvent, find a GrabPoint that it is touching, and set the moving point to that GrabPoint.
 void addEOMGListener(EOMGListener l)
          Add a EOMGListener.
 void attachToMovingGrabPoint(OffsetGrabPoint gp)
          Attach to the Moving OffsetGrabPoint so if it moves, it will move this EditableOMGraphic with it.
 void cleanMap(java.awt.event.MouseEvent e)
          Clean the surface all the painting is taking place over.
 javax.swing.JComponent createAttributePanel(GraphicAttributes graphicAttributes)
           
abstract  void createGraphic(GraphicAttributes ga)
          Create the OMGraphic that is to be modified by the EditableOMGraphic.
protected  UndoEvent createUndoEventForCurrentState(java.lang.String whatHappened)
          This method should be overwritten for each EditableOMGraphic to save the state of the current OMGraphic, in case the user wants to revert to this state.
 void detachFromMovingGrabPoint(OffsetGrabPoint gp)
          Detach from a Moving OffsetGrabPoint.
protected  void finalize()
           
 void fireEvent(java.awt.Cursor cursor, java.lang.String message, int status)
          Create the event with a Cursor and/or message, and then fire it.
 void fireEvent(java.awt.Cursor cursor, java.lang.String message, java.awt.event.MouseEvent mouseEvent, int status)
          Create the event with the Cursor, message and/or MouseEvent.
 void fireEvent(EOMGEvent event)
          The method to call if you want to let listeners know that the state has changed.
 void fireEvent(int status)
          Create the event with no cursor change or message to be displayed.
abstract  boolean generate(Projection proj)
          Use the current projection to place the graphics on the screen.
 int getActionMask()
          Get the OMAction mask for this graphic.
 boolean getCanGrabGraphic()
          Get whether a graphic can be manipulated by its edges, rather than just by its grab points.
 GrabPoint getGrabPoint(int index)
          Return a particular GrabPoint at a particular point in the array.
 GrabPoint[] getGrabPoints()
          Get the array of grab points used for the EditableOMGraphic.
abstract  OMGraphic getGraphic()
          Get the OMGraphic that is being created/modified by the EditableOMGraphic.
 java.awt.Component getGUI()
          If this EditableOMGraphic has parameters that can be manipulated that are independent of other EditableOMGraphic types, then you can provide the widgets to control those parameters here.
 java.awt.Component getGUI(GraphicAttributes graphicAttributes)
          If this EditableOMGraphic has parameters that can be manipulated that are independent of other EditableOMGraphic types, then you can provide the widgets to control those parameters here.
 java.lang.String[] getMouseModeServiceList()
          Get the list of MouseMode names that this EditableOMGraphic will respond to, if it is dealing directly with a MouseDelegator.
 GrabPoint getMovingPoint()
          Get the GrabPoint that is being moved.
 GrabPoint getMovingPoint(java.awt.event.MouseEvent e)
          Given a MouseEvent, find a GrabPoint that it is touching, and set the moving point to that GrabPoint.
 Projection getProjection()
          Get the current projection.
 java.awt.geom.Point2D getProjectionPoint(java.awt.event.MouseEvent e)
           
 boolean getShowGUI()
           
 EOMGStateMachine getStateMachine()
          Get the state machine for this EditableOMGraphic.
 UndoStack getUndoStack()
           
 void handleInitialMouseEvent(java.awt.event.MouseEvent e)
          Notification that a MouseEvent was used to trigger creation or edit of this EditableOMGraphic, and this is the first MouseEvent received.
 boolean isMouseEventTouching(java.awt.event.MouseEvent e)
           
 boolean isMouseEventTouchingTheEdge(java.awt.event.MouseEvent e)
           
 boolean isPopupIsUp()
           
 boolean isXorRendering()
           
protected  void modifyOMGraphicForEditRender()
          A convenience method that gives an EditableOMGraphic a chance to modify the OMGraphic so it can be drawn quickly, by turning off labels, etc, right before the XORpainting happens.
 boolean mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse has been clicked on a component.
 boolean mouseDragged(java.awt.event.MouseEvent e)
          Invoked when a mouse button is pressed on a component and then dragged.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a component.
 void mouseMoved()
          Handle a mouse cursor moving without the button being pressed.
 boolean mouseMoved(java.awt.event.MouseEvent e)
          Invoked when the mouse button has been moved on a component (with no buttons down).
 boolean mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 boolean mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a component.
abstract  void move(java.awt.event.MouseEvent e)
          Called to set the OffsetGrabPoint to the current mouse location, and update the OffsetGrabPoint with all the other GrabPoint locations, so everything can shift smoothly.
 void redraw(java.awt.event.MouseEvent e)
          Same as redraw(e, false)
 void redraw(java.awt.event.MouseEvent e, boolean firmPaint)
           
 void redraw(java.awt.event.MouseEvent e, boolean firmPaint, boolean drawXOR)
          Given a MouseEvent, check the source, and if it's a MapBean, then grab the projection and java.awt.Graphics from it to use for generation and rendering of the EditableOMGraphic objects.
abstract  void regenerate(Projection proj)
          Given a new projection, the grab points may need to be repositioned off the current position of the graphic.
 void removeEOMGListener(EOMGListener l)
          Remove a EOMGListener.
abstract  void render(java.awt.Graphics g)
           
 void repaint()
           
 void repaintRender(java.awt.Graphics g)
           
 void reset()
          Remove all changes and put graphic as it was before modifications.
protected  void resetOMGraphicAfterEditRender()
          A convenience method that gives an EditableOMGraphic a chance to reset the OMGraphic so it can be rendered normally, after it has been modified for quick paints.
 void setActionMask(int mask)
          Method to allow objects to set OMAction masks on this editable graphic.
 void setCanGrabGraphic(boolean set)
          Set whether a graphic can be manipulated by its edges, rather than just by its grab points.
 boolean setGrabPoint(GrabPoint gb, int index)
          Set the GrabPoint at a particule index of the array.
abstract  void setGrabPoints()
          Tells the EditableOMGraphic that the locations of the grab points have been modified, and that the parameters of the OMGraphic need to be modified accordingly.
 boolean setGrabPoints(GrabPoint[] points)
          Set the grab point objects within the EditableOMGraphic array.
abstract  void setGraphic(OMGraphic graphic)
          Set the OMGraphic that is being modified by the EditableOMGraphic.
 void setMouseModeServiceList(java.lang.String[] list)
          Set the list of MouseMode names that this EditableOMGraphic will respond to, if it is dealing directly with a MouseDelegator.
 void setMovingPoint(GrabPoint gp)
          Set the GrabPoint that is in the middle of being modified, as a result of a mouseDragged event, or other selection.
 void setPopupIsUp(boolean popupIsUp)
          A little flag to let the EOMG that a popup menu is up on the map.
 void setProjection(Projection proj)
          Set the current projection.
 void setShowGUI(boolean set)
          Set whether this EOMG should provide a user interface to have the attributes modified.
 void setStateMachine(EOMGStateMachine sm)
          Set the StateMachine for this EditableOMGraphic.
 void setUndoStack(UndoStack undoStack)
           
 void setXorRendering(boolean xorRendering)
          Set whether the painting will occur using XOR rendering.
 void updateCurrentState(java.lang.String whatHappened)
          Called by anything that knows that the EOMG has arrived at a stable state that should be kept for Undo actions.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE

public static final java.lang.String GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE
If the grab points should be rendered differently than the default, the DrawingAttributes should be stored in the edited OMGraphic under this attribute key.

See Also:
Constant Field Values

SELECTED_GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE

public static final java.lang.String SELECTED_GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE
If the EditableOMGraphic supports the notion of a selected GrabPoint (to highlight a node), and that selection should change the appearance of a GrabPoint, the DrawingAttributes for that selection appearance should be stored in the edited OMGraphic attributes under this attribute key.

See Also:
Constant Field Values

stateMachine

protected EOMGStateMachine stateMachine
The state machine that interprets the mouse events (and other events) and modifies the OMGraphics accordingly.

See Also:
StateMachine

mouseModeServiceList

protected java.lang.String[] mouseModeServiceList
This is here for the MapMouseListener interface. This may not be important, depending on what is funneling mouse events to the graphic.


gPoints

protected GrabPoint[] gPoints
The array of GrabPoints.


projection

protected Projection projection
The projection of the map. This can be retrieved from the mouse events, provided that the mouse events source is the MapBean.


movingPoint

protected GrabPoint movingPoint
This GrabPoint is one that has been grabbed by the mouse, and is being moved.


listeners

protected EOMGListenerSupport listeners

showGUI

protected boolean showGUI
Flag to indicate whether a GUI for this EOMG should be presented to allow edits to it's attributes.


canGrabGraphic

protected boolean canGrabGraphic
Flag to let states know if the edges of the graphic can be grabbed directly, for movement or manipulation, as opposed to just allowing those actions through the grab points.


undoStack

protected UndoStack undoStack
The component to notify for changes made to the OMGraphic, so they can be undone if desired.


i18n

protected I18n i18n

popupIsUp

protected boolean popupIsUp
A little flag to let the EOMG that a popup menu is up on the map. If the menu is up, and the menu is not clicked on, we don't really want to deactivate the drawing tool right then - let a free click go by first, which will dismiss the menu.


actionMask

protected int actionMask
Action mask for this graphic. Used as a holder for modifying objects to let this EditableOMGraphic know what is being done to it.


DEBUG

protected boolean DEBUG

DEBUG_DETAIL

protected boolean DEBUG_DETAIL

xorRendering

protected boolean xorRendering

holder

protected DrawingAttributes holder
A DrawingAttributes object used to hold OMGraphic settings while it is being moved. When an OMGraphic is being moved, basic (DEFAULT) settings are put on the OMGraphic to make it as light and uncomplicated as possible.


lastMouseEvent

protected java.awt.event.MouseEvent lastMouseEvent
Constructor Detail

EditableOMGraphic

protected EditableOMGraphic()
Method Detail

setStateMachine

public void setStateMachine(EOMGStateMachine sm)
Set the StateMachine for this EditableOMGraphic.

Parameters:
sm - StateMachine.
See Also:
StateMachine

getStateMachine

public EOMGStateMachine getStateMachine()
Get the state machine for this EditableOMGraphic.


setMouseModeServiceList

public void setMouseModeServiceList(java.lang.String[] list)
Set the list of MouseMode names that this EditableOMGraphic will respond to, if it is dealing directly with a MouseDelegator.


getMouseModeServiceList

public java.lang.String[] getMouseModeServiceList()
Get the list of MouseMode names that this EditableOMGraphic will respond to, if it is dealing directly with a MouseDelegator.

Specified by:
getMouseModeServiceList in interface MapMouseListener
Overrides:
getMouseModeServiceList in class MapMouseAdapter
Returns:
String[] of modeID's
See Also:
NavMouseMode.modeID, SelectMouseMode.modeID, NullMouseMode.modeID

setShowGUI

public void setShowGUI(boolean set)
Set whether this EOMG should provide a user interface to have the attributes modified.

Parameters:
set - true if the GUI should be shown.

getShowGUI

public boolean getShowGUI()

setCanGrabGraphic

public void setCanGrabGraphic(boolean set)
Set whether a graphic can be manipulated by its edges, rather than just by its grab points. Used internally.


getCanGrabGraphic

public boolean getCanGrabGraphic()
Get whether a graphic can be manipulated by its edges, rather than just by its grab points.


setGraphic

public abstract void setGraphic(OMGraphic graphic)
Set the OMGraphic that is being modified by the EditableOMGraphic. The type of OMGraphic needs to match what the EditableOMGraphic is expecting. Assume that if the graphic passed in is null, that a proper graphic will be created.

Parameters:
graphic - OMGraphic.

createGraphic

public abstract void createGraphic(GraphicAttributes ga)
Create the OMGraphic that is to be modified by the EditableOMGraphic.

Parameters:
ga - GraphicAttributes, describing the graphic to be created.

getGraphic

public abstract OMGraphic getGraphic()
Get the OMGraphic that is being created/modified by the EditableOMGraphic.


reset

public void reset()
Remove all changes and put graphic as it was before modifications. If the graphic is being created, start over.


setGrabPoints

public boolean setGrabPoints(GrabPoint[] points)
Set the grab point objects within the EditableOMGraphic array. The size and layout of the points in the array are carefully determined by the EditableOMGraphic, so this method merely replaces objects within the array, not replacing the array itself, so that you cannot reset the number of grab points an EditableOMGraphic uses for a particular OMGraphic.

Parameters:
points - a GrabPoint[]
Returns:
true if the grab point array was exactly what the EditableOMGraphic was expecting, in terms of length of the GrabPoint array length. The method copies the array values that fit into the resident array.

setActionMask

public void setActionMask(int mask)
Method to allow objects to set OMAction masks on this editable graphic.


getActionMask

public int getActionMask()
Get the OMAction mask for this graphic.


setGrabPoints

public abstract void setGrabPoints()
Tells the EditableOMGraphic that the locations of the grab points have been modified, and that the parameters of the OMGraphic need to be modified accordingly.


getGrabPoints

public GrabPoint[] getGrabPoints()
Get the array of grab points used for the EditableOMGraphic. Given a mouse event, you can see if one of these is affected, and move it accordingly. Call setGrabPoints() when modifications are done, so that the OMGraphic is modified.


setGrabPoint

public boolean setGrabPoint(GrabPoint gb,
                            int index)
Set the GrabPoint at a particule index of the array. This can be used to tie two different grab points together.

Parameters:
gb - GrabPoint to assign within array.
index - the index of the array to put the GrabPoint. The EditableOMGraphic should be able to provide the description of the proper placement indexes.
Returns:
If the grab point or array is null, or if the index is outside the range of the array, false is returned. If everything goes OK, then true is returned.

getGrabPoint

public GrabPoint getGrabPoint(int index)
Return a particular GrabPoint at a particular point in the array. The EditableOMGraphic should describe which indexes refer to which grab points in the EOMG GrabPoint array. If the index is outside the range of the array, null is returned.


attachToMovingGrabPoint

public void attachToMovingGrabPoint(OffsetGrabPoint gp)
Attach to the Moving OffsetGrabPoint so if it moves, it will move this EditableOMGraphic with it. EditableOMGraphic version doesn't do anything, each subclass has to decide which of its OffsetGrabPoints should be attached to it.


detachFromMovingGrabPoint

public void detachFromMovingGrabPoint(OffsetGrabPoint gp)
Detach from a Moving OffsetGrabPoint. The EditableOMGraphic version doesn't do anything, each subclass should remove whatever GrabPoint it would have attached to an OffsetGrabPoint.


setMovingPoint

public void setMovingPoint(GrabPoint gp)
Set the GrabPoint that is in the middle of being modified, as a result of a mouseDragged event, or other selection.


getMovingPoint

public GrabPoint getMovingPoint()
Get the GrabPoint that is being moved. If it's null, then there isn't one.


handleInitialMouseEvent

public void handleInitialMouseEvent(java.awt.event.MouseEvent e)
Notification that a MouseEvent was used to trigger creation or edit of this EditableOMGraphic, and this is the first MouseEvent received. If the EditableOMGraphic can handle it, it should. Otherwise, it should put itself in the right state to let the user know it's active.


getMovingPoint

public GrabPoint getMovingPoint(java.awt.event.MouseEvent e)
Given a MouseEvent, find a GrabPoint that it is touching, and set the moving point to that GrabPoint. Called when a MouseEvent happens like a mousePressed or mouseReleased, and you want to find out if a GrabPoint should be used to make modifications to the graphic or its position. This method should only be called to establish a moving point. getMovingPoint() should be called to check to see if one has been established, and then redraw(MouseEvent) would be called to move that moving point.

Parameters:
e - MouseEvent
Returns:
GrabPoint that is touched by the MouseEvent, null if none are.

_getMovingPoint

public GrabPoint _getMovingPoint(java.awt.event.MouseEvent e)
Given a MouseEvent, find a GrabPoint that it is touching, and set the moving point to that GrabPoint. A version for grandchild classes.

Parameters:
e - MouseEvent that the GrabPoint should attach to.
See Also:
getMovingPoint(MouseEvent)

move

public abstract void move(java.awt.event.MouseEvent e)
Called to set the OffsetGrabPoint to the current mouse location, and update the OffsetGrabPoint with all the other GrabPoint locations, so everything can shift smoothly. Should also set the OffsetGrabPoint to the movingPoint.


cleanMap

public void cleanMap(java.awt.event.MouseEvent e)
Clean the surface all the painting is taking place over.


redraw

public void redraw(java.awt.event.MouseEvent e)
Same as redraw(e, false)


redraw

public void redraw(java.awt.event.MouseEvent e,
                   boolean firmPaint)

redraw

public void redraw(java.awt.event.MouseEvent e,
                   boolean firmPaint,
                   boolean drawXOR)
Given a MouseEvent, check the source, and if it's a MapBean, then grab the projection and java.awt.Graphics from it to use for generation and rendering of the EditableOMGraphic objects.

Parameters:
e - MouseEvent
firmPaint - true if the graphic is being rendered at rest, with fill colors and true colors, with the grab point if the state allows it. If false, then the fill color will not be used, and just the graphic will be drawn. Use false for graphics that are moving.

modifyOMGraphicForEditRender

protected void modifyOMGraphicForEditRender()
A convenience method that gives an EditableOMGraphic a chance to modify the OMGraphic so it can be drawn quickly, by turning off labels, etc, right before the XORpainting happens. The OMGraphic should be configured so that the render method does the least amount of painting possible. Note that the DrawingAttributes for the OMGraphic have already been set to DrawingAttributes.DEFAULT (black line, clear fill).


resetOMGraphicAfterEditRender

protected void resetOMGraphicAfterEditRender()
A convenience method that gives an EditableOMGraphic a chance to reset the OMGraphic so it can be rendered normally, after it has been modified for quick paints. The DrawingAttributes for the OMGraphic have already been reset to their normal settings, from the DrawingAttributes.DEFAULT settings that were used for the quick paint.


repaint

public void repaint()

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

generate

public abstract boolean generate(Projection proj)
Use the current projection to place the graphics on the screen. Has to be called to at least assure the graphics that they are ready for rendering. Called when the graphic position changes.

Parameters:
proj - com.bbn.openmap.proj.Projection
Returns:
true

regenerate

public abstract void regenerate(Projection proj)
Given a new projection, the grab points may need to be repositioned off the current position of the graphic. Called when the projection changes. IMPORTANT! Set the GrabPoints for the graphic here.


repaintRender

public void repaintRender(java.awt.Graphics g)

render

public abstract void render(java.awt.Graphics g)

isXorRendering

public boolean isXorRendering()

setXorRendering

public void setXorRendering(boolean xorRendering)
Set whether the painting will occur using XOR rendering. If false, the mapbean will be repainted on every movement. Looks better, but you need to make sure the repaint burden on the mapbean doesn't slow the drawing down too much.

Parameters:
xorRendering - if true, XOR rendering will be used. Otherwise, the old location won't be drawn.

setProjection

public void setProjection(Projection proj)
Set the current projection.


getProjection

public Projection getProjection()
Get the current projection.


mousePressed

public boolean mousePressed(java.awt.event.MouseEvent e)
Description copied from class: MapMouseAdapter
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface MapMouseListener
Overrides:
mousePressed in class MapMouseAdapter
Parameters:
e - MouseEvent
Returns:
false

mouseReleased

public boolean mouseReleased(java.awt.event.MouseEvent e)
Description copied from class: MapMouseAdapter
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface MapMouseListener
Overrides:
mouseReleased in class MapMouseAdapter
Parameters:
e - MouseEvent
Returns:
false

mouseClicked

public boolean mouseClicked(java.awt.event.MouseEvent e)
Description copied from class: MapMouseAdapter
Invoked when the mouse has been clicked on a component.

Specified by:
mouseClicked in interface MapMouseListener
Overrides:
mouseClicked in class MapMouseAdapter
Parameters:
e - MouseEvent
Returns:
false

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Description copied from class: MapMouseAdapter
Invoked when the mouse enters a component.

Specified by:
mouseEntered in interface MapMouseListener
Overrides:
mouseEntered in class MapMouseAdapter
Parameters:
e - MouseEvent

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Description copied from class: MapMouseAdapter
Invoked when the mouse exits a component.

Specified by:
mouseExited in interface MapMouseListener
Overrides:
mouseExited in class MapMouseAdapter
Parameters:
e - MouseEvent

mouseDragged

public boolean mouseDragged(java.awt.event.MouseEvent e)
Description copied from class: MapMouseAdapter
Invoked when a mouse button is pressed on a component and then dragged. The listener will receive these events if it

Specified by:
mouseDragged in interface MapMouseListener
Overrides:
mouseDragged in class MapMouseAdapter
Parameters:
e - MouseEvent
Returns:
false

mouseMoved

public boolean mouseMoved(java.awt.event.MouseEvent e)
Description copied from class: MapMouseAdapter
Invoked when the mouse button has been moved on a component (with no buttons down).

Specified by:
mouseMoved in interface MapMouseListener
Overrides:
mouseMoved in class MapMouseAdapter
Parameters:
e - MouseEvent
Returns:
false

mouseMoved

public void mouseMoved()
Description copied from class: MapMouseAdapter
Handle a mouse cursor moving without the button being pressed. Another layer has consumed the event.

Specified by:
mouseMoved in interface MapMouseListener
Overrides:
mouseMoved in class MapMouseAdapter

addEOMGListener

public void addEOMGListener(EOMGListener l)
Add a EOMGListener.

Parameters:
l - EOMGListener

removeEOMGListener

public void removeEOMGListener(EOMGListener l)
Remove a EOMGListener.

Parameters:
l - EOMGListener

fireEvent

public void fireEvent(EOMGEvent event)
The method to call if you want to let listeners know that the state has changed. Usually called when a graphic is selected or not, so that GUIs can be directed.


fireEvent

public void fireEvent(java.awt.Cursor cursor,
                      java.lang.String message,
                      int status)
Create the event with a Cursor and/or message, and then fire it.

Parameters:
cursor - Cursor to be used.
message - an instruction/error to be displayed to the user.
status - the current status of the EditableOMGraphic.

fireEvent

public void fireEvent(java.awt.Cursor cursor,
                      java.lang.String message,
                      java.awt.event.MouseEvent mouseEvent,
                      int status)
Create the event with the Cursor, message and/or MouseEvent.

Parameters:
cursor - Cursor to be used.
message - an instruction/error to be displayed to the user.
mouseEvent - where that caused the EOMGEvent. May be null.
status - the current status of the EditableOMGraphic.

fireEvent

public void fireEvent(int status)
Create the event with no cursor change or message to be displayed.


getGUI

public java.awt.Component getGUI()
If this EditableOMGraphic has parameters that can be manipulated that are independent of other EditableOMGraphic types, then you can provide the widgets to control those parameters here. By default, this method returns null, which indicates that you can extend this method to return a Component that controls parameters for the EditableOMGraphic other than the GraphicAttribute parameters. Should return something like a toolbar, small.

Returns:
Component to control EOMG parameters, without the GraphicAttribute GUI.

getGUI

public java.awt.Component getGUI(GraphicAttributes graphicAttributes)
If this EditableOMGraphic has parameters that can be manipulated that are independent of other EditableOMGraphic types, then you can provide the widgets to control those parameters here. By default, returns the GraphicAttributes GUI widgets. If you don't want a GUI to appear when a widget is being created/edited, then don't call this method from the EditableOMGraphic implementation, and return a null Component from getGUI.

Parameters:
graphicAttributes - the GraphicAttributes that could be used to get the GUI widget from to control those parameters for this EOMG. The GraphicAttributes used to provide the GUI widget, but it doesn't anymore. Subclasses can take this opportunity to reset the GraphicAttributes interface for a new OMGraphic.
Returns:
Component to use to control parameters for this EOMG, generally a JPanel with a toolbar.

getProjectionPoint

public java.awt.geom.Point2D getProjectionPoint(java.awt.event.MouseEvent e)

isMouseEventTouching

public boolean isMouseEventTouching(java.awt.event.MouseEvent e)

isMouseEventTouchingTheEdge

public boolean isMouseEventTouchingTheEdge(java.awt.event.MouseEvent e)

createUndoEventForCurrentState

protected UndoEvent createUndoEventForCurrentState(java.lang.String whatHappened)
This method should be overwritten for each EditableOMGraphic to save the state of the current OMGraphic, in case the user wants to revert to this state. Called from the updateCurrentState method.

Parameters:
whatHappened - String describing what got you here. You can leave this null if you just want to go with the default.
Returns:
UndoEvent reflecting current state. May be null if undo isn't handled. Returning null is the default action.

updateCurrentState

public void updateCurrentState(java.lang.String whatHappened)
Called by anything that knows that the EOMG has arrived at a stable state that should be kept for Undo actions.

Parameters:
whatHappened - a description of was done to get to this state. If null, the EOMG will create a default string to use.

getUndoStack

public UndoStack getUndoStack()
Returns:
the undoStack

setUndoStack

public void setUndoStack(UndoStack undoStack)
Parameters:
undoStack - the undoStack to set

setPopupIsUp

public void setPopupIsUp(boolean popupIsUp)
A little flag to let the EOMG that a popup menu is up on the map. If the menu is up, and the menu is not clicked on, we don't really want to deactivate the drawing tool right then - let a free click go by first, which will dismiss the menu.

Parameters:
popupIsUp -

isPopupIsUp

public boolean isPopupIsUp()

createAttributePanel

public javax.swing.JComponent createAttributePanel(GraphicAttributes graphicAttributes)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details