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 HubClient
createClient(java.lang.String publicId, ProfileToken ptoken)
Factory method used to create all the client objects which will be used by this hub service.ClientSet
createClientSet()
Factory method used to create the client set used by this hub service.javax.swing.JComponent
createHubPanel()
Creates a new component containing a display of the current hub internal state.javax.swing.ListSelectionModel
getClientSelectionModel()
Returns the selection model corresponding to this service's client list model.javax.swing.ListModel
getRxListModel(Client client)
Returns a ListModel representing the pending messages received by a given client.javax.swing.ListModel
getTxListModel(Client client)
Returns a ListModel representing the pending messages sent from a given client.protected void
reply(HubClient caller, java.lang.String msgId, java.util.Map response)
Does the work for thereply
method of connections registered with this service.void
start()
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:HubService
Begin operation. TheHubService.register(org.astrogrid.samp.hub.ProfileToken)
method should not be called until the hub has been started.- Specified by:
start
in interfaceHubService
- Overrides:
start
in classGuiHubService
-
createClientSet
public ClientSet createClientSet()
Description copied from class:BasicHubService
Factory method used to create the client set used by this hub service.- Overrides:
createClientSet
in classGuiHubService
- Returns:
- client set
-
createClient
public HubClient createClient(java.lang.String publicId, ProfileToken ptoken)
Description copied from class:BasicHubService
Factory method used to create all the client objects which will be used by this hub service.- Overrides:
createClient
in classBasicHubService
- Parameters:
publicId
- client public IDptoken
- connection source- Returns:
- hub client
-
createHubPanel
public javax.swing.JComponent createHubPanel()
Description copied from class:GuiHubService
Creates a new component containing a display of the current hub internal state.- Overrides:
createHubPanel
in classGuiHubService
- Returns:
- new hub viewer panel
-
getClientSelectionModel
public javax.swing.ListSelectionModel getClientSelectionModel()
Description copied from class:GuiHubService
Returns the selection model corresponding to this service's client list model.- Overrides:
getClientSelectionModel
in 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 areTransmission
objects.- 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 areTransmission
objects.- 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:BasicHubService
Does the work for thereply
method of connections registered with this service.- Overrides:
reply
in classBasicHubService
- Parameters:
caller
- calling clientmsgId
- message IDresponse
- response to forward- Throws:
SampException
- See Also:
HubConnection.reply(java.lang.String, java.util.Map)
-
-