ucar.unidata.view.station
Class StationLocationMap

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 ucar.unidata.view.station.StationLocationMap
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class StationLocationMap
extends JPanel

A navigated panel with 2 renderers - a map renderer and a station location renderer.

Author:
Don Murray
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String DEFAULT_MAP
          name of default map
static String LABEL_ID
          ID label
static String LABEL_LAT
          latitude label
static String LABEL_LON
          longitude label
static String LABEL_NAME
          Name label
static String SELECTED_PROPERTY
          Property for selecting a station
static String TEMPLATE_ID
          Property to use the station ID for the station label
static String TEMPLATE_NAME
          template for name
static String TEMPLATE_NAME_AND_ID
          template for name and id
static String UNSELECTED_PROPERTY
          Property for unselecting a station
 
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
StationLocationMap()
          Default constructor.
StationLocationMap(boolean multipleSelect)
          Construct a new StationLocationMap using the specified station selection type.
StationLocationMap(boolean multipleSelect, Renderer theMapRender)
          Create a StationLocationMap
StationLocationMap(boolean multipleSelect, Renderer theMapRender, String template)
          Create a StationLocationMap
StationLocationMap(boolean multipleSelect, String defaultMap)
          Construct a new StationLocationMap using the specified station selection type and map.
StationLocationMap(boolean multipleSelect, String defaultMap, String template)
          Construct a new StationLocationMap using the specified station selection type, map and template.
StationLocationMap(String template)
          Construct a new StationLocationMap using the specified label type.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a property change listener.
 void addPropertyChangeListener(String name, PropertyChangeListener listener)
          Adds a property change listener for a named property.
 void clearStations()
          Convenience method to clear out the data in the station renderer
protected  void doPickPoint(PickEvent e)
          Process the PickEvent.
 boolean getDeclutter()
          Determine whether decluttering is on for this map.
 Renderer getMapRender()
          Get the map renderer for this object
 boolean getMultipleSelect()
          See if this supports multiple station selection.
 NavigatedPanel getNavigatedPanel()
          Access to the navigated panel.
 List getSelectedStations()
          Get the list of selected stations.
 StationLocationRenderer getStationLocationRenderer()
          Access to the station location renderer
 List getStations()
          Get the list of stations
 boolean getWasDoubleClick()
          See if a double click happened.
 boolean isFocusTraversable()
          Get the isFocusTransverable property
 boolean isMultipleSelect()
          See if this map allows multiple station selection
static void main(String[] args)
          test with ucar.unidata.view.station.StationLocationMap
 void redraw()
          Redraw the graphics on the screen.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a property change listener.
 void removePropertyChangeListener(String name, PropertyChangeListener listener)
          Removes a property change listener for a named property.
protected  void selectAll()
          Select all visible stations.
 void setDeclutter(boolean declut)
          Change the state of decluttering
 void setMapRenderer(Renderer r)
          Set the map renderer for this object
 void setProjectionImpl(ucar.unidata.geoloc.ProjectionImpl p)
          Set the projection to use for this map.
 void setSelectedStations(List stns)
          Set the list of selected stations.
 void setStationRenderer(Renderer r)
          Set the station location renderer.
 void setStations(List stns)
          Set the list of stations to be displayed.
 void setStations(List stns, boolean declutter)
          Set the list of stations to be displayed.
 void setStations(List stns, List selectedStations, boolean declutter)
          Set the list of stations to be displayed.
 
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, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, 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, 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, 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, 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
 

Field Detail

SELECTED_PROPERTY

public static final String SELECTED_PROPERTY
Property for selecting a station

See Also:
Constant Field Values

UNSELECTED_PROPERTY

public static final String UNSELECTED_PROPERTY
Property for unselecting a station

See Also:
Constant Field Values

DEFAULT_MAP

public static final String DEFAULT_MAP
name of default map

See Also:
Constant Field Values

LABEL_ID

public static final String LABEL_ID
ID label

See Also:
Constant Field Values

LABEL_NAME

public static final String LABEL_NAME
Name label

See Also:
Constant Field Values

LABEL_LAT

public static final String LABEL_LAT
latitude label

See Also:
Constant Field Values

LABEL_LON

public static final String LABEL_LON
longitude label

See Also:
Constant Field Values

TEMPLATE_ID

public static final String TEMPLATE_ID
Property to use the station ID for the station label

See Also:
Constant Field Values

TEMPLATE_NAME

public static final String TEMPLATE_NAME
template for name

See Also:
Constant Field Values

TEMPLATE_NAME_AND_ID

public static final String TEMPLATE_NAME_AND_ID
template for name and id

See Also:
Constant Field Values
Constructor Detail

StationLocationMap

public StationLocationMap()
Default constructor. Uses default label type and single station selection.


StationLocationMap

public StationLocationMap(String template)
Construct a new StationLocationMap using the specified label type. Use default station selection and map.

Parameters:
template - The String template to use for displaying station labels.

StationLocationMap

public StationLocationMap(boolean multipleSelect)
Construct a new StationLocationMap using the specified station selection type. Use default labeling and map.

Parameters:
multipleSelect - true to allow multiple station selections

StationLocationMap

public StationLocationMap(boolean multipleSelect,
                          String defaultMap)
Construct a new StationLocationMap using the specified station selection type and map. Use default labeling.

Parameters:
multipleSelect - true to allow multiple station selections
defaultMap - map to use

StationLocationMap

public StationLocationMap(boolean multipleSelect,
                          String defaultMap,
                          String template)
Construct a new StationLocationMap using the specified station selection type, map and template.

Parameters:
multipleSelect - true to allow multiple station selections
defaultMap - map to use
template - The String template to use for displaying station labels.

StationLocationMap

public StationLocationMap(boolean multipleSelect,
                          Renderer theMapRender)
Create a StationLocationMap

Parameters:
multipleSelect - true if multiple selection is allowed
theMapRender - the renderer for the map

StationLocationMap

public StationLocationMap(boolean multipleSelect,
                          Renderer theMapRender,
                          String template)
Create a StationLocationMap

Parameters:
multipleSelect - true if multiple selection is allowed
theMapRender - the renderer for the map
template - the template for the display of the data
Method Detail

doPickPoint

protected void doPickPoint(PickEvent e)
Process the PickEvent.

Parameters:
e - PickEvent to process

isFocusTraversable

public boolean isFocusTraversable()
Get the isFocusTransverable property

Overrides:
isFocusTraversable in class Component
Returns:
true if we can transverse focus

selectAll

protected void selectAll()
Select all visible stations.


isMultipleSelect

public boolean isMultipleSelect()
See if this map allows multiple station selection

Returns:
true if allows multiple selection.

getSelectedStations

public List getSelectedStations()
Get the list of selected stations.

Returns:
List of stations that have been selected.

getNavigatedPanel

public NavigatedPanel getNavigatedPanel()
Access to the navigated panel.

Returns:
navigated panel object

setMapRenderer

public void setMapRenderer(Renderer r)
Set the map renderer for this object

Parameters:
r - map renderer

getMapRender

public Renderer getMapRender()
Get the map renderer for this object

Returns:
Map renderer

getStationLocationRenderer

public StationLocationRenderer getStationLocationRenderer()
Access to the station location renderer

Returns:
station location renderer

setStationRenderer

public void setStationRenderer(Renderer r)
Set the station location renderer.

Parameters:
r - station location renderer

setSelectedStations

public void setSelectedStations(List stns)
Set the list of selected stations.

Parameters:
stns - List of stations to set selected.

setStations

public void setStations(List stns)
Set the list of stations to be displayed. Stations will be decluttered when they are displayed.

Parameters:
stns - list of stations

setStations

public void setStations(List stns,
                        boolean declutter)
Set the list of stations to be displayed. Stations will be decluttered or not based on the value of declutter

Parameters:
stns - list of stations
declutter - display will be decluttered if true, not if false

setStations

public void setStations(List stns,
                        List selectedStations,
                        boolean declutter)
Set the list of stations to be displayed. Stations will be decluttered or not based on the value of declutter

Parameters:
stns - list of stations
selectedStations - already selected stations
declutter - display will be decluttered if true, not if false

getStations

public List getStations()
Get the list of stations

Returns:
the list of stations

setDeclutter

public void setDeclutter(boolean declut)
Change the state of decluttering

Parameters:
declut - station display will be decluttered if true, not if false

clearStations

public void clearStations()
Convenience method to clear out the data in the station renderer


getDeclutter

public boolean getDeclutter()
Determine whether decluttering is on for this map.

Returns:
true if map is being decluttered.

setProjectionImpl

public void setProjectionImpl(ucar.unidata.geoloc.ProjectionImpl p)
Set the projection to use for this map.

Parameters:
p - projection to use

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener.

Overrides:
addPropertyChangeListener in class Container
Parameters:
listener - The property change listener.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.

Overrides:
removePropertyChangeListener in class Component
Parameters:
listener - The property change listener.

addPropertyChangeListener

public void addPropertyChangeListener(String name,
                                      PropertyChangeListener listener)
Adds a property change listener for a named property.

Overrides:
addPropertyChangeListener in class Container
Parameters:
name - The name of the property.
listener - The property change listener.

removePropertyChangeListener

public void removePropertyChangeListener(String name,
                                         PropertyChangeListener listener)
Removes a property change listener for a named property.

Overrides:
removePropertyChangeListener in class Component
Parameters:
name - The name of the property.
listener - The property change listener.

redraw

public void redraw()
Redraw the graphics on the screen.


getMultipleSelect

public boolean getMultipleSelect()
See if this supports multiple station selection.

Returns:
true if this allows multiple station selection

main

public static void main(String[] args)
test with ucar.unidata.view.station.StationLocationMap

Parameters:
args -

getWasDoubleClick

public boolean getWasDoubleClick()
See if a double click happened.

Returns:
true if a double click happened