Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.layer.editor
Class DrawingEditorTool

    java.lang.Object
      com.bbn.openmap.omGraphics.event.StandardMapMouseInterpreter
          com.bbn.openmap.layer.editor.AbstractEditorTool
              com.bbn.openmap.layer.editor.DrawingEditorTool

All Implemented Interfaces:
  java.awt.event.ActionListener, EditorTool, java.util.EventListener, LightMapHandlerChild, MapMouseInterpreter, MapMouseListener, java.beans.PropertyChangeListener, PropertyConsumer

public class DrawingEditorTool
extends AbstractEditorTool
implements java.awt.event.ActionListener, java.beans.PropertyChangeListener, PropertyConsumer

The DrawingEditorTool is a EditorTool for the EditorLayer that will use a custom OMDrawingTool to create OMGraphics as needed by the EditorTool. This is a class that lets you define which EditToolLoaders the internal OMDrawingTool will use for its own, targeted use. These definitions are specified in the properties for the EditorLayer using this tool. This class provides the OMDrawingTool and all the button mechanisms organized for smooth behavior integrated with the regular OpenMap mouse modes. Properties for an EditorLayer using the DrawingEditorTool:

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

###

       # 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

    Nested Class Summary

    Nested classes inherited from class com.bbn.openmap.omGraphics.event.StandardMapMouseInterpreter

    StandardMapMouseInterpreter.GeometryOfInterest, StandardMapMouseInterpreter.MouseTimerListener

    Field Summary

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

    Fields inherited from class com.bbn.openmap.layer.editor.AbstractEditorTool

    face, visible, wantsEvents

    Fields inherited from class com.bbn.openmap.omGraphics.event.StandardMapMouseInterpreter

    clickInterest, consumeEvents, currentMouseEvent, DEBUG, grp, lastToolTip, layer, mouseModeServiceList, mouseTimer, mouseTimerInterval, mouseTimerListener, movementInterest, noTimerOverOMGraphic

    Fields inherited from interface com.bbn.openmap.PropertyConsumer

    EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty

    Constructor Summary

    DrawingEditorTool(EditorLayer layer)

              The general constructor that can be called from subclasses to initialize
     the drawing tool and interface.

    Method Summary

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

    Methods inherited from class com.bbn.openmap.layer.editor.AbstractEditorTool

    isVisible, setLayer, wantsEvents

    Methods inherited from class com.bbn.openmap.omGraphics.event.StandardMapMouseInterpreter

    deselect, displayPopup, getClickInterest, getConsumeEvents, getCurrentMouseEvent, getGeometryUnder, getGRP, getLayer, getMouseModeServiceList, getMouseTimerInterval, getMovementInterest, getNoTimerOverOMGraphic, handleInfoLine, handleToolTip, isLeftMouseButton, leftClick, leftClick, leftClickOff, mouseMoved, mouseNotOver, mouseOver, mouseOver, rightClick, rightClick, rightClickOff, select, setClickInterest, setConsumeEvents, setCurrentMouseEvent, setGRP, setMouseModeServiceList, setMouseTimerInterval, setMovementInterest, setNoTimerOverOMGraphic, testForAndHandlePopupTrigger, updateMouseMoved

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.bbn.openmap.omGraphics.event.MapMouseInterpreter

    getCurrentMouseEvent, getGRP, leftClick, leftClick, leftClickOff, mouseNotOver, mouseOver, mouseOver, rightClick, rightClick, rightClickOff, setGRP

    Methods inherited from interface com.bbn.openmap.event.MapMouseListener

    getMouseModeServiceList, mouseMoved

    Field Detail

    drawingTool

    protected OMDrawingTool drawingTool

    OMDrawingTool handling OMGraphic modifications and creations.

    omdtmm

    protected OMDrawingToolMouseMode omdtmm

    A handler on the OMDrawingToolMouseMode that the OMDrawingTool is using,
     for convenience. If this handle is not null, then that's an internal
     signal for this EditorTool to know that it's active and interpreting
     MouseEvents. If this is null, and the EditorTool wants events, that's a
     signal to create a new OMGraphic (see mousePressed).

    thingToCreate

    protected java.lang.String thingToCreate

    The class name of the next thing to create. Used as a signal to this
     EditorTool that when the next appropriate MouseEvent comes in, this
     "thing" should be created.

    bg

    protected javax.swing.ButtonGroup bg

    The ButtonGroup to use for the face.

    unpickBtn

    protected javax.swing.JToggleButton unpickBtn

    The button that unpicks all the rest of the tool buttons. It is kept
     invisible, but a member of all the other button's ButtonGroup. When
     selected, all of the other buttons are deselected.

    ga

    protected GraphicAttributes ga

    mouseDelegator

    protected MouseDelegator mouseDelegator

    The MouseDelegator that is controlling the MouseModes. We need to keep
     track of what's going on so we can adjust our tools accordingly.

    loaderList

    protected java.util.ArrayList loaderList

    The ArrayList containing the EditToolLoaders for the drawing tool.

    RESET_CMD

    public static final java.lang.String RESET_CMD

    See Also:Constant Field Values

    propertyPrefix

    protected java.lang.String propertyPrefix

    Property prefix for PropertyConsumer interface.

    drawingAttributesTable

    protected java.util.Hashtable drawingAttributesTable

    Hashtable that holds default DrawingAttributes for different loaders.

    showAttributes

    protected boolean showAttributes

    ShowAttributesProperty

    public static final java.lang.String ShowAttributesProperty

    See Also:Constant Field Values

    LoaderProperty

    public static final java.lang.String LoaderProperty

    See Also:Constant Field Values

    AttributesClassProperty

    public static final java.lang.String AttributesClassProperty

    See Also:Constant Field Values

    DefaultDrawingAttributesClass

    public static final java.lang.String DefaultDrawingAttributesClass

    See Also:Constant Field Values

    Constructor Detail

    DrawingEditorTool

    public DrawingEditorTool(EditorLayer layer)

    The general constructor that can be called from subclasses to initialize
     the drawing tool and interface. All that is left to do for subclasses is
     to add EditToolLoaders to the DrawingEditorTool subclass.

    Method Detail

    initDrawingTool

    public void initDrawingTool()

    Method called in the AbstractDrawingEditorTool constructor.

    createDrawingTool

    protected OMDrawingTool createDrawingTool()

    addEditToolLoader

    public void addEditToolLoader(EditToolLoader loader)

    removeEditToolLoader

    public void removeEditToolLoader(EditToolLoader loader)

    clearEditToolLoaders

    public void clearEditToolLoaders()

    initDefaultDrawingToolLoaders

    public void initDefaultDrawingToolLoaders()

    Add the default (line, poly, rectangle, circle/range rings, point)
     capabilities to the tool.

    setWantsEvents

    protected void setWantsEvents(java.lang.String command)

    The main method for getting the tool ready to create something. When
     called, it sets the thingToCreate from the command, calls
     setWantEvents(true), which calls resetForNewGraphic().

    setWantsEvents

    public void setWantsEvents(boolean value)

    The EditorTool method, with the added bonus of resetting the tool if it
     doesn't want events.

    Overrides:setWantsEvents in class AbstractEditorTool

    findAndInit

    public void findAndInit(java.lang.Object someObj)

    Called by findAndInit(Iterator) so subclasses can find objects, too.

    Specified by:findAndInit in interface LightMapHandlerChildOverrides:findAndInit in class AbstractEditorTool

    findAndUndo

    public void findAndUndo(java.lang.Object someObj)

    Description copied from class: AbstractEditorTool
    Part of the interface where the EditorLayer can provide
     components that are available via the MapHandler/BeanContext.
     The object is something that has been removed from the
     MapHandler.

    Specified by:findAndUndo in interface LightMapHandlerChildOverrides:findAndUndo in class AbstractEditorTool

    drawingComplete

    public void drawingComplete(OMGraphic omg,
                                OMAction action)

    When a graphic is complete, the drawing tool gets ready to make another.

    Specified by:drawingComplete in interface EditorToolOverrides:drawingComplete in class AbstractEditorTool

    resetForNewGraphic

    public void resetForNewGraphic()

    Called when the Tool should be reset to draw a new graphic. Currently
     sets the OMDrawingToolMouseMode to null, which is a signal to the
     DrawingEditorTool that if an appropriate MouseEvent is provided, that the
     DrawingTool should be configured to create a new OMGraphic. If the
     OMDrawingToolMouseMode is not null, then the MouseEvent is just given to
     it.

    totalReset

    public void totalReset()

    Does everything to make the DrawingEditorTool go to sleep, and disable
     all buttons.

    setDrawingTool

    public void setDrawingTool(OMDrawingTool omdt)

    Set the OMDrawingTool to use. It's created internally, though.

    getDrawingTool

    public OMDrawingTool getDrawingTool()

    Get the OMDrawingTool to use with this DrawingEditorTool.

    getGraphicAttributes

    public GraphicAttributes getGraphicAttributes()

    setGraphicAttributes

    public void setGraphicAttributes(GraphicAttributes ga)

    isShowAttributes

    public boolean isShowAttributes()

    setShowAttributes

    public void setShowAttributes(boolean showAttributes)

    actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)

    actionPerformed - Handle the mouse clicks on the button(s)

    Specified by:actionPerformed in interface java.awt.event.ActionListener

    activateDrawingTool

    protected OMDrawingToolMouseMode activateDrawingTool(java.lang.String ttc)

    Method to set up the drawing tool with default behavior in order to
     create a new OMGraphic. Will try to deactivate the OMDrawingTool if it
     thinks it's busy.

    Parameters:ttc - thingToCreate, classname of thing to create
    Returns:OMDrawingToolMouseMode of DrawingTool if all goes well, null if
             the drawing tool can't create the new thingy.

    mousePressed

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

    Invoked when a mouse button has been pressed on a component.

    Specified by:mousePressed in interface MapMouseListenerOverrides:mousePressed in class StandardMapMouseInterpreter

    Parameters:e - MouseEvent
    Returns:false

    mouseReleased

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

    Invoked when a mouse button has been released on a component.

    Specified by:mouseReleased in interface MapMouseListenerOverrides:mouseReleased in class StandardMapMouseInterpreter

    Parameters:e - MouseEvent
    Returns:false

    mouseClicked

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

    Invoked when the mouse has been clicked on a component.

    Specified by:mouseClicked in interface MapMouseListenerOverrides:mouseClicked in class StandardMapMouseInterpreter

    Parameters:e - MouseEvent
    Returns:false

    mouseEntered

    public void mouseEntered(java.awt.event.MouseEvent e)

    Invoked when the mouse enters a component.

    Specified by:mouseEntered in interface MapMouseListenerOverrides:mouseEntered in class StandardMapMouseInterpreter

    Parameters:e - MouseEvent

    mouseExited

    public void mouseExited(java.awt.event.MouseEvent e)

    Invoked when the mouse exits a component.

    Specified by:mouseExited in interface MapMouseListenerOverrides:mouseExited in class StandardMapMouseInterpreter

    Parameters:e - MouseEvent

    mouseDragged

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

    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 MapMouseListenerOverrides:mouseDragged in class StandardMapMouseInterpreter

    Parameters:e - MouseEvent
    Returns:false

    mouseMoved

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

    Invoked when the mouse button has been moved on a component (with no
     buttons down).

    Specified by:mouseMoved in interface MapMouseListenerOverrides:mouseMoved in class StandardMapMouseInterpreter

    Parameters:e - MouseEvent
    Returns:false

    setVisible

    public void setVisible(boolean value)

    Description copied from class: AbstractEditorTool
    A method that lets the EditorTool know whether its interface
     should be visible.

    Specified by:setVisible in interface EditorToolOverrides:setVisible in class AbstractEditorTool

    getFace

    public java.awt.Container getFace()

    The tool's interface. This is added to the tool bar.

    Specified by:getFace in interface EditorToolOverrides:getFace in class AbstractEditorTool

    Returns:String The key for this tool.

    fillFaceToolBar

    protected void fillFaceToolBar(javax.swing.JToolBar faceTB,
                                   javax.swing.ButtonGroup bg)

    Fill the Face's toolbar with buttons

    setMouseDelegator

    public void setMouseDelegator(MouseDelegator md)

    Set the MouseDelegator used to hold the different MouseModes available to
     the map.

    getMouseDelegator

    public MouseDelegator getMouseDelegator()

    Get the MouseDelegator used to control mouse gestures over the map.

    propertyChange

    public 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

    Specified by:propertyChange in interface java.beans.PropertyChangeListener

    setPropertyPrefix

    public void setPropertyPrefix(java.lang.String prefix)

    Description copied from interface: PropertyConsumer
    Set the property key prefix that should be used by the
     PropertyConsumer. The prefix, along with a '.', should be
     prepended to the property keys known by the PropertyConsumer.

    Specified by:setPropertyPrefix in interface PropertyConsumer

    Parameters:prefix - the prefix String.

    getPropertyPrefix

    public java.lang.String getPropertyPrefix()

    Description copied from interface: PropertyConsumer
    Get the property key prefix that is being used to prepend to
     the property keys for Properties lookups.

    Specified by:getPropertyPrefix in interface PropertyConsumer

    Returns:the prefix string

    setProperties

    public void setProperties(java.util.Properties props)

    Description copied from interface: PropertyConsumer
    Method to set the properties in the PropertyConsumer. It is
     assumed that the properties do not have a prefix associated
     with them, or that the prefix has already been set.

    Specified by:setProperties in interface PropertyConsumer

    Parameters:props - a properties object that the PropertyConsumer
            can use to retrieve expected properties it can use for
            configuration.

    setProperties

    public void setProperties(java.lang.String prefix,
                              java.util.Properties props)

    Description copied from interface: PropertyConsumer
    Method to set the properties in the PropertyConsumer. The
     prefix is a string that should be prepended to each property
     key (in addition to a separating '.') in order for the
     PropertyConsumer to uniquely identify properties meant for it,
     in the midst of of Properties meant for several objects.

    Specified by:setProperties in interface PropertyConsumer

    Parameters: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.

    getProperties

    public java.util.Properties getProperties(java.util.Properties props)

    Description copied from interface: PropertyConsumer
    Method to fill in a Properties object, reflecting the current
     values of the PropertyConsumer. If the PropertyConsumer has a
     prefix set, the property keys should have that prefix plus a
     separating '.' prepended to each property key it uses for
     configuration.

    Specified by:getProperties in interface PropertyConsumer

    Parameters:props - a Properties object to load the PropertyConsumer
            properties into. If getList equals null, then a new
            Properties object should be created.
    Returns:Properties object containing PropertyConsumer property
             values. If getList was not null, this should equal
             getList. Otherwise, it should be the Properties object
             created by the PropertyConsumer.

    getPropertyInfo

    public java.util.Properties getPropertyInfo(java.util.Properties props)

    Description copied from interface: PropertyConsumer
    Method to fill in a Properties object with values reflecting
     the properties able to be set on this PropertyConsumer. The key
     for each property should be the raw property name (without a
     prefix) with a value that is a String that describes what the
     property key represents, along with any other information about
     the property that would be helpful (range, default value,
     etc.).

    Specified by:getPropertyInfo in interface PropertyConsumer

    Parameters:props - a Properties object to load the PropertyConsumer
            properties into. If getList equals null, then a new
            Properties object should be created.
    Returns:Properties object containing PropertyConsumer property
             values. If getList was not null, this should equal
             getList. Otherwise, it should be the Properties object
             created by the PropertyConsumer.

          Overview
          Package
        Class
          Use
          Tree
          Deprecated
          Index
          Help

     PREV CLASS
     NEXT CLASS

      FRAMES
     NO FRAMES

      SUMMARY: NESTED | FIELD | CONSTR | METHOD

    DETAIL: FIELD | CONSTR | METHOD

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