Class AbstractCallActionManager.CallResponseHandler

  • All Implemented Interfaces:
    java.util.EventListener, javax.swing.event.ChangeListener, ResponseHandler
    Enclosing class:
    AbstractCallActionManager

    private class AbstractCallActionManager.CallResponseHandler
    extends java.lang.Object
    implements ResponseHandler, javax.swing.event.ChangeListener
    ResponseHandler implementation for use by this class. It handles all SAMP responses for calls which have been made by this object and passes them on to the appropriate ResultHandlers.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int iCall_  
      private java.util.Map tagMap_  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String createTag()
      Creates and returns a new tag which will be attached to an outgoing message, and updates internal structures so that it will be recognised in the future.
      private void hubDisconnected()
      Called when the connection to the hub disappears.
      boolean ownsTag​(java.lang.String tag)
      Indicates whether this handler will process the response with a given message tag.
      private void processResponse​(java.lang.String tag, AbstractCallActionManager.TagInfo info, java.lang.String responderId, Response response)
      Does the work of passing on a received response to a registered result handler.
      void receiveResponse​(HubConnection connection, java.lang.String responderId, java.lang.String tag, Response response)
      Processes a response to an earlier message.
      void registerHandler​(java.lang.String tag, Client[] recipients, ResultHandler handler)
      Registers a result handler to handle results corresponding to a message tag.
      void stateChanged​(javax.swing.event.ChangeEvent evt)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • iCall_

        private int iCall_
      • tagMap_

        private final java.util.Map tagMap_
    • Constructor Detail

      • CallResponseHandler

        CallResponseHandler()
        Constructor.
    • Method Detail

      • registerHandler

        public void registerHandler​(java.lang.String tag,
                                    Client[] recipients,
                                    ResultHandler handler)
        Registers a result handler to handle results corresponding to a message tag.
        Parameters:
        tag - tag returned by an earlier invocation of createTag()
        recipients - clients from which responses are expected
        handler - result handler for responses; may be null if no handling is required
      • ownsTag

        public boolean ownsTag​(java.lang.String tag)
        Description copied from interface: ResponseHandler
        Indicates whether this handler will process the response with a given message tag.
        Specified by:
        ownsTag in interface ResponseHandler
        Parameters:
        tag - tag with which earlier call was labelled
        Returns:
        true iff this handler wants to process the response labelled with msgTag
      • receiveResponse

        public void receiveResponse​(HubConnection connection,
                                    java.lang.String responderId,
                                    java.lang.String tag,
                                    Response response)
        Description copied from interface: ResponseHandler
        Processes a response to an earlier message. Will only be called for msgTag values which return true from ResponseHandler.ownsTag(java.lang.String).
        Specified by:
        receiveResponse in interface ResponseHandler
        Parameters:
        connection - hub connection
        responderId - client id of client sending response
        tag - message tag from previous call
        response - response object
      • processResponse

        private void processResponse​(java.lang.String tag,
                                     AbstractCallActionManager.TagInfo info,
                                     java.lang.String responderId,
                                     Response response)
        Does the work of passing on a received response to a registered result handler.
        Parameters:
        tag - message tag
        info - tag handling information object
        responderId - client ID of responder
        response - response object
      • stateChanged

        public void stateChanged​(javax.swing.event.ChangeEvent evt)
        Specified by:
        stateChanged in interface javax.swing.event.ChangeListener
      • hubDisconnected

        private void hubDisconnected()
        Called when the connection to the hub disappears.