com.bbn.openmap.layer.editor
Class EditorLayer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.bbn.openmap.Layer
                  extended by com.bbn.openmap.layer.OMGraphicHandlerLayer
                      extended by com.bbn.openmap.layer.DrawingToolLayer
                          extended by com.bbn.openmap.layer.editor.EditorLayer
All Implemented Interfaces:
ProjectionListener, Tool, GestureResponsePolicy, OMGraphicHandler, ProjectionPainter, PropertyConsumer, DrawingToolRequestor, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener
Direct Known Subclasses:
GeoCrossDemoLayer, GeoIntersectionLayer

public class EditorLayer
extends DrawingToolLayer
implements Tool

The EditorLayer is a layer that provides a specific set of tools to modify a set of OMGraphics that represent specific types of objects. It has an EditorTool that controls what the interface looks like, and controls reception of the mouse events to direct their interpretation usefully. The EditorLayer can use the following property:

 
 
   # could be com.bbn.openmap.layer.editor.DrawingEditorTool, for instance
   editorLayer.editor=EditorTool class
 
 
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  EditorTool editorTool
          The EditorTool controls the interface, and how OMGraphics are managed.
static java.lang.String EditorToolProperty
          The property to use of the EditorLayer doesn't really know what EditorTool it will have.
protected  EditorLayerMouseMode elmm
          The mouse mode used to direct mouse events to the editor.
protected  int orientation
           
 
Fields inherited from class com.bbn.openmap.layer.DrawingToolLayer
actions, box, dbfFactory, drawingAttributes, drawingTool, DTL_DEBUG, fileName, jcb, omGraphics, proxyMMM, SerializedURLNameProperty, showHints, ShowHintsProperty
 
Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, layerWorkerQueue, logger, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty
 
Fields inherited from class com.bbn.openmap.Layer
addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, coordTransform, DataPathPrefixProperty, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, localHackList, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, readyToPaint, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, TransformProperty, 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
EditorLayer()
           
 
Method Summary
protected  void creatingOMGraphic(OMGraphic newOMG)
          A hook to get a handle on a new OMGraphic that is being created for editing.
 void dispose()
          Overrides Layer.dispose(), makes sure the OMGraphicList is cleared.
 void drawingComplete(OMGraphic omg, OMAction action)
          DrawingToolRequestor method.
 void findAndInit(java.lang.Object someObj)
          Called by findAndInit(Iterator) so subclasses can find objects, too.
 void findAndUndo(java.lang.Object someObj)
          BeanContextMembershipListener method.
 EditorTool getEditorTool()
           
 java.awt.Container getFace()
          The tool's interface.
 java.lang.String getKey()
          The retrieval key for this tool.
 MapMouseInterpreter getMouseEventInterpreter()
          Get the interpreter used to field and interpret MouseEvents, thereby calling GestureResponsePolicy methods on this layer.
 EditorLayerMouseMode getMouseMode()
          Get and/or create the EditorLayerMouseMode that can be used specifically for this layer, used to capture the MapBean's MouseEvents when an EditorTool is invoked.
 java.lang.String[] getMouseModeIDsForEvents()
          This is the important method call that determines what MapMouseModes the interpreter for this layer responds to.
 int getOrientation()
          Set the orientation for the GUI of the Tool, SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.
 void setEditorTool(EditorTool editorTool)
           
 void setKey(java.lang.String aKey)
          Set the retrieval key for this tool.
 void setMouseModeIDsForEvents(java.lang.String[] modes)
          Use this method to set which mouse modes this layer responds to.
 void setName(java.lang.String name)
          Need to do this so the EditorLayerMouseMode will be recreated with the proper identification if the name of the layer changes.
 void setOrientation(int orientation)
          Set the orientation for the GUI of the Tool, SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Overrides the Layer setProperties method.
 void setVisible(boolean show)
          Part of a layer hack to notify the component listener when the component is hidden.
 
Methods inherited from class com.bbn.openmap.layer.DrawingToolLayer
doIt, edit, getActions, getDbfFactory, getDrawingAttributes, getDrawingTool, getFileName, getGUI, getInfoText, getOMGraphics, getProperties, getPropertyInfo, getProxyMouseMode, getShowHints, getToolTipTextFor, isHighlightable, isSelectable, load, prepare, releaseProxyMouseMode, saveOMGraphics, select, setDbfFactory, setDrawingAttributes, setDrawingTool, setFileName, setOMGraphics, setProxyMouseMode, setShowHints, shouldEdit
 
Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
actionPerformed, canSetList, copy, createLayerWorker, cut, deselect, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getDefaultSettingsPanel, getFilter, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMapMouseListener, getProjectionChangePolicy, getRedrawButton, getRenderPolicy, getSelected, getSettingsButton, getTransparency, getTransparencyAdjustmentPanel, highlight, isCancelled, isInterruptable, isWorking, leftClick, mouseOver, paint, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setProjectionChangePolicy, setRenderPolicy, setTransparency, supportsSQL, unhighlight, workerComplete
 
Methods inherited from class com.bbn.openmap.Layer
addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, disconnectFromBeanContext, finalize, findAndInit, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getCoordTransform, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setCoordTransform, setIcon, setLayerProperties, setMaxScale, setMinScale, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setReadyToPaint, setRemovable, setWindowSupport, showPalette
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bbn.openmap.tools.drawing.DrawingToolRequestor
getName
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

editorTool

protected EditorTool editorTool
The EditorTool controls the interface, and how OMGraphics are managed.


elmm

protected EditorLayerMouseMode elmm
The mouse mode used to direct mouse events to the editor.


EditorToolProperty

public static final java.lang.String EditorToolProperty
The property to use of the EditorLayer doesn't really know what EditorTool it will have. This property is used in setProperties if the EditorTool isn't already set. If you extend the EditorLayer and specifically set the EditorTool in the constructor, this property will be ignored.

See Also:
Constant Field Values

orientation

protected int orientation
Constructor Detail

EditorLayer

public EditorLayer()
Method Detail

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMGraphicHandlerLayer
Overrides the Layer setProperties method. Also calls Layer's version. If the ProjectionChangePolicy and RenderPolicy objects are set programmatically, are PropertyConsumers and the .class property is not set, they will still have access to properties if this method is called. Their property prefix will be scoped as if the OMGraphicHandlerLayer had them created, with their prefix being prefix + . + PropertyChangePolicyProperty and prefix + . + RenderPolicyProperty. If the .class property is set, then a new policy object will be created and replace the one set before this method is called.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class DrawingToolLayer
Parameters:
prefix - the token to prefix the property names
props - the Properties object

getMouseMode

public EditorLayerMouseMode getMouseMode()
Get and/or create the EditorLayerMouseMode that can be used specifically for this layer, used to capture the MapBean's MouseEvents when an EditorTool is invoked. The EditorLayerMouseMode is invisible, meaning it won't show up in standard OpenMap GUI widgets as a viable MouseMode. It is expected that the EditorTool will compensate for displaying what is going on.

If the EditorLayerMouseMode isn't set programmatically, this method will create one with this layer's name as the mouse mode ID. If the layer's name hasn't been set, a temporary mouse mode will be returned, but with a somewhat random name that may not really work as expected. Once the layer's name gets set, however, a good, usable mouse mode will get picked up and used.


setName

public void setName(java.lang.String name)
Need to do this so the EditorLayerMouseMode will be recreated with the proper identification if the name of the layer changes.

Overrides:
setName in class Layer

drawingComplete

public void drawingComplete(OMGraphic omg,
                            OMAction action)
DrawingToolRequestor method. It's actually pretty important to call EditorTool.drawingComplete() from here, too, if you create a subclass to EditorLayer. The EditorTool needs to know this to reset the drawing tool mouse mode, to get ready for another new OMGraphic if necessary.

Specified by:
drawingComplete in interface DrawingToolRequestor
Overrides:
drawingComplete in class DrawingToolLayer

findAndInit

public void findAndInit(java.lang.Object someObj)
Called by findAndInit(Iterator) so subclasses can find objects, too.

Overrides:
findAndInit in class DrawingToolLayer

findAndUndo

public void findAndUndo(java.lang.Object someObj)
Description copied from class: DrawingToolLayer
BeanContextMembershipListener method. Called when a new object is removed from the BeanContext of this object.

Overrides:
findAndUndo in class DrawingToolLayer

dispose

public void dispose()
Description copied from class: OMGraphicHandlerLayer
Overrides Layer.dispose(), makes sure the OMGraphicList is cleared.

Overrides:
dispose in class OMGraphicHandlerLayer

setMouseModeIDsForEvents

public void setMouseModeIDsForEvents(java.lang.String[] modes)
Description copied from class: OMGraphicHandlerLayer
Use this method to set which mouse modes this layer responds to. The array should contain the mouse mode IDs.

Overrides:
setMouseModeIDsForEvents in class OMGraphicHandlerLayer

getMouseModeIDsForEvents

public java.lang.String[] getMouseModeIDsForEvents()
Description copied from class: OMGraphicHandlerLayer
This is the important method call that determines what MapMouseModes the interpreter for this layer responds to. The MapMouseInterpreter calls this so it can respond to MouseDelegator queries. You can programmatically call setMouseModeIDsForEvents with the mode IDs to set these values, or set the mouseModes property for this layer set to a space-separated list of mode IDs.

Overrides:
getMouseModeIDsForEvents in class OMGraphicHandlerLayer

getMouseEventInterpreter

public MapMouseInterpreter getMouseEventInterpreter()
Get the interpreter used to field and interpret MouseEvents, thereby calling GestureResponsePolicy methods on this layer. It returns whatever has been set as the interpreter, which could be null.

Overrides:
getMouseEventInterpreter in class OMGraphicHandlerLayer

getEditorTool

public EditorTool getEditorTool()

setEditorTool

public void setEditorTool(EditorTool editorTool)

setVisible

public void setVisible(boolean show)
Part of a layer hack to notify the component listener when the component is hidden. These components don't receive the ComponentHidden notification. Remove when it works.

Overrides:
setVisible in class Layer

getFace

public java.awt.Container getFace()
The tool's interface. This is added to the tool bar.

Specified by:
getFace in interface Tool
Returns:
String The key for this tool.

getKey

public java.lang.String getKey()
The retrieval key for this tool. We use the property prefix for the key. If the property prefix is not set then the name is used, which may not be that unique.

Specified by:
getKey in interface Tool
Returns:
String The key for this tool.

setKey

public void setKey(java.lang.String aKey)
Set the retrieval key for this tool. This call sets the key used for the Tool interface method, which is generally the property prefix used for this layer. Do not use this lightly, since the ToolPanel may be expecting to find a key that is reflected in the openmap.properties file.

Specified by:
setKey in interface Tool
Parameters:
aKey - The key for this tool.

getOrientation

public int getOrientation()
Description copied from interface: Tool
Set the orientation for the GUI of the Tool, SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.

Specified by:
getOrientation in interface Tool
Returns:
orientation that is set on tool

setOrientation

public void setOrientation(int orientation)
Description copied from interface: Tool
Set the orientation for the GUI of the Tool, SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.

Specified by:
setOrientation in interface Tool
Parameters:
orientation - that should be set on tool.

creatingOMGraphic

protected void creatingOMGraphic(OMGraphic newOMG)
A hook to get a handle on a new OMGraphic that is being created for editing. The DrawingEditorTool calls this. NOOP here, but if you need a handle to the new OMGraphic just as it's being created, here it is.

Parameters:
newOMG -


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