com.bbn.openmap
Class Layer

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.bbn.openmap.Layer
All Implemented Interfaces:
java.awt.event.ActionListener, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, ProjectionListener, ProjectionPainter, PropertyConsumer, java.io.Serializable
Direct Known Subclasses:
BufferedLayer, CacheLayer, DTEDLayer, HelloWorldLayer, LocationLayer, OMGraphicHandlerLayer, OverviewMapAreaLayer, RouteLayer, RouteLayer, ScaleFilterLayer, SimpleBeanLayer, SinkLayer, TextLayer

public abstract class Layer
extends javax.swing.JComponent
implements ProjectionListener, ProjectionPainter, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, PropertyConsumer, java.awt.event.ActionListener

Layer objects are components which can be added to the MapBean to make a map.

Layers implement the ProjectionListener interface to listen for ProjectionEvents. When the projection changes, they may need to refetch, regenerate their graphics, and then repaint themselves into the new view.

When the Layer is added to the MapBean, it will start receiving ProjectionEvents via the ProjectionListener.projectionChanged() method it has to implement. There is a setProjection(ProjectionEvent) methods that should be called from there if you want to save the projection for later use (handling MouseEvents, etc). If you call getProjection() before calling setProjection(), getProjection() will return null, and your OMGraphics will complain and probably freak out at some point.

 //// SAMPLE handling of the ProjectionListener interface.
 
 public void projectionChanged(com.bbn.openmap.event.ProjectionEvent pe) {
     Projection proj = setProjection(pe);
     if (proj != null) {
         // Use the projection to gather OMGraphics in the layer,
         // and prepare the layer so that in the paint() method,
         // the OMGraphics get rendered.  
 
         // Call any methods that kick off work to build graphics
         // here...
 
         // You get the paint() methods called by calling
         // repaint():
         repaint();
     }
 
     fireStatusUpdate(LayerStatusEvent.FINISH_WORKING);
 }
 

See Also:
ProjectionListener, ProjectionEvent, PropertyConsumer, Serialized Form

Field Summary
protected  boolean addAsBackground
          Flag used by the layer to indicate that it should be treated as a background layer, indicating that any cache mechanism available can enable extra buffering.
static java.lang.String AddAsBackgroundProperty
          Property 'background' to designate this layer as a background layer, which will cause extra buffering to occur if the application can handle it.
protected  boolean addToBeanContext
          Used by the LayerHandler to check if the layer should be added to the MapHandler BeanContext.
static java.lang.String AddToBeanContextProperty
          The property to set to add the layer to the BeanContext "addToBeanContext".
protected  boolean autoPalette
          A flag to have the layer display it's palette when the properties are set.
static java.lang.String AutoPaletteProperty
          The property to show the palette when the layer is created - or, more accurately, when the properties are set.
protected  java.beans.beancontext.BeanContextChildSupport beanContextChildSupport
          The BeanContext allows Layers to find other components, and other components to find the layer, if the layer is added to it.
static java.lang.String DisplayPaletteCmd
          Layer-defined action event command to display the palette.
static java.lang.String DisplayPropertiesCmd
          Layer-defined action event command to display the properties using an Inspector.
protected  boolean doHack
          Part of a layer hack to notify the component listener when the component is hidden.
static java.lang.String HidePaletteCmd
          Layer-defined action event command to hide the palette.
protected  I18n i18n
          All layers have access to an I18n object, which is provided by the Environment.
protected  ListenerSupport IDListeners
          The listeners to the Layer that respond to requests for information displays, like messages, requests for URL displays, etc.
protected  ListenerSupport localHackList
          Part of a layer hack to notify the component listener when the component is hidden.
protected  ListenerSupport lsListeners
          List of LayerStatusListeners.
protected  java.awt.Container palette
          A pointer to the JDialog or JInternalFrame.
protected  java.awt.event.ComponentListener paletteListener
          A helper component listener that is paying attention to the visibility of the palette.
static java.lang.String PrettyNameProperty
          The String to use for a key lookup in a Properties object to find the name to use in a GUI relating to this layer.
protected  java.lang.String propertyPrefix
          Token uniquely identifying this layer in the application properties.
static java.lang.String RedrawCmd
          Layer-defined action event command to force a redraw on the layer.
protected  boolean removable
          Flag to designate the layer as removable or not.
static java.lang.String RemovableProperty
          Property 'removable' to designate this layer as removable from the application, or able to be deleted.
static java.lang.String RemoveableProperty
          Deprecated. use RemovableProperty
protected static java.lang.String SWING_PACKAGE
          Precaches the swing package.
protected  WindowSupport windowSupport
          Support class that now handles palette windows.
 
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
Layer()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
          The default actionPerformed method for Layer.
 void addComponentListener(java.awt.event.ComponentListener cl)
          Part of a layer hack to notify the component listener when the component is hidden.
 void added(java.awt.Container cont)
          This method is called when the layer is added to the MapBean
 void addInfoDisplayListener(InfoDisplayListener aInfoDisplayListener)
          Adds a listener for InfoDisplayEvents.
 void addLayerStatusListener(LayerStatusListener aLayerStatusListener)
          Adds a listener for LayerStatusEvents.
 void addMouseListener(java.awt.event.MouseListener l)
          Override to only allow swing package listeners.
 void addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener in_vcl)
          Method for BeanContextChild interface.
 void childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)
          BeanContextMembershipListener method.
 void childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)
          BeanContextMembershipListener method.
 void clearListeners()
           
 void connectToBeanContext(java.beans.beancontext.BeanContext in_bc)
          Layer method to just connect to the BeanContext, without grabbing the interator as in setBeanContext().
protected  WindowSupport createWindowSupport()
           
 void finalize()
           
 void findAndInit(java.util.Iterator it)
          This is the method that your layer can use to find other objects within the MapHandler (BeanContext).
 void findAndInit(java.lang.Object obj)
          This method is called by the findAndInit(Iterator) method, once for every object inside the iterator.
 void findAndUndo(java.lang.Object obj)
          This is the method that does the opposite as the findAndInit(Object).
 void fireHideToolTip()
          Request to hide the tool tips on the map.
 void fireHideToolTip(java.awt.event.MouseEvent me)
          Deprecated. use fireHideToolTip() instead.
 void firePaletteEvent(java.awt.event.ComponentEvent event)
          Fire a component event to the Layer component listeners, with the palette as the component, letting them know if it's visible or not.
 void fireRequestBrowserContent(InfoDisplayEvent evt)
          Sends a request to the InfoDisplay listener to display the information in the InfoDisplay event in a Browser.
 void fireRequestBrowserContent(java.lang.String browserContent)
          Sends a request to the InfoDisplayListener to display the information in a Browser.
 void fireRequestCursor(java.awt.Cursor cursor)
          Sends a request to the InfoDisplayListener to show a specific cursor over its component area.
 void fireRequestInfoLine(InfoDisplayEvent evt)
          Sends a request to the InfoDisplayListener to show the information in the InfoDisplay event on an single line display facility.
 void fireRequestInfoLine(java.lang.String infoLine)
          Sends a request to the InfoDisplay listener to display the information on an single line display facility.
 void fireRequestInfoLine(java.lang.String infoLine, int loc)
          Sends a request to the InfoDisplay listener to display the information on an single line display facility at preferred location.
 void fireRequestMessage(InfoDisplayEvent evt)
          Sends a request to the InfoDisplayListener to put the information in the InfoDisplay event in a dialog window.
 void fireRequestMessage(java.lang.String message)
          Sends a request to the InfoDisplayListener to display the information in a dialog window.
 void fireRequestToolTip(InfoDisplayEvent event)
          Fire off a Tool Tip request to the InfoDisplayListeners.
 void fireRequestToolTip(java.awt.event.MouseEvent me, InfoDisplayEvent event)
          Deprecated. use fireHideToolTip(InfoDisplayEvent) instead.
 void fireRequestToolTip(java.awt.event.MouseEvent me, java.lang.String tip)
          Deprecated. use fireRequestToolTip(String tip) instead.
 void fireRequestToolTip(java.lang.String tip)
          Request to show the tool tips on the map.
 void fireRequestURL(InfoDisplayEvent evt)
          Sends a request to the InfoDisplayListener to display a URL given in the InfoDisplay event in a Browser.
 void fireRequestURL(java.lang.String url)
          Sends a request to the InfoDisplayListener to display a URL in a browser.
 void fireStatusUpdate(int status)
          Sends a status update to the LayerStatusListener.
 void fireStatusUpdate(LayerStatusEvent evt)
          Sends a status update to the LayerStatusListener.
 void fireVetoableChange(java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
          Report a vetoable property update to any registered listeners.
 boolean getAddAsBackground()
          Check to see if the layer is marked as one that should be considered a background layer.
 boolean getAddToBeanContext()
          Set whether the Layer should be added to the BeanContext.
 java.beans.beancontext.BeanContext getBeanContext()
          Method for BeanContextChild interface.
 java.awt.Component getGUI()
          Gets the gui controls associated with the layer.
 MapMouseListener getMapMouseListener()
          Returns the MapMouseListener object that handles the mouse events.
protected static java.lang.String getPackage(java.lang.Class c)
          Returns the package of the given class as a string.
 java.awt.Container getPalette()
          Return the JDialog, or JInternalFrame, that serves as the palette for the layer.
 Projection getProjection()
          Get the latest projection.
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the layer.
 java.util.Properties getPropertyInfo(java.util.Properties list)
          Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
 java.lang.String getPropertyPrefix()
          Get the property key prefix that is being used to prepend to the property keys for Properties lookups.
 WindowSupport getWindowSupport()
          Get the WindowSupport object handling the palette.
 void hidePalette()
          Hide the layer's palette.
 boolean isRemovable()
          Check to see if the layer is marked as one that can be removed from an application.
 boolean isRemoveable()
          Deprecated. isRemovable() should be used instead.
 void notifyHideHack()
          Part of a layer hack to notify the component listener when the component is hidden.
 void removeComponentListener(java.awt.event.ComponentListener cl)
          Part of a layer hack to notify the component listener when the component is hidden.
 boolean removeConfirmed()
          Check to see if the removable layer can be removed now.
 void removed(java.awt.Container cont)
          This method is called after the layer is removed from the MapBean and when the projection changes.
 void removeInfoDisplayListener(InfoDisplayListener aInfoDisplayListener)
          Removes an InfoDisplayListener from this Layer.
 void removeLayerStatusListener(LayerStatusListener aLayerStatusListener)
          Removes a LayerStatusListene from this Layer.
 void removeVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener in_vcl)
          Method for BeanContextChild interface.
 void renderDataForProjection(Projection proj, java.awt.Graphics g)
          This method is here to provide a default action for Layers as they act as a ProjectionPainter.
 void repaint(long tm, int x, int y, int width, int height)
          Repaint the layer.
protected  void resetPalette()
          Called when something about the layer has changed that would require the palette to be reconfigured.
 void setAddAsBackground(boolean set)
          Mark the layer as one that should be considered a background layer.
 void setAddToBeanContext(boolean set)
          Set whether the Layer should be added to the BeanContext.
 void setBeanContext(java.beans.beancontext.BeanContext in_bc)
          Method for BeanContextChild interface.
 void setName(java.lang.String name)
           
 void setPaletteVisible(boolean visible)
          Make the palette visible or not, destroy if invisible.
 void setProjection(Projection proj)
          Set the projection the layer should use for calculations.
 Projection setProjection(ProjectionEvent projEvent)
          This method lets you take the ProjectionEvent received from the MapBean, and lets you know if you should do something with it.
 void setProperties(java.util.Properties props)
          Sets the properties for the Layer.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the Layer.
 void setPropertyPrefix(java.lang.String prefix)
          Set the property key prefix that should be used by the PropertyConsumer.
 void setRemovable(boolean set)
          Mark the layer as removable, or one that can be deleted from the application.
 void setRemoveable(boolean set)
          Deprecated. setRemovable() should be used instead.
 void setVisible(boolean show)
          Part of a layer hack to notify the component listener when the component is hidden.
 void setWindowSupport(WindowSupport ws)
          Set the WindowSupport object handling the palette.
 void showPalette()
          Make the palette visible.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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 com.bbn.openmap.event.ProjectionListener
projectionChanged
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

SWING_PACKAGE

protected static final java.lang.String SWING_PACKAGE
Precaches the swing package. Computed based on the package of JComponent.


PrettyNameProperty

public static final java.lang.String PrettyNameProperty
The String to use for a key lookup in a Properties object to find the name to use in a GUI relating to this layer.

See Also:
Constant Field Values

AddToBeanContextProperty

public static final java.lang.String AddToBeanContextProperty
The property to set to add the layer to the BeanContext "addToBeanContext". This probably needs be set by the layer itself, because it knows whether it needs other components or not. However, this property is defined in case an option can be given to the user. If a Layer doesn't want this option given, it should reset the addToBeanContext variable after setProperties() is called. The Layer.setProperties() methods maintain the current state of the variable if undefined, which is true by default.

See Also:
Constant Field Values

AddAsBackgroundProperty

public static final java.lang.String AddAsBackgroundProperty
Property 'background' to designate this layer as a background layer, which will cause extra buffering to occur if the application can handle it. False by default.

See Also:
Constant Field Values

RemovableProperty

public static final java.lang.String RemovableProperty
Property 'removable' to designate this layer as removable from the application, or able to be deleted. True by default.

See Also:
Constant Field Values

RemoveableProperty

public static final java.lang.String RemoveableProperty
Deprecated. use RemovableProperty

Misspelled property 'removeable' to designate this layer as removable from the application, or able to be deleted. True by default. Going away. Really.

See Also:
Constant Field Values

AutoPaletteProperty

public static final java.lang.String AutoPaletteProperty
The property to show the palette when the layer is created - or, more accurately, when the properties are set.

See Also:
Constant Field Values

DisplayPaletteCmd

public static final java.lang.String DisplayPaletteCmd
Layer-defined action event command to display the palette.

See Also:
Constant Field Values

HidePaletteCmd

public static final java.lang.String HidePaletteCmd
Layer-defined action event command to hide the palette.

See Also:
Constant Field Values

DisplayPropertiesCmd

public static final java.lang.String DisplayPropertiesCmd
Layer-defined action event command to display the properties using an Inspector.

See Also:
Constant Field Values

RedrawCmd

public static final java.lang.String RedrawCmd
Layer-defined action event command to force a redraw on the layer. The Layer class does not respond to this command, it's provided as a convenience.

See Also:
Constant Field Values

IDListeners

protected ListenerSupport IDListeners
The listeners to the Layer that respond to requests for information displays, like messages, requests for URL displays, etc.


lsListeners

protected ListenerSupport lsListeners
List of LayerStatusListeners.


propertyPrefix

protected java.lang.String propertyPrefix
Token uniquely identifying this layer in the application properties.


addToBeanContext

protected boolean addToBeanContext
Used by the LayerHandler to check if the layer should be added to the MapHandler BeanContext. See the comments under the AddToBeanContextProperty. True by default.


addAsBackground

protected boolean addAsBackground
Flag used by the layer to indicate that it should be treated as a background layer, indicating that any cache mechanism available can enable extra buffering. This may prevent mouse events from being received by the layer.


removable

protected boolean removable
Flag to designate the layer as removable or not.


autoPalette

protected boolean autoPalette
A flag to have the layer display it's palette when the properties are set. If you are creating a layer manually, just call showPalette() instead.


windowSupport

protected transient WindowSupport windowSupport
Support class that now handles palette windows.


paletteListener

protected transient java.awt.event.ComponentListener paletteListener
A helper component listener that is paying attention to the visibility of the palette.


palette

protected transient java.awt.Container palette
A pointer to the JDialog or JInternalFrame. May be used by the layer's ComponentListeners to figure out if a component event is for the layer or for the palette.


beanContextChildSupport

protected final java.beans.beancontext.BeanContextChildSupport beanContextChildSupport
The BeanContext allows Layers to find other components, and other components to find the layer, if the layer is added to it.


i18n

protected I18n i18n
All layers have access to an I18n object, which is provided by the Environment.


localHackList

protected ListenerSupport localHackList
Part of a layer hack to notify the component listener when the component is hidden. These components don't receive the ComponentHidden notification. Remove when it works.


doHack

protected boolean doHack
Part of a layer hack to notify the component listener when the component is hidden. These components don't receive the ComponentHidden notification. Remove when it works. Set to false to test.

Constructor Detail

Layer

public Layer()
Method Detail

getPackage

protected static java.lang.String getPackage(java.lang.Class c)
Returns the package of the given class as a string.

Parameters:
c - a class

addMouseListener

public final void addMouseListener(java.awt.event.MouseListener l)
Override to only allow swing package listeners. If Listeners get added to the Layers, the mouse events don't make it to the map. Ever.

Swing popup menus, like JPopupMenu grab the JComponent by adding themselves as MouseListener s. So this method allows instances of classes in the xxx.swing package to be added as MouseListeners, and no one else.

Overrides:
addMouseListener in class java.awt.Component
Parameters:
l - a mouse listener.

setProperties

public void setProperties(java.util.Properties props)
Sets the properties for the Layer. This particular method assumes that the marker name is not needed, because all of the contents of this Properties object are to be used for this layer, and scoping the properties with a prefix is unnecessary.

Specified by:
setProperties in interface PropertyConsumer
Parameters:
props - the Properties object.

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Sets the properties for the Layer. Part of the PropertyConsumer interface. Layers which override this method should do something like:
 public void setProperties(String prefix, Properties props) {
     super.setProperties(prefix, props);
     // do local stuff
 }
 
If the addToBeanContext property is not defined, it maintains the same state.

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

setName

public void setName(java.lang.String name)
Overrides:
setName in class java.awt.Component

getProperties

public java.util.Properties getProperties(java.util.Properties props)
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the layer. If the layer has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each propery key it uses for configuration.

Specified by:
getProperties in interface PropertyConsumer
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 list)
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
Parameters:
list - 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.

setPropertyPrefix

public void setPropertyPrefix(java.lang.String prefix)
Set the property key prefix that should be used by the PropertyConsumer. The prefix, along with a '.', should be prepended to the property keys known by the PropertyConsumer.

Specified by:
setPropertyPrefix in interface PropertyConsumer
Parameters:
prefix - the prefix String.

getPropertyPrefix

public java.lang.String getPropertyPrefix()
Get the property key prefix that is being used to prepend to the property keys for Properties lookups.

Specified by:
getPropertyPrefix in interface PropertyConsumer
Returns:
the property prefix for the layer

setProjection

public void setProjection(Projection proj)
Set the projection the layer should use for calculations. You probably don't need this if you are wondering if you do. Call setProjection(projEvent) instead.


setProjection

public Projection setProjection(ProjectionEvent projEvent)
This method lets you take the ProjectionEvent received from the MapBean, and lets you know if you should do something with it. MUST to be called in the projectionChanged() method of your layer, if you want to refer to the projection later. If this methods returns null, you probably just want to call repaint() if your layer.paint() method is ready to paint what it should.

Parameters:
projEvent - the ProjectionEvent from the ProjectionListener method.
Returns:
The new Projection if it is different from the one we already have, null if is the same as the current one.

getProjection

public Projection getProjection()
Get the latest projection.


getMapMouseListener

public MapMouseListener getMapMouseListener()
Returns the MapMouseListener object that handles the mouse events. This method is IGNORED in this class: it returns null. Derived Layers should return the appropriate object if they desire to receive MouseEvents. The easiest thing for a Layer to do in order to receive MouseEvents is to implement the MapMouseListener interface and return itself. A code snippet:
 public MapMouseListener getMapMouseListener() {
     return this;
 }
 
 public String[] getMouseModeServiceList() {
     return new String[] { SelectMouseMode.modeID };
 }
 

Returns:
null

getGUI

public java.awt.Component getGUI()
Gets the gui controls associated with the layer. This default implementation returns null indicating that the layer has no gui controls.

Returns:
java.awt.Component or null

addInfoDisplayListener

public void addInfoDisplayListener(InfoDisplayListener aInfoDisplayListener)
Adds a listener for InfoDisplayEvents.

Parameters:
aInfoDisplayListener - the listener to add

removeInfoDisplayListener

public void removeInfoDisplayListener(InfoDisplayListener aInfoDisplayListener)
Removes an InfoDisplayListener from this Layer.

Parameters:
aInfoDisplayListener - the listener to remove

fireRequestInfoLine

public void fireRequestInfoLine(InfoDisplayEvent evt)
Sends a request to the InfoDisplayListener to show the information in the InfoDisplay event on an single line display facility.

Parameters:
evt - the InfoDisplay event carrying the string.

fireRequestInfoLine

public void fireRequestInfoLine(java.lang.String infoLine)
Sends a request to the InfoDisplay listener to display the information on an single line display facility. The InfoDisplayEvent is created inside this function.

Parameters:
infoLine - the string to put in the InfoDisplayEvent.

fireRequestInfoLine

public void fireRequestInfoLine(java.lang.String infoLine,
                                int loc)
Sends a request to the InfoDisplay listener to display the information on an single line display facility at preferred location. The InfoDisplayEvent is created inside this function.

Parameters:
infoLine - the string to put in the InfoDisplayEvent.
loc - the index of a preferred location, starting at 0.

fireRequestBrowserContent

public void fireRequestBrowserContent(InfoDisplayEvent evt)
Sends a request to the InfoDisplay listener to display the information in the InfoDisplay event in a Browser.

Parameters:
evt - the InfoDisplayEvent holding the contents to put in the Browser.

fireRequestBrowserContent

public void fireRequestBrowserContent(java.lang.String browserContent)
Sends a request to the InfoDisplayListener to display the information in a Browser. The InfoDisplayEvent is created here holding the browserContent

Parameters:
browserContent - the contents to put in the Browser.

fireRequestURL

public void fireRequestURL(InfoDisplayEvent evt)
Sends a request to the InfoDisplayListener to display a URL given in the InfoDisplay event in a Browser.

Parameters:
evt - the InfoDisplayEvent holding the url location to give to the Browser.

fireRequestURL

public void fireRequestURL(java.lang.String url)
Sends a request to the InfoDisplayListener to display a URL in a browser. The InfoDisplayEvent is created here, and the URL location is put inside it.

Parameters:
url - the url location to give to the Browser.

fireRequestCursor

public void fireRequestCursor(java.awt.Cursor cursor)
Sends a request to the InfoDisplayListener to show a specific cursor over its component area.

Parameters:
cursor - the cursor to use.

fireRequestMessage

public void fireRequestMessage(InfoDisplayEvent evt)
Sends a request to the InfoDisplayListener to put the information in the InfoDisplay event in a dialog window.

Parameters:
evt - the InfoDisplayEvent holding the message to put into the dialog window.

fireRequestMessage

public void fireRequestMessage(java.lang.String message)
Sends a request to the InfoDisplayListener to display the information in a dialog window. The InfoDisplayEvent is created here, and the URL location is put inside it.

Parameters:
message - the message to put in the dialog window.

fireRequestToolTip

public void fireRequestToolTip(java.awt.event.MouseEvent me,
                               java.lang.String tip)
Deprecated. use fireRequestToolTip(String tip) instead.

Request to show the tool tips on the map.

Parameters:
me - MouseEvent location for the tool tip.
tip - string to display.

fireRequestToolTip

public void fireRequestToolTip(java.lang.String tip)
Request to show the tool tips on the map.

Parameters:
tip - string to display.

fireHideToolTip

public void fireHideToolTip(java.awt.event.MouseEvent me)
Deprecated. use fireHideToolTip() instead.

Request to hide the tool tips on the map.

Parameters:
me - MouseEvent location.

fireHideToolTip

public void fireHideToolTip()
Request to hide the tool tips on the map.


fireRequestToolTip

public void fireRequestToolTip(java.awt.event.MouseEvent me,
                               InfoDisplayEvent event)
Deprecated. use fireHideToolTip(InfoDisplayEvent) instead.

Fire off a Tool Tip request to the InfoDisplayListeners. If the InfoDisplayEvent is null, then a requestHideToolTip will be fired.


fireRequestToolTip

public void fireRequestToolTip(InfoDisplayEvent event)
Fire off a Tool Tip request to the InfoDisplayListeners. If the InfoDisplayEvent is null, then a requestHideToolTip will be fired.


addLayerStatusListener

public void addLayerStatusListener(LayerStatusListener aLayerStatusListener)
Adds a listener for LayerStatusEvents.

Parameters:
aLayerStatusListener - LayerStatusListener

removeLayerStatusListener

public void removeLayerStatusListener(LayerStatusListener aLayerStatusListener)
Removes a LayerStatusListene from this Layer.

Parameters:
aLayerStatusListener - the listener to remove

fireStatusUpdate

public void fireStatusUpdate(LayerStatusEvent evt)
Sends a status update to the LayerStatusListener.

Parameters:
evt - LayerStatusEvent

fireStatusUpdate

public void fireStatusUpdate(int status)
Sends a status update to the LayerStatusListener.

Parameters:
status - the new status

repaint

public void repaint(long tm,
                    int x,
                    int y,
                    int width,
                    int height)
Repaint the layer. If you are using BufferedMapBean for your application, WE STRONGLY RECOMMEND THAT YOU DO NOT OVERRIDE THIS METHOD. This method marks the layer buffer so that it will be refreshed. If you override this method, and don't call super.repaint(), the layers will not be repainted.

Overrides:
repaint in class javax.swing.JComponent

renderDataForProjection

public void renderDataForProjection(Projection proj,
                                    java.awt.Graphics g)
This method is here to provide a default action for Layers as they act as a ProjectionPainter. Normally, ProjectionPainters are expected to receive the projection, gather/create OMGraphics that apply to the projection, and render them into the Graphics provided. This is supposed to be done in the same thread that calls this function, so the caller knows that when this method returns, everything that the ProjectionPainter needed to do is complete.

If the layer doesn't override this method, then the paint(Graphics) method will be called.

Specified by:
renderDataForProjection in interface ProjectionPainter
Parameters:
proj - Projection of the map.
g - java.awt.Graphics to draw into.

added

public void added(java.awt.Container cont)
This method is called when the layer is added to the MapBean

Parameters:
cont - Container

removed

public void removed(java.awt.Container cont)
This method is called after the layer is removed from the MapBean and when the projection changes. We recommend that Layers override this method and nullify memory-intensive variables.

Parameters:
cont - Container

setVisible

public void setVisible(boolean show)
Part of a layer hack to notify the component listener when the component is hidden. These components don't receive the ComponentHidden notification. Remove when it works.

Overrides:
setVisible in class javax.swing.JComponent

addComponentListener

public void addComponentListener(java.awt.event.ComponentListener cl)
Part of a layer hack to notify the component listener when the component is hidden. These components don't receive the ComponentHidden notification. Remove when it works.

Overrides:
addComponentListener in class java.awt.Component

removeComponentListener

public void removeComponentListener(java.awt.event.ComponentListener cl)
Part of a layer hack to notify the component listener when the component is hidden. These components don't receive the ComponentHidden notification. Remove when it works.

Overrides:
removeComponentListener in class java.awt.Component

notifyHideHack

public void notifyHideHack()
Part of a layer hack to notify the component listener when the component is hidden. These components don't receive the ComponentHidden notification. Remove when it works.


setAddToBeanContext

public void setAddToBeanContext(boolean set)
Set whether the Layer should be added to the BeanContext.


getAddToBeanContext

public boolean getAddToBeanContext()
Set whether the Layer should be added to the BeanContext.


setAddAsBackground

public void setAddAsBackground(boolean set)
Mark the layer as one that should be considered a background layer. What that means is up to the MapBean or application.


getAddAsBackground

public boolean getAddAsBackground()
Check to see if the layer is marked as one that should be considered a background layer. What that means is up to the MapBean or application.

Returns:
true if layer is a background layer.

setRemoveable

public void setRemoveable(boolean set)
Deprecated. setRemovable() should be used instead.

Mark the layer as removable, or one that can be deleted from the application. What that means is up to the LayerHandler or other application components. This is the misspelled version of the method, it's going away. Really.


isRemoveable

public boolean isRemoveable()
Deprecated. isRemovable() should be used instead.

Check to see if the layer is marked as one that can be removed from an application. This is the misspelled version of the method, it's going away. Really.

Returns:
true if layer should be allowed to be deleted.

setRemovable

public void setRemovable(boolean set)
Mark the layer as removable, or one that can be deleted from the application. What that means is up to the LayerHandler or other application components.


isRemovable

public boolean isRemovable()
Check to see if the layer is marked as one that can be removed from an application.

Returns:
true if layer should be allowed to be deleted.

removeConfirmed

public boolean removeConfirmed()
Check to see if the removable layer can be removed now.

Returns:
true if layer should be allowed to be deleted.

findAndInit

public void findAndInit(java.util.Iterator it)
This is the method that your layer can use to find other objects within the MapHandler (BeanContext). This method gets called when the Layer gets added to the MapHandler, or when another object gets added to the MapHandler after the Layer is a member. If the LayerHandler creates the Layer from properties, the LayerHandler will add the Layer to the BeanContext if Layer.addToBeanContext is true. It is false by default. For Layers, this method doesn't do anything by default. If you need your layer to get ahold of another object, then you can use the Iterator to go through the objects to look for the one you need.


findAndInit

public void findAndInit(java.lang.Object obj)
This method is called by the findAndInit(Iterator) method, once for every object inside the iterator. It's here to allow subclasses a way to receive objects and still let the super classes have a shot at the object. So, you can override this method can call super.findAndInit(obj), or override the findAndInit(Iterator) method and call super.findAndInit(obj). Whatever.


childrenAdded

public void childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)
BeanContextMembershipListener method. Called when a new object is added to the BeanContext of this object.

Specified by:
childrenAdded in interface java.beans.beancontext.BeanContextMembershipListener

childrenRemoved

public void childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)
BeanContextMembershipListener method. Called when a new object is removed from the BeanContext of this object. For the Layer, this method doesn't do anything. If your layer does something with the childrenAdded method, or findAndInit, you should take steps in this method to unhook the layer from the object used in those methods.

Specified by:
childrenRemoved in interface java.beans.beancontext.BeanContextMembershipListener

findAndUndo

public void findAndUndo(java.lang.Object obj)
This is the method that does the opposite as the findAndInit(Object). Lets you call super classes with objects that need to be removed.


getBeanContext

public java.beans.beancontext.BeanContext getBeanContext()
Method for BeanContextChild interface.

Specified by:
getBeanContext in interface java.beans.beancontext.BeanContextChild

setBeanContext

public void setBeanContext(java.beans.beancontext.BeanContext in_bc)
                    throws java.beans.PropertyVetoException
Method for BeanContextChild interface. Gets an iterator from the BeanContext to call findAndInit() over.

Specified by:
setBeanContext in interface java.beans.beancontext.BeanContextChild
java.beans.PropertyVetoException

connectToBeanContext

public void connectToBeanContext(java.beans.beancontext.BeanContext in_bc)
                          throws java.beans.PropertyVetoException
Layer method to just connect to the BeanContext, without grabbing the interator as in setBeanContext(). Good for protected sub-layers where you want to optimize the calling of the findAndInit() method over them.

java.beans.PropertyVetoException

addVetoableChangeListener

public void addVetoableChangeListener(java.lang.String propertyName,
                                      java.beans.VetoableChangeListener in_vcl)
Method for BeanContextChild interface. Uses the BeanContextChildSupport to add a listener to this object's property. This listener wants to have the right to veto a property change.

Specified by:
addVetoableChangeListener in interface java.beans.beancontext.BeanContextChild

removeVetoableChangeListener

public void removeVetoableChangeListener(java.lang.String propertyName,
                                         java.beans.VetoableChangeListener in_vcl)
Method for BeanContextChild interface. Uses the BeanContextChildSupport to remove a listener to this object's property. The listener has the power to veto property changes.

Specified by:
removeVetoableChangeListener in interface java.beans.beancontext.BeanContextChild

fireVetoableChange

public void fireVetoableChange(java.lang.String name,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
                        throws java.beans.PropertyVetoException
Report a vetoable property update to any registered listeners. If anyone vetos the change, then fire a new event reverting everyone to the old value and then rethrow the PropertyVetoException.

No event is fired if old and new are equal and non-null.

Overrides:
fireVetoableChange in class javax.swing.JComponent
Parameters:
name - The programmatic name of the property that is about to change
oldValue - The old value of the property
newValue - - The new value of the property
Throws:
java.beans.PropertyVetoException - if the recipient wishes the property change to be rolled back.

clearListeners

public void clearListeners()

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

firePaletteEvent

public void firePaletteEvent(java.awt.event.ComponentEvent event)
Fire a component event to the Layer component listeners, with the palette as the component, letting them know if it's visible or not.


getPalette

public java.awt.Container getPalette()
Return the JDialog, or JInternalFrame, that serves as the palette for the layer. May be null.


resetPalette

protected void resetPalette()
Called when something about the layer has changed that would require the palette to be reconfigured. Will cause getGUI() to be called again. You should take steps before calling this method to make sure that the getGUI() method is ready to recreate the palette components from scratch if needed.


setPaletteVisible

public void setPaletteVisible(boolean visible)
Make the palette visible or not, destroy if invisible.


setWindowSupport

public void setWindowSupport(WindowSupport ws)
Set the WindowSupport object handling the palette.


getWindowSupport

public WindowSupport getWindowSupport()
Get the WindowSupport object handling the palette.


createWindowSupport

protected WindowSupport createWindowSupport()

showPalette

public void showPalette()
Make the palette visible. Will automatically determine if we're running in an applet environment and will use a JInternalFrame over a JFrame if necessary.


hidePalette

public void hidePalette()
Hide the layer's palette.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
The default actionPerformed method for Layer. Make sure you call super.actionPerformed if you care about receiving palette show/hide commands. This method is also set up to receive the DisplayPropertiesCmd, and will bring up the Inspector for the layer.

Specified by:
actionPerformed in interface java.awt.event.ActionListener


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