Package org.astrogrid.samp.gui
Class MessageTrackerHubService
- java.lang.Object
-
- org.astrogrid.samp.hub.BasicHubService
-
- org.astrogrid.samp.gui.GuiHubService
-
- org.astrogrid.samp.gui.MessageTrackerHubService
-
- All Implemented Interfaces:
HubService
public class MessageTrackerHubService extends GuiHubService
GuiHubService subclass which additionally keeps track of which messages have been sent and received, and can provide a graphical display of these. The overhead in maintaining the GUI display can be significant if there is high volume of message traffic.- Since:
- 20 Nov 2008
- Author:
- Mark Taylor
-
-
Field Summary
-
Fields inherited from class org.astrogrid.samp.hub.BasicHubService
MAX_TIMEOUT, MAX_WAITERS
-
-
Constructor Summary
Constructors Constructor Description MessageTrackerHubService(java.util.Random random)Constructs a hub service with default message tracker GUI expiry times.MessageTrackerHubService(java.util.Random random, int listRemoveDelay, int tableRemoveDelay, int tableMaxRows)Constructs a hub service with specified message tracker GUI expiry times.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HubClientcreateClient(java.lang.String publicId, ProfileToken ptoken)Factory method used to create all the client objects which will be used by this hub service.ClientSetcreateClientSet()Factory method used to create the client set used by this hub service.javax.swing.JComponentcreateHubPanel()Creates a new component containing a display of the current hub internal state.javax.swing.ListSelectionModelgetClientSelectionModel()Returns the selection model corresponding to this service's client list model.javax.swing.ListModelgetRxListModel(Client client)Returns a ListModel representing the pending messages received by a given client.javax.swing.ListModelgetTxListModel(Client client)Returns a ListModel representing the pending messages sent from a given client.protected voidreply(HubClient caller, java.lang.String msgId, java.util.Map response)Does the work for thereplymethod of connections registered with this service.voidstart()Begin operation.-
Methods inherited from class org.astrogrid.samp.gui.GuiHubService
createHubWindow, createMenus, declareMetadata, declareSubscriptions, getClientListModel
-
Methods inherited from class org.astrogrid.samp.hub.BasicHubService
call, callAll, callAndWait, createConnection, createHubMessageHandlers, disconnect, disconnectAll, getClientSet, getIdComparator, getMetadata, getRegisteredClients, getServiceConnection, getSubscribedClients, getSubscriptions, isHubRunning, notify, notifyAll, register, setCallable, shutdown, unregister
-
-
-
-
Constructor Detail
-
MessageTrackerHubService
public MessageTrackerHubService(java.util.Random random)
Constructs a hub service with default message tracker GUI expiry times.- Parameters:
random- random number generator
-
MessageTrackerHubService
public MessageTrackerHubService(java.util.Random random, int listRemoveDelay, int tableRemoveDelay, int tableMaxRows)Constructs a hub service 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:
random- random number generatorlistRemoveDelay- 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
-
start
public void start()
Description copied from interface:HubServiceBegin operation. TheHubService.register(org.astrogrid.samp.hub.ProfileToken)method should not be called until the hub has been started.- Specified by:
startin interfaceHubService- Overrides:
startin classGuiHubService
-
createClientSet
public ClientSet createClientSet()
Description copied from class:BasicHubServiceFactory method used to create the client set used by this hub service.- Overrides:
createClientSetin classGuiHubService- Returns:
- client set
-
createClient
public HubClient createClient(java.lang.String publicId, ProfileToken ptoken)
Description copied from class:BasicHubServiceFactory method used to create all the client objects which will be used by this hub service.- Overrides:
createClientin classBasicHubService- Parameters:
publicId- client public IDptoken- connection source- Returns:
- hub client
-
createHubPanel
public javax.swing.JComponent createHubPanel()
Description copied from class:GuiHubServiceCreates a new component containing a display of the current hub internal state.- Overrides:
createHubPanelin classGuiHubService- Returns:
- new hub viewer panel
-
getClientSelectionModel
public javax.swing.ListSelectionModel getClientSelectionModel()
Description copied from class:GuiHubServiceReturns the selection model corresponding to this service's client list model.- Overrides:
getClientSelectionModelin classGuiHubService- Returns:
- list selection model for client selection
-
getTxListModel
public javax.swing.ListModel getTxListModel(Client client)
Returns a ListModel representing the pending messages sent from a given client. Elements of the model areTransmissionobjects.- Parameters:
client- client owned by this hub service- Returns:
- transmission list model
-
getRxListModel
public javax.swing.ListModel getRxListModel(Client client)
Returns a ListModel representing the pending messages received by a given client. Elements of the model areTransmissionobjects.- Parameters:
client- client owned by this hub service- Returns:
- transmission list model
-
reply
protected void reply(HubClient caller, java.lang.String msgId, java.util.Map response) throws SampException
Description copied from class:BasicHubServiceDoes the work for thereplymethod of connections registered with this service.- Overrides:
replyin classBasicHubService- Parameters:
caller- calling clientmsgId- message IDresponse- response to forward- Throws:
SampException- See Also:
HubConnection.reply(java.lang.String, java.util.Map)
-
-