com.bbn.openmap.gui
Class LayersPanel

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.OMToolComponent
                          extended by com.bbn.openmap.gui.LayersPanel
All Implemented Interfaces:
LayerListener, Tool, LightMapHandlerChild, PropertyConsumer, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class LayersPanel
extends OMToolComponent
implements java.io.Serializable, java.awt.event.ActionListener, LayerListener, java.beans.PropertyChangeListener

The LayersPanel displays the list of layers that OpenMap can display. The layer name is displayed accompanied by an on/off button and a tool palette button. Pressing the on/off button will cause the the map to display/remove the layer. Pressing the tool palette button will cause a window to be displayed containing widgets specific to that layer.

The order of the layers in the list reflects the order that the layers are displayed on the map, with the bottom-most layer listed on the panel underneath all the the other layers displayed on the map. The order of the layers is determined by their order in the Layer[] passed in the setLayers method.

The order of the layers can be changed by sending the LayersPanel an ActionEvent with one of the string commands in the class, or by sending a PropertyChangeEvent with a command and a Layer as the new value.

In the standard GUI, the order can be changed by selecting a layer by clicking on the layer's name (or on either of buttons), then clicking on one of the four buttons on the left side of the panel. The four buttons signify, from top to bottom: Move the selected layer to the top; Move the selected layer up one position; Move the selected layer down one position; Move the selected layer to the bottom.

The LayersPanel can be used within a BeanContext. If it is added to a BeanConext, it will look for a LayerHandler to add itself to as a LayerListener. The LayersPanel can only listen to one LayerHandler, so if more than one is found, only the last one found will be used. If another LayerHandler is added to the BeanContext later, the new LayerHandler will be used. The LayersPanel is also considered to be a Tool, which will cause a button that will bring up the LayersPanel to be automatically added to the ToolPanel if a ToolPanel is part of the BeanContext.

When the LayersPanel discovers a BufferedLayerMapBean is being used, it adds a special LayerPane to its LayerPane list that shows which layers are being buffered in the MapBean. This special LayerPane shows up as a line in the list, and all layers below that line are being specially buffered by the BufferedLayerMapBean.

The properties that can be set for the LayersPanel:

 
 
 
          # Use LayerStatusPanes for the layers if true, otherwise
          # LayerPanes.  LayerStatusPanes turn the on/off bulbs to green/red
          # bulbs when the layer is resting/working.  LayerPanes just show
          # yellow bulbs when the layer is part of the map.
          showStatus=true
          # When the BufferedLayerMapBean is used, a divider will be
          # displayed in the list of layers showing which layers are in the
          # MapBean buffer (below the line).  Commands to move layers, by
          # default, respect this divider, requiring more commands to have
          # layers cross it.
          boundary=true
          # Add control buttons - use "none" for no button.  If undefined,
          # the LayerControlButtonPanel will be created automatically.
          controls=com.bbn.openmap.gui.LayerControlButtonPanel
          # Any control properties added here, prepended by "controls"...
          controls.configuration=WEST
 
 
 
 

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.event.ActionListener actionListener
          The ActionListener that will bring up the LayersPanel.
protected  LayerPane backgroundLayerSeparator
          A special LayerPane used when the LayersPanel senses that a BufferedLayerMapBean is being used.
protected  javax.swing.ButtonGroup bg
          The Layer order adjustment button group.
protected  boolean bufferedBoundary
          Behavior flag so that if there is a background buffered layer on the MapBean, and a buffered layer divider in the LayersPanel, whether commands instructing a layer to the top or bottom of the list should honor the virtual boundary between buffered and unbuffered layers.
static java.lang.String BufferedBoundaryProperty
          A property that can be used for controlling how the to top and to bottom commands will be interpreted when a BufferedLayerMapBean is used.
static java.lang.String ControlButtonsProperty
          A property to set the class to create for layer order controls.
protected  LayerControlButtonPanel controls
          The set of buttons that control the layers.
static java.lang.String defaultKey
          Default key for the LayersPanel Tool.
static java.lang.String LayerAddCmd
          Action command adding a layer.
protected  LayerAddPanel layerAddPanel
          Panel that lets you dynamically add and configure layers.
static java.lang.String LayerBottomCmd
          Action command for the layer order buttons.
static java.lang.String LayerDeselectedCmd
          Action command for notification that a layer has been deselected.
static java.lang.String LayerDownCmd
          Action command for the layer order buttons.
protected  LayerHandler layerHandler
          The LayerHandler to listen to for LayerEvents, and also to notify if the layer order should change.
static java.lang.String LayerRemoveCmd
          Action command removing a layer.
static java.lang.String LayerSelectedCmd
          Action command for notification that a layer has been selected.
static java.lang.String LayerTopCmd
          Action command for the layer order buttons.
static java.lang.String LayerUpCmd
          Action command for the layer order buttons.
static java.util.logging.Logger logger
           
static java.lang.String NO_CONTROLS
          A value for the (controls) property to not include control buttons in the interface.
protected  java.util.Hashtable<Layer,LayerPane> paneLookUp
          Hashtable that tracks LayerPanes for layers, with the layer as the key and LayerPane as the value.
protected  java.util.List<LayerPane> panes
          The components holding the layer name label, the on/off indicator and on button, and the palette on/off indicator and palette on button.
protected  javax.swing.JPanel panesPanel
          The internal component that holds the panes.
protected  javax.swing.JScrollPane scrollPane
          The scroll pane to use for panes.
protected  boolean showStatus
          Behavior flag that determines what kind of LayerPane is used for the layers.
static java.lang.String ShowStatusProperty
          A property that can be used for controlling what type of LayerPanes are used.
 
Fields inherited from class com.bbn.openmap.gui.OMToolComponent
c, gridbag, key, useAsTool, UseAsToolProperty
 
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
LayersPanel()
          Construct the LayersPanel.
LayersPanel(LayerHandler lHandler)
          Construct the LayersPanel.
LayersPanel(LayerHandler lHandler, boolean addLayerControls)
          Construct the LayersPanel.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Method associated with the ActionListener interface.
protected  void addFillerToPanesPanel()
           
 void addLayerControls()
          Tell the LayersPanel to add layer control buttons.
 LayerControlButtonPanel createControlButtons()
          Set up the buttons used to move layers up and down, or add/remove layers.
protected  LayerPane createLayerPaneForLayer(Layer layer, LayerHandler layerHandler, javax.swing.ButtonGroup bg)
          Called when a new LayerPane needs to be created for a layer.
 void createPanel(Layer[] inLayers)
          Create the panel that shows the LayerPanes.
 void deletePanes(java.util.List<LayerPane> dpanes)
           
 void findAndInit(java.lang.Object someObj)
          Called when the LayersPanel is added the BeanContext, or when another object is added to the BeanContext after the LayerHandler has been added.
 void findAndUndo(java.lang.Object someObj)
          BeanContextMembershipListener method.
protected  LayerPane findSelectedPane()
          Find the selected LayerPane in the current LayerPane list.
 java.awt.event.ActionListener getActionListener()
          Get the ActionListener that triggers the LayersPanel.
 LayerControlButtonPanel getControls()
           
 java.awt.Container getFace()
          Tool interface method.
 LayerHandler getLayerHandler()
          Get the LayerHandler that the LayersPanel listens to and uses to reorder layers.
protected  java.util.List<LayerPane> getPanes()
           
 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)
          Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
protected  void moveLayer(LayerPane lp, java.lang.String command)
          Change a layer's position, with the layer represented by a LayerPane.
 void moveLayer(Layer layer, java.lang.String command)
          Change a layer's position.
 void propertyChange(java.beans.PropertyChangeEvent pce)
           
protected  void rejiggerMapLayers()
          Makes a new layer cake of active layers to send to LayerHandler.setLayers().
 void setControls(LayerControlButtonPanel lcbp)
          Simply sets the controls.
protected  void setControlsAndNotify(LayerControlButtonPanel lcbp)
          Should be called internally, when the LayersPanel creates the LayerControlButtonPanel.
 void setLayerHandler(LayerHandler lh)
          Set the LayerHandler that the LayersPanel listens to.
 void setLayers(Layer[] inLayers)
          Set the layers that are on the menu.
 void setLayers(LayerEvent evt)
          LayerListener interface method.
protected  void setLayersFromEDT(Layer[] inLayers)
          Set the layers that are in the LayersPanel.
protected  void setPanes(java.util.List<LayerPane> lpa)
           
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 void updateLayerLabels()
          Update the layer names - if a layer name has changed, tell the LayerPanes to check with their layers to update their labels.
protected  void updateLayerPanes(LayerHandler layerHandler)
          Set the LayerPanes with the given LayerHandler.
 
Methods inherited from class com.bbn.openmap.gui.OMToolComponent
add, createLayout, getGridBagConstraints, getKey, getUseAsTool, setKey, setUseAsTool
 
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, 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, 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 com.bbn.openmap.gui.Tool
getOrientation, setOrientation
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

logger

public static java.util.logging.Logger logger

LayerTopCmd

public static final java.lang.String LayerTopCmd
Action command for the layer order buttons.

See Also:
Constant Field Values

LayerBottomCmd

public static final java.lang.String LayerBottomCmd
Action command for the layer order buttons.

See Also:
Constant Field Values

LayerUpCmd

public static final java.lang.String LayerUpCmd
Action command for the layer order buttons.

See Also:
Constant Field Values

LayerDownCmd

public static final java.lang.String LayerDownCmd
Action command for the layer order buttons.

See Also:
Constant Field Values

LayerRemoveCmd

public static final java.lang.String LayerRemoveCmd
Action command removing a layer.

See Also:
Constant Field Values

LayerAddCmd

public static final java.lang.String LayerAddCmd
Action command adding a layer.

See Also:
Constant Field Values

LayerSelectedCmd

public static final java.lang.String LayerSelectedCmd
Action command for notification that a layer has been selected.

See Also:
Constant Field Values

LayerDeselectedCmd

public static final java.lang.String LayerDeselectedCmd
Action command for notification that a layer has been deselected. Not so reliable. Usually a selection notification means that others are deselected.

See Also:
Constant Field Values

ControlButtonsProperty

public static final java.lang.String ControlButtonsProperty
A property to set the class to create for layer order controls. If undefined, a LayerControlButtonPanel in its default configuration will be created. For no controls added, use (none) for this property.

See Also:
Constant Field Values

BufferedBoundaryProperty

public static final java.lang.String BufferedBoundaryProperty
A property that can be used for controlling how the to top and to bottom commands will be interpreted when a BufferedLayerMapBean is used. See the definition of bufferedBoundary.

See Also:
Constant Field Values

ShowStatusProperty

public static final java.lang.String ShowStatusProperty
A property that can be used for controlling what type of LayerPanes are used. If true (default) a LayerStatusPane will be created for each layer. Otherwise, a LayerPane will be used.

See Also:
Constant Field Values

NO_CONTROLS

public static final java.lang.String NO_CONTROLS
A value for the (controls) property to not include control buttons in the interface.

See Also:
Constant Field Values

defaultKey

public static final java.lang.String defaultKey
Default key for the LayersPanel Tool.

See Also:
Constant Field Values

layerHandler

protected transient LayerHandler layerHandler
The LayerHandler to listen to for LayerEvents, and also to notify if the layer order should change.


layerAddPanel

protected transient LayerAddPanel layerAddPanel
Panel that lets you dynamically add and configure layers.


panes

protected transient java.util.List<LayerPane> panes
The components holding the layer name label, the on/off indicator and on button, and the palette on/off indicator and palette on button.


panesPanel

protected transient javax.swing.JPanel panesPanel
The internal component that holds the panes.


scrollPane

protected transient javax.swing.JScrollPane scrollPane
The scroll pane to use for panes.


bg

protected transient javax.swing.ButtonGroup bg
The Layer order adjustment button group.


actionListener

protected java.awt.event.ActionListener actionListener
The ActionListener that will bring up the LayersPanel.


controls

protected LayerControlButtonPanel controls
The set of buttons that control the layers.


paneLookUp

protected java.util.Hashtable<Layer,LayerPane> paneLookUp
Hashtable that tracks LayerPanes for layers, with the layer as the key and LayerPane as the value.


backgroundLayerSeparator

protected LayerPane backgroundLayerSeparator
A special LayerPane used when the LayersPanel senses that a BufferedLayerMapBean is being used. This LayersPanel is a separating line showing which layers are part of the MapBean's buffer, and which are not.


bufferedBoundary

protected boolean bufferedBoundary
Behavior flag so that if there is a background buffered layer on the MapBean, and a buffered layer divider in the LayersPanel, whether commands instructing a layer to the top or bottom of the list should honor the virtual boundary between buffered and unbuffered layers. That is, if a layer is on the bottom of the buffered list and is instructed to go to the top of the overall list, it will only first travel to the top of the buffered layers. On a subsequent top command, it will go to the top of the list. The same behavior applies for going down. True is default. If set to false, these commands will just send the selected layer to the top and bottom of the entire list.


showStatus

protected boolean showStatus
Behavior flag that determines what kind of LayerPane is used for the layers. If true (default) the LayerStatusPane will be used. Otherwise, the LayerPane will be used instead.

Constructor Detail

LayersPanel

public LayersPanel()
Construct the LayersPanel.


LayersPanel

public LayersPanel(LayerHandler lHandler)
Construct the LayersPanel.

Parameters:
lHandler - the LayerHandler controlling the layers.

LayersPanel

public LayersPanel(LayerHandler lHandler,
                   boolean addLayerControls)
Construct the LayersPanel.

Parameters:
lHandler - the LayerHandler controlling the layers.
addLayerControls - if true, buttons that modify layer positions will be added.
Method Detail

setLayerHandler

public void setLayerHandler(LayerHandler lh)
Set the LayerHandler that the LayersPanel listens to. If the LayerHandler passed in is not null, the LayersMenu will be added to the LayerHandler LayerListener list, and the LayersMenu will receive a LayerEvent with the current layers.

If there is a LayerHandler that is already being listened to, then the LayersPanel will remove itself from current LayerHandler as a LayerListener, before adding itself to the new LayerHandler.

Lastly, if the LayerHandler passed in is null, the LayersPanel will disconnect itself from any LayerHandler currently held, and reset itself with no layers.

Parameters:
lh - LayerHandler to listen to, and to use to reorder the layers.

getLayerHandler

public LayerHandler getLayerHandler()
Get the LayerHandler that the LayersPanel listens to and uses to reorder layers.

Returns:
LayerHandler.

updateLayerPanes

protected void updateLayerPanes(LayerHandler layerHandler)
Set the LayerPanes with the given LayerHandler.

Parameters:
layerHandler - The LayerHandler controlling the layers

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. The LayersPanel only reacts to LayerEvent.ALL events, to reset the components in the LayersPanel.

Specified by:
setLayers in interface LayerListener
Parameters:
evt - a LayerEvent.

getFace

public java.awt.Container getFace()
Tool interface method. The retrieval tool's interface. This method creates a button that will bring up the LayersPanel.

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

getActionListener

public java.awt.event.ActionListener getActionListener()
Get the ActionListener that triggers the LayersPanel. Useful to have to provide an alternative way to bring up the LayersPanel.

Returns:
ActionListener

setLayers

public void setLayers(Layer[] inLayers)
Set the layers that are on the menu. Calls for AWT thread to update layers

Parameters:
inLayers - the array of layers.

setLayersFromEDT

protected void setLayersFromEDT(Layer[] inLayers)
Set the layers that are in the LayersPanel. Make sure that the layer[] is the same as that passed to any other OpenMap component, like the LayersMenu. This method checks to see if the layer[] has actually changed, in order or in size. If it has, then createPanel() is called to rebuild the LayersPanel. Should be called within the Event Dispatch Thread.

Parameters:
inLayers - the array of layers.

getPanes

protected java.util.List<LayerPane> getPanes()

setPanes

protected void setPanes(java.util.List<LayerPane> lpa)

createPanel

public void createPanel(Layer[] inLayers)
Create the panel that shows the LayerPanes. This method creates the on/off buttons, palette buttons, and layer labels, and adds them to the scrollPane used to display all the layers.

Parameters:
inLayers - the Layer[] that reflects all possible layers that can be added to the map.

addFillerToPanesPanel

protected void addFillerToPanesPanel()

createLayerPaneForLayer

protected LayerPane createLayerPaneForLayer(Layer layer,
                                            LayerHandler layerHandler,
                                            javax.swing.ButtonGroup bg)
Called when a new LayerPane needs to be created for a layer. You can use this to extend LayerPane and return something else that fits your GUI.


deletePanes

public void deletePanes(java.util.List<LayerPane> dpanes)

addLayerControls

public void addLayerControls()
Tell the LayersPanel to add layer control buttons. Does nothing if the controls are already set.


createControlButtons

public LayerControlButtonPanel createControlButtons()
Set up the buttons used to move layers up and down, or add/remove layers. The button component should hook itself up to the LayersPanel, and assume that the LayersPanel has a BorderLayout with the list in the center spot.


setControlsAndNotify

protected void setControlsAndNotify(LayerControlButtonPanel lcbp)
Should be called internally, when the LayersPanel creates the LayerControlButtonPanel. If called from the LCBP, a loop will ensue.

Parameters:
lcbp -

setControls

public void setControls(LayerControlButtonPanel lcbp)
Simply sets the controls.

Parameters:
lcbp -

getControls

public LayerControlButtonPanel getControls()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Method associated with the ActionListener interface. This method listens for action events meant to change the order of the layers, as fired by the layer order buttons.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - ActionEvent

moveLayer

public void moveLayer(Layer layer,
                      java.lang.String command)
Change a layer's position.


moveLayer

protected void moveLayer(LayerPane lp,
                         java.lang.String command)
Change a layer's position, with the layer represented by a LayerPane.


findSelectedPane

protected LayerPane findSelectedPane()
Find the selected LayerPane in the current LayerPane list. Will return null if there isn't a selected pane.


rejiggerMapLayers

protected void rejiggerMapLayers()
Makes a new layer cake of active layers to send to LayerHandler.setLayers().


updateLayerLabels

public void updateLayerLabels()
Update the layer names - if a layer name has changed, tell the LayerPanes to check with their layers to update their labels.


propertyChange

public void propertyChange(java.beans.PropertyChangeEvent pce)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

findAndInit

public void findAndInit(java.lang.Object someObj)
Called when the LayersPanel is added the BeanContext, or when another object is added to the BeanContext after the LayerHandler has been added. This allows the LayersPanel to keep up-to-date with any objects that it may be interested in, namely, the LayerHandler. If a LayerHandler has already been added, the new LayerHandler will replace it.

Specified by:
findAndInit in interface LightMapHandlerChild
Overrides:
findAndInit in class OMComponentPanel
Parameters:
someObj - the object being added to the BeanContext

findAndUndo

public void findAndUndo(java.lang.Object someObj)
BeanContextMembershipListener method. Called when an object has been removed from the parent BeanContext. If a LayerHandler is removed, and it's the current one being listened to, then the layers in the panel will be wiped clean.

Specified by:
findAndUndo in interface LightMapHandlerChild
Overrides:
findAndUndo in class OMComponentPanel
Parameters:
someObj - the object being removed from the BeanContext

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 OMToolComponent
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 OMToolComponent
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)
Description copied from class: OMComponentPanel
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.). For Layer, this method should at least return the 'prettyName' property.

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


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