com.bbn.openmap.gui
Class LayerPane

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.LayerPane
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
LayerStatusPane

public class LayerPane
extends javax.swing.JPanel
implements java.io.Serializable, java.awt.event.ActionListener, java.awt.event.ComponentListener

A LayerPane is a single instance of how a layer represented in the LayersPanel. It contains three widgets: an on/off button; a palette button; and a toggle button with the layer name.

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  I18n i18n
           
protected  Layer layer
           
protected  LayerHandler layerHandler
           
protected  javax.swing.JToggleButton layerName
           
protected static javax.swing.ImageIcon layerOffIcon
           
protected static javax.swing.ImageIcon layerOnIcon
           
static java.util.logging.Logger logger
           
protected  java.awt.Color offColor
           
protected  java.awt.Color onColor
           
protected  javax.swing.AbstractButton onoffButton
           
protected  javax.swing.AbstractButton paletteButton
           
protected static javax.swing.ImageIcon paletteIcon
           
protected static javax.swing.ImageIcon paletteOnIcon
           
protected  boolean selected
           
static java.lang.String showPaletteCmd
           
static java.lang.String toggleLayerCmd
           
protected static java.net.URL url1
           
protected static java.net.URL url2
           
protected static java.net.URL url3
           
protected static java.net.URL url4
           
 
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
  LayerPane(Layer layer, LayerHandler layerHandler, javax.swing.ButtonGroup bg)
           
protected LayerPane(java.lang.String title)
          Used for the background LayerPanel marker.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          ActionListener interface.
 void cleanup()
          LayerPane disconnects from listeners, nulls out components, shuts down layer palette.
 void cleanup(javax.swing.ButtonGroup bg)
          Same as cleanup, except the layer name toggle button gets removed from the given button group.
 void componentHidden(java.awt.event.ComponentEvent e)
          Invoked when component has been hidden.
 void componentMoved(java.awt.event.ComponentEvent e)
          Invoked when component has been moved.
 void componentResized(java.awt.event.ComponentEvent e)
          Invoked when component has been resized.
 void componentShown(java.awt.event.ComponentEvent e)
          Invoked when component has been shown.
protected  void createGUI(javax.swing.ButtonGroup bg)
           
protected  javax.swing.AbstractButton createOnOffButton()
          Simply creates the AbstractButton object that turns the layer on/off.
protected  javax.swing.AbstractButton createPaletteButton()
          Simply creates the AbstractButton object that turns the layer palette on/off.
static LayerPane getBackgroundLayerSeparator(java.lang.String title)
           
 Layer getLayer()
           
protected  LayerHandler getLayerHandler()
           
 java.awt.Dimension getMinimumSize()
           
protected  javax.swing.AbstractButton getOnOffButton()
          Calls createOnOFfButton to create the button, and then adds all the behavior settings to the button.
protected  javax.swing.AbstractButton getPaletteButton()
          Calls createPaletteButton to create the button, and then adds all the behavior settings to the button.
 java.awt.Dimension getPreferredSize()
           
protected  void hidePalette()
           
 boolean isLayerOn()
           
 boolean isPaletteOn()
           
 boolean isSelected()
           
 void setLayerHandler(LayerHandler in_layerHandler)
           
 void setLayerOn(boolean value)
          Turns the button on or off
 void setPaletteOn(boolean value)
          Turns the palette button on or off
 void setSelected(boolean select)
          Highlights/de-highlights the panel border.
protected  void showPalette()
           
 void updateLayerLabel()
          Tell the pane to check with the layer to get the current layer name for it's label.
 
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, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, 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, 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
 

Field Detail

logger

public static java.util.logging.Logger logger

onoffButton

protected transient javax.swing.AbstractButton onoffButton

paletteButton

protected transient javax.swing.AbstractButton paletteButton

layerName

protected transient javax.swing.JToggleButton layerName

selected

protected transient boolean selected

layer

protected transient Layer layer

layerHandler

protected transient LayerHandler layerHandler

url1

protected static transient java.net.URL url1

paletteIcon

protected static transient javax.swing.ImageIcon paletteIcon

url2

protected static transient java.net.URL url2

paletteOnIcon

protected static transient javax.swing.ImageIcon paletteOnIcon

url3

protected static transient java.net.URL url3

layerOnIcon

protected static transient javax.swing.ImageIcon layerOnIcon

url4

protected static transient java.net.URL url4

layerOffIcon

protected static transient javax.swing.ImageIcon layerOffIcon

showPaletteCmd

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

toggleLayerCmd

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

offColor

protected java.awt.Color offColor

onColor

protected java.awt.Color onColor

i18n

protected I18n i18n
Constructor Detail

LayerPane

public LayerPane(Layer layer,
                 LayerHandler layerHandler,
                 javax.swing.ButtonGroup bg)
Parameters:
layer - the layer to be represented by the pane.
bg - the buttongroup for the layer
layerHandler - the LayerHandler that contains information about the Layers.

LayerPane

protected LayerPane(java.lang.String title)
Used for the background LayerPanel marker.

Method Detail

createGUI

protected void createGUI(javax.swing.ButtonGroup bg)

createOnOffButton

protected javax.swing.AbstractButton createOnOffButton()
Simply creates the AbstractButton object that turns the layer on/off. Override this if you want to change the kind of button used.

Returns:
AbstractButton in an off state.

getOnOffButton

protected javax.swing.AbstractButton getOnOffButton()
Calls createOnOFfButton to create the button, and then adds all the behavior settings to the button. Override this if you want to change everything about the button.

Returns:
AbstractButton in an off state.

createPaletteButton

protected javax.swing.AbstractButton createPaletteButton()
Simply creates the AbstractButton object that turns the layer palette on/off. Override this if you want to change the kind of button used.

Returns:
AbstractButton in an off state.

getPaletteButton

protected javax.swing.AbstractButton getPaletteButton()
Calls createPaletteButton to create the button, and then adds all the behavior settings to the button. Override this if you want to change everything about the button.

Returns:
AbstractButton in an off state.

setLayerHandler

public void setLayerHandler(LayerHandler in_layerHandler)

getLayerHandler

protected LayerHandler getLayerHandler()
Returns:
LayerHandler if it has been found in the MapHandler or set.

cleanup

public void cleanup(javax.swing.ButtonGroup bg)
Same as cleanup, except the layer name toggle button gets removed from the given button group.


cleanup

public void cleanup()
LayerPane disconnects from listeners, nulls out components, shuts down layer palette.


getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

isLayerOn

public boolean isLayerOn()
Returns:
whether the layer is on

setLayerOn

public void setLayerOn(boolean value)
Turns the button on or off


isPaletteOn

public boolean isPaletteOn()
Returns:
whether the palette for this layer is on

setPaletteOn

public void setPaletteOn(boolean value)
Turns the palette button on or off


isSelected

public boolean isSelected()
Returns:
the status of the layerName toggle button

setSelected

public void setSelected(boolean select)
Highlights/de-highlights the panel border.


getLayer

public Layer getLayer()
Returns:
the layer represented by this LayerPane

updateLayerLabel

public void updateLayerLabel()
Tell the pane to check with the layer to get the current layer name for it's label.


showPalette

protected void showPalette()

hidePalette

protected void hidePalette()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
ActionListener interface.

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

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Invoked when component has been resized.

Specified by:
componentResized in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Invoked when component has been moved.

Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Invoked when component has been shown.

Specified by:
componentShown in interface java.awt.event.ComponentListener

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Invoked when component has been hidden.

Specified by:
componentHidden in interface java.awt.event.ComponentListener

getBackgroundLayerSeparator

public static LayerPane getBackgroundLayerSeparator(java.lang.String title)


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