uk.ac.starlink.topcat.interop
Class SampCommunicator

java.lang.Object
  extended by uk.ac.starlink.topcat.interop.SampCommunicator
All Implemented Interfaces:
TopcatCommunicator

public class SampCommunicator
extends Object
implements TopcatCommunicator

TopcatCommunicator implementation based on SAMP.

Since:
4 Sep 2008
Author:
Mark Taylor

Constructor Summary
SampCommunicator(ControlWindow controlWindow)
          Constructor.
 
Method Summary
 void addConnectionListener(ChangeListener listener)
          Adds a listener which will be notified any time that connection status may have changed.
 ImageActivity createImageActivity()
          Returns an object which can be used to display images.
 Transmitter createImageTransmitter(DensityWindow densWin)
          Returns an object that can send the density map currently displayed in the density plot window to other applications as a FITS image.
 JComponent createInfoPanel()
          Optionally returns a panel which can be displayed in the control window to show communications status.
 Transmitter createResourceListTransmitter(uk.ac.starlink.vo.RegistryPanel regPanel, String resourceType)
          Returns an object that can send the currently displayed resources from a registry panel.
 RowActivity createRowActivity()
          Returns an object which can be used to send messages highlighting single table rows.
 SkyPointActivity createSkyPointActivity()
          Returns an object which can be used to send messages drawing attention to particular sky positions.
 SpectrumActivity createSpectrumActivity()
          Returns an object which can be used to display spectra.
 SubsetActivity createSubsetActivity()
          Returns an object which can be used to send messages selecting table row subsets.
 Transmitter createSubsetTransmitter(TopcatModel tcModel, SubsetWindow subWin)
          Returns an object that can send the RowSubset currently selected in a given subset window to other applications as a row selection on a commonly-known table.
 Action createWindowAction(Component parent)
          Constructs an action which will display a control window for this communicator.
 org.astrogrid.samp.gui.GuiHubConnector getConnector()
          Returns the SAMP HubConnector used by this object.
 Action[] getInteropActions()
          Returns a list of actions suitable for insertion in a general purpose menu associated with interoperability functionality (register/unregister etc).
 String getProtocolName()
          Returns the name of the protocol over which this object is implemented.
 TopcatSampControl getSampControl()
          Returns the TopcatSampControl object used by this object.
 Transmitter getTableTransmitter()
          Returns an object that can send send the currently selected table from TOPCAT to other applications.
 boolean isConnected()
          Indicates (without attempting a connection) whether a hub connection is currently in force.
 void maybeStartHub()
          According to the policy of this communicator, this method may start a hub if none is already running.
static Map sanitizeMap(Map map)
          Makes sure that a map is SAMP-friendly.
 boolean setActive()
          Must be called before any of the actions provided by this object are used.
 void startHub(boolean external)
          Attempts to start a messaging hub suitable for use with this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SampCommunicator

public SampCommunicator(ControlWindow controlWindow)
                 throws IOException
Constructor.

Parameters:
controlWindow - TOPCAT control window
Throws:
IOException
Method Detail

getProtocolName

public String getProtocolName()
Description copied from interface: TopcatCommunicator
Returns the name of the protocol over which this object is implemented.

Specified by:
getProtocolName in interface TopcatCommunicator
Returns:
protocol name

setActive

public boolean setActive()
Description copied from interface: TopcatCommunicator
Must be called before any of the actions provided by this object are used. May initiate communication with the messaging system etc.

Specified by:
setActive in interface TopcatCommunicator
Returns:
true iff there is a current connection

getTableTransmitter

public Transmitter getTableTransmitter()
Description copied from interface: TopcatCommunicator
Returns an object that can send send the currently selected table from TOPCAT to other applications.

Specified by:
getTableTransmitter in interface TopcatCommunicator
Returns:
table transmitter

createImageTransmitter

public Transmitter createImageTransmitter(DensityWindow densWin)
Description copied from interface: TopcatCommunicator
Returns an object that can send the density map currently displayed in the density plot window to other applications as a FITS image.

Specified by:
createImageTransmitter in interface TopcatCommunicator
Parameters:
densWin - density plot window
Returns:
new image transmitter

createSubsetTransmitter

public Transmitter createSubsetTransmitter(TopcatModel tcModel,
                                           SubsetWindow subWin)
Description copied from interface: TopcatCommunicator
Returns an object that can send the RowSubset currently selected in a given subset window to other applications as a row selection on a commonly-known table.

Specified by:
createSubsetTransmitter in interface TopcatCommunicator
Parameters:
tcModel - table
subWin - subset window
Returns:
new subset transmitter

createResourceListTransmitter

public Transmitter createResourceListTransmitter(uk.ac.starlink.vo.RegistryPanel regPanel,
                                                 String resourceType)
Description copied from interface: TopcatCommunicator
Returns an object that can send the currently displayed resources from a registry panel.

Specified by:
createResourceListTransmitter in interface TopcatCommunicator
Parameters:
regPanel - registry panel component
resourceType - resource subtype - must match the appropriate voresource.loadlist.* MType subtype
Returns:
new resource list transmitter

createSkyPointActivity

public SkyPointActivity createSkyPointActivity()
Description copied from interface: TopcatCommunicator
Returns an object which can be used to send messages drawing attention to particular sky positions.

Specified by:
createSkyPointActivity in interface TopcatCommunicator
Returns:
new activity object

createRowActivity

public RowActivity createRowActivity()
Description copied from interface: TopcatCommunicator
Returns an object which can be used to send messages highlighting single table rows.

Specified by:
createRowActivity in interface TopcatCommunicator
Returns:
new activity object

createSubsetActivity

public SubsetActivity createSubsetActivity()
Description copied from interface: TopcatCommunicator
Returns an object which can be used to send messages selecting table row subsets.

Specified by:
createSubsetActivity in interface TopcatCommunicator
Returns:
new activity object

createSpectrumActivity

public SpectrumActivity createSpectrumActivity()
Description copied from interface: TopcatCommunicator
Returns an object which can be used to display spectra.

Specified by:
createSpectrumActivity in interface TopcatCommunicator
Returns:
new activity object

createImageActivity

public ImageActivity createImageActivity()
Description copied from interface: TopcatCommunicator
Returns an object which can be used to display images. Note this may include options apart from interop-type ones (display in local viewers).

Specified by:
createImageActivity in interface TopcatCommunicator
Returns:
new activity object

getInteropActions

public Action[] getInteropActions()
Description copied from interface: TopcatCommunicator
Returns a list of actions suitable for insertion in a general purpose menu associated with interoperability functionality (register/unregister etc).

Specified by:
getInteropActions in interface TopcatCommunicator
Returns:
action list

startHub

public void startHub(boolean external)
              throws IOException
Description copied from interface: TopcatCommunicator
Attempts to start a messaging hub suitable for use with this object.

Specified by:
startHub in interface TopcatCommunicator
Parameters:
external - true to run hub in external JVM, false to run it in the current one
Throws:
IOException

maybeStartHub

public void maybeStartHub()
                   throws IOException
Description copied from interface: TopcatCommunicator
According to the policy of this communicator, this method may start a hub if none is already running.

Specified by:
maybeStartHub in interface TopcatCommunicator
Throws:
IOException

createWindowAction

public Action createWindowAction(Component parent)
Description copied from interface: TopcatCommunicator
Constructs an action which will display a control window for this communicator.

Specified by:
createWindowAction in interface TopcatCommunicator
Parameters:
parent - parent component
Returns:
communicator control window, or null if none is available

isConnected

public boolean isConnected()
Description copied from interface: TopcatCommunicator
Indicates (without attempting a connection) whether a hub connection is currently in force.

Specified by:
isConnected in interface TopcatCommunicator
Returns:
whether hub is connected

addConnectionListener

public void addConnectionListener(ChangeListener listener)
Description copied from interface: TopcatCommunicator
Adds a listener which will be notified any time that connection status may have changed.

Specified by:
addConnectionListener in interface TopcatCommunicator
Parameters:
listener - listener to add

getConnector

public org.astrogrid.samp.gui.GuiHubConnector getConnector()
Returns the SAMP HubConnector used by this object.

Returns:
connector

getSampControl

public TopcatSampControl getSampControl()
Returns the TopcatSampControl object used by this object.

Returns:
samp control

createInfoPanel

public JComponent createInfoPanel()
Description copied from interface: TopcatCommunicator
Optionally returns a panel which can be displayed in the control window to show communications status.

Specified by:
createInfoPanel in interface TopcatCommunicator
Returns:
status component, or null if unimplemented

sanitizeMap

public static Map sanitizeMap(Map map)
Makes sure that a map is SAMP-friendly. Any entries which are not are simply discarded.



Copyright © 2003-2018 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.