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.tools.drawing
Class OMDrawingTool

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      com.bbn.openmap.gui.OMComponentPanel
                          com.bbn.openmap.gui.OMToolComponent
                              com.bbn.openmap.tools.drawing.OMDrawingTool

All Implemented Interfaces:
  javax.accessibility.Accessible, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, DrawingTool, EOMGListener, java.util.EventListener, java.awt.image.ImageObserver, LightMapHandlerChild, java.awt.MenuContainer, PaintListener, ProjectionListener, java.beans.PropertyChangeListener, PropertyConsumer, SelectionProvider, java.io.Serializable, Tool

public class OMDrawingTool
extends OMToolComponent
implements DrawingTool, java.io.Serializable, java.beans.PropertyChangeListener, ProjectionListener, EOMGListener, PaintListener, SelectionProvider

The OMDrawingTool implements the DrawingTool interface, and can be used to adjust the drawing parameters of OMGraphics. It is basically a manager for directing MouseEvents and MouseMotionEvents from a Component to a EditableOMGraphic. The EditableOMGraphic is responsible for interpreting the events and making the adjustments to the OMGraphic it has wrapped within. The OMDrawingTool also tries to keep the presentation of the OMGraphic up to date, by managing the repaints of the Component to include the graphic being modified.

The OMDrawingTool is also a com.bbn.openmap.gui.Tool, which allows it to appear in the OpenMap toolbar. The OMDrawingTool keeps track of whether it is a tool, and appears accordingly:

If the OMDrawingTool is being used as a tool (getUseAsTool() == true), then it will set itself to be visible. If you are putting an OMDrawingTool in the OpenMap application and you want the color/line/graphic options to be visible in the toolbar, use the itTool property for the OMDrawingTool in the properties file. If you are using your own OMDrawingTool, in your EditorLayerTool for instance, you should set useAsTool(true) programmatically to get the visiblity of the tool to appear. There is a property to tell the OMDrawingTool to be visible when it is inactive, and that flag is true by default. You can set that property (visibleWhenInactive) to change this behavior. If the OMDrawingTool is not being used as a tool, it can be brought up in a window. This window can be brought up with a right click or control-click on the object being edited.

If the OMGraphic being edited doesn't want to have the OMDrawingTool visible, it won't be. Neither the tool nor the option to bring the window up won't be displayed with a right/control click.

The OMDrawingTool uses a behavior mask to give control over how it behaves. You can control if the attribute palette appears, if a popup gui appears by default when the editing is complete, or appear when the alt+mouse key or right mouse key is pressed. You should set this mask if you are not sure about the values that other components may have set on the OMDrawingTool.

The OMDrawingTool uses EditToolLoaders to determine what EditableOMGraphic can be used for a particular class name or OMGraphic type. If a loader for an OMGraphic type is not found, then that OMGraphic type won't be handled, and the tool will react to a create() or edit() call with a null object pointer. If a loader is found, and the OMgraphic can be edited or modified, then the create() or edit() methods will return a pointer to the OMGraphic being modified.

The GUI for the OMDrawingTool is multi-layered. The OMDrawingTool contains a GraphicsAttributes object, which is an extension of the GraphicAttributes object. The GraphicAttributes GUI within the tool lets you change the colors, line width and line dash pattern of the current OMGraphic. The GraphicAttributes conttribution to the GUI is not yet implemented, but will let you change the render type and line type of the OMGraphic. Finally, the EditableOMGraphic is given an opportunity to change and set parameters of the OMGraphic that is knows about - for instance, the EditableOMLine object will soon provide an interface to set arrowheads on the lines, as well as set the amount of arc a line has (it's currently not implemented).

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JPanel
`javax.swing.JPanel.AccessibleJPanel`

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`protected boolean` | `activated` Just a helper flag to reduce work caused by unnecessary deactivate calls.
`static int` | `ALT_POPUP_BEHAVIOR_MASK` Allow a GUI popup to appear over the map when the gesturing/modifications appear to be over, and when the ctrl key or right mouse button is pressed.
`protected int` | `behaviorMask` A integer that is looked at, bitwise, to determine different behaviors.
`static java.lang.String` | `BehaviorProperty` The property list defining behavior mask values that should be set.
`protected javax.swing.JComponent` | `canvas` The JComponent the drawing tool is servicing, usually the MapBean.
`protected EditableOMGraphic` | `currentEditable` The current graphic being modified.
`static int` | `DEACTIVATE_ASAP_BEHAVIOR_MASK` This behavior is used internally, when the OMDrawingTool should be told to clean up as soon as it is safe.
`protected boolean` | `DEBUG` Debug flag turned on when drawingtool debug flag enabled.
`static int` | `DEFAULT_BEHAVIOR_MASK` A convenience value that tells the OMDrawingTool to show the GUI if it is a tool, or to only display the popup with the ctrl key or right mouse button if it isn't.
`protected OMDrawingToolMouseMode` | `dtmm` The MouseMode used for the drawing tool.
`protected MapMouseMode` | `formerMouseMode` A placeholder for the last mouse mode active before the drawing tool took over.
`protected GraphicAttributes` | `graphicAttributes` A GraphicAttributes object that describes the current coloring parameters for the current graphic.
`static int` | `GUI_VIA_POPUP_BEHAVIOR_MASK` A behavior mask to add a menu item to the popup that will allow the GUI to appear.
`protected InformationDelegator` | `informationDelegator` A handle to the InformationDelegator to use for status messages.
`protected java.util.Hashtable` | `loaders` The objects that know how to create a EditableOMGraphic for a particular class name or OMGraphic.
`static java.lang.String` | `LoadersProperty` Used for property change notifications.
`protected MouseDelegator` | `mouseDelegator` The MouseDelegator to use to get mouse events directed to the DrawingTool.
`static int` | `PASSIVE_MOUSE_EVENT_BEHAVIOR_MASK` Set the flag for the behavior that will tell the OMDrawingTool to *NOT* add the OMDrawingToolMouseMode to the MouseDelegator as the active mouse mode when activated.
`protected java.util.Vector` | `possibleEditableClasses` A Vector of Classes that can be handled by the OMDrawingTool.
`protected Projection` | `projection` The current projection.
`static int` | `QUICK_CHANGE_BEHAVIOR_MASK` A convenience value that tells the OMDrawingTool to not show the GUI, but show the popup with the alt key, and the popup has the ability to delete the OMGraphic.
`protected java.util.Vector` | `rawLoaders` The ordered list of EditToolLoaders, for notification.
`protected DrawingToolRequestor` | `requestor` The component to notify when the drawing tool is finished.
`protected boolean` | `resetGUIWhenDeactivated` Flag to tell tool to reset the GUI when it is deactivated.
`protected SelectionSupport` | `selectionSupport` A support object to handle telling listeners that the drawing tool is in the process of editing an object, hence making it selected.
`static int` | `SHOW_GUI_BEHAVIOR_MASK` A behavior mask to show the GUI for the OMDrawingTool.
`static int` | `USE_POPUP_BEHAVIOR_MASK` Flag to tell the OMDrawingTool to display a popup when gesturing/modifications appear to be over.
`protected boolean` | `visibleWhenInactive` Tell the drawing tool to be invisible when it is inactive.
`static java.lang.String` | `VisibleWhenInactiveProperty` The property, visibleWhenIactive, to set to false if you want that behavior.

Fields inherited from class com.bbn.openmap.gui.OMToolComponent
`c, defaultKey, gridbag, key, useAsTool, UseAsToolProperty`

Fields inherited from class com.bbn.openmap.gui.OMComponentPanel
`beanContextChildSupport, propertyPrefix, windowSupport`

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`OMDrawingTool()` Create a OpenMap Drawing Tool.

Method Summary
`protected void` | `activate()` Turn the OMDrawingTool on, attaching it to the MouseDelegator or the canvas component it is assigned to.
`protected void` | `activate(boolean completeHookup)` Turn the OMDrawingTool on with the caveaut that the OMDrawingTool may be active already, and that a complete hookup may not be needed.
`void` | `addLoader(EditToolLoader loader)` Add an EditToolLoader to the Hashtable of loaders that the OMDrawingTool can use to create/modify OMGraphics.
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` Make sure that new property change listeners receive a current list of edit tool loaders.
`void` | `addSelectionListener(SelectionListener list)`
`boolean` | `canEdit(java.lang.Class omgc)` Return true if the OMDrawingTool can edit the OMGraphic.
`void` | `clearSelectionListeners()`
`OMGraphic` | `create(java.lang.String classname, DrawingToolRequestor requestor)` Create a new OMGraphic, encased in a new EditableOMGraphic that can modify it.
`OMGraphic` | `create(java.lang.String classname, GraphicAttributes ga, DrawingToolRequestor requestor)` Create a new OMGraphic, encased in a new EditableOMGraphic that can modify it.
`OMGraphic` | `create(java.lang.String classname, GraphicAttributes ga, DrawingToolRequestor requestor, boolean showGUI)` Create a new OMGraphic, encased in a new EditableOMGraphic that can modify it.
`protected OMDrawingToolMouseMode` | `createMouseMode()` Create the mouse mode used with the drawing tool.
`javax.swing.JPopupMenu` | `createPopupMenu()`
`void` | `deactivate()` Turn the drawing tool off, disconnecting it from the MouseDelegator or canvas component, and removing the palette.
`void` | `deactivate(int actionToDoWithOMGraphic)` Turn the drawing tool off, disconnecting it from the MouseDelegator or canvas component, and removing the palette.
`void` | `deselect(OMGraphic omg)`
`protected boolean` | `doPopup(int x, int y, java.util.List additionalOptions)`
`OMGraphic` | `edit(EditableOMGraphic eomg, DrawingToolRequestor requestor)` Given an EditableOMGraphic, use it to make modifications, and then call requestor.drawingComplete().
`OMGraphic` | `edit(EditableOMGraphic eomg, DrawingToolRequestor requestor, java.awt.event.MouseEvent e)` A slightly different edit method, where the EditableOMGraphic is put directly into edit mode, and the mouse events immediately start making modifications to the OMGraphic.
`OMGraphic` | `edit(OMGraphic g, DrawingToolRequestor requestor)` Given an OMGraphic, wrap it in the applicable EditableOMGraphic, allow the user to make modifications, and then call requestor.drawingComplete().
`OMGraphic` | `edit(OMGraphic g, DrawingToolRequestor requestor, boolean showGUI)` Given an OMGraphic, wrap it in the applicable EditableOMGraphic, allow the user to make modifications, and then call requestor.drawingComplete().
`OMGraphic` | `edit(OMGraphic g, DrawingToolRequestor requestor, java.awt.event.MouseEvent e)` A slightly different edit method, where the EditableOMGraphic is put directly into edit mode, and the mouse events immediately start making modifications to the OMGraphic.
`void` | `eomgChanged(EOMGEvent event)` This is a EOMGListener method, and gets called by the EditableOMGraphic when something changes.
`void` | `findAndInit(java.lang.Object someObj)` Called from the findAndInit(Iterator) method, when objects are added to the MapHandler.
`void` | `findAndUndo(java.lang.Object someObj)` Called by childrenRemoved, it provides a good method for handling any object you may want to take away from the OMDrawingTool.
`protected void` | `generateOMGraphic(OMGraphic g)` If the projection is not null, generate the OMGraphic.
`GraphicAttributes` | `getAttributes()` Get the DrawingAttributes driving the parameters of the current graphic.
`int` | `getBehaviorMask()` A integer that is looked at internally, bitwise, to determine different behaviors.
`javax.swing.JComponent` | `getCanvas()` Get the JComponent this thing is directing events for.
`EditableOMGraphic` | `getCurrentEditable()` Get the current EditableOMGraphic being used by the drawing tool.
`java.awt.Cursor` | `getCursor()`
`EditableOMGraphic` | `getEditableGraphic(OMGraphic g)` Given an OMGraphic, check the EditToolLoaders and wrap it in an EditableOMGraphic.
`EditableOMGraphic` | `getEditableGraphic(java.lang.String classname, GraphicAttributes ga)` Given a classname, check the EditToolLoaders and create the OMGraphic it represents wrapped in an EditableOMGraphic.
`java.awt.Component` | `getGUI()` Get the GUI that dictates what the OMDrawingTool has control over.
`InformationDelegator` | `getInformationDelegator()`
`EditToolLoader[]` | `getLoaders()` Get all the loaders the OMDrawingTool has access to.
`MouseDelegator` | `getMouseDelegator()` Get the MouseDelegator used to receive mouse events.
`OMDrawingToolMouseMode` | `getMouseMode()` If you want to run the drawing tool in passive mode, you'll need a handle on the mouseMode to feed events to.
`Projection` | `getProjection()` Get the current projection, if one has been provided.
`void` | `hidePalette()` Hide the OMDrawingTool palette.
`boolean` | `isActivated()` Convenience function to tell if the OMDrawingTool is currently working on an OMGraphic.
`boolean` | `isEditing(OMGraphic omg)` Returns true of the OMGraphic is being edited, or is on an EditableOMGraphicList being manipulated.
`boolean` | `isMask(int mask)` Return whether a mask value is set in the internal value.
`void` | `listenerPaint(java.awt.Graphics g)` PaintListener interface.
`static void` | `main(java.lang.String[] args)`
`void` | `notifyListener(OMGraphic graphic, OMAction action)` Notify the listener of an action to a graphic.
`void` | `projectionChanged(ProjectionEvent e)` ProjectionListener method.
`void` | `propertyChange(java.beans.PropertyChangeEvent pce)` PropertyChangeListener method.
`void` | `removeLoader(EditToolLoader loader)` Remove an EditToolLoader from the Hashtable of loaders that the OMDrawingTool can use to create/modify OMGraphics.
`void` | `removeSelectionListener(SelectionListener list)`
`void` | `resetBehaviorMask()` Set the behavior mask to the default.
`void` | `resetGUIWhenDeactivated(boolean value)`
`boolean` | `select(OMGraphic omg, DrawingToolRequestor req, java.awt.event.MouseEvent e)`
`void` | `setAttributes(GraphicAttributes da)` Set the GraphicAttributes object used to fill the OMGraphic java.awt.Graphics parameters.
`void` | `setBehaviorMask(int mask)` A integer that is looked at internally, bitwise, to determine different behaviors.
`void` | `setCanvas(javax.swing.JComponent can)` Set the JComponent this thing is directing events for.
`boolean` | `setCurrentEditable(EditableOMGraphic eomg)` Set the EditableOMGraphic being used, if it hasn't already been set.
`void` | `setCursor(java.awt.Cursor cursor)`
`void` | `setInformationDelegator(InformationDelegator id)`
`void` | `setLoaders(EditToolLoader[] etls)` Set the loaders that the OMDrawingTool has access to.
`int` | `setMask(int mask)` Set a particular mask bit in the internal value.
`void` | `setMouseDelegator(MouseDelegator md)` Set the MouseDelegator used to receive mouse events.
`void` | `setMouseMode(OMDrawingToolMouseMode adtmm)` If you need your OMDrawingToolMouseMode to do something a little different, you can substitude your subclass here.
`void` | `setProjection(Projection proj)` Set the current projection.
`void` | `setProperties(java.lang.String prefix, java.util.Properties props)` Sets the properties for the OMComponent.
`void` | `setRemarks(java.lang.String message)` Put the message in a display line that the OMDrawingTool is using.
`void` | `setUseAsTool(boolean value)` Set whether the Tool's face should be used.
`void` | `showInWindow()`
`void` | `showPalette()` Display the palette.
`int` | `unsetMask(int mask)` Unset a particular mask bit in the internal value.

Methods inherited from class com.bbn.openmap.gui.OMToolComponent
`add, createLayout, getFace, getGridBagConstraints, getKey, getProperties, getPropertyInfo, getUseAsTool, setKey`

Methods inherited from class com.bbn.openmap.gui.OMComponentPanel
`addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, fireVetoableChange, getBeanContext, getPropertyPrefix, getWindowSupport, removeVetoableChangeListener, setBeanContext, setProperties, setPropertyPrefix, setWindowSupport`

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container
`add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component
`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.beans.beancontext.BeanContextChild
`addPropertyChangeListener, removePropertyChangeListener`

Field Detail

### graphicAttributes

    protected GraphicAttributes graphicAttributes

  A GraphicAttributes object that describes the current coloring parameters for the current graphic.

### currentEditable

    protected EditableOMGraphic currentEditable

  The current graphic being modified.

### mouseDelegator

    protected MouseDelegator mouseDelegator

  The MouseDelegator to use to get mouse events directed to the DrawingTool.

### formerMouseMode

    protected MapMouseMode formerMouseMode

  A placeholder for the last mouse mode active before the drawing tool took over.

### canvas

    protected javax.swing.JComponent canvas

  The JComponent the drawing tool is servicing, usually the MapBean.

### loaders

    protected java.util.Hashtable loaders

  The objects that know how to create a EditableOMGraphic for a particular class name or OMGraphic.

### rawLoaders

    protected java.util.Vector rawLoaders

  The ordered list of EditToolLoaders, for notification. Preservers order, no duplicates.

### dtmm

    protected OMDrawingToolMouseMode dtmm

  The MouseMode used for the drawing tool.

### requestor

    protected DrawingToolRequestor requestor

  The component to notify when the drawing tool is finished.

### projection

    protected Projection projection

  The current projection.

### selectionSupport

    protected SelectionSupport selectionSupport

  A support object to handle telling listeners that the drawing tool is in the process of editing an object, hence making it selected.

### SHOW_GUI_BEHAVIOR_MASK

    public static final int SHOW_GUI_BEHAVIOR_MASK

  A behavior mask to show the GUI for the OMDrawingTool. Since the OMDrawingTool is a com.bbn.openmap.gui.Tool object, it will only appear on the tool panel if it has been added to it, and if it is being used as a tool.

  See Also:
    Constant Field Values

### GUI_VIA_POPUP_BEHAVIOR_MASK

    public static final int GUI_VIA_POPUP_BEHAVIOR_MASK

  A behavior mask to add a menu item to the popup that will allow the GUI to appear. If the OMDrawingTool is not being used as a tool and this is set along with USE_POPUP_BEHAVIOR_MASK or ALT_POPUP_BEHAVIOR_MASK, then the OMDrawingTool will appear in a window when the Change Appearance option is selected in the popup menu.

  See Also:
    Constant Field Values

### USE_POPUP_BEHAVIOR_MASK

    public static final int USE_POPUP_BEHAVIOR_MASK

  Flag to tell the OMDrawingTool to display a popup when gesturing/modifications appear to be over. Was the default action of the tool, but was moved to only happening when the ctrl key or right mouse button is pressed. You can force the old behavior by setting this.

  See Also:
    Constant Field Values

### ALT_POPUP_BEHAVIOR_MASK

    public static final int ALT_POPUP_BEHAVIOR_MASK

  Allow a GUI popup to appear over the map when the gesturing/modifications appear to be over, and when the ctrl key or right mouse button is pressed.

  See Also:
    Constant Field Values

### PASSIVE_MOUSE_EVENT_BEHAVIOR_MASK

    public static final int PASSIVE_MOUSE_EVENT_BEHAVIOR_MASK

  Set the flag for the behavior that will tell the OMDrawingTool to *NOT* add the OMDrawingToolMouseMode to the MouseDelegator as the active mouse mode when activated. Should be called before create/edit is called, and then you have to make sure that you provide MouseEvents to the OMDrawingToolMouseMode or EditableOMGraphic in order to modify the OMGraphic. Don't call this if you have already started using the tool, the tool won't do anything if anything else is currently being modified.

  See Also:
    Constant Field Values

### DEACTIVATE_ASAP_BEHAVIOR_MASK

    public static final int DEACTIVATE_ASAP_BEHAVIOR_MASK

  This behavior is used internally, when the OMDrawingTool should be told to clean up as soon as it is safe.

  See Also:
    Constant Field Values

### DEFAULT_BEHAVIOR_MASK

    public static final int DEFAULT_BEHAVIOR_MASK

  A convenience value that tells the OMDrawingTool to show the GUI if it is a tool, or to only display the popup with the ctrl key or right mouse button if it isn't. A combination of SHOW_GUI, GUI_VIA_POPUP and ALT_POPUP.

  See Also:
    Constant Field Values

### QUICK_CHANGE_BEHAVIOR_MASK

    public static final int QUICK_CHANGE_BEHAVIOR_MASK

  A convenience value that tells the OMDrawingTool to not show the GUI, but show the popup with the alt key, and the popup has the ability to delete the OMGraphic. A combination of GUI_VIA_POPUP and ALT_POPUP.

  See Also:
    Constant Field Values

### behaviorMask

    protected int behaviorMask

  A integer that is looked at, bitwise, to determine different behaviors.

### LoadersProperty

    public static final java.lang.String LoadersProperty

  Used for property change notifications.

  See Also:
    Constant Field Values

### DEBUG

    protected boolean DEBUG

  Debug flag turned on when drawingtool debug flag enabled.

### informationDelegator

    protected InformationDelegator informationDelegator

  A handle to the InformationDelegator to use for status messages.

### possibleEditableClasses

    protected java.util.Vector possibleEditableClasses

  A Vector of Classes that can be handled by the OMDrawingTool. Constructed the first time canEdit() is called after an EditToolLoader is added or removed.

### activated

    protected boolean activated

  Just a helper flag to reduce work caused by unnecessary deactivate calls. Set internally in activate() and deactivate().

### visibleWhenInactive

    protected boolean visibleWhenInactive

  Tell the drawing tool to be invisible when it is inactive. True by default.

### VisibleWhenInactiveProperty

    public static final java.lang.String VisibleWhenInactiveProperty

  The property, visibleWhenIactive, to set to false if you want that behavior.

  See Also:
    Constant Field Values

### BehaviorProperty

    public static final java.lang.String BehaviorProperty

  The property list defining behavior mask values that should be set.

  See Also:
    Constant Field Values

### resetGUIWhenDeactivated

    protected boolean resetGUIWhenDeactivated

  Flag to tell tool to reset the GUI when it is deactivated. The only time you would want this to be false (true is default) is when you are creating many objects of the same type, and don't want the gui to keep going back and forth between the default and special settings. Usually set to in the drawingComplete method of an EditorTool. Reset to true when showPalette is called.

Constructor Detail

### OMDrawingTool

    public OMDrawingTool()

  Create a OpenMap Drawing Tool.

Method Detail

### createMouseMode

    protected OMDrawingToolMouseMode createMouseMode()

  Create the mouse mode used with the drawing tool. Called in the default empty constructor, returns a OMDrawingToolMouseMode by default.

### create

    public OMGraphic create(java.lang.String classname,
                            DrawingToolRequestor requestor)

  Create a new OMGraphic, encased in a new EditableOMGraphic that can modify it. If a loader cannot be found that can handle a graphic with the given classname, this method will return a null object. If you aren't sure of the behavior mask set in the tool, and you want a particular behavior, set it before calling this method.

  Specified by:
    `create` in interface `DrawingTool`
  Parameters:
    `classname` - the classname of the graphic to create.
    `requestor` - the Component that is requesting the OMGraphic. The requestor gets notified when the user is finished with the DrawingTool and the graphic is ready.
  Returns:
    OMGraphic of the classname given, null if the DrawingTool can't create it.

### create

    public OMGraphic create(java.lang.String classname,
                            GraphicAttributes ga,
                            DrawingToolRequestor requestor)

  Create a new OMGraphic, encased in a new EditableOMGraphic that can modify it. If a loader cannot be found that can handle a graphic with the given classname, this method will return a null object. If you aren't sure of the behavior mask set in the tool, and you want a particular behavior, set it before calling this method.

  Specified by:
    `create` in interface `DrawingTool`
  Parameters:
    `classname` - the classname of the graphic to create.
    `ga` - GraphicAttributes object that contains more information about the type of line to be created.
    `requestor` - the Component that is requesting the OMGraphic. The requestor gets notified when the user is finished with the DrawingTool and the graphic is ready.
  Returns:
    OMGraphic of the classname given, null if the DrawingTool can't create it.

### create

    public OMGraphic create(java.lang.String classname,
                            GraphicAttributes ga,
                            DrawingToolRequestor requestor,
                            boolean showGUI)

  Create a new OMGraphic, encased in a new EditableOMGraphic that can modify it. If a loader cannot be found that can handle a graphic with the given classname, this method will return a null object. This method gives you the option of supressing the GUI for the EditableOMGraphic. If you aren't sure of the behavior mask set in the tool, and you want a particular behavior, set it before calling this method.

  Specified by:
    `create` in interface `DrawingTool`
  Parameters:
    `classname` - the classname of the graphic to create.
    `ga` - GraphicAttributes object that contains more information about the type of line to be created.
    `requestor` - the Component that is requesting the OMGraphic. The requestor gets notified when the user is finished with the DrawingTool and the graphic is ready.
    `showGUI` - set to true (default) if a GUI showing attribute controls should be displayed. The behaviorMask will be adjusted accordingly.
  Returns:
    OMGraphic of the classname given, null if the DrawingTool can't create it.

### edit

    public OMGraphic edit(OMGraphic g,
                          DrawingToolRequestor requestor)

  Given an OMGraphic, wrap it in the applicable EditableOMGraphic, allow the user to make modifications, and then call requestor.drawingComplete(). If you aren't sure of the behavior mask set in the tool, and you want a particular behavior, set it before calling this method.

  Specified by:
    `edit` in interface `DrawingTool`
  Parameters:
    `g` - OMGraphic to modify
    `requestor` - the Component that is requesting the OMGraphic. The requestor gets notified when the user is finished with the DrawingTool and the graphic is ready.
  Returns:
    OMGraphic being modified, null if the OMDrawingTool can't figure out what to use for the modifications.

### edit

    public OMGraphic edit(OMGraphic g,
                          DrawingToolRequestor requestor,
                          boolean showGUI)

  Given an OMGraphic, wrap it in the applicable EditableOMGraphic, allow the user to make modifications, and then call requestor.drawingComplete(). This methods gives you the option to supress the GUI from the EditableOMGraphic. If you aren't sure of the behavior mask set in the tool, and you want a particular behavior, set it before calling this method.

  Specified by:
    `edit` in interface `DrawingTool`
  Parameters:
    `g` - OMGraphic to modify
    `requestor` - the Component that is requesting the OMGraphic. The requestor gets notified when the user is finished with the DrawingTool and the graphic is ready.
    `showGUI` - set to true (default) if a GUI showing attribute controls should be displayed. The behaviorMask will be adjusted accordingly.
  Returns:
    OMGraphic being modified, null if the OMDrawingTool can't figure out what to use for the modifications.

### edit

    public OMGraphic edit(EditableOMGraphic eomg,
                          DrawingToolRequestor requestor)

  Given an EditableOMGraphic, use it to make modifications, and then call requestor.drawingComplete(). The requestor is responsible for setting up the correct initial state of the EditableOMGraphic. The requestor will be given the action mask that is set in the EditableOMGraphic at this point, if no other external modifications to it are made. If you aren't sure of the behavior mask set in the tool, and you want a particular behavior, set it before calling this method. This method is called by other edit methods.

  Specified by:
    `edit` in interface `DrawingTool`
  Parameters:
    `eomg` - OMGraphic to modify
    `requestor` - the Component that is requesting the OMGraphic. The requestor gets notified when the user is finished with the DrawingTool and the graphic is ready.
  Returns:
    OMGraphic being modified contained within the EditableOMGraphic.

### edit

    public OMGraphic edit(OMGraphic g,
                          DrawingToolRequestor requestor,
                          java.awt.event.MouseEvent e)

  A slightly different edit method, where the EditableOMGraphic is put directly into edit mode, and the mouse events immediately start making modifications to the OMGraphic. The palette is not shown, but if you set the GUI_VIA_POPUP_BEHAVIOR_MASK on the OMDrawingTool, the option to bring up the drawing tool palette will be presented to the user. If you aren't sure of the behavior mask set in the tool, and you want a particular behavior, set it before calling this method.

  Specified by:
    `edit` in interface `DrawingTool`
  Parameters:
    `g` - OMGraphic to modify
    `requestor` - the Component that is requesting the OMGraphic. The requestor gets notified when the user is finished with the DrawingTool and the graphic is ready.
    `e` - MouseEvent to use to start editing with.
  Returns:
    OMGraphic being modified.

### edit

    public OMGraphic edit(EditableOMGraphic eomg,
                          DrawingToolRequestor requestor,
                          java.awt.event.MouseEvent e)

  A slightly different edit method, where the EditableOMGraphic is put directly into edit mode, and the mouse events immediately start making modifications to the OMGraphic. If you aren't sure of the behavior mask set in the tool, and you want a particular behavior, set it before calling this method.

  Specified by:
    `edit` in interface `DrawingTool`
  Parameters:
    `eomg` - EditableOMGraphic to modify
    `requestor` - the Component that is requesting the OMGraphic. The requestor gets notified when the user is finished with the DrawingTool and the graphic is ready.
    `e` - MouseEvent to use to start editing with.
  Returns:
    OMGraphic being modified contained within the EditableOMGraphic.

### isEditing

    public boolean isEditing(OMGraphic omg)

  Returns true of the OMGraphic is being edited, or is on an EditableOMGraphicList being manipulated.

### deselect

    public void deselect(OMGraphic omg)

### select

    public boolean select(OMGraphic omg,
                          DrawingToolRequestor req,
                          java.awt.event.MouseEvent e)

  Returns:
    true if the OMDrawingTool is editing where it wasn't before.

### getEditableGraphic

    public EditableOMGraphic getEditableGraphic(java.lang.String classname,
                                                GraphicAttributes ga)

  Given a classname, check the EditToolLoaders and create the OMGraphic it represents wrapped in an EditableOMGraphic.

  Parameters:
    `classname` - the classname of an OMGraphic to create.
    `ga` - GraphicAttributes needed to initialize the OMGraphic.
  Returns:
    EdtiableOMGraphic, or null if none of the loaders can figure out what to make.

### getEditableGraphic

    public EditableOMGraphic getEditableGraphic(OMGraphic g)

  Given an OMGraphic, check the EditToolLoaders and wrap it in an EditableOMGraphic.

  Parameters:
    `g` - the OMGraphic being wrapped.
  Returns:
    EdtiableOMGraphic, or null if none of the loaders can figure out what to make.

### canEdit

    public boolean canEdit(java.lang.Class omgc)

  Return true if the OMDrawingTool can edit the OMGraphic. Meant to be a low-cost check, with a minimal allocation of memory.

  Specified by:
    `canEdit` in interface `DrawingTool`

### setCurrentEditable

    public boolean setCurrentEditable(EditableOMGraphic eomg)

  Set the EditableOMGraphic being used, if it hasn't already been set. You can set it to null all the time. This method triggers the selection listeners.

### getCurrentEditable

    public EditableOMGraphic getCurrentEditable()

  Get the current EditableOMGraphic being used by the drawing tool. Could be null if nothing valid is happening, i.e. if the OMDrawingTool isn't actively editing something.

### setMouseMode

    public void setMouseMode(OMDrawingToolMouseMode adtmm)

  If you need your OMDrawingToolMouseMode to do something a little different, you can substitude your subclass here. Don't set this to null.

### getMouseMode

    public OMDrawingToolMouseMode getMouseMode()

  If you want to run the drawing tool in passive mode, you'll need a handle on the mouseMode to feed events to.

### addLoader

    public void addLoader(EditToolLoader loader)

  Add an EditToolLoader to the Hashtable of loaders that the OMDrawingTool can use to create/modify OMGraphics.

  Specified by:
    `addLoader` in interface `DrawingTool`

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

  Make sure that new property change listeners receive a current list of edit tool loaders.

### removeLoader

    public void removeLoader(EditToolLoader loader)

  Remove an EditToolLoader from the Hashtable of loaders that the OMDrawingTool can use to create/modify OMGraphics.

  Specified by:
    `removeLoader` in interface `DrawingTool`

### getLoaders

    public EditToolLoader[] getLoaders()

  Get all the loaders the OMDrawingTool has access to.

  Specified by:
    `getLoaders` in interface `DrawingTool`

### setLoaders

    public void setLoaders(EditToolLoader[] etls)

  Set the loaders that the OMDrawingTool has access to.

  Specified by:
    `setLoaders` in interface `DrawingTool`

### resetGUIWhenDeactivated

    public void resetGUIWhenDeactivated(boolean value)

### getGUI

    public java.awt.Component getGUI()

  Get the GUI that dictates what the OMDrawingTool has control over. This should include a section on controlling the GraphicAttributes, a section for controls provided by the current EditableOMGraphic for parameters unique to the EOMG, and any other controls that the tool may need. This method now returns this OMDrawingTool, but also serves as a reset method for the GUI to configure itself for the current EditableOMGraphic.

  To create different types of graphics, the OMDrawingToolMouseMode can be used, to attach to a layer to make it a drawing layer. The Loaders can be queried to get their trigger graphics so you can load the drawing tool with a particular loader to create a particular graphic. But here, we just deal with the actual controls over the particular graphic loaded and being modified.

  Returns:
    this.

### setInformationDelegator

    public void setInformationDelegator(InformationDelegator id)

### getInformationDelegator

    public InformationDelegator getInformationDelegator()

### setRemarks

    public void setRemarks(java.lang.String message)

  Put the message in a display line that the OMDrawingTool is using.

### isActivated

    public boolean isActivated()

  Convenience function to tell if the OMDrawingTool is currently working on an OMGraphic.

### activate

    protected void activate()

  Turn the OMDrawingTool on, attaching it to the MouseDelegator or the canvas component it is assigned to. Also brings up the drawing palette. Called automatically from the create/edit methods.

### activate

    protected void activate(boolean completeHookup)

  Turn the OMDrawingTool on with the caveaut that the OMDrawingTool may be active already, and that a complete hookup may not be needed. If a complete hookup is needed, this methid will attach the OMDrawingTool to the MouseDelegator or the canvas component it is assigned to and display the drawing palette. Called automatically from the create/edit methods for complete hookup. Partial hookup is called from select() methods.

### deactivate

    public void deactivate()

  Turn the drawing tool off, disconnecting it from the MouseDelegator or canvas component, and removing the palette. Called automatically from the mouse mode an GUI when appropriate, although you can force a cleanup if needed by calling this method. Calling this version of deactivate() just uses the action mask stored in the EditableOMGraphic, which knows if the graphic is being updated or created.

### deactivate

    public void deactivate(int actionToDoWithOMGraphic)

  Turn the drawing tool off, disconnecting it from the MouseDelegator or canvas component, and removing the palette. This version can called when you want to control what action is taken by the receiver.

  Parameters:
    `actionToDoWithOMGraphic` - a masked int from OMGraphicConstants that describes an OMAction to take on the current editable.
  See Also:
    `OMGraphicConstants`

### generateOMGraphic

    protected void generateOMGraphic(OMGraphic g)

  If the projection is not null, generate the OMGraphic.

### notifyListener

    public void notifyListener(OMGraphic graphic,
                               OMAction action)

  Notify the listener of an action to a graphic.

  Parameters:
    `graphic` - the graphic being created/modified
    `action` - the OMAction telling the listener what to do with the graphic.

### projectionChanged

    public void projectionChanged(ProjectionEvent e)

  ProjectionListener method. Helps if the currentEditable is set.

  Specified by:
    `projectionChanged` in interface `ProjectionListener`
  Parameters:
    `e` - ProjectionEvent

### setProjection

    public void setProjection(Projection proj)

  Set the current projection. Tells the currentEditable what it is too.

### getProjection

    public Projection getProjection()

  Get the current projection, if one has been provided. If one has not been provided, then the canvas is checked to see if it is a MapBean. If it is, then that projection is returned. If that doesn't work, it will finally return null.

### setAttributes

    public void setAttributes(GraphicAttributes da)

  Set the GraphicAttributes object used to fill the OMGraphic java.awt.Graphics parameters.

### getAttributes

    public GraphicAttributes getAttributes()

  Get the DrawingAttributes driving the parameters of the current graphic.

### listenerPaint

    public void listenerPaint(java.awt.Graphics g)

  PaintListener interface. We want to know when the canvas is repainted.

  Specified by:
    `listenerPaint` in interface `PaintListener`
  Parameters:
    `g` - the Graphics to draw into.

### setMouseDelegator

    public void setMouseDelegator(MouseDelegator md)

  Set the MouseDelegator used to receive mouse events.

### getMouseDelegator

    public MouseDelegator getMouseDelegator()

  Get the MouseDelegator used to receive mouse events.

### setCursor

    public void setCursor(java.awt.Cursor cursor)

### getCursor

    public java.awt.Cursor getCursor()

### setCanvas

    public void setCanvas(javax.swing.JComponent can)

  Set the JComponent this thing is directing events for. If the MouseDelegator is not set, the Canvas is contacted to get MouseEvents from. Within the BeanContext, the OMDrawingTool looks for MapBeans to use as canvases.

### getCanvas

    public javax.swing.JComponent getCanvas()

  Get the JComponent this thing is directing events for.

### setUseAsTool

    public void setUseAsTool(boolean value)

  Set whether the Tool's face should be used. The subclasses to this class should either remove all components from its face, or make its face invisible if this is set to false.

  Overrides:
    `setUseAsTool` in class `OMToolComponent`

### findAndInit

    public void findAndInit(java.lang.Object someObj)

  Called from the findAndInit(Iterator) method, when objects are added to the MapHandler. so the OMDrawingTool can hook up with what it needs. An InformationDelegator is used to provide map coordinates of the mouse movements. The MouseDelegator is used to intercept MouseEvents when the OMDrawingTool is activated. The MapBean is used to get mouse events if the MouseDelegator isn't loaded, and is also used to help out with smooth repaints() in general. EditToolLoaders are looked for to load into the OMDrawingTool to handler different graphic requests.

  Specified by:
    `findAndInit` in interface `LightMapHandlerChild`
  Overrides:
    `findAndInit` in class `OMComponentPanel`

### findAndUndo

    public void findAndUndo(java.lang.Object someObj)

  Called by childrenRemoved, it provides a good method for handling any object you may want to take away from the OMDrawingTool. The OMDrawingTool figures out if it should disconnect itseld from the object.

  Specified by:
    `findAndUndo` in interface `LightMapHandlerChild`
  Overrides:
    `findAndUndo` in class `OMComponentPanel`

### showPalette

    public void showPalette()

  Display the palette.

### hidePalette

    public void hidePalette()

  Hide the OMDrawingTool palette.

### showInWindow

    public void showInWindow()

### setBehaviorMask

    public void setBehaviorMask(int mask)

  A integer that is looked at internally, bitwise, to determine different behaviors. If you care about specific behavior of the DrawingTool, you should set this to what you want to make sure the tool acts the way you want.

  Specified by:
    `setBehaviorMask` in interface `DrawingTool`

### getBehaviorMask

    public int getBehaviorMask()

  A integer that is looked at internally, bitwise, to determine different behaviors.

  Specified by:
    `getBehaviorMask` in interface `DrawingTool`

### resetBehaviorMask

    public void resetBehaviorMask()

  Set the behavior mask to the default.

### setMask

    public int setMask(int mask)

  Set a particular mask bit in the internal value.

  Parameters:
    `mask` - an OMDrawingTool behavior mask.
  Returns:
    the changed integer value.

### unsetMask

    public int unsetMask(int mask)

  Unset a particular mask bit in the internal value.

  Parameters:
    `mask` - an OMDrawingTool behavior mask.
  Returns:
    the changed integer value.

### isMask

    public boolean isMask(int mask)

  Return whether a mask value is set in the internal value.

  Parameters:
    `mask` - an OMDrawingTool behavior mask.
  Returns:
    whether the value bit is set on the internal value.

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent pce)

  PropertyChangeListener method. If DrawingAttribute parameters change, this method is called, and we update the OMGraphic parameters.

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`

### eomgChanged

    public void eomgChanged(EOMGEvent event)

  This is a EOMGListener method, and gets called by the EditableOMGraphic when something changes.

  Specified by:
    `eomgChanged` in interface `EOMGListener`

### doPopup

    protected boolean doPopup(int x,
                              int y,
                              java.util.List additionalOptions)

### createPopupMenu

    public javax.swing.JPopupMenu createPopupMenu()

### addSelectionListener

    public void addSelectionListener(SelectionListener list)

  Specified by:
    `addSelectionListener` in interface `SelectionProvider`

### removeSelectionListener

    public void removeSelectionListener(SelectionListener list)

  Specified by:
    `removeSelectionListener` in interface `SelectionProvider`

### clearSelectionListeners

    public void clearSelectionListeners()

  Specified by:
    `clearSelectionListeners` in interface `SelectionProvider`

### main

    public static void main(java.lang.String[] args)

### setProperties

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

  Description copied from class: `OMComponentPanel`
  Sets the properties for the OMComponent.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Overrides:
    `setProperties` in class `OMToolComponent`

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