|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.event.MapMouseAdapter com.bbn.openmap.omGraphics.EditableOMGraphic
public abstract class EditableOMGraphic
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 |
---|
public static final java.lang.String GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE
public static final java.lang.String SELECTED_GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE
protected EOMGStateMachine stateMachine
StateMachine
protected java.lang.String[] mouseModeServiceList
protected GrabPoint[] gPoints
protected Projection projection
protected GrabPoint movingPoint
protected EOMGListenerSupport listeners
protected boolean showGUI
protected boolean canGrabGraphic
protected UndoStack undoStack
protected I18n i18n
protected boolean popupIsUp
protected int actionMask
protected boolean DEBUG
protected boolean DEBUG_DETAIL
protected boolean xorRendering
protected DrawingAttributes holder
protected java.awt.event.MouseEvent lastMouseEvent
Constructor Detail |
---|
protected EditableOMGraphic()
Method Detail |
---|
public void setStateMachine(EOMGStateMachine sm)
sm
- StateMachine.StateMachine
public EOMGStateMachine getStateMachine()
public void setMouseModeServiceList(java.lang.String[] list)
public java.lang.String[] getMouseModeServiceList()
getMouseModeServiceList
in interface MapMouseListener
getMouseModeServiceList
in class MapMouseAdapter
NavMouseMode.modeID
,
SelectMouseMode.modeID
,
NullMouseMode.modeID
public void setShowGUI(boolean set)
set
- true if the GUI should be shown.public boolean getShowGUI()
public void setCanGrabGraphic(boolean set)
public boolean getCanGrabGraphic()
public abstract void setGraphic(OMGraphic graphic)
graphic
- OMGraphic.public abstract void createGraphic(GraphicAttributes ga)
ga
- GraphicAttributes, describing the graphic to be created.public abstract OMGraphic getGraphic()
public void reset()
public boolean setGrabPoints(GrabPoint[] points)
points
- a GrabPoint[]
public void setActionMask(int mask)
public int getActionMask()
public abstract void setGrabPoints()
public GrabPoint[] getGrabPoints()
public boolean setGrabPoint(GrabPoint gb, int index)
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.
public GrabPoint getGrabPoint(int index)
public void attachToMovingGrabPoint(OffsetGrabPoint gp)
public void detachFromMovingGrabPoint(OffsetGrabPoint gp)
public void setMovingPoint(GrabPoint gp)
public GrabPoint getMovingPoint()
public void handleInitialMouseEvent(java.awt.event.MouseEvent e)
public GrabPoint getMovingPoint(java.awt.event.MouseEvent e)
e
- MouseEvent
public GrabPoint _getMovingPoint(java.awt.event.MouseEvent e)
e
- MouseEvent that the GrabPoint should attach to.getMovingPoint(MouseEvent)
public abstract void move(java.awt.event.MouseEvent e)
public void cleanMap(java.awt.event.MouseEvent e)
public void redraw(java.awt.event.MouseEvent e)
public void redraw(java.awt.event.MouseEvent e, boolean firmPaint)
public void redraw(java.awt.event.MouseEvent e, boolean firmPaint, boolean drawXOR)
e
- MouseEventfirmPaint
- 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.protected void modifyOMGraphicForEditRender()
protected void resetOMGraphicAfterEditRender()
public void repaint()
protected void finalize()
finalize
in class java.lang.Object
public abstract boolean generate(Projection proj)
proj
- com.bbn.openmap.proj.Projection
public abstract void regenerate(Projection proj)
public void repaintRender(java.awt.Graphics g)
public abstract void render(java.awt.Graphics g)
public boolean isXorRendering()
public void setXorRendering(boolean xorRendering)
xorRendering
- if true, XOR rendering will be used. Otherwise, the old location won't be drawn.public void setProjection(Projection proj)
public Projection getProjection()
public boolean mousePressed(java.awt.event.MouseEvent e)
MapMouseAdapter
mousePressed
in interface MapMouseListener
mousePressed
in class MapMouseAdapter
e
- MouseEvent
public boolean mouseReleased(java.awt.event.MouseEvent e)
MapMouseAdapter
mouseReleased
in interface MapMouseListener
mouseReleased
in class MapMouseAdapter
e
- MouseEvent
public boolean mouseClicked(java.awt.event.MouseEvent e)
MapMouseAdapter
mouseClicked
in interface MapMouseListener
mouseClicked
in class MapMouseAdapter
e
- MouseEvent
public void mouseEntered(java.awt.event.MouseEvent e)
MapMouseAdapter
mouseEntered
in interface MapMouseListener
mouseEntered
in class MapMouseAdapter
e
- MouseEventpublic void mouseExited(java.awt.event.MouseEvent e)
MapMouseAdapter
mouseExited
in interface MapMouseListener
mouseExited
in class MapMouseAdapter
e
- MouseEventpublic boolean mouseDragged(java.awt.event.MouseEvent e)
MapMouseAdapter
mouseDragged
in interface MapMouseListener
mouseDragged
in class MapMouseAdapter
e
- MouseEvent
public boolean mouseMoved(java.awt.event.MouseEvent e)
MapMouseAdapter
mouseMoved
in interface MapMouseListener
mouseMoved
in class MapMouseAdapter
e
- MouseEvent
public void mouseMoved()
MapMouseAdapter
mouseMoved
in interface MapMouseListener
mouseMoved
in class MapMouseAdapter
public void addEOMGListener(EOMGListener l)
l
- EOMGListenerpublic void removeEOMGListener(EOMGListener l)
l
- EOMGListenerpublic void fireEvent(EOMGEvent event)
public void fireEvent(java.awt.Cursor cursor, java.lang.String message, int status)
cursor
- Cursor to be used.message
- an instruction/error to be displayed to the user.status
- the current status of the EditableOMGraphic.public void fireEvent(java.awt.Cursor cursor, java.lang.String message, java.awt.event.MouseEvent mouseEvent, int status)
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.public void fireEvent(int status)
public java.awt.Component getGUI()
public java.awt.Component getGUI(GraphicAttributes graphicAttributes)
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.
public java.awt.geom.Point2D getProjectionPoint(java.awt.event.MouseEvent e)
public boolean isMouseEventTouching(java.awt.event.MouseEvent e)
public boolean isMouseEventTouchingTheEdge(java.awt.event.MouseEvent e)
protected UndoEvent createUndoEventForCurrentState(java.lang.String whatHappened)
whatHappened
- String describing what got you here. You can leave this null if you just want to go with the default.
public void updateCurrentState(java.lang.String whatHappened)
whatHappened
- a description of was done to get to this state. If null, the EOMG will create a default string
to use.public UndoStack getUndoStack()
public void setUndoStack(UndoStack undoStack)
undoStack
- the undoStack to setpublic void setPopupIsUp(boolean popupIsUp)
popupIsUp
- public boolean isPopupIsUp()
public javax.swing.JComponent createAttributePanel(GraphicAttributes graphicAttributes)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |