com.bbn.openmap.omGraphics
Class EditableOMText

java.lang.Object
  extended by com.bbn.openmap.event.MapMouseAdapter
      extended by com.bbn.openmap.omGraphics.EditableOMGraphic
          extended by com.bbn.openmap.omGraphics.EditableOMText
All Implemented Interfaces:
MapMouseListener, java.awt.event.ActionListener, java.util.EventListener

public class EditableOMText
extends EditableOMGraphic
implements java.awt.event.ActionListener

Wrapper class to edit OMText objects. This component is used by the OMDrawingTool.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.EditableOMGraphic
EditableOMGraphic.OMGraphicUndoEvent
 
Field Summary
static int CENTER_POINT_INDEX
           
protected  GrabPoint gpc
           
protected  OffsetGrabPoint gpo
           
protected  int lastRenderType
           
static int OFFSET_POINT_INDEX
           
protected  OMText text
           
static java.lang.String TextFieldCommand
          Command for text string adjustments.
static java.lang.String TextFontCommand
           
static java.lang.String TextRotationCommand
           
 
Fields inherited from class com.bbn.openmap.omGraphics.EditableOMGraphic
actionMask, canGrabGraphic, DEBUG, DEBUG_DETAIL, gPoints, GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE, holder, i18n, lastMouseEvent, listeners, mouseModeServiceList, movingPoint, popupIsUp, projection, SELECTED_GRAB_POINT_DRAWING_ATTRIBUTES_ATTRIBUTE, showGUI, stateMachine, undoStack, xorRendering
 
Constructor Summary
EditableOMText()
          Create the EditableOMText, setting the state machine to create the point off of the gestures.
EditableOMText(GraphicAttributes ga)
          Create an EditableOMText with the pointType and renderType parameters in the GraphicAttributes object.
EditableOMText(OMText omc)
          Create the EditableOMText with an OMText already defined, ready for editing.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void assertGrabPoints()
          Check to make sure the grab points are not null.
 void attachToMovingGrabPoint(OffsetGrabPoint gp)
          Attach to the Moving OffsetGrabPoint so if it moves, it will move this EditableOMGraphic with it.
protected  void clearGrabPoints()
           
 void createGraphic(GraphicAttributes ga)
          Create and set the graphic within the state machine.
 void detachFromMovingGrabPoint(OffsetGrabPoint gp)
          Detach from a Moving OffsetGrabPoint.
 boolean generate(Projection proj)
          Use the current projection to place the graphics on the screen.
 boolean getCanGrabGraphic()
          Get whether a graphic can be manipulated by its edges, rather than just by its grab points.
 OMGraphic getGraphic()
          Get the OMGraphic being created/modified by the EditableOMText.
 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.
 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.
protected  javax.swing.JComponent getTextGUI()
           
protected  javax.swing.JComponent getTextGUI(int orientation, javax.swing.JComponent guiComp)
          Get the GUI associated with changing the Text.
 void init()
          Create and initialize the state machine that interprets the modifying gestures/commands, as well as initialize the grab points.
 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 regenerate(Projection proj)
          Given a new projection, the grab points may need to be repositioned off the current position of the graphic.
 void render(java.awt.Graphics graphics)
          Draw the EditableOMtext parts into the java.awt.Graphics object.
 void setGrabPoints()
          Take the current location of the GrabPoints, and modify the location parameters of the OMPoint with them.
 void setGrabPoints(OMGraphic graphic)
          Set the grab points for the graphic provided, setting them on the extents of the graphic.
 void setGraphic(OMGraphic graphic)
          Set the graphic within the state machine.
 
Methods inherited from class com.bbn.openmap.omGraphics.EditableOMGraphic
_getMovingPoint, addEOMGListener, cleanMap, createAttributePanel, createUndoEventForCurrentState, finalize, fireEvent, fireEvent, fireEvent, fireEvent, getActionMask, getGrabPoint, getGrabPoints, getGUI, getMouseModeServiceList, getMovingPoint, getProjection, getProjectionPoint, getShowGUI, getStateMachine, getUndoStack, handleInitialMouseEvent, isMouseEventTouching, isMouseEventTouchingTheEdge, isPopupIsUp, isXorRendering, modifyOMGraphicForEditRender, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mouseReleased, redraw, redraw, redraw, removeEOMGListener, repaint, repaintRender, reset, resetOMGraphicAfterEditRender, setActionMask, setCanGrabGraphic, setGrabPoint, setGrabPoints, setMouseModeServiceList, setMovingPoint, setPopupIsUp, setProjection, setShowGUI, setStateMachine, setUndoStack, setXorRendering, updateCurrentState
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gpc

protected GrabPoint gpc

gpo

protected OffsetGrabPoint gpo

text

protected OMText text

CENTER_POINT_INDEX

public static final int CENTER_POINT_INDEX
See Also:
Constant Field Values

OFFSET_POINT_INDEX

public static final int OFFSET_POINT_INDEX
See Also:
Constant Field Values

lastRenderType

protected int lastRenderType

TextFieldCommand

public static final java.lang.String TextFieldCommand
Command for text string adjustments.

See Also:
Constant Field Values

TextFontCommand

public static final java.lang.String TextFontCommand
See Also:
Constant Field Values

TextRotationCommand

public static final java.lang.String TextRotationCommand
See Also:
Constant Field Values
Constructor Detail

EditableOMText

public EditableOMText()
Create the EditableOMText, setting the state machine to create the point off of the gestures.


EditableOMText

public EditableOMText(GraphicAttributes ga)
Create an EditableOMText with the pointType and renderType parameters in the GraphicAttributes object.


EditableOMText

public EditableOMText(OMText omc)
Create the EditableOMText with an OMText already defined, ready for editing.

Parameters:
omc - OMText that should be edited.
Method Detail

init

public void init()
Create and initialize the state machine that interprets the modifying gestures/commands, as well as initialize the grab points. Also allocates the grab point array needed by the EditableOMText.


setGraphic

public void setGraphic(OMGraphic graphic)
Set the graphic within the state machine. If the graphic is null, then one shall be created, and located off screen until the gestures driving the state machine place it on the map.

Specified by:
setGraphic in class EditableOMGraphic
Parameters:
graphic - OMGraphic.

createGraphic

public void createGraphic(GraphicAttributes ga)
Create and set the graphic within the state machine. The GraphicAttributes describe the type of point to create.

Specified by:
createGraphic in class EditableOMGraphic
Parameters:
ga - GraphicAttributes, describing the graphic to be created.

getGraphic

public OMGraphic getGraphic()
Get the OMGraphic being created/modified by the EditableOMText.

Specified by:
getGraphic in class EditableOMGraphic

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.

Overrides:
attachToMovingGrabPoint in class EditableOMGraphic

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.

Overrides:
detachFromMovingGrabPoint in class EditableOMGraphic

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.

Overrides:
getMovingPoint in class EditableOMGraphic
Parameters:
e - MouseEvent
Returns:
GrabPoint that is touched by the MouseEvent, null if none are.

assertGrabPoints

public void assertGrabPoints()
Check to make sure the grab points are not null. If they are, allocate them, and them assign them to the array.


clearGrabPoints

protected void clearGrabPoints()

setGrabPoints

public void setGrabPoints(OMGraphic graphic)
Set the grab points for the graphic provided, setting them on the extents of the graphic. Called when you want to set the grab points off the location of the graphic.


setGrabPoints

public void setGrabPoints()
Take the current location of the GrabPoints, and modify the location parameters of the OMPoint with them. Called when you want the graphic to change according to the grab points.

Specified by:
setGrabPoints in class EditableOMGraphic

getCanGrabGraphic

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

Overrides:
getCanGrabGraphic in class EditableOMGraphic

move

public 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. Should be called only once at the beginning of the general movement, in order to set the movingPoint. After that, redraw(e) should just be called, and the movingPoint will make the adjustments to the graphic that are needed.

Specified by:
move in class EditableOMGraphic

generate

public 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.

Specified by:
generate in class EditableOMGraphic
Parameters:
proj - com.bbn.openmap.proj.Projection
Returns:
true

regenerate

public 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.

Specified by:
regenerate in class EditableOMGraphic

render

public void render(java.awt.Graphics graphics)
Draw the EditableOMtext parts into the java.awt.Graphics object. The grab points are only rendered if the point machine state is TextSelectedState.TEXT_SELECTED.

Specified by:
render in class EditableOMGraphic
Parameters:
graphics - java.awt.Graphics.

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.

Overrides:
getGUI in class EditableOMGraphic
Parameters:
graphicAttributes - the GraphicAttributes to use to get the GUI widget from to control those parameters for this EOMG.
Returns:
java.awt.Component to use to control parameters for this EOMG.

getTextGUI

protected javax.swing.JComponent getTextGUI()

getTextGUI

protected javax.swing.JComponent getTextGUI(int orientation,
                                            javax.swing.JComponent guiComp)
Get the GUI associated with changing the Text.

Parameters:
orientation - SwingConstants.HORIZONTAL/VERTICAL
guiComp - the JComponent to add stuff to. If the orientation is HORIZONTAL, the components will be added directly to this component, or to a new JComponent that is returned if null. If the orientation is Vertical, a button will be added to the guiComp, or returned. This button will call up a dialog box with the settings, since they don't really lay out vertically.
Returns:
JComponent with text controls.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener


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