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(Random random)`
Constructs a hub service with default message tracker GUI expiry times.
`MessageTrackerHubService(Random random, int listRemoveDelay, int tableRemoveDelay, int tableMaxRows)`
Constructs a hub service with specified message tracker GUI expiry times.

## Method Summary

Modifier and Type
Method
Description
`HubClient`
`createClient(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.
`JComponent`
`createHubPanel()`
Creates a new component containing a display of the current hub internal state.
`ListSelectionModel`
`getClientSelectionModel()`
Returns the selection model corresponding to this service's client list model.
`ListModel`
`getRxListModel(Client client)`
Returns a ListModel representing the pending messages received by a given client.
`ListModel`
`getTxListModel(Client client)`
Returns a ListModel representing the pending messages sent from a given client.
`protected void`
`reply(HubClient caller, String msgId, Map response)`
Does the work for the `reply` 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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MessageTrackerHubService

public MessageTrackerHubService(Random random)
Constructs a hub service with default message tracker GUI expiry times.

Parameters:
  `random` - random number generator

### MessageTrackerHubService

public MessageTrackerHubService(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 generator
  `listRemoveDelay` - expiry delay for summary icons in client list display
  `tableRemoveDelay` - expiry delay for rows in message table display
  `tableMaxRows` - maximum number of rows in message table (beyond this limit resolved messages may be removed early)

## Method Details

### start

public void start()
Description copied from interface: `HubService`
Begin operation. The `HubService.register(org.astrogrid.samp.hub.ProfileToken)` method should not be called until the hub has been started.

Specified by:
  `start` in interface `HubService`
Overrides:
  `start` in class `GuiHubService`

### 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 class `GuiHubService`
Returns:
  client set

### createClient

public HubClient createClient(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 class `BasicHubService`
Parameters:
  `publicId` - client public ID
  `ptoken` - connection source
Returns:
  hub client

### createHubPanel

public JComponent createHubPanel()
Description copied from class: `GuiHubService`
Creates a new component containing a display of the current hub internal state.

Overrides:
  `createHubPanel` in class `GuiHubService`
Returns:
  new hub viewer panel

### getClientSelectionModel

public ListSelectionModel getClientSelectionModel()
Description copied from class: `GuiHubService`
Returns the selection model corresponding to this service's client list model.

Overrides:
  `getClientSelectionModel` in class `GuiHubService`
Returns:
  list selection model for client selection

### getTxListModel

public ListModel getTxListModel(Client client)
Returns a ListModel representing the pending messages sent from a given client. Elements of the model are `Transmission` objects.

Parameters:
  `client` - client owned by this hub service
Returns:
  transmission list model

### getRxListModel

public ListModel getRxListModel(Client client)
Returns a ListModel representing the pending messages received by a given client. Elements of the model are `Transmission` objects.

Parameters:
  `client` - client owned by this hub service
Returns:
  transmission list model

### reply

protected void reply(HubClient caller, String msgId, Map response) throws SampException
Description copied from class: `BasicHubService`
Does the work for the `reply` method of connections registered with this service.

Overrides:
  `reply` in class `BasicHubService`
Parameters:
  `caller` - calling client
  `msgId` - message ID
  `response` - response to forward
Throws:
  `SampException`
See Also:
  - `HubConnection.reply(java.lang.String, java.util.Map)`