Class SendManager

java.lang.Object
uk.ac.starlink.topcat.interop.SendManager

public class SendManager extends Object
Provides a ComboBoxModel allowing selection of SAMP clients subscribed to a given MType. An option corresponding to broadcast to all clients is also provided. This class is useful for implementing Activity subclasses using SAMP.
Since:
17 Sep 2008
Author:
Mark Taylor
  • Constructor Summary

    Constructors
    Constructor
    Description
    SendManager(org.astrogrid.samp.gui.GuiHubConnector connector, String mtype)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    call(Map<?,?> message)
    Sends a given message by call/response to the currently selected target client or clients.
    ListModel<org.astrogrid.samp.Client>
    Returns a list model containing all clients that are potential targets for this send manager.
    Returns a combo box model which allows to select any of the subscribed clients, or broadcast to all.
    org.astrogrid.samp.Client
    Returns the client currently selected for sending.
    void
    notify(Map<?,?> message)
    Sends a given message by notification to the currently selected target client or clients.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SendManager

      public SendManager(org.astrogrid.samp.gui.GuiHubConnector connector, String mtype)
      Constructor.
      Parameters:
      connector - hub connector
      mtype - MType to which all selectable clients must be subscribed
  • Method Details

    • getComboBoxModel

      public ComboBoxModel<Object> getComboBoxModel()
      Returns a combo box model which allows to select any of the subscribed clients, or broadcast to all.
      Returns:
      combo box model
    • getClientListModel

      public ListModel<org.astrogrid.samp.Client> getClientListModel()
      Returns a list model containing all clients that are potential targets for this send manager. If the list is empty, sending won't do anything. Note the content is not the same as for getComboBoxModel(), since this list contains only Client instances, not the Broadcast pseudo-client.
      Returns:
      list with only Client entries
    • getSelectedClient

      public org.astrogrid.samp.Client getSelectedClient()
      Returns the client currently selected for sending. If null, a broadcast is indicated.
      Returns:
      selected destination client, or null for broadcast
    • notify

      public void notify(Map<?,?> message) throws org.astrogrid.samp.client.SampException
      Sends a given message by notification to the currently selected target client or clients. This message will presumably have the MType supplied to this object in the constructor.
      Parameters:
      message - Message-like map
      Throws:
      org.astrogrid.samp.client.SampException
    • call

      public void call(Map<?,?> message) throws org.astrogrid.samp.client.SampException
      Sends a given message by call/response to the currently selected target client or clients. This message will presumably have the MType supplied to this object in the constructor. The response is logged, but nothing else is done with it.
      Parameters:
      message - Message-like map
      Throws:
      org.astrogrid.samp.client.SampException