org.springframework.richclient.util
Class PopupMenuMouseListener

Show UML class diagram
java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by org.springframework.richclient.util.PopupMenuMouseListener
All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public class PopupMenuMouseListener
extends MouseAdapter

Convenient listener that will show a popup menu when it receives a popup trigger.

Author:
Keith Donald, Oliver Hutchison
See Also:
MouseEvent.isPopupTrigger()

Constructor Summary
protected PopupMenuMouseListener()
          Creates a new PopupMenuMouseListener.
  PopupMenuMouseListener(JPopupMenu popupMenu)
          Creates a new PopupMenuMouseListener that will show the provided popup.
 
Method Summary
protected  JPopupMenu getPopupMenu()
          Returns the popup menu to be displayed.
protected  JPopupMenu getPopupMenu(MouseEvent e)
          Returns the popup menu to be displayed.
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
protected  boolean onAboutToShow(MouseEvent e)
          Called before the popup menu becomes visible.
protected  void showPopupMenu(MouseEvent e)
          Called to display the popup menu.
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopupMenuMouseListener

protected PopupMenuMouseListener()
Creates a new PopupMenuMouseListener.

NOTE: When using this constructor subclasses must overide one of the getPopupMenu methods.


PopupMenuMouseListener

public PopupMenuMouseListener(JPopupMenu popupMenu)
Creates a new PopupMenuMouseListener that will show the provided popup.

Method Detail

onAboutToShow

protected boolean onAboutToShow(MouseEvent e)
Called before the popup menu becomes visible. May veto the display of the popup by returning false.


showPopupMenu

protected void showPopupMenu(MouseEvent e)
Called to display the popup menu.


getPopupMenu

protected JPopupMenu getPopupMenu(MouseEvent e)
Returns the popup menu to be displayed. Default implementation delegates to getPopupMenu().


getPopupMenu

protected JPopupMenu getPopupMenu()
Returns the popup menu to be displayed.


mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener
Overrides:
mousePressed in class MouseAdapter

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class MouseAdapter


Copyright © 2004-2009 The Spring Framework. All Rights Reserved.