Package org.astrogrid.samp.gui
Class Transmission
java.lang.Object
org.astrogrid.samp.gui.Transmission
Describes the properties of a message which has been sent from one
client to another. Methods which might change the state of instances
of this class should be invoked only from the AWT event dispatch thread.
- Since:
- 20 Nov 2008
- Author:
- Mark Taylor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Describes the status of a transmission in terms that can be presented in the GUI. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(ChangeListener listener) Adds a listener which will be notified if the state of this transmission changes (if a response or failure is signalled).long
Returns the epoch at which this transmission was completed.getError()
Returns a Throwable which prevented normal resolution of this transmission.Returns the message which was sent.Returns the message ID associated with this message.Returns the message tag corresponding to this transmission.Returns the client to which this transmission was sent.Returns the response for this transmission.Returns the client which sent this transmission.Returns an object which describes the current status of this transmission in terms which can be presented to the GUI.boolean
isDone()
Indicates whether further changes to the state of this object are expected, that is if a response/failure is yet to be received.void
removeChangeListener
(ChangeListener listener) Removes a listener previously added byaddChangeListener(javax.swing.event.ChangeListener)
.void
Associates an error with this transmission.void
Indicates that the receiver of this transmission has unregistered.void
setResponse
(Response response) Sets the response for this transmission.void
Indicates that the sender of this transmission has unregistered.
-
Constructor Details
-
Transmission
Constructor.- Parameters:
sender
- senderreceiver
- receivermsg
- messagemsgTag
- message tagmsgId
- message ID
-
-
Method Details
-
getSender
Returns the client which sent this transmission.- Returns:
- sender
-
getReceiver
Returns the client to which this transmission was sent.- Returns:
- receiver
-
getMessage
Returns the message which was sent.- Returns:
- message
-
getMessageTag
Returns the message tag corresponding to this transmission. Will be null for notify-type sends.- Returns:
- msg tag
-
getMessageId
Returns the message ID associated with this message. This is the identifier passed to the receiver which it uses to match messages with responses; it will be null iff the transmission used the notify delivery pattern (no response expected).- Returns:
- msgId; possibly null
-
setResponse
Sets the response for this transmission.- Parameters:
response
- response
-
getResponse
Returns the response for this transmission. Will be null if no response has (yet) arrived.- Returns:
- response
-
setError
Associates an error with this transmission. This is probably an indication that the send failed or some other non-SAMP event intervened to prevent normal resolution.- Parameters:
error
- throwable causing the failure
-
getError
Returns a Throwable which prevented normal resolution of this transmission.- Returns:
- error
-
setSenderUnregistered
public void setSenderUnregistered()Indicates that the sender of this transmission has unregistered. -
setReceiverUnregistered
public void setReceiverUnregistered()Indicates that the receiver of this transmission has unregistered. -
getDoneTime
public long getDoneTime()Returns the epoch at which this transmission was completed. If it is still pending (isDone()
==false), the returned value will be (way) in the future.- Returns:
- value of
System.currentTimeMillis()
at whichisDone()
first returned true
-
isDone
public boolean isDone()Indicates whether further changes to the state of this object are expected, that is if a response/failure is yet to be received.- Returns:
- true iff no further changes are expected
-
getStatus
Returns an object which describes the current status of this transmission in terms which can be presented to the GUI. -
addChangeListener
Adds a listener which will be notified if the state of this transmission changes (if a response or failure is signalled). TheChangeEvent
s sent to these listeners will have a source which is this Transmission.- Parameters:
listener
- listener to add
-
removeChangeListener
Removes a listener previously added byaddChangeListener(javax.swing.event.ChangeListener)
.- Parameters:
listener
- listener to remove
-