com.bbn.openmap
Class BufferedLayerMapBean

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.bbn.openmap.MapBean
                  extended by com.bbn.openmap.BufferedMapBean
                      extended by com.bbn.openmap.BufferedLayerMapBean
All Implemented Interfaces:
CenterListener, LayerListener, PanListener, ProjectionListener, ZoomListener, SoloMapComponent, java.awt.event.ComponentListener, java.awt.event.ContainerListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener

public class BufferedLayerMapBean
extends BufferedMapBean

The BufferedLayerMapBean is a BufferedMapBean with an additional image buffer that holds Layers designated as background layers. The additional image buffer is a BufferedLayer that this MapBean manages, and all background layers are added to the BufferedLayer, which is automatically added to the bottom of the map. When layers are added to the MapBean via the setLayers() method, the Layer.getAddAsBackground() flag is checked, and if that is true for a layer, it is added to the BufferedLayer. The background layers do not receive mouse events.

It should be cautioned that the appearance of the map may not match the layer stack as it is delivered to the MapBean because of this flag. If, for example, layers 1 and 4 are marked as background layers, while layers 2 and 3 are not (in a 4 layer stack), then the map will show layers 2, 3, 1, 4, with layers 1 and 4 being displayed from the BufferedLayer. Something to think about when it comes to designing GUI elements.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.BufferedMapBean
BufferedMapBean.PanHelper
 
Nested classes/interfaces inherited from class com.bbn.openmap.MapBean
MapBean.RotationHelper
 
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  BufferedLayer bufferedLayer
           
protected  boolean DEBUG
           
 
Fields inherited from class com.bbn.openmap.BufferedMapBean
bufferDirty, drawingBuffer, panningTransform
 
Fields inherited from class com.bbn.openmap.MapBean
addedLayers, background, BackgroundProperty, currentLayers, CursorProperty, DEFAULT_BACKGROUND_COLOR, DEFAULT_CENTER_LAT, DEFAULT_CENTER_LON, DEFAULT_HEIGHT, DEFAULT_SCALE, DEFAULT_WIDTH, doContainerChange, layerRemovalDelayed, LayersProperty, minHeight, minWidth, painters, projection, projectionFactory, ProjectionProperty, projectionSupport, ProjectionVetoedProperty, removedLayers, repaintPolicy, rotationAngle, rotHelper, suppressCopyright, title, version
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BufferedLayerMapBean()
          Construct a MapBean.
BufferedLayerMapBean(boolean useThreadedNotification)
           
 
Method Summary
protected  void changeLayers(java.awt.event.ContainerEvent e)
          ContainerListener Interface method.
 void dispose()
          Call when getting rid of the MapBean, it releases pointers to all listeners and kills the ProjectionSupport thread.
 BufferedLayer getBufferedLayer()
           
 void repaint(Layer layer)
          In an effort to limit map flashing, the BufferedLayerMapBean consults the BufferedLayer to check that all background layers are ready to be painted after a projection change, before forwarding on all repaint requests.
 void setBackgroundColor(java.awt.Color color)
          Set the background color of the map.
 void setBckgrnd(java.awt.Paint paint)
          Set the background of the map.
 void setBufferedLayer(BufferedLayer bl)
           
 void setLayers(LayerEvent evt)
          LayerListener interface method.
 void setMapBeanRepaintPolicy(MapBeanRepaintPolicy mbrp)
          Set the MapBeanRepaintPolicy used by the MapBean.
 
Methods inherited from class com.bbn.openmap.BufferedMapBean
componentResized, disposeDrawingBuffer, getPanningTransform, isBufferDirty, isBuffered, paintChildren, resetDrawingBuffer, setBufferDirty, setPanningTransform
 
Methods inherited from class com.bbn.openmap.MapBean
addImpl, addPaintListener, addProjectionListener, addPropertyChangeListener, center, componentAdded, componentHidden, componentMoved, componentRemoved, componentShown, debugmsg, drawProjectionBackground, fireProjectionChanged, getBackground, getBckgrnd, getCenter, getCoordinates, getCoordinates, getCopyrightMessage, getDoContainerChange, getGraphics, getInsets, getMapBeanRepaintPolicy, getMinimumSize, getNonRotatedLocation, getNonRotatedLocation, getNonRotatedShape, getProjection, getProjectionFactory, getRotatedProjection, getRotationAngle, getRotHelper, getScale, getUpdatedRotHelper, hideLayerPalettes, inverse, isLayerRemovalDelayed, paint, paintBorder, paintChildren, paintChildrenWithBorder, paintLayers, paintPainters, pan, projectionChanged, purgeAndNotifyRemovedLayers, removePaintListener, removeProjectionListener, setBackground, setCenter, setCenter, setCenter, setCursor, setDoContainerChange, setLayerRemovalDelayed, setLayout, setMinimumSize, setProjection, setProjectionFactory, setRotationAngle, setRotationAngle, setRotHelper, setScale, showLayerPalettes, toString, zoom
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getListeners, getLocation, getMaximumSize, 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, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bufferedLayer

protected BufferedLayer bufferedLayer

DEBUG

protected boolean DEBUG
Constructor Detail

BufferedLayerMapBean

public BufferedLayerMapBean()
Construct a MapBean.


BufferedLayerMapBean

public BufferedLayerMapBean(boolean useThreadedNotification)
Method Detail

setBackgroundColor

public void setBackgroundColor(java.awt.Color color)
Set the background color of the map. Actually sets the background color of the projection, and calls repaint().

Overrides:
setBackgroundColor in class MapBean
Parameters:
color - java.awt.Color.

setBckgrnd

public void setBckgrnd(java.awt.Paint paint)
Description copied from class: MapBean
Set the background of the map. If the background for this MapBean is not null, the background of the projection will be used.

Overrides:
setBckgrnd in class MapBean
Parameters:
paint - java.awt.Paint.

setBufferedLayer

public void setBufferedLayer(BufferedLayer bl)

getBufferedLayer

public BufferedLayer getBufferedLayer()

setMapBeanRepaintPolicy

public void setMapBeanRepaintPolicy(MapBeanRepaintPolicy mbrp)
Set the MapBeanRepaintPolicy used by the MapBean. This method is overridden in order to pass the policy on to the MapBean stored in the internal BufferedLayer.

Overrides:
setMapBeanRepaintPolicy in class MapBean

setLayers

public void setLayers(LayerEvent evt)
LayerListener interface method. A list of layers will be added, removed, or replaced based on on the type of LayerEvent.

Specified by:
setLayers in interface LayerListener
Overrides:
setLayers in class MapBean
Parameters:
evt - a LayerEvent

repaint

public void repaint(Layer layer)
In an effort to limit map flashing, the BufferedLayerMapBean consults the BufferedLayer to check that all background layers are ready to be painted after a projection change, before forwarding on all repaint requests.

Overrides:
repaint in class MapBean

changeLayers

protected void changeLayers(java.awt.event.ContainerEvent e)
ContainerListener Interface method. Should not be called directly. Part of the ContainerListener interface, and it's here to make the MapBean a good Container citizen.

Overrides:
changeLayers in class MapBean
Parameters:
e - ContainerEvent

dispose

public void dispose()
Call when getting rid of the MapBean, it releases pointers to all listeners and kills the ProjectionSupport thread.

Overrides:
dispose in class BufferedMapBean


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