com.bbn.openmap.gui
Class EmbeddedNavPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.bbn.openmap.gui.OMComponentPanel
                      extended by com.bbn.openmap.gui.EmbeddedNavPanel
All Implemented Interfaces:
ProjectionListener, LightMapHandlerChild, ProjectionStackTrigger, PropertyConsumer, SoloMapComponent, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class EmbeddedNavPanel
extends OMComponentPanel
implements ProjectionListener, ProjectionStackTrigger, SoloMapComponent

A panel with map navigation widgets.

Portions of the implementation were ripped from com.bbn.openmap.gui.NavigatePanel, com.bbn.openmap.gui.ProjectionStackTool, and com.bbn.openmap.gui.ZoomPanel.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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  java.awt.AlphaComposite ac
           
protected  javax.swing.ImageIcon backDimIcon
           
protected  javax.swing.ImageIcon backIcon
           
protected  javax.swing.JButton backProjectionButton
           
protected  int buttonSize
           
protected  CenterSupport centerDelegate
           
protected static java.awt.Color CONTROL_BACKGROUND
           
static int DEFAULT_BUTTON_SIZE
           
protected static float defaultPanDistance
           
protected static float defaultZoomFactor
           
protected  boolean fade
           
static java.lang.String FADE_ATTRIBUTES_PROPERTY
           
protected  DrawingAttributes fadeAttributes
           
protected  javax.swing.ImageIcon forwardDimIcon
           
protected  javax.swing.ImageIcon forwardIcon
           
protected  javax.swing.JButton forwardProjectionButton
           
static java.lang.String LIVE_ATTRIBUTES_PROPERTY
           
protected  DrawingAttributes liveAttributes
           
static java.util.logging.Logger logger
           
protected  MapBean map
           
protected  float MAX_TRANSPARENCY
           
protected  float MIN_TRANSPARENCY
           
protected  PanSupport panDelegate
           
static java.lang.String PanDistanceProperty
           
protected  java.awt.geom.Point2D recenterPoint
           
protected  float SEMI_TRANSPARENCY
           
protected  javax.swing.JSlider slider
           
static int SLIDER_MAX
           
protected  ZoomSupport zoomDelegate
           
static java.lang.String ZoomFactorProperty
           
 
Fields inherited from class com.bbn.openmap.gui.OMComponentPanel
beanContextChildSupport, i18n, isolated, orientation, 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
EmbeddedNavPanel()
           
EmbeddedNavPanel(DrawingAttributes buttonColors, DrawingAttributes fadeColors, int buttonSize)
          Make one.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Adds a listener for events that shift the Projection stack.
 void addCenterListener(CenterListener listener)
           
 void addPanListener(PanListener listener)
           
 void addZoomListener(ZoomListener listener)
           
protected  void changeMapScale(int sliderValue)
           
protected  void changeSliderValue(Projection projection)
           
 void findAndInit(java.lang.Object someObject)
           
 void findAndUndo(java.lang.Object someObject)
           
 java.awt.AlphaComposite getAc()
           
 DrawingAttributes getFadeAttributes()
           
 DrawingAttributes getLiveAttributes()
           
 MapBean getMap()
           
 float getPanDistance()
           
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent.
 java.util.Properties getPropertyInfo(java.util.Properties props)
          TODO: This is not complete, the drawing attributes need to be separated out and scoped, so they can be set individually.
 java.awt.geom.Point2D getRecenterPoint()
           
 java.awt.Color getScaleSliderBackground()
           
 java.awt.Color getScaleSliderForeground()
           
 float getZoomFactor()
           
protected  void initColors(DrawingAttributes buttonColors, DrawingAttributes fadeColors, int buttonSize)
           
protected  void layoutPanel()
           
static int logBase2(double number)
          Returns the largest integer n, such that 2^n <= the specified number.
protected  javax.swing.JButton makeButton(IconPart iconPart, DrawingAttributes da, int size, double ddRot, java.lang.String tooltip, java.awt.event.ActionListener ac)
           
protected  javax.swing.JButton makeButton(javax.swing.ImageIcon icon, java.lang.String toolTip)
           
protected  javax.swing.JButton makeButton(javax.swing.ImageIcon icon, java.lang.String toolTip, java.awt.event.ActionListener listener)
           
protected  javax.swing.JComponent makeScaleSlider(DrawingAttributes da)
           
 void paint(java.awt.Graphics g)
           
 void projectionChanged(ProjectionEvent event)
          Invoked when there has been a fundamental change to the Map.
 void removeActionListener(java.awt.event.ActionListener listener)
          Removes the listener for events that shift the Projection stack.
 void removeCenterListener(CenterListener listener)
           
 void removePanListener(PanListener listener)
           
 void removeZoomListener(ZoomListener listener)
           
protected  int scaleToSlider(float mapScale)
           
 void setAc(java.awt.AlphaComposite ac)
           
 void setFadeAttributes(DrawingAttributes fadeAttributes)
           
 void setLiveAttributes(DrawingAttributes liveAttributes)
           
 void setMinimumTransparency(float minTransparency)
           
 void setPanDistance(float panDistance)
           
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 void setRecenterPoint(java.awt.geom.Point2D recenterPoint)
           
 void setScaleSliderBackground(java.awt.Color sliderBackground)
           
 void setScaleSliderForeground(java.awt.Color sliderForeground)
           
 void setSemiTransparency(float semiTransparency)
           
 void setTransparency(float transparency)
           
 void setZoomFactor(float zoomFactor)
           
protected  float sliderToScale(int sliderValue)
           
 void updateProjectionStackStatus(boolean haveBackProjections, boolean haveForwardProjections)
          Respond to changes in the contents of the forward and back projection stacks.
 
Methods inherited from class com.bbn.openmap.gui.OMComponentPanel
addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, fireVetoableChange, getBeanContext, getOrientation, getPropertyPrefix, getWindowSupport, isIsolated, removeVetoableChangeListener, setBeanContext, setIsolated, setOrientation, 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, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, 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, 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, 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, removeComponentListener, 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, 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

logger

public static java.util.logging.Logger logger

SLIDER_MAX

public static final int SLIDER_MAX
See Also:
Constant Field Values

FADE_ATTRIBUTES_PROPERTY

public static final java.lang.String FADE_ATTRIBUTES_PROPERTY
See Also:
Constant Field Values

LIVE_ATTRIBUTES_PROPERTY

public static final java.lang.String LIVE_ATTRIBUTES_PROPERTY
See Also:
Constant Field Values

PanDistanceProperty

public static final java.lang.String PanDistanceProperty
See Also:
Constant Field Values

ZoomFactorProperty

public static final java.lang.String ZoomFactorProperty
See Also:
Constant Field Values

DEFAULT_BUTTON_SIZE

public static final int DEFAULT_BUTTON_SIZE
See Also:
Constant Field Values

defaultPanDistance

protected static final float defaultPanDistance
See Also:
Constant Field Values

defaultZoomFactor

protected static final float defaultZoomFactor
See Also:
Constant Field Values

CONTROL_BACKGROUND

protected static java.awt.Color CONTROL_BACKGROUND

fadeAttributes

protected DrawingAttributes fadeAttributes

liveAttributes

protected DrawingAttributes liveAttributes

buttonSize

protected int buttonSize

backIcon

protected javax.swing.ImageIcon backIcon

backDimIcon

protected javax.swing.ImageIcon backDimIcon

forwardIcon

protected javax.swing.ImageIcon forwardIcon

forwardDimIcon

protected javax.swing.ImageIcon forwardDimIcon

map

protected MapBean map

centerDelegate

protected CenterSupport centerDelegate

panDelegate

protected PanSupport panDelegate

zoomDelegate

protected ZoomSupport zoomDelegate

forwardProjectionButton

protected javax.swing.JButton forwardProjectionButton

backProjectionButton

protected javax.swing.JButton backProjectionButton

slider

protected javax.swing.JSlider slider

MIN_TRANSPARENCY

protected float MIN_TRANSPARENCY

SEMI_TRANSPARENCY

protected float SEMI_TRANSPARENCY

MAX_TRANSPARENCY

protected float MAX_TRANSPARENCY

fade

protected boolean fade

recenterPoint

protected java.awt.geom.Point2D recenterPoint

ac

protected java.awt.AlphaComposite ac
Constructor Detail

EmbeddedNavPanel

public EmbeddedNavPanel()

EmbeddedNavPanel

public EmbeddedNavPanel(DrawingAttributes buttonColors,
                        DrawingAttributes fadeColors,
                        int buttonSize)
Make one.

Parameters:
buttonColors - The live button colors when active.
fadeColors - The faded button colors, when inactive.
buttonSize - The relative pixel button sizes.
Method Detail

initColors

protected void initColors(DrawingAttributes buttonColors,
                          DrawingAttributes fadeColors,
                          int buttonSize)

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 OMComponentPanel
Parameters:
prefix - the token to prefix the property names
props - the Properties object

getProperties

public java.util.Properties getProperties(java.util.Properties props)
Description copied from class: OMComponentPanel
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. If the component has a propertyPrefix 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
Overrides:
getProperties in class OMComponentPanel
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If props 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)
TODO: This is not complete, the drawing attributes need to be separated out and scoped, so they can be set individually.

Specified by:
getPropertyInfo in interface PropertyConsumer
Overrides:
getPropertyInfo in class OMComponentPanel
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.

layoutPanel

protected void layoutPanel()

getRecenterPoint

public java.awt.geom.Point2D getRecenterPoint()

setRecenterPoint

public void setRecenterPoint(java.awt.geom.Point2D recenterPoint)

getPanDistance

public float getPanDistance()

setPanDistance

public void setPanDistance(float panDistance)

getZoomFactor

public float getZoomFactor()

setZoomFactor

public void setZoomFactor(float zoomFactor)

makeButton

protected javax.swing.JButton makeButton(IconPart iconPart,
                                         DrawingAttributes da,
                                         int size,
                                         double ddRot,
                                         java.lang.String tooltip,
                                         java.awt.event.ActionListener ac)

makeButton

protected javax.swing.JButton makeButton(javax.swing.ImageIcon icon,
                                         java.lang.String toolTip,
                                         java.awt.event.ActionListener listener)

makeButton

protected javax.swing.JButton makeButton(javax.swing.ImageIcon icon,
                                         java.lang.String toolTip)

makeScaleSlider

protected javax.swing.JComponent makeScaleSlider(DrawingAttributes da)

changeMapScale

protected void changeMapScale(int sliderValue)

changeSliderValue

protected void changeSliderValue(Projection projection)

sliderToScale

protected float sliderToScale(int sliderValue)

scaleToSlider

protected int scaleToSlider(float mapScale)

logBase2

public static final int logBase2(double number)
Returns the largest integer n, such that 2^n <= the specified number.


getScaleSliderBackground

public java.awt.Color getScaleSliderBackground()

setScaleSliderBackground

public void setScaleSliderBackground(java.awt.Color sliderBackground)

getScaleSliderForeground

public java.awt.Color getScaleSliderForeground()

setScaleSliderForeground

public void setScaleSliderForeground(java.awt.Color sliderForeground)

findAndInit

public void findAndInit(java.lang.Object someObject)
Specified by:
findAndInit in interface LightMapHandlerChild
Overrides:
findAndInit in class OMComponentPanel

findAndUndo

public void findAndUndo(java.lang.Object someObject)
Specified by:
findAndUndo in interface LightMapHandlerChild
Overrides:
findAndUndo in class OMComponentPanel

addCenterListener

public void addCenterListener(CenterListener listener)

removeCenterListener

public void removeCenterListener(CenterListener listener)

addPanListener

public void addPanListener(PanListener listener)

removePanListener

public void removePanListener(PanListener listener)

addZoomListener

public void addZoomListener(ZoomListener listener)

removeZoomListener

public void removeZoomListener(ZoomListener listener)

projectionChanged

public void projectionChanged(ProjectionEvent event)
Description copied from interface: ProjectionListener
Invoked when there has been a fundamental change to the Map.

Layers are expected to recompute their graphics (if this makes sense), and then repaint() themselves.

Specified by:
projectionChanged in interface ProjectionListener
Parameters:
event - ProjectionEvent

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Adds a listener for events that shift the Projection stack.

Specified by:
addActionListener in interface ProjectionStackTrigger

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Removes the listener for events that shift the Projection stack.

Specified by:
removeActionListener in interface ProjectionStackTrigger

updateProjectionStackStatus

public void updateProjectionStackStatus(boolean haveBackProjections,
                                        boolean haveForwardProjections)
Respond to changes in the contents of the forward and back projection stacks.

Specified by:
updateProjectionStackStatus in interface ProjectionStackTrigger
Parameters:
haveBackProjections - true if there is at least one back projection available
haveForwardProjections - true if there is at least one forward projection available

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JComponent

setTransparency

public void setTransparency(float transparency)

setMinimumTransparency

public void setMinimumTransparency(float minTransparency)

setSemiTransparency

public void setSemiTransparency(float semiTransparency)

getFadeAttributes

public DrawingAttributes getFadeAttributes()

setFadeAttributes

public void setFadeAttributes(DrawingAttributes fadeAttributes)

getLiveAttributes

public DrawingAttributes getLiveAttributes()

setLiveAttributes

public void setLiveAttributes(DrawingAttributes liveAttributes)

getAc

public java.awt.AlphaComposite getAc()

setAc

public void setAc(java.awt.AlphaComposite ac)

getMap

public MapBean getMap()


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