Package org.astrogrid.samp.gui
Class NotifyActionManager
- java.lang.Object
-
- org.astrogrid.samp.gui.SendActionManager
-
- org.astrogrid.samp.gui.NotifyActionManager
-
public abstract class NotifyActionManager extends SendActionManager
SendActionManager subclass which works with messages of a single MType, using the Notify delivery pattern.- Since:
- 5 Sep 2008
- Author:
- Mark Taylor
-
-
Field Summary
-
Fields inherited from class org.astrogrid.samp.gui.SendActionManager
BROADCAST_TARGET
-
-
Constructor Summary
Constructors Constructor Description NotifyActionManager(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()
Returns a new action for broadcast associated with this object.protected abstract java.util.Map
createMessage()
Generates the message which is sent to one or all clients by this object's actions.javax.swing.JMenu
createSendMenu()
Returns a new menu for targetted sends with a title suitable for this object.protected javax.swing.Action
getSendAction(Client client)
Returns an action which can perform a single-client send associated with this object.protected void
messageSent(HubConnection connection, Message msg, Client[] recipients)
Called when a message has been sent by this object.-
Methods inherited from class org.astrogrid.samp.gui.SendActionManager
createSendMenu, createTargetAction, createTargetSelector, dispose, disposeSendMenu, getBroadcastAction, getBroadcastIcon, getClientListModel, getConnector, getSendIcon, setEnabled, updateState
-
-
-
-
Constructor Detail
-
NotifyActionManager
public NotifyActionManager(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
-
messageSent
protected void messageSent(HubConnection connection, Message msg, Client[] recipients)
Called when a message has been sent by this object. The default action is to notify via the logging system. Subclasses may override this method.- Parameters:
connection
- connection objectmsg
- the message which was sentrecipients
- the recipients to whom an attempt was made to send the message
-
createBroadcastAction
protected javax.swing.Action createBroadcastAction()
Description copied from class:SendActionManager
Returns a new action for broadcast associated with this object. The enabled status of the action will be managed by this object.- Specified by:
createBroadcastAction
in classSendActionManager
- Returns:
- broadcast action; may be null if broadcast is not required
-
createSendMenu
public javax.swing.JMenu createSendMenu()
Returns a new menu for targetted sends with a title suitable for this object.- Returns:
- new send menu
-
getSendAction
protected 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.- Specified by:
getSendAction
in classSendActionManager
- Parameters:
client
- recipient client- Returns:
- action which sends to the given client
-
-