|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.astrogrid.samp.client.HubConnector
org.astrogrid.samp.gui.GuiHubConnector
public class GuiHubConnector
Extends HubConnector to provide additional graphical functionality.
In particular Swing Actions are provided for
hub connection/disconnection
and the client list is made available as a ListModel.
See the superclass
documentation for details of how to use this class.
A number of utility methods build on these features to provide
Swing components and Actions which can be used directly to populate
application menus etc.
| Constructor Summary | |
|---|---|
GuiHubConnector(ClientProfile profile)
Constructs a hub connector based on a given profile instance. |
|
| Method Summary | |
|---|---|
void |
addConnectionListener(ChangeListener listener)
Adds a listener which will be notified when this connector registers or unregisters with a hub. |
protected void |
connectionChanged(boolean isConnected)
Method which is called every time this connector changes its connection status (from disconnected to connected, or vice versa). |
JComponent |
createClientBox(boolean vertical,
int iconSize)
Creates a component which shows an icon for each registered client. |
ListCellRenderer |
createClientListCellRenderer()
Returns a list cell renderer suitable for use with the client list model returned by getClientListModel(). |
JComponent |
createConnectionIndicator()
Creates a component which indicates whether this connector is currently connected or not, using default icons. |
JComponent |
createConnectionIndicator(Icon onIcon,
Icon offIcon)
Creates a component which indicates whether this connector is currently connected or not, using supplied icons. |
Action |
createHubAction(boolean external,
HubServiceMode hubMode)
Returns an action which will start up a SAMP hub. |
JComponent |
createMonitorPanel()
Returns a new component which displays status for this connector. |
Action |
createRegisterAction()
Returns an action which attempts to register with the hub. |
Action |
createRegisterOrHubAction(Component parent,
Action[] hubStartActions)
Returns a new action which will register with a hub if one is running, and if not, will offer to start a hub. |
Action |
createShowMonitorAction()
Returns an action which will display a SAMP hub monitor window. |
Action |
createToggleRegisterAction()
Returns an action which toggles hub registration. |
Action |
createUnregisterAction()
Returns an action which attempts to unregister from the hub. |
ListModel |
getClientListModel()
Returns a ListModel containing the registered clients. |
void |
removeConnectionListener(ChangeListener listener)
Removes a listener previously added by addConnectionListener. |
| Methods inherited from class org.astrogrid.samp.client.HubConnector |
|---|
addMessageHandler, addResponseHandler, call, callAll, callAndWait, computeSubscriptions, configureConnection, createConnection, createTag, declareMetadata, declareSubscriptions, disconnect, getClientMap, getClientSet, getConnection, getMetadata, getSubscriptions, isConnected, removeMessageHandler, removeResponseHandler, setActive, setAutoconnect |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GuiHubConnector(ClientProfile profile)
profile - profile implementation| Method Detail |
|---|
protected void connectionChanged(boolean isConnected)
HubConnector
connectionChanged in class HubConnectorisConnected - true if we've just registered;
false if we've just unregisteredpublic void addConnectionListener(ChangeListener listener)
listener - listener to addpublic void removeConnectionListener(ChangeListener listener)
addConnectionListener.
listener - listener to removepublic ListModel getClientListModel()
Client objectspublic ListCellRenderer createClientListCellRenderer()
getClientListModel().
public Action createRegisterAction()
public Action createUnregisterAction()
public Action createToggleRegisterAction()
public Action createRegisterOrHubAction(Component parent,
Action[] hubStartActions)
hubStartActions parameter - the elements of this array
will normally be generated by calling the
createHubAction method.
parent - parent component, used for placing dialoguehubStartActions - actions which start a hub,
or null for a default listpublic Action createShowMonitorAction()
public Action createHubAction(boolean external,
HubServiceMode hubMode)
external - false to run in the current JVM,
true to run in a new onehubMode - hub mode
public JComponent createConnectionIndicator(Icon onIcon,
Icon offIcon)
onIcon - icon indicating connectionoffIcon - icon indicating no connection
public JComponent createConnectionIndicator()
public JComponent createClientBox(boolean vertical,
int iconSize)
vertical - true for vertical box, false for horizontaliconSize - dimension in pixel of each icon (square)public JComponent createMonitorPanel()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||