Package org.astrogrid.samp.gui
Class HubClientPopupListener
- java.lang.Object
-
- org.astrogrid.samp.gui.HubClientPopupListener
-
- All Implemented Interfaces:
java.awt.event.MouseListener
,java.util.EventListener
class HubClientPopupListener extends java.lang.Object implements java.awt.event.MouseListener
MouseListener which provides a popup menu with per-client options for use with a JList containing HubClient objects.- Since:
- 8 Jul 2009
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
HubClientPopupListener.CallAction
Action which will send a message to a client.private class
HubClientPopupListener.DisconnectAction
Action which will forcibly disconnect a given client.
-
Field Summary
Fields Modifier and Type Field Description private BasicHubService
hub_
private static Message
PING_MSG
Message which does a ping.
-
Constructor Summary
Constructors Constructor Description HubClientPopupListener(BasicHubService hub)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private javax.swing.JPopupMenu
createPopup(java.awt.Component parent, HubClient client)
Returns a new popup menu for a given client.private void
maybeShowPopup(java.awt.event.MouseEvent evt)
Invoked for a MouseEvent which may be a popup menu trigger.void
mouseClicked(java.awt.event.MouseEvent evt)
void
mouseEntered(java.awt.event.MouseEvent evt)
void
mouseExited(java.awt.event.MouseEvent evt)
void
mousePressed(java.awt.event.MouseEvent evt)
void
mouseReleased(java.awt.event.MouseEvent evt)
-
-
-
Field Detail
-
hub_
private final BasicHubService hub_
-
PING_MSG
private static final Message PING_MSG
Message which does a ping.
-
-
Constructor Detail
-
HubClientPopupListener
public HubClientPopupListener(BasicHubService hub)
Constructor.- Parameters:
hub
- hub service which knows about the HubClients contained in the JList this will be listening to
-
-
Method Detail
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent evt)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent evt)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent evt)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent evt)
- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent evt)
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
maybeShowPopup
private void maybeShowPopup(java.awt.event.MouseEvent evt)
Invoked for a MouseEvent which may be a popup menu trigger.- Parameters:
evt
- popup trigger event candidate
-
createPopup
private javax.swing.JPopupMenu createPopup(java.awt.Component parent, HubClient client)
Returns a new popup menu for a given client. The actions on this menu are not dynamic (e.g. do not enable/disable themselves according to changes in the hub status) because the menu is likely to be short-lived.- Parameters:
parent
- parent componentclient
- hub client which the menu will affect- Returns:
- new popup menu
-
-