Class SendManager


  • public class SendManager
    extends java.lang.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, java.lang.String mtype)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void call​(java.util.Map<?,​?> message)
      Sends a given message by call/response to the currently selected target client or clients.
      javax.swing.ListModel<org.astrogrid.samp.Client> getClientListModel()
      Returns a list model containing all clients that are potential targets for this send manager.
      javax.swing.ComboBoxModel<java.lang.Object> getComboBoxModel()
      Returns a combo box model which allows to select any of the subscribed clients, or broadcast to all.
      org.astrogrid.samp.Client getSelectedClient()
      Returns the client currently selected for sending.
      void notify​(java.util.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 Detail

      • SendManager

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

      • getComboBoxModel

        public javax.swing.ComboBoxModel<java.lang.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 javax.swing.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​(java.util.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​(java.util.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