Class NotifyActionManager

java.lang.Object
org.astrogrid.samp.gui.SendActionManager
org.astrogrid.samp.gui.NotifyActionManager

public abstract class NotifyActionManager extends SendActionManager
SendActionManager subclass which works with messages of a single MType, using the Notify delivery pattern.
Since:
5 Sep 2008
Author:
Mark Taylor
  • Constructor Details

    • NotifyActionManager

      public NotifyActionManager(Component parent, GuiHubConnector connector, String mtype, String sendType)
      Constructor.
      Parameters:
      parent - parent component
      connector - hub connector
      mtype - MType for messages transmitted by this object's actions
      sendType - short string identifying the kind of thing being sent (used for action descriptions etc)
  • Method Details

    • createMessage

      protected abstract Map createMessage() throws Exception
      Generates the message which is sent to one or all clients by this object's actions.
      Returns:
      Message-like Map representing message to transmit
      Throws:
      Exception
    • messageSent

      protected void messageSent(HubConnection connection, Message msg, Client[] recipients)
      Called when a message has been sent by this object. The default action is to notify via the logging system. Subclasses may override this method.
      Parameters:
      connection - connection object
      msg - the message which was sent
      recipients - the recipients to whom an attempt was made to send the message
    • createBroadcastAction

      protected Action createBroadcastAction()
      Description copied from class: SendActionManager
      Returns a new action for broadcast associated with this object. The enabled status of the action will be managed by this object.
      Specified by:
      createBroadcastAction in class SendActionManager
      Returns:
      broadcast action; may be null if broadcast is not required
    • createSendMenu

      public JMenu createSendMenu()
      Returns a new menu for targetted sends with a title suitable for this object.
      Returns:
      new send menu
    • getSendAction

      protected Action getSendAction(Client client)
      Description copied from class: SendActionManager
      Returns an action which can perform a single-client send associated with this object. If it implements equals (and hashCode) intelligently there will be efficiency advantages. The enabled status of such actions will be managed by this object.
      Specified by:
      getSendAction in class SendActionManager
      Parameters:
      client - recipient client
      Returns:
      action which sends to the given client