Package org.astrogrid.samp.gui
Class MessageTrackerHubConnector
- java.lang.Object
-
- org.astrogrid.samp.client.HubConnector
-
- org.astrogrid.samp.gui.GuiHubConnector
-
- org.astrogrid.samp.gui.MessageTrackerHubConnector
-
- All Implemented Interfaces:
ClientTransmissionHolder
public class MessageTrackerHubConnector extends GuiHubConnector implements ClientTransmissionHolder
HubConnector implementation which provides facilities for keeping track of incoming and outgoing messages as well as the other GUI features.- Since:
- 26 Nov 2008
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
MessageTrackerHubConnector.CallAllHandler
Class used to keep track of outgoing callAll() messages.private class
MessageTrackerHubConnector.ClientTransmissionListListener
ListDataListener implementation which responds to transmission list events and passes them on to the client list, since any changes to the transmission list may change the way that a client is renderered in the JList.private class
MessageTrackerHubConnector.MessageTrackerCallableClient
CallableClient wrapper class which intercepts calls to keep track of sent and received messages.private class
MessageTrackerHubConnector.MessageTrackerHubConnection
HubConnection object which intercepts calls to keep track of outgoing and incoming messages.-
Nested classes/interfaces inherited from class org.astrogrid.samp.gui.GuiHubConnector
GuiHubConnector.ConnectionUpdate
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map
callAllMap_
private int
listRemoveDelay_
private static java.util.logging.Logger
logger_
private TransmissionListModel
rxListModel_
private java.util.Map
rxModelMap_
private TransmissionTableModel
rxTableModel_
private javax.swing.event.ListDataListener
transListListener_
private TransmissionListModel
txListModel_
private java.util.Map
txModelMap_
private TransmissionTableModel
txTableModel_
-
Fields inherited from class org.astrogrid.samp.gui.GuiHubConnector
DISABLE_ACTION, ENABLE_ACTION, ENABLE_COMPONENT, REPAINT_COMPONENT
-
-
Constructor Summary
Constructors Constructor Description MessageTrackerHubConnector(ClientProfile profile)
Constructs a hub connector with default message tracker GUI expiry times.MessageTrackerHubConnector(ClientProfile profile, int listRemoveDelay, int tableRemoveDelay, int tableMaxRows)
Constructs a hub connector with specified message tracker GUI expiry times.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.ListCellRenderer
createClientListCellRenderer()
Returns a list cell renderer suitable for use with the client list model returned byGuiHubConnector.getClientListModel()
.protected HubConnection
createConnection()
Invoked by this class to create a hub connection.javax.swing.JComponent
createMessageBox(int iconSize)
Returns a component which displays messages currently being sent/received by this connector.static javax.swing.JComponent
createMessageBox(int iconSize, javax.swing.ListModel rxListModel, javax.swing.ListModel txListModel)
Returns a component which displays messages in receiver and/or sender list models.javax.swing.JComponent
createMonitorPanel()
Returns a new component which displays status for this connector.javax.swing.ListModel
getRxListModel()
Returns a ListModel representing the pending messages received using this connector.javax.swing.ListModel
getRxListModel(Client client)
Returns a list model containing messages received by a given client.javax.swing.ListModel
getTxListModel()
Returns a ListModel representing the pending messages sent using this connector.javax.swing.ListModel
getTxListModel(Client client)
Returns a list model containing messages sent by a given client.private void
scheduleAddTransmission(Transmission trans, boolean tx)
Schedules a new transmission to add to the appropriate list models.private void
scheduleSetFailure(Transmission trans, java.lang.Throwable error)
Schedules an error to be registered for a previously added transmission.private void
scheduleSetResponse(Transmission trans, Response response)
Schedules a response to be registered for a previously added transmission.-
Methods inherited from class org.astrogrid.samp.gui.GuiHubConnector
addConnectionListener, connectionChanged, createBoxBorder, createClientBox, createConnectionIndicator, createConnectionIndicator, createHubAction, createRegisterAction, createRegisterOrHubAction, createShowMonitorAction, createToggleRegisterAction, createUnregisterAction, getClientListModel, registerUpdater, removeConnectionListener
-
Methods inherited from class org.astrogrid.samp.client.HubConnector
addMessageHandler, addResponseHandler, call, callAll, callAndWait, computeSubscriptions, configureConnection, createTag, declareMetadata, declareSubscriptions, disconnect, getClientMap, getClientSet, getConnection, getMetadata, getSubscriptions, isConnected, removeMessageHandler, removeResponseHandler, setActive, setAutoconnect
-
-
-
-
Field Detail
-
txListModel_
private final TransmissionListModel txListModel_
-
rxListModel_
private final TransmissionListModel rxListModel_
-
txTableModel_
private final TransmissionTableModel txTableModel_
-
rxTableModel_
private final TransmissionTableModel rxTableModel_
-
callAllMap_
private final java.util.Map callAllMap_
-
txModelMap_
private final java.util.Map txModelMap_
-
rxModelMap_
private final java.util.Map rxModelMap_
-
transListListener_
private final javax.swing.event.ListDataListener transListListener_
-
listRemoveDelay_
private final int listRemoveDelay_
-
logger_
private static final java.util.logging.Logger logger_
-
-
Constructor Detail
-
MessageTrackerHubConnector
public MessageTrackerHubConnector(ClientProfile profile)
Constructs a hub connector with default message tracker GUI expiry times.- Parameters:
profile
- profile implementation
-
MessageTrackerHubConnector
public MessageTrackerHubConnector(ClientProfile profile, int listRemoveDelay, int tableRemoveDelay, int tableMaxRows)
Constructs a hub connector with specified message tracker GUI expiry times. The delay times are times in milliseconds after message resolution before message representations expire and hence remove themselves from gui components.- Parameters:
profile
- profile implementationlistRemoveDelay
- expiry delay for summary icons in client list displaytableRemoveDelay
- expiry delay for rows in message table displaytableMaxRows
- maximum number of rows in message table (beyond this limit resolved messages may be removed early)
-
-
Method Detail
-
getTxListModel
public javax.swing.ListModel getTxListModel()
Returns a ListModel representing the pending messages sent using this connector. Elements of the model areTransmission
objects.- Returns:
- transmission list model
-
getRxListModel
public javax.swing.ListModel getRxListModel()
Returns a ListModel representing the pending messages received using this connector. Elements of the model areTransmission
objects.- Returns:
- transmission list model
-
getTxListModel
public javax.swing.ListModel getTxListModel(Client client)
Description copied from interface:ClientTransmissionHolder
Returns a list model containing messages sent by a given client.- Specified by:
getTxListModel
in interfaceClientTransmissionHolder
- Returns:
- list model containing
Transmission
objects
-
getRxListModel
public javax.swing.ListModel getRxListModel(Client client)
Description copied from interface:ClientTransmissionHolder
Returns a list model containing messages received by a given client.- Specified by:
getRxListModel
in interfaceClientTransmissionHolder
- Returns:
- list model containing
Transmission
objects
-
createMessageBox
public javax.swing.JComponent createMessageBox(int iconSize)
Returns a component which displays messages currently being sent/received by this connector.- Returns:
- iconSize height of icons in box
-
createMessageBox
public static javax.swing.JComponent createMessageBox(int iconSize, javax.swing.ListModel rxListModel, javax.swing.ListModel txListModel)
Returns a component which displays messages in receiver and/or sender list models.- Parameters:
iconSize
- height of iconsrxListModel
- list model containing receivedTransmission
objectstxListModel
- list model containing sentTransmission
objects
-
createClientListCellRenderer
public javax.swing.ListCellRenderer createClientListCellRenderer()
Description copied from class:GuiHubConnector
Returns a list cell renderer suitable for use with the client list model returned byGuiHubConnector.getClientListModel()
.- Overrides:
createClientListCellRenderer
in classGuiHubConnector
- Returns:
- list cell renderer for Client objects
-
createMonitorPanel
public javax.swing.JComponent createMonitorPanel()
Description copied from class:GuiHubConnector
Returns a new component which displays status for this connector.- Overrides:
createMonitorPanel
in classGuiHubConnector
- Returns:
- new hub connection monitor component
-
createConnection
protected HubConnection createConnection() throws SampException
Description copied from class:HubConnector
Invoked by this class to create a hub connection. The default implementation just callsprofile.register()
.- Overrides:
createConnection
in classHubConnector
- Returns:
- new hub connection
- Throws:
SampException
-
scheduleAddTransmission
private void scheduleAddTransmission(Transmission trans, boolean tx)
Schedules a new transmission to add to the appropriate list models. May be called from any thread.- Parameters:
trans
- transmissiontx
- true for send, false for receive
-
scheduleSetResponse
private void scheduleSetResponse(Transmission trans, Response response)
Schedules a response to be registered for a previously added transmission. May be called from any thread.- Parameters:
trans
- transmissionresponse
- response to associated with trans
-
scheduleSetFailure
private void scheduleSetFailure(Transmission trans, java.lang.Throwable error)
Schedules an error to be registered for a previously added transmission. May be called from any thread.- Parameters:
trans
- transmissionerror
- exception
-
-