Package uk.ac.starlink.topcat.activate
Class SampSender
java.lang.Object
uk.ac.starlink.topcat.activate.SampSender
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 -
Method Summary
Modifier and TypeMethodDescriptionactivateMessage
(Map<?, ?> message) Invoked to perform an activation action which involves sending a SAMP message to this sender's currently selected target client(s).ListModel<org.astrogrid.samp.Client>
Returns a list of the clients that are current possible targets for this sender's messages (subscribed to the relevant MType).Returns a ComboBoxModel listing clients that are subscribed to this sender's MType.org.astrogrid.samp.gui.GuiHubConnector
Returns this sender's hub connector.getMType()
Returns the MType of the message that this sender will send.Returns this sender's Samp control.Returns a message explaining why this sender can't do any useful work at the moment.boolean
Indicates whether any registered clients are subscribed to this sender's MType.boolean
Indicates whether this sender has a chance of working.
-
Constructor Details
-
SampSender
Constructor. The supplied MType determines what the offered list of recipient clients will contain.- Parameters:
mtype
- message type to which this sender is sensitive
-
-
Method Details
-
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
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
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
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
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
-