LabelLayer (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.layer
Class LabelLayer

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  com.bbn.openmap.Layer
                      com.bbn.openmap.layer.OMGraphicHandlerLayer
                          com.bbn.openmap.layer.LabelLayer

All Implemented Interfaces:
  MapMouseListener, ProjectionListener, GestureResponsePolicy, OMGraphicHandler, ProjectionPainter, PropertyConsumer, Taskable, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener

Direct Known Subclasses:
  DateLayer

    public class LabelLayer

extends OMGraphicHandlerLayer
implements Taskable, MapMouseListener

Layer that displays a label. This Layer is a Taskable (ActionListener) object so that it can be prompted by a javax.swing.Timer object. This layer understands the following properties:

       # display font as a Java font string
       label.font=SansSerif-Bold
       # like XWindows geometry: [+-]X[+-]Y, `+' indicates relative to
       # left edge or top edges, `-' indicates relative to right or bottom
       # edges, XX is x coordinate, YY is y coordinate
       label.geometry=+20-30
       # background rectangle color (ARGB)
       label.color.bg=ffb3b3b3
       # foreground text color (ARGB)
       label.color.fg=ff000000
       # date format (using java.text.SimpleDateFormat patterns)
       label.text=The Graph

In addition to the previous properties, you can get this layer to work with the OpenMap viewer by adding/editing the additional properties in your `openmap.properties` file:

       # layers
       openmap.layers=label ...
       # class
       label.class=com.bbn.openmap.layer.LabelLayer
       # name
       label.prettyName=Label Layer

NOTE: the color properties do not support alpha value if running on JDK 1.1...

See Also:
  Serialized Form

Nested Class Summary

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.Color` | `bgColor`
`static java.lang.String` | `bgColorProperty`
`protected int` | `bgColorValue`
`protected java.awt.Color` | `fgColor`
`static java.lang.String` | `fgColorProperty`
`protected int` | `fgColorValue`
`protected java.awt.Font` | `font`
`static java.lang.String` | `fontProperty`
`protected java.lang.String` | `fontString`
`static java.lang.String` | `geometryProperty`
`protected java.lang.String` | `geometryString`
`static java.lang.String` | `labelProperty`
`protected java.lang.String` | `labelText`
`protected OMText` | `text`
`protected java.lang.String` | `xgrav`
`protected int` | `xpos`
`protected java.lang.String` | `ygrav`
`protected int` | `ypos`

Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
`consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, layerWorkerQueue, logger, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty`

Fields inherited from class com.bbn.openmap.Layer
`addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, coordTransform, DataPathPrefixProperty, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, localHackList, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, readyToPaint, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, TransformProperty, 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
`LabelLayer()` Construct the LabelLayer.

Method Summary
`void` | `actionPerformed(java.awt.event.ActionEvent e)` Invoked by a javax.swing.Timer.
`java.lang.String` | `getLabelText()` Get the String to display
`MapMouseListener` | `getMapMouseListener()` Returns the MapMouseListener object that handles the mouse events.
`java.lang.String[]` | `getMouseModeServiceList()` Return a list of the modes that are interesting to the MapMouseListener.
`int` | `getSleepHint()` Get the sleep hint in milliseconds.
`boolean` | `mouseClicked(java.awt.event.MouseEvent e)` Invoked when the mouse has been clicked on a component.
`boolean` | `mouseDragged(java.awt.event.MouseEvent e)` Invoked when a mouse button is pressed on a component and then dragged.
`void` | `mouseEntered(java.awt.event.MouseEvent e)` Invoked when the mouse enters a component.
`void` | `mouseExited(java.awt.event.MouseEvent e)` Invoked when the mouse exits a component.
`void` | `mouseMoved()` Handle a mouse cursor moving without the button being pressed.
`boolean` | `mouseMoved(java.awt.event.MouseEvent e)` Invoked when the mouse button has been moved on a component (with no buttons down).
`boolean` | `mousePressed(java.awt.event.MouseEvent e)` Invoked when a mouse button has been pressed on a component.
`boolean` | `mouseReleased(java.awt.event.MouseEvent e)` Invoked when a mouse button has been released on a component.
`void` | `paint(java.awt.Graphics g)` Paints the layer.
`protected void` | `parseGeometryString()` Parse X-like geometry string.
`protected void` | `positionText(int w, int h)` Position the text graphic
`void` | `setLabelText(java.lang.String s)` Set the text to display
`void` | `setProperties(java.lang.String prefix, java.util.Properties props)` Sets the properties for the `Layer`.

Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
`canSetList, copy, createLayerWorker, cut, deselect, dispose, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getDefaultSettingsPanel, getFilter, getInfoText, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getProperties, getPropertyInfo, getRedrawButton, getRenderPolicy, getSelected, getSettingsButton, getToolTipTextFor, getTransparency, getTransparencyAdjustmentPanel, highlight, isCancelled, isHighlightable, isInterruptable, isSelectable, isWorking, leftClick, mouseOver, paste, prepare, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, select, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setRenderPolicy, setTransparency, supportsSQL, unhighlight, workerComplete`

Methods inherited from class com.bbn.openmap.Layer
`addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, disconnectFromBeanContext, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getCoordTransform, getGUI, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setCoordTransform, setIcon, setLayerProperties, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setReadyToPaint, setRemovable, setVisible, setWindowSupport, showPalette`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, 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, unregisterKeyboardAction, update, updateUI`

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, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, 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, 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, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.beans.beancontext.BeanContextChild
`addPropertyChangeListener, removePropertyChangeListener`

Field Detail

### fontProperty

    public static final transient java.lang.String fontProperty

See Also:
  Constant Field Values

### fgColorProperty

    public static final transient java.lang.String fgColorProperty

See Also:
  Constant Field Values

### bgColorProperty

    public static final transient java.lang.String bgColorProperty

See Also:
  Constant Field Values

### geometryProperty

    public static final transient java.lang.String geometryProperty

See Also:
  Constant Field Values

### labelProperty

    public static final transient java.lang.String labelProperty

See Also:
  Constant Field Values

### fontString

    protected java.lang.String fontString

### font

    protected java.awt.Font font

### fgColorValue

    protected int fgColorValue

### fgColor

    protected java.awt.Color fgColor

### bgColorValue

    protected int bgColorValue

### bgColor

    protected java.awt.Color bgColor

### geometryString

    protected java.lang.String geometryString

### labelText

    protected java.lang.String labelText

### text

    protected OMText text

### xpos

    protected int xpos

### ypos

    protected int ypos

### xgrav

    protected java.lang.String xgrav

### ygrav

    protected java.lang.String ygrav

Constructor Detail

### LabelLayer

    public LabelLayer()

  Construct the LabelLayer.

Method Detail

### setProperties

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

  Sets the properties for the `Layer`.

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

### parseGeometryString

    protected void parseGeometryString()

  Parse X-like geometry string.

### positionText

    protected void positionText(int w,
                                int h)

  Position the text graphic

### setLabelText

    public void setLabelText(java.lang.String s)

  Set the text to display

  Parameters:
    `s` - String

### getLabelText

    public java.lang.String getLabelText()

  Get the String to display

  Returns:
    String

### paint

    public void paint(java.awt.Graphics g)

  Paints the layer.

  Overrides:
    `paint` in class `OMGraphicHandlerLayer`
  Parameters:
    `g` - the Graphics context for painting

### actionPerformed

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

  Invoked by a javax.swing.Timer.

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`
  Overrides:
    `actionPerformed` in class `OMGraphicHandlerLayer`
  Parameters:
    `e` - ActionEvent

### getMapMouseListener

    public MapMouseListener getMapMouseListener()

  Returns the MapMouseListener object that handles the mouse events.

  Overrides:
    `getMapMouseListener` in class `OMGraphicHandlerLayer`
  Returns:
    MapMouseListener this

### getMouseModeServiceList

    public java.lang.String[] getMouseModeServiceList()

  Return a list of the modes that are interesting to the MapMouseListener.

  Specified by:
    `getMouseModeServiceList` in interface `MapMouseListener`
  Returns:
    String[] { SelectMouseMode.modeID }
  See Also:
    `NavMouseMode.modeID`, `SelectMouseMode.modeID`, `NullMouseMode.modeID`

### mousePressed

    public boolean mousePressed(java.awt.event.MouseEvent e)

  Invoked when a mouse button has been pressed on a component.

  Specified by:
    `mousePressed` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    false

### mouseReleased

    public boolean mouseReleased(java.awt.event.MouseEvent e)

  Invoked when a mouse button has been released on a component.

  Specified by:
    `mouseReleased` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    false

### mouseClicked

    public boolean mouseClicked(java.awt.event.MouseEvent e)

  Invoked when the mouse has been clicked on a component.

  Specified by:
    `mouseClicked` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    false

### mouseEntered

    public void mouseEntered(java.awt.event.MouseEvent e)

  Invoked when the mouse enters a component.

  Specified by:
    `mouseEntered` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent

### mouseExited

    public void mouseExited(java.awt.event.MouseEvent e)

  Invoked when the mouse exits a component.

  Specified by:
    `mouseExited` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent

### mouseDragged

    public boolean mouseDragged(java.awt.event.MouseEvent e)

  Invoked when a mouse button is pressed on a component and then dragged. The listener will receive these events if it

  Specified by:
    `mouseDragged` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    false

### mouseMoved

    public boolean mouseMoved(java.awt.event.MouseEvent e)

  Invoked when the mouse button has been moved on a component (with no buttons down).

  Specified by:
    `mouseMoved` in interface `MapMouseListener`
  Parameters:
    `e` - MouseEvent
  Returns:
    false

### mouseMoved

    public void mouseMoved()

  Handle a mouse cursor moving without the button being pressed. Another layer has consumed the event.

  Specified by:
    `mouseMoved` in interface `MapMouseListener`

### getSleepHint

    public int getSleepHint()

  Description copied from interface: `Taskable`
  Get the sleep hint in milliseconds. The Taskable implementation should determine the sleep (delay) interval between invocations of its `actionPerformed()`.

  NOTE: this is only a hint for the timer. It's the Taskable's responsibility to determine if too little or too much time has elapsed between invocations of `actionPerformed()`.

  Specified by:
    `getSleepHint` in interface `Taskable`
  Returns:
    int milliseconds of sleep interval

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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