|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.bbn.openmap.gui.OMComponentPanel com.bbn.openmap.gui.OMToolComponent com.bbn.openmap.gui.LayersPanel
public class LayersPanel
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
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 |
---|
public static java.util.logging.Logger logger
public static final java.lang.String LayerTopCmd
public static final java.lang.String LayerBottomCmd
public static final java.lang.String LayerUpCmd
public static final java.lang.String LayerDownCmd
public static final java.lang.String LayerRemoveCmd
public static final java.lang.String LayerAddCmd
public static final java.lang.String LayerSelectedCmd
public static final java.lang.String LayerDeselectedCmd
public static final java.lang.String ControlButtonsProperty
public static final java.lang.String BufferedBoundaryProperty
public static final java.lang.String ShowStatusProperty
public static final java.lang.String NO_CONTROLS
public static final java.lang.String defaultKey
protected transient LayerHandler layerHandler
protected transient LayerAddPanel layerAddPanel
protected transient java.util.List<LayerPane> panes
protected transient javax.swing.JPanel panesPanel
protected transient javax.swing.JScrollPane scrollPane
protected transient javax.swing.ButtonGroup bg
protected java.awt.event.ActionListener actionListener
protected LayerControlButtonPanel controls
protected java.util.Hashtable<Layer,LayerPane> paneLookUp
protected LayerPane backgroundLayerSeparator
protected boolean bufferedBoundary
protected boolean showStatus
Constructor Detail |
---|
public LayersPanel()
public LayersPanel(LayerHandler lHandler)
lHandler
- the LayerHandler controlling the layers.public LayersPanel(LayerHandler lHandler, boolean addLayerControls)
lHandler
- the LayerHandler controlling the layers.addLayerControls
- if true, buttons that modify layer positions will
be added.Method Detail |
---|
public void setLayerHandler(LayerHandler lh)
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.
lh
- LayerHandler to listen to, and to use to reorder the layers.public LayerHandler getLayerHandler()
protected void updateLayerPanes(LayerHandler layerHandler)
layerHandler
- The LayerHandler controlling the layerspublic void setLayers(LayerEvent evt)
setLayers
in interface LayerListener
evt
- a LayerEvent.public java.awt.Container getFace()
getFace
in interface Tool
getFace
in class OMToolComponent
public java.awt.event.ActionListener getActionListener()
public void setLayers(Layer[] inLayers)
inLayers
- the array of layers.protected void setLayersFromEDT(Layer[] inLayers)
inLayers
- the array of layers.protected java.util.List<LayerPane> getPanes()
protected void setPanes(java.util.List<LayerPane> lpa)
public void createPanel(Layer[] inLayers)
inLayers
- the Layer[] that reflects all possible layers that can be
added to the map.protected void addFillerToPanesPanel()
protected LayerPane createLayerPaneForLayer(Layer layer, LayerHandler layerHandler, javax.swing.ButtonGroup bg)
public void deletePanes(java.util.List<LayerPane> dpanes)
public void addLayerControls()
public LayerControlButtonPanel createControlButtons()
protected void setControlsAndNotify(LayerControlButtonPanel lcbp)
lcbp
- public void setControls(LayerControlButtonPanel lcbp)
lcbp
- public LayerControlButtonPanel getControls()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- ActionEventpublic void moveLayer(Layer layer, java.lang.String command)
protected void moveLayer(LayerPane lp, java.lang.String command)
protected LayerPane findSelectedPane()
protected void rejiggerMapLayers()
public void updateLayerLabels()
public void propertyChange(java.beans.PropertyChangeEvent pce)
propertyChange
in interface java.beans.PropertyChangeListener
public void findAndInit(java.lang.Object someObj)
findAndInit
in interface LightMapHandlerChild
findAndInit
in class OMComponentPanel
someObj
- the object being added to the BeanContextpublic void findAndUndo(java.lang.Object someObj)
findAndUndo
in interface LightMapHandlerChild
findAndUndo
in class OMComponentPanel
someObj
- the object being removed from the BeanContextpublic void setProperties(java.lang.String prefix, java.util.Properties props)
OMComponentPanel
setProperties
in interface PropertyConsumer
setProperties
in class OMToolComponent
prefix
- the token to prefix the property namesprops
- the Properties
objectpublic java.util.Properties getProperties(java.util.Properties props)
OMComponentPanel
getProperties
in interface PropertyConsumer
getProperties
in class OMToolComponent
props
- a Properties object to load the PropertyConsumer properties
into. If props equals null, then a new Properties object should be
created.
public java.util.Properties getPropertyInfo(java.util.Properties props)
OMComponentPanel
getPropertyInfo
in interface PropertyConsumer
getPropertyInfo
in class OMToolComponent
props
- a Properties object to load the PropertyConsumer properties
into. If getList equals null, then a new Properties object should
be created.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |