## com.bbn.openmap.graphicLoader.netmap
Class NetMapConnector

    java.lang.Object
      com.bbn.openmap.graphicLoader.netmap.NetMapConnector

All Implemented Interfaces:
  java.awt.event.ActionListener, java.util.EventListener, NetMapConstants, PropertyConsumer

public class NetMapConnector
extends java.lang.Object
implements java.awt.event.ActionListener, NetMapConstants, PropertyConsumer

The NetMapConnector is the bridge between the parser from the output of the NetMap server (NetMapReader), and whoever wants the OMGraphicList that is being mananged. It forwards the list on to the NetMapListReceiver that wants the list. The NetMapConnector will create it's NetMapReader to control and use. If you have a component that wants to receive updates from the reader, then you can register as an NetMapListener with the NetMapConnector. The NetMapConnector can be used in conjunction with the NetMapConnectionHandler. The NetMapConnectionHandler will look for NetMapConnectors in the BeanContext (MapHandler), and create a NetMapGraphicLoader for it. That will set off the GraphicLoader -> GraphicLoaderConnector -> GraphicLoaderPlugIn -> PlugInLayer creation chain, if the GraphicLoaderConnector is also in the MapHandler. The following properties can be set:

      server=hostname of the NetMap server
      port=port of NetMap server
      defaultView=default view for NetMap server stream

Field Summary
`protected java.lang.String` `defaultView` The NetMap server has a notion of views that represent nodes and links, and these are names.
`static java.lang.String` `DefaultViewProperty`
`static java.lang.String` `GetViewsCmd`
`static java.lang.String` `LoadViewCmd`
`protected java.lang.String` `port`
`static java.lang.String` `PortProperty`
`protected java.lang.String` `propertyPrefix`
`protected java.lang.String` `server`
`static java.lang.String` `ServerConnectCmd`
`static java.lang.String` `ServerDisconnectCmd`
`static java.lang.String` `ServerProperty`
`static java.lang.String` `STATUS_CONNECTED`
`static java.lang.String` `STATUS_CONNECTING`
`static java.lang.String` `STATUS_IDLE`

Fields inherited from interface com.bbn.openmap.graphicLoader.netmap.NetMapConstants

`CLEAR, COMMAND_FIELD, DATABASE_TAG_FIELD, DEFAULT_PORT, DEFAULT_SERVER, ELEVATION_FIELD, ERROR_VALUE_DOUBLE, ERROR_VALUE_FLOAT, ERROR_VALUE_INT, HEIGHT_FIELD, ICON_FIELD, INDEX_FIELD, IP_FIELD, JMAP_VIEW_CMD, JOFFSET_FIELD, LABEL_FIELD, LAT_FIELD, LINE_DELETE, LINE_DELETE_STRING, LINK_NODE1_FIELD, LINK_NODE2_FIELD, LINK_OBJECT, LINK_OBJECT_STATUS, LON_FIELD, MENU_FIELD, NAME_FIELD, NODE_DELETE, NODE_DELETE_STRING, NODE_MOVE, NODE_MOVE_STRING, NODE_OBJECT, NODE_OBJECT_STATUS, POSX_FIELD, POSY_FIELD, REFRESH, SHAPE_FIELD, STATUS_FIELD, TIME_FIELD, UPDATE, WIDTH_FIELD`

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Constructor Summary
`NetMapConnector()`

Method Summary
`void` `actionPerformed(java.awt.event.ActionEvent ae)` Act on GUI commands controlling the NetMapReader.
`void` `addNetMapListener(NetMapListener nml)` Add a NetMapListener to receive NetMapEvents.
`void` `clearNetMapListeners()` Clear all NetMapListeners from receiving NetMapEvents.
`void` `connect(java.lang.String view)` Connects to the NetMap server to get messages about the given view.
`protected void` `connectionDown()` Callback for the NetMapReader to let it provide the connector with connection status.
`protected void` `connectionUp()` Callback for the NetMapReader to let it provide the connector with connection status.
`void` `disconnect()` Resets the controls to the disconnected mode.
`protected void` `distributeEvent(java.util.Properties netmapProps)` Called by the NetMapReader so a parsed line, representing an event, can be dispersed to the listeners.
`java.lang.String` `getDefaultView()` Get the defaultView to use for NetMap server queries.
`java.awt.Component` `getGUI()` Gets the GUI control for the NetMapReader, creates it if it doesn't exist.
`java.lang.String` `getPort()` Get the port that the NetMap server is running on.
`java.util.Properties` `getProperties(java.util.Properties list)` Method to fill in a Properties object, reflecting the current values of the PropertyConsumer.
`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.
`java.lang.String` `getServer()` Get the hostname or IP address of the NetMap server.
`ChoiceList` `getViews()` Gets a list of possible views.
`void` `removeNetMapListener(NetMapListener nml)` Remove a NetMapListener from the list to receive NetMapEvents.
`void` `reset()` Complete disconnect, sends clear command to NetMapListeners, resets GUI if it's being used.
`void` `setDefaultView(java.lang.String view)` Set the defaultView to use for NetMap server queries.
`void` `setPort(java.lang.String port)` Set the port that the NetMap server is running on.
`void` `setProperties(java.util.Properties setList)` Method to set the properties in the PropertyConsumer.
`void` `setProperties(java.lang.String prefix, java.util.Properties setList)` Method to set the properties in the PropertyConsumer.
`void` `setPropertyPrefix(java.lang.String prefix)` Set the property key prefix that should be used by the PropertyConsumer.
`void` `setServer(java.lang.String sName)` Set the hostname or IP address to use to contact the NetMap server.

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

Field Detail

### ServerConnectCmd

    public static final java.lang.String ServerConnectCmd

See Also:
  Constant Field Values

### ServerDisconnectCmd

    public static final java.lang.String ServerDisconnectCmd

See Also:
  Constant Field Values

### LoadViewCmd

    public static final java.lang.String LoadViewCmd

See Also:
  Constant Field Values

### GetViewsCmd

    public static final java.lang.String GetViewsCmd

See Also:
  Constant Field Values

### ServerProperty

    public static final java.lang.String ServerProperty

See Also:
  Constant Field Values

### PortProperty

    public static final java.lang.String PortProperty

See Also:
  Constant Field Values

### DefaultViewProperty

    public static final java.lang.String DefaultViewProperty

See Also:
  Constant Field Values

### STATUS_CONNECTING

    public static final java.lang.String STATUS_CONNECTING

See Also:
  Constant Field Values

### STATUS_CONNECTED

    public static final java.lang.String STATUS_CONNECTED

See Also:
  Constant Field Values

### STATUS_IDLE

    public static final java.lang.String STATUS_IDLE

See Also:
  Constant Field Values

### server

    protected java.lang.String server

### port

    protected java.lang.String port

### defaultView

    protected java.lang.String defaultView

  The NetMap server has a notion of views that represent nodes and links, and these are names. If using a GUI, the view names will show up because they are received from the NetMap server. Programmatically, you can set what the default view should be.

### propertyPrefix

    protected java.lang.String propertyPrefix

Constructor Detail

### NetMapConnector

    public NetMapConnector()

Method Detail

### setServer

    public void setServer(java.lang.String sName)

  Set the hostname or IP address to use to contact the NetMap server.

### getServer

    public java.lang.String getServer()

  Get the hostname or IP address of the NetMap server.

### setPort

    public void setPort(java.lang.String port)

  Set the port that the NetMap server is running on.

### getPort

    public java.lang.String getPort()

  Get the port that the NetMap server is running on.

### setDefaultView

    public void setDefaultView(java.lang.String view)

  Set the defaultView to use for NetMap server queries.

### getDefaultView

    public java.lang.String getDefaultView()

  Get the defaultView to use for NetMap server queries.

### addNetMapListener

    public void addNetMapListener(NetMapListener nml)

  Add a NetMapListener to receive NetMapEvents.

### removeNetMapListener

    public void removeNetMapListener(NetMapListener nml)

  Remove a NetMapListener from the list to receive NetMapEvents.

### clearNetMapListeners

    public void clearNetMapListeners()

  Clear all NetMapListeners from receiving NetMapEvents.

### distributeEvent

    protected void distributeEvent(java.util.Properties netmapProps)

  Called by the NetMapReader so a parsed line, representing an event, can be dispersed to the listeners.

### actionPerformed

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

  Act on GUI commands controlling the NetMapReader.

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

### connectionUp

    protected void connectionUp()

  Callback for the NetMapReader to let it provide the connector with connection status.

### connectionDown

    protected void connectionDown()

  Callback for the NetMapReader to let it provide the connector with connection status.

### disconnect

    public void disconnect()

  Resets the controls to the disconnected mode.

### getViews

    public ChoiceList getViews()

  Gets a list of possible views.

  Returns:
    ChoiceList of possible views retrieved from the NetMap server.

### connect

    public void connect(java.lang.String view)

  Connects to the NetMap server to get messages about the given view.

### reset

    public void reset()

  Complete disconnect, sends clear command to NetMapListeners, resets GUI if it's being used.

### getGUI

    public java.awt.Component getGUI()

  Gets the GUI control for the NetMapReader, creates it if it doesn't exist.

### setProperties

    public void setProperties(java.util.Properties setList)

  Method to set the properties in the PropertyConsumer. It is assumed that the properties do not have a prefix associated with them, or that the prefix has already been set.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Parameters:
    `setList` - a properties object that the PropertyConsumer can use to retrieve expected properties it can use for configuration.

### setProperties

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

  Method to set the properties in the PropertyConsumer. The prefix is a string that should be prepended to each property key (in addition to a separating '.') in order for the PropertyConsumer to uniquely identify properties meant for it, in the midst of of Properties meant for several objects.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Parameters:
    `prefix` - a String used by the PropertyConsumer to prepend to each property value it wants to look up - setList.getProperty(prefix.propertyKey). If the prefix had already been set, then the prefix passed in should replace that previous value.
    `setList` - a Properties object that the PropertyConsumer can use to retrieve expected properties it can use for configuration.

### getProperties

    public java.util.Properties getProperties(java.util.Properties list)

  Method to fill in a Properties object, reflecting the current values of the PropertyConsumer. If the PropertyConsumer has a prefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

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

### 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.).

  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

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