com.bbn.openmap.gui
Class GoToMenu

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.AbstractButton
                  extended by javax.swing.JMenuItem
                      extended by javax.swing.JMenu
                          extended by com.bbn.openmap.gui.AbstractOpenMapMenu
                              extended by com.bbn.openmap.gui.GoToMenu
All Implemented Interfaces:
MenuBarMenu, LightMapHandlerChild, PropertyConsumer, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.MenuElement, javax.swing.SwingConstants

public class GoToMenu
extends AbstractOpenMapMenu

Menu that keeps track of different saved map views (lat/lon, scale and projection type), and provides a way to set the map projection to those views. There is a set of optional default views, but new views can be added. If these views are added to the properties file, they will be added to the menu automatically for later uses. This menu can understand a set of properties:

 
 
   gotoMenu.class=com.bbn.openmap.gui.GoToMenu
   #Add the default, world view option
   gotoMenu.addDefaults=true
   #Add the menu for DataBoundsProviders
   gotoMenu.addDataViews=true
   #Additional views
   goto.views=Argentina India United_States Caspian_Sea
   Argentina.latitude=-39.760445
   Argentina.longitude=-65.92294
   Argentina.name=Argentina
   Argentina.projection=Mercator
   Argentina.scale=5.0E7
   India.latitude=20.895763
   India.longitude=80.437485
   India.name=India
   India.projection=Mercator
   India.scale=3.86688E7
   United_States.latitude=38.82259
   United_States.longitude=-96.74999
   United_States.name=United States
   United_States.projection=Mercator
   United_States.scale=5.186114E7
   Caspian_Sea.name=Caspian Sea
   Caspian_Sea.latitude=40f
   Caspian_Sea.longitude=47f
   Caspian_Sea.scale=1000000
   Caspian_Sea.projection=CADRG
 
 
 

See Also:
Serialized Form

Nested Class Summary
 class GoToMenu.AddNewViewButton
          This is the button that will bring up the dialog to actually name a new view being added.
 class GoToMenu.GoToButton
          This button contains the trigger for a saved view.
 class GoToMenu.NameFetcher
          Brings up a GUI to name a new view.
 
Nested classes/interfaces inherited from class javax.swing.JMenu
javax.swing.JMenu.AccessibleJMenu, javax.swing.JMenu.WinListener
 
Nested classes/interfaces inherited from class javax.swing.JMenuItem
javax.swing.JMenuItem.AccessibleJMenuItem
 
Nested classes/interfaces inherited from class javax.swing.AbstractButton
javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener
 
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  boolean addDataViews
           
static java.lang.String AddDataViewsProperty
          Flag to use to enable/disable the gathering of DataBoundsProviders.
static java.lang.String AddDefaultListProperty
          Flag to use to add default views (World, each continent.
protected  boolean addDefaults
           
protected  java.util.List customViews
           
protected  OMBasicMenu dataBoundsMenu
           
protected  java.util.Hashtable dataBoundsProviders
           
static java.lang.String LatProperty
          The center latitude of the view projection.
static java.lang.String LonProperty
          The center longitude of the view projection.
protected  MapBean map
           
static java.lang.String NameProperty
          The name of the view to use in the GUI.
static java.lang.String ProjectionTypeProperty
          The projection type of the view projection.
static java.lang.String ScaleProperty
          The scale of the view projection.
static java.lang.String ViewListProperty
          A space separated list of marker names for the views to be loaded from the properties.
 
Fields inherited from class com.bbn.openmap.gui.AbstractOpenMapMenu
beanContextChildSupport, i18n, items, itemsProperties, ItemsProperty, itemsPropertyContents, MnemonicProperty, PrettyNameProperty, propertyPrefix, SeparatorProperty
 
Fields inherited from class javax.swing.JMenu
popupListener
 
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GoToMenu()
           
 
Method Summary
 void addDataBoundsProvider(DataBoundsProvider provider)
           
 void addDefaultLocations()
          Add the default views to the menu.
 void addLocationItem(java.lang.String prefix, java.util.Properties props)
          Parse and add the view from properties.
 void addView(GoToMenu.GoToButton newOne)
          Add a button to the menu that will set the map to a particular view.
protected  java.util.List createCustomViews()
          An internal callback method that creates the custom views List object.
 java.util.List ensureCustomViews()
          Should call this when dealing with the custom views list, will always return a non-null answer.
 void findAndInit(java.lang.Object someObj)
          Method called when an object is added from the MapHandler.
 void findAndUndo(java.lang.Object someObj)
          Method called when an object is removed from the MapHandler.
 java.util.List getCustomViews()
           
 MapBean getMap()
           
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer interface method.
 java.util.Properties getPropertyInfo(java.util.Properties props)
          PropertyConsumer interface method.
 void removeDataBoundsProvider(DataBoundsProvider provider)
           
 void setCustomViews(java.util.List views)
           
 void setMap(MapBean mb)
          Set the map to control.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          PropertyConsumer interface method.
 
Methods inherited from class com.bbn.openmap.gui.AbstractOpenMapMenu
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndUndo, getBeanContext, getMapHandler, getPropertyPrefix, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setProperties, setPropertyPrefix
 
Methods inherited from class javax.swing.JMenu
add, add, add, add, add, addMenuListener, addSeparator, applyComponentOrientation, createActionChangeListener, createActionComponent, createWinListener, doClick, fireMenuCanceled, fireMenuDeselected, fireMenuSelected, getAccessibleContext, getComponent, getDelay, getItem, getItemCount, getMenuComponent, getMenuComponentCount, getMenuComponents, getMenuListeners, getPopupMenu, getPopupMenuOrigin, getSubElements, getUIClassID, insert, insert, insert, insertSeparator, isMenuComponent, isPopupMenuVisible, isSelected, isTearOff, isTopLevelMenu, menuSelectionChanged, paramString, processKeyEvent, remove, remove, remove, removeAll, removeMenuListener, setAccelerator, setComponentOrientation, setDelay, setMenuLocation, setModel, setPopupMenuVisible, setSelected, updateUI
 
Methods inherited from class javax.swing.JMenuItem
actionPropertyChanged, addMenuDragMouseListener, addMenuKeyListener, configurePropertiesFromAction, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getMenuDragMouseListeners, getMenuKeyListeners, init, isArmed, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setArmed, setEnabled, setUI
 
Methods inherited from class javax.swing.AbstractButton
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, paintBorder, removeActionListener, removeChangeListener, removeItemListener, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, addContainerListener, addPropertyChangeListener, 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, 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, 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, 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, repaint, repaint, repaint, resize, resize, setBounds, setBounds, 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 javax.swing.MenuElement
processKeyEvent, processMouseEvent
 

Field Detail

dataBoundsProviders

protected java.util.Hashtable dataBoundsProviders

dataBoundsMenu

protected OMBasicMenu dataBoundsMenu

map

protected MapBean map

ViewListProperty

public static final java.lang.String ViewListProperty
A space separated list of marker names for the views to be loaded from the properties.

See Also:
Constant Field Values

NameProperty

public static final java.lang.String NameProperty
The name of the view to use in the GUI.

See Also:
Constant Field Values

LatProperty

public static final java.lang.String LatProperty
The center latitude of the view projection.

See Also:
Constant Field Values

LonProperty

public static final java.lang.String LonProperty
The center longitude of the view projection.

See Also:
Constant Field Values

ScaleProperty

public static final java.lang.String ScaleProperty
The scale of the view projection.

See Also:
Constant Field Values

ProjectionTypeProperty

public static final java.lang.String ProjectionTypeProperty
The projection type of the view projection.

See Also:
Constant Field Values

AddDefaultListProperty

public static final java.lang.String AddDefaultListProperty
Flag to use to add default views (World, each continent.

See Also:
Constant Field Values

AddDataViewsProperty

public static final java.lang.String AddDataViewsProperty
Flag to use to enable/disable the gathering of DataBoundsProviders.

See Also:
Constant Field Values

addDefaults

protected boolean addDefaults

addDataViews

protected boolean addDataViews

customViews

protected java.util.List customViews
Constructor Detail

GoToMenu

public GoToMenu()
Method Detail

findAndUndo

public void findAndUndo(java.lang.Object someObj)
Description copied from class: AbstractOpenMapMenu
Method called when an object is removed from the MapHandler. Called to let menu objects disconnect from it.

Specified by:
findAndUndo in interface LightMapHandlerChild
Overrides:
findAndUndo in class AbstractOpenMapMenu

findAndInit

public void findAndInit(java.lang.Object someObj)
Description copied from class: AbstractOpenMapMenu
Method called when an object is added from the MapHandler. Called to let menu objects connect to it.

Specified by:
findAndInit in interface LightMapHandlerChild
Overrides:
findAndInit in class AbstractOpenMapMenu

setMap

public void setMap(MapBean mb)
Set the map to control.


getMap

public MapBean getMap()

setProperties

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

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

getProperties

public java.util.Properties getProperties(java.util.Properties props)
PropertyConsumer interface method.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class AbstractOpenMapMenu
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)
PropertyConsumer interface method.

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

addDefaultLocations

public void addDefaultLocations()
Add the default views to the menu.


createCustomViews

protected java.util.List createCustomViews()
An internal callback method that creates the custom views List object. Override to change what kind of object gets created (it's a Vector by default).

Returns:
List

getCustomViews

public java.util.List getCustomViews()

ensureCustomViews

public java.util.List ensureCustomViews()
Should call this when dealing with the custom views list, will always return a non-null answer.

Returns:
List

setCustomViews

public void setCustomViews(java.util.List views)

addLocationItem

public void addLocationItem(java.lang.String prefix,
                            java.util.Properties props)
Parse and add the view from properties.


addDataBoundsProvider

public void addDataBoundsProvider(DataBoundsProvider provider)

removeDataBoundsProvider

public void removeDataBoundsProvider(DataBoundsProvider provider)

addView

public void addView(GoToMenu.GoToButton newOne)
Add a button to the menu that will set the map to a particular view.



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