Package uk.ac.starlink.topcat.activate
Class SampSender
- java.lang.Object
-
- uk.ac.starlink.topcat.activate.SampSender
-
public class SampSender extends java.lang.Object
Takes care of sending SAMP messages from activation methods.It does a similar job to its predecessor
SendManager
, which it cannibalises, but unlike that class it provides support for synchronous message sending (call/callAll), with result strings handed back to the calling code rather than just discarded or pushed through the logging system.- Since:
- 27 Mar 2018
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description SampSender(java.lang.String mtype)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Outcome
activateMessage(java.util.Map<?,?> message)
Invoked to perform an activation action which involves sending a SAMP message to this sender's currently selected target client(s).javax.swing.ListModel<org.astrogrid.samp.Client>
getClientListModel()
Returns a list of the clients that are current possible targets for this sender's messages (subscribed to the relevant MType).javax.swing.ComboBoxModel<java.lang.Object>
getClientSelectionModel()
Returns a ComboBoxModel listing clients that are subscribed to this sender's MType.org.astrogrid.samp.gui.GuiHubConnector
getConnector()
Returns this sender's hub connector.java.lang.String
getMType()
Returns the MType of the message that this sender will send.TopcatSampControl
getSampControl()
Returns this sender's Samp control.java.lang.String
getUnavailableText()
Returns a message explaining why this sender can't do any useful work at the moment.boolean
hasClients()
Indicates whether any registered clients are subscribed to this sender's MType.boolean
isAvailable()
Indicates whether this sender has a chance of working.
-
-
-
Method Detail
-
getMType
public java.lang.String getMType()
Returns the MType of the message that this sender will send.- Returns:
- MType
-
isAvailable
public boolean isAvailable()
Indicates whether this sender has a chance of working.- Returns:
- false if this will never work
-
getClientListModel
public javax.swing.ListModel<org.astrogrid.samp.Client> getClientListModel()
Returns a list of the clients that are current possible targets for this sender's messages (subscribed to the relevant MType). If this list is empty, then the sender can't currently do any useful work.- Returns:
- listmodel containing appropriately-subscribed clients
-
hasClients
public boolean hasClients()
Indicates whether any registered clients are subscribed to this sender's MType.- Returns:
- true iff at least one subscribed client is present
-
getClientSelectionModel
public javax.swing.ComboBoxModel<java.lang.Object> getClientSelectionModel()
Returns a ComboBoxModel listing clients that are subscribed to this sender's MType. It may also contain an object representing broadcast.- Returns:
- client selection list
-
getSampControl
public TopcatSampControl getSampControl()
Returns this sender's Samp control.- Returns:
- samp control object
-
getConnector
public org.astrogrid.samp.gui.GuiHubConnector getConnector()
Returns this sender's hub connector.- Returns:
- connector object
-
activateMessage
public Outcome activateMessage(java.util.Map<?,?> message)
Invoked to perform an activation action which involves sending a SAMP message to this sender's currently selected target client(s).- Parameters:
message
- message to send- Returns:
- outcome
-
getUnavailableText
public java.lang.String getUnavailableText()
Returns a message explaining why this sender can't do any useful work at the moment. If it can, null is returned.- Returns:
- unavailablity message, or null if all is working
-
-