public class DrawingEditorTool extends AbstractEditorTool implements java.awt.event.ActionListener, java.beans.PropertyChangeListener, PropertyConsumer
# Layer declaration, dtlayer has to go in openmap.layers property dtlayer.class=com.bbn.openmap.layer.editor.EditorLayer # GUI name for layer, will also be the ID of the 'hidden' mouse mode used for tool. dtlayer.prettyName=Drawing Layer # List of other MouseModes to respond to for the layer, when *not* in editing mode. dtlayer.mouseModes=Gestures # Editor Tool to use with layer dtlayer.editor=com.bbn.openmap.layer.editor.DrawingEditorTool # This tool lets you hide the drawing attribute controls (lines, # colors) for the different objects. Default is true. dtlayer.showAttributes=false # List of EditToolLoaders to use in DrawingEditorTool dtlayer.loaders=polys points lines # EditToolLoader class to use for the polys dtlayer.polys.class=com.bbn.openmap.tools.drawing.OMPolyLoader # Set the DrawingAttributes class to use for polys dtlayer.polys.attributesClass=com.bbn.openmap.omGraphics.DrawingAttributes # Polys have specific line color, defaults for other settings. dtlayer.polys.lineColor=FFFF0000 # EditToolLoader classes for points and lines, they get rendered # with whatever color was set last for the DrawingEditorTool. dtlayer.points.class=com.bbn.openmap.tools.drawing.OMPointLoader dtlayer.lines.class=com.bbn.openmap.tools.drawing.OMLineLoader
StandardMapMouseInterpreter.GeometryOfInterest, StandardMapMouseInterpreter.MouseTimerListener
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AttributesClassProperty |
protected javax.swing.ButtonGroup |
bg
The ButtonGroup to use for the face.
|
static java.lang.String |
DefaultDrawingAttributesClass |
protected java.util.Hashtable<java.lang.String,DrawingAttributes> |
drawingAttributesTable
Hashtable that holds default DrawingAttributes for different loaders.
|
protected OMDrawingTool |
drawingTool
OMDrawingTool handling OMGraphic modifications and creations.
|
protected GraphicAttributes |
ga |
protected java.util.ArrayList<EditToolLoader> |
loaderList
The ArrayList containing the EditToolLoaders for the drawing tool.
|
static java.lang.String |
LoaderProperty |
protected MouseDelegator |
mouseDelegator
The MouseDelegator that is controlling the MouseModes.
|
protected OMDrawingToolMouseMode |
omdtmm
A handler on the OMDrawingToolMouseMode that the OMDrawingTool is using,
for convenience.
|
protected java.lang.String |
propertyPrefix
Property prefix for PropertyConsumer interface.
|
static java.lang.String |
RESET_CMD |
protected boolean |
showAttributes |
static java.lang.String |
ShowAttributesProperty |
protected java.lang.String |
thingToCreate
The class name of the next thing to create.
|
protected javax.swing.JToggleButton |
unpickBtn
The button that unpicks all the rest of the tool buttons.
|
face, visible, wantsEvents
active, clickInterest, consumeEvents, currentMouseEvent, DEBUG, grp, lastToolTip, layer, mouseModeServiceList, mouseTimer, mouseTimerInterval, mouseTimerListener, movementInterest, noTimerOverOMGraphic
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
Constructor and Description |
---|
DrawingEditorTool(EditorLayer layer)
The general constructor that can be called from subclasses to initialize
the drawing tool and interface.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
actionPerformed - Handle the mouse clicks on the button(s)
|
protected OMDrawingToolMouseMode |
activateDrawingTool(java.lang.String ttc)
Method to set up the drawing tool with default behavior in order to
create a new OMGraphic.
|
void |
addEditToolLoader(EditToolLoader loader) |
void |
clearEditToolLoaders() |
protected OMDrawingTool |
createDrawingTool() |
void |
dispose()
Called when the parent layer detects that it has been removed from the
application.
|
void |
drawingComplete(OMGraphic omg,
OMAction action)
When a graphic is complete, the drawing tool gets ready to make another.
|
protected void |
fillFaceToolBar(javax.swing.JToolBar faceTB,
javax.swing.ButtonGroup bg)
Fill the Face's toolbar with buttons
|
void |
findAndInit(java.lang.Object someObj)
Called by findAndInit(Iterator) so subclasses can find objects, too.
|
void |
findAndUndo(java.lang.Object someObj)
Part of the interface where the EditorLayer can provide components that
are available via the MapHandler/BeanContext.
|
OMDrawingTool |
getDrawingTool()
Get the OMDrawingTool to use with this DrawingEditorTool.
|
java.awt.Container |
getFace()
The tool's interface.
|
GraphicAttributes |
getGraphicAttributes() |
MouseDelegator |
getMouseDelegator()
Get the MouseDelegator used to control mouse gestures over the map.
|
java.util.Properties |
getProperties(java.util.Properties props)
Method to fill in a Properties object, reflecting the current
values of the PropertyConsumer.
|
java.util.Properties |
getPropertyInfo(java.util.Properties props)
Method to fill in a Properties object with values reflecting
the properties able to be set on this PropertyConsumer.
|
java.lang.String |
getPropertyPrefix()
Get the property key prefix that is being used to prepend to
the property keys for Properties lookups.
|
void |
initDefaultDrawingToolLoaders()
Add the default (line, poly, rectangle, circle/range rings, point)
capabilities to the tool.
|
void |
initDrawingTool()
Method called in the AbstractDrawingEditorTool constructor.
|
boolean |
isShowAttributes() |
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.
|
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.
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
Listen for changes to the active mouse mode and for any changes to the
list of available mouse modes
|
void |
removeEditToolLoader(EditToolLoader loader) |
void |
resetForNewGraphic()
Called when the Tool should be reset to draw a new graphic.
|
void |
setDrawingTool(OMDrawingTool omdt)
Set the OMDrawingTool to use.
|
void |
setGraphicAttributes(GraphicAttributes ga) |
void |
setMouseDelegator(MouseDelegator md)
Set the MouseDelegator used to hold the different MouseModes available to
the map.
|
void |
setProperties(java.util.Properties props)
Method to set the properties in the PropertyConsumer.
|
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
Method to set the properties in the PropertyConsumer.
|
void |
setPropertyPrefix(java.lang.String prefix)
Set the property key prefix that should be used by the
PropertyConsumer.
|
void |
setShowAttributes(boolean showAttributes) |
void |
setVisible(boolean value)
A method that lets the EditorTool know whether its interface should be
visible.
|
void |
setWantsEvents(boolean value)
The EditorTool method, with the added bonus of resetting the tool if it
doesn't want events.
|
protected void |
setWantsEvents(java.lang.String command)
The main method for getting the tool ready to create something.
|
void |
totalReset()
Does everything to make the DrawingEditorTool go to sleep, and disable
all buttons.
|
protected void |
unhook(java.lang.Object someObj) |
isVisible, setLayer, wantsEvents
deselect, displayPopup, getClickInterest, getConsumeEvents, getCurrentMouseEvent, getGeometryUnder, getGRP, getLayer, getMouseModeServiceList, getMouseTimerInterval, getMovementInterest, getNoTimerOverOMGraphic, handleInfoLine, handleToolTip, isActive, isLeftMouseButton, leftClick, leftClick, leftClickOff, mouseMoved, mouseNotOver, mouseOver, mouseOver, rightClick, rightClick, rightClickOff, select, setActive, setClickInterest, setClickInterestFromMouseEvent, setConsumeEvents, setCurrentMouseEvent, setGRP, setMouseModeServiceList, setMouseTimerInterval, setMovementInterest, setNoTimerOverOMGraphic, testForAndHandlePopupTrigger, updateMouseMoved
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCurrentMouseEvent, getGRP, isActive, leftClick, leftClick, leftClickOff, mouseNotOver, mouseOver, mouseOver, rightClick, rightClick, rightClickOff, setActive, setGRP
getMouseModeServiceList, mouseMoved
protected OMDrawingTool drawingTool
protected OMDrawingToolMouseMode omdtmm
protected java.lang.String thingToCreate
protected javax.swing.ButtonGroup bg
protected javax.swing.JToggleButton unpickBtn
protected GraphicAttributes ga
protected MouseDelegator mouseDelegator
protected java.util.ArrayList<EditToolLoader> loaderList
public static final java.lang.String RESET_CMD
protected java.lang.String propertyPrefix
protected java.util.Hashtable<java.lang.String,DrawingAttributes> drawingAttributesTable
protected boolean showAttributes
public static final java.lang.String ShowAttributesProperty
public static final java.lang.String LoaderProperty
public static final java.lang.String AttributesClassProperty
public static final java.lang.String DefaultDrawingAttributesClass
public DrawingEditorTool(EditorLayer layer)
public void initDrawingTool()
protected OMDrawingTool createDrawingTool()
public void addEditToolLoader(EditToolLoader loader)
public void removeEditToolLoader(EditToolLoader loader)
public void clearEditToolLoaders()
public void initDefaultDrawingToolLoaders()
protected void setWantsEvents(java.lang.String command)
public void setWantsEvents(boolean value)
setWantsEvents
in class AbstractEditorTool
public void findAndInit(java.lang.Object someObj)
findAndInit
in interface LightMapHandlerChild
findAndInit
in class AbstractEditorTool
public void findAndUndo(java.lang.Object someObj)
AbstractEditorTool
findAndUndo
in interface LightMapHandlerChild
findAndUndo
in class AbstractEditorTool
public void dispose()
AbstractEditorTool
dispose
in interface EditorTool
dispose
in class AbstractEditorTool
protected void unhook(java.lang.Object someObj)
public void drawingComplete(OMGraphic omg, OMAction action)
drawingComplete
in interface EditorTool
drawingComplete
in class AbstractEditorTool
public void resetForNewGraphic()
public void totalReset()
public void setDrawingTool(OMDrawingTool omdt)
public OMDrawingTool getDrawingTool()
public GraphicAttributes getGraphicAttributes()
public void setGraphicAttributes(GraphicAttributes ga)
public boolean isShowAttributes()
public void setShowAttributes(boolean showAttributes)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
protected OMDrawingToolMouseMode activateDrawingTool(java.lang.String ttc)
ttc
- thingToCreate, classname of thing to createpublic boolean mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface MapMouseListener
mousePressed
in class StandardMapMouseInterpreter
e
- MouseEventpublic boolean mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface MapMouseListener
mouseReleased
in class StandardMapMouseInterpreter
e
- MouseEventpublic boolean mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface MapMouseListener
mouseClicked
in class StandardMapMouseInterpreter
e
- MouseEventpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface MapMouseListener
mouseEntered
in class StandardMapMouseInterpreter
e
- MouseEventpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface MapMouseListener
mouseExited
in class StandardMapMouseInterpreter
e
- MouseEventpublic boolean mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface MapMouseListener
mouseDragged
in class StandardMapMouseInterpreter
e
- MouseEventpublic boolean mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface MapMouseListener
mouseMoved
in class StandardMapMouseInterpreter
e
- MouseEventpublic void setVisible(boolean value)
AbstractEditorTool
setVisible
in interface EditorTool
setVisible
in class AbstractEditorTool
public java.awt.Container getFace()
getFace
in interface EditorTool
getFace
in class AbstractEditorTool
protected void fillFaceToolBar(javax.swing.JToolBar faceTB, javax.swing.ButtonGroup bg)
public void setMouseDelegator(MouseDelegator md)
public MouseDelegator getMouseDelegator()
public void propertyChange(java.beans.PropertyChangeEvent evt)
propertyChange
in interface java.beans.PropertyChangeListener
public void setPropertyPrefix(java.lang.String prefix)
PropertyConsumer
setPropertyPrefix
in interface PropertyConsumer
prefix
- the prefix String.public java.lang.String getPropertyPrefix()
PropertyConsumer
getPropertyPrefix
in interface PropertyConsumer
public void setProperties(java.util.Properties props)
PropertyConsumer
setProperties
in interface PropertyConsumer
props
- a properties object that the PropertyConsumer
can use to retrieve expected properties it can use for
configuration.public void setProperties(java.lang.String prefix, java.util.Properties props)
PropertyConsumer
setProperties
in interface PropertyConsumer
prefix
- a String used by the PropertyConsumer to prepend
to each property value it wants to look up -
setList.getProperty(prefix.propertyKey). If the prefix
had already been set, then the prefix passed in should
replace that previous value.props
- a Properties object that the PropertyConsumer
can use to retrieve expected properties it can use for
configuration.public java.util.Properties getProperties(java.util.Properties props)
PropertyConsumer
getProperties
in interface PropertyConsumer
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.public java.util.Properties getPropertyInfo(java.util.Properties props)
PropertyConsumer
getPropertyInfo
in interface PropertyConsumer
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details