|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.bbn.openmap.Layer com.bbn.openmap.layer.OMGraphicHandlerLayer com.bbn.openmap.layer.link.LinkLayer
public class LinkLayer
The LinkLayer is a Swing component, and an OpenMap layer, that communicates with a server via the Link protocol. It transmits graphics requests and gesture information, and handles the responses to those queries. The entry in the openmap.properties file looks like this:
# port number of server link.port=3031 # host name of server link.host=host.com # URL of properties file for server attributes. Properties # contained in this file are passed directly to the server to provide # additional information to the server about how to provide the # graphics. Some standard properties are listed in the # LinkPropertiesConstants file, but any property can be passed to the # server. How the server handles the property depends on the server, # but non-applicable properties are ignored. link.propertiesURL=http://location.of.properties.file.comYou have to call setProperties() on this layer to set its parameters, and to start the thread that listens to updates from the server.
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 LinkProperties |
args
The special parameters (attributes) transmitted to the server with every query. |
static java.lang.String |
ArgsProperty
The property name to specify a URL of a properties file containing properties that will be sent to the server within requests to it. |
protected OMGridGenerator |
currentGenerator
The generator to use with LinkGrid objects. |
static int |
DEFAULT_DISTANCE_LIMIT
|
protected int |
distanceLimit
The maximum distance away a mouse event can happen away from a graphic in order for it to be considered to have touched. |
static java.lang.String |
DistanceLimitProperty
The property to set a pixel distance limit for gestures. |
static java.lang.String |
ExitOnCommandProperty
The property to set to true if the server should be able to decide when to kill the client, the overall application. |
protected int |
gestureDescriptor
A masked integer describing which gestures should be sent to the server. |
static java.lang.String |
GridGeneratorProperty
The property to specify which grid generator to use for grid objects. |
protected java.lang.String |
host
The host where the server is running. |
static java.lang.String |
HostProperty
The property name to specify the hostname the server is running on. |
protected LinkManager |
linkManager
The object that provides a link to the layer (and its various threads) on a coordinateed basis. |
protected LinkListener |
listener
The thread listener used to communicate asynchronously. |
protected int |
port
The port to connect to the server on. |
static java.lang.String |
PortProperty
The property name to specify what port the server is running on. |
protected boolean |
quiet
The flag to suppress pop-up messages. |
static java.lang.String |
QuietProperty
The property to make the layer quiet. |
static java.lang.String |
ServerLocationProperty
|
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 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 | |
---|---|
LinkLayer()
The default constructor for the Layer. |
|
LinkLayer(java.lang.String host,
int port,
java.lang.String propertiesURL)
Constructor to use when LinkLayer is not being used with OpenMap application. |
Method Summary | |
---|---|
void |
checkAndReplaceOldPropertyName(LinkProperties props,
java.lang.String oldPropertyName,
java.lang.String newPropertyName)
|
void |
checkAndReplaceOldPropertyNames(LinkProperties props)
The LinkPropertiesConstants have changed in LinkProtocol version .6, to much small strings that don't match up with the DrawingAttributes properties. |
void |
drawingComplete(OMGraphic omg,
OMAction action)
The method where a graphic, and an action to take on the graphic, arrives. |
int |
getDistanceLimit()
Get the search distance limit pixel distance for graphics searches. |
int |
getGestureDescriptor()
Gets the masked integer which indicates what types of events get sent to the server. |
LinkOMGraphicList |
getGraphicList()
Retrieves the current graphics list. |
protected LinkListener |
getListener()
|
MapMouseListener |
getMapMouseListener()
Return the MapMouseListener for the layer. |
java.lang.String[] |
getMouseModeServiceList()
Return the strings identifying the Mouse Modes that the MapMouseListener wants to receive gestures from. |
protected boolean |
graphicGestureReaction(OMGraphic graphic,
int descriptor,
java.awt.event.MouseEvent e)
Given a graphic and the type of gesture caught, react to it based on the properties object located in the Graphic. |
protected boolean |
handleGesture(int descriptor,
java.awt.event.MouseEvent e)
Send the query, act on the response, and tell the caller if the gesture was consumed. |
void |
handleLinkActionList(LinkActionList lal)
|
void |
handleLinkActionRequest(LinkActionRequest lar)
|
void |
handleLinkGraphicList(LinkGraphicList lgl)
|
void |
handleMessages(LinkProperties props)
Looks at a properties object, and checks for the pre-defined messaging attributes. |
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. |
OMGraphicList |
prepare()
Prepares the graphics for the layer. |
void |
removed(java.awt.Container cont)
Called when the layer is no longer part of the map. |
protected void |
sendMapRequest(ClientLink link,
Projection proj)
Creates the LinkMapRequest. |
void |
setDistanceLimit(int limit)
Set the search distance limit pixel distance for graphics searches. |
void |
setGestureDescriptor(int descriptor)
Sets the masked integer which indicates what types of events get sent to the server. |
void |
setGraphicList(LinkOMGraphicList aList)
Sets the current graphics list to the given list. |
protected void |
setListener(LinkListener ll)
|
void |
setProperties(java.lang.String prefix,
java.util.Properties properties)
Set all the Link properties from a properties object. |
void |
updateMap(LinkProperties props)
Looks at a properties object, and checks for map updates. |
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 com.bbn.openmap.tools.drawing.DrawingToolRequestor |
---|
getName |
Methods inherited from interface java.beans.beancontext.BeanContextChild |
---|
addPropertyChangeListener, removePropertyChangeListener |
Field Detail |
---|
protected LinkListener listener
protected int gestureDescriptor
protected int port
protected java.lang.String host
protected LinkProperties args
protected LinkManager linkManager
protected boolean quiet
protected OMGridGenerator currentGenerator
public static final java.lang.String PortProperty
public static final java.lang.String HostProperty
public static final java.lang.String ArgsProperty
public static final java.lang.String ServerLocationProperty
public static final java.lang.String QuietProperty
public static final java.lang.String GridGeneratorProperty
public static final java.lang.String DistanceLimitProperty
public static final int DEFAULT_DISTANCE_LIMIT
protected int distanceLimit
public static final java.lang.String ExitOnCommandProperty
Constructor Detail |
---|
public LinkLayer()
public LinkLayer(java.lang.String host, int port, java.lang.String propertiesURL)
host
- the hostname of the server's computer.port
- the port number of the server.propertiesURL
- the URL of a properties file that contains parameters for the
server.Method Detail |
---|
public void setGraphicList(LinkOMGraphicList aList)
aList
- a list of OMGraphicspublic LinkOMGraphicList getGraphicList()
public void removed(java.awt.Container cont)
removed
in class Layer
cont
- Containerpublic void setGestureDescriptor(int descriptor)
descriptor
- masked intLinkActionRequest
public int getGestureDescriptor()
LinkActionRequest
public void setProperties(java.lang.String prefix, java.util.Properties properties)
setProperties
in interface PropertyConsumer
setProperties
in class OMGraphicHandlerLayer
prefix
- the prefix to the properties that might individualize it to a
particular layer.properties
- the properties for the layer.public void checkAndReplaceOldPropertyNames(LinkProperties props)
props
- public void checkAndReplaceOldPropertyName(LinkProperties props, java.lang.String oldPropertyName, java.lang.String newPropertyName)
protected void setListener(LinkListener ll)
protected LinkListener getListener()
public OMGraphicList prepare()
Occasionally it is necessary to abort a prepare call. When this happens, the map will set the cancel bit in the LayerThread, (the thread that is running the prepare). If this Layer needs to do any cleanups during the abort, it should do so, but return out of the prepare asap.
prepare
in class OMGraphicHandlerLayer
protected void sendMapRequest(ClientLink link, Projection proj) throws java.io.IOException
link
- the link to communicate over.proj
- the projection to give to the graphics.
java.io.IOException
public void handleLinkGraphicList(LinkGraphicList lgl)
public void handleLinkActionList(LinkActionList lal)
public void handleLinkActionRequest(LinkActionRequest lar)
public void handleMessages(LinkProperties props)
props
- LinkProperties containing messages.public MapMouseListener getMapMouseListener()
getMapMouseListener
in class OMGraphicHandlerLayer
public java.lang.String[] getMouseModeServiceList()
getMouseModeServiceList
in interface MapMouseListener
NavMouseMode.modeID
,
SelectMouseMode.modeID
,
NullMouseMode.modeID
public boolean mousePressed(java.awt.event.MouseEvent e)
MapMouseListener
mousePressed
in interface MapMouseListener
e
- MouseEvent
public boolean mouseReleased(java.awt.event.MouseEvent e)
MapMouseListener
mouseReleased
in interface MapMouseListener
e
- MouseEvent
public boolean mouseClicked(java.awt.event.MouseEvent e)
MapMouseListener
mousePressed()
, or if no other listener
processes the event. If the listener successfully processes
mouseClicked()
, then it will receive the next
mouseClicked()
notifications that have a click
count greater than one.
NOTE: We have noticed that this method can sometimes be
erroneously invoked. It seems to occur when a light-weight AWT
component (like an internal window or menu) closes (removes
itself from the window hierarchy). A specific OpenMap example
is when you make a menu selection when the MenuItem you select
is above the MapBean canvas. After making the selection, the
mouseClicked() gets invoked on the MouseDelegator, which passes
it to the appropriate listeners depending on the MouseMode. The
best way to avoid this problem is to not implement anything
crucial in this method. Use a combination of
mousePressed()
and mouseReleased()
instead.
mouseClicked
in interface MapMouseListener
e
- MouseEvent
public void mouseEntered(java.awt.event.MouseEvent e)
MapMouseListener
mouseEntered
in interface MapMouseListener
e
- MouseEventpublic void mouseExited(java.awt.event.MouseEvent e)
MapMouseListener
mouseExited
in interface MapMouseListener
e
- MouseEventpublic boolean mouseDragged(java.awt.event.MouseEvent e)
MapMouseListener
mouseDragged
in interface MapMouseListener
e
- MouseEvent
public boolean mouseMoved(java.awt.event.MouseEvent e)
MapMouseListener
mouseMoved
in interface MapMouseListener
e
- MouseEvent
public void mouseMoved()
MapMouseListener
mouseMoved
in interface MapMouseListener
protected boolean graphicGestureReaction(OMGraphic graphic, int descriptor, java.awt.event.MouseEvent e)
graphic
- the graphic to check out.descriptor
- the type of gesture.e
- mouse event, to get location.
protected boolean handleGesture(int descriptor, java.awt.event.MouseEvent e)
descriptor
- a masked integer telling the type of gesture.e
- the MouseEvent.
public void drawingComplete(OMGraphic omg, OMAction action)
DrawingToolRequestor
drawingComplete
in interface DrawingToolRequestor
public void setDistanceLimit(int limit)
limit
- the pixel limit to consider something "closest".public int getDistanceLimit()
public void updateMap(LinkProperties props)
props
- LinkProperties containing map parameters.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |