Package org.astrogrid.samp.gui
Class UniformCallActionManager
- java.lang.Object
-
- org.astrogrid.samp.gui.SendActionManager
-
- org.astrogrid.samp.gui.AbstractCallActionManager
-
- org.astrogrid.samp.gui.UniformCallActionManager
-
public abstract class UniformCallActionManager extends AbstractCallActionManager
SendActionManager subclass which works with messages of a single MType, using the Aysnchronous Call/Response delivery pattern. Concrete subclasses need only implementcreateMessage()
.- Since:
- 11 Nov 2008
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
UniformCallActionManager.BroadcastAction
Action for sending broadcast messages.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
mtype_
private java.awt.Component
parent_
private java.lang.String
sendType_
-
Fields inherited from class org.astrogrid.samp.gui.SendActionManager
BROADCAST_TARGET, subscribedClientModel_
-
-
Constructor Summary
Constructors Constructor Description UniformCallActionManager(java.awt.Component parent, GuiHubConnector connector, java.lang.String mtype, java.lang.String sendType)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected javax.swing.Action
createBroadcastAction()
Must be implemented by concrete subclasses.protected abstract java.util.Map
createMessage()
Generates the message which is sent to one or all clients by this object's actions.protected java.util.Map
createMessage(Client client)
Implemented simply by callingcreateMessage()
.javax.swing.JMenu
createSendMenu()
Returns a new targetted send menu with a title suitable for this object.javax.swing.Action
getSendAction(Client client)
Returns an action which can perform a single-client send associated with this object.-
Methods inherited from class org.astrogrid.samp.gui.AbstractCallActionManager
createResultHandler, createTag, dispose, registerHandler
-
Methods inherited from class org.astrogrid.samp.gui.SendActionManager
createSendMenu, createTargetAction, createTargetSelector, disposeSendMenu, getBroadcastAction, getBroadcastIcon, getClientListModel, getConnector, getSendIcon, setEnabled, updateState
-
-
-
-
Constructor Detail
-
UniformCallActionManager
public UniformCallActionManager(java.awt.Component parent, GuiHubConnector connector, java.lang.String mtype, java.lang.String sendType)
Constructor.- Parameters:
parent
- parent componentconnector
- hub connectormtype
- MType for messages transmitted by this object's actionssendType
- short string identifying the kind of thing being sent (used for action descriptions etc)
-
-
Method Detail
-
createMessage
protected abstract java.util.Map createMessage() throws java.lang.Exception
Generates the message which is sent to one or all clients by this object's actions.- Returns:
Message
-like Map representing message to transmit- Throws:
java.lang.Exception
-
createMessage
protected java.util.Map createMessage(Client client) throws java.lang.Exception
Implemented simply by callingcreateMessage()
.- Specified by:
createMessage
in classAbstractCallActionManager
- Parameters:
client
- target- Returns:
- message
- Throws:
java.lang.Exception
-
createBroadcastAction
protected javax.swing.Action createBroadcastAction()
Description copied from class:AbstractCallActionManager
Must be implemented by concrete subclasses.- Specified by:
createBroadcastAction
in classAbstractCallActionManager
- Returns:
- broadcast action; may be null if broadcast is not required
-
createSendMenu
public javax.swing.JMenu createSendMenu()
Returns a new targetted send menu with a title suitable for this object.- Returns:
- new send menu
-
getSendAction
public javax.swing.Action getSendAction(Client client)
Description copied from class:SendActionManager
Returns an action which can perform a single-client send associated with this object. If it implementsequals
(andhashCode
) intelligently there will be efficiency advantages. The enabled status of such actions will be managed by this object.- Overrides:
getSendAction
in classAbstractCallActionManager
- Parameters:
client
- recipient client- Returns:
- action which sends to the given client
-
-