org.favabeans.views
Class ContextMenuMouseAdapter
java.lang.Object
|
+--org.favabeans.views.ContextMenuMouseAdapter
- All Implemented Interfaces:
- EventListener, MouseListener
- public class ContextMenuMouseAdapter
- extends Object
- implements MouseListener
This is an object which can be created by a View
to listen
for popup trigger mouse events on the View
's behalf and
display the appropriate standard context menu in response.
After creating a ContextMenuMouseAdapter
, a View
must add it as a mouse listener to one or more Component
s;
the ContextMenuMouseAdapter
does not do this automatically.
A ContextMenuMouseAdapter
may be a mouse listener
for several Component
s at once.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ContextMenuMouseAdapter
public ContextMenuMouseAdapter(View parentView)
- Construct a new
ContextMenuMouseAdapter
.
- Parameters:
parentView
- the View
on behalf of which to listen
for mouse events.
getParentView
public View getParentView()
getModelShown
protected Object getModelShown(Component eventSource,
Point p)
- Obtain the object for which the context menu is to be displayed
in response to a popup trigger mouse event. The default implementation
of this menthod returns the property
View.getModel()
of the
parent view, as obtained by getParentView()
.
Implementations may usefully return null
from this
method in either of two cases: (a) if getParentView()
is
not displaying anything at the moment; or, more generally, (b) if the location
p
in eventSource
is not displaying any
object for which a context menu is desired. In any case, if this method
returns null
, the associated popup trigger mouse event is
silently ignored.
- Parameters:
eventSource
- the Component
at which the mouse
event has occurred.p
- the location within eventSource
at which
the mouse event has occurred.- Returns:
- the object for which to display the context menu, or
null
if no object is shown at location p
.
isContextMenuShowing
public boolean isContextMenuShowing()
- Returns:
true
if the context menu is currently
shown.
mouseClicked
public void mouseClicked(MouseEvent e)
- Specified by:
mouseClicked
in interface MouseListener
mousePressed
public void mousePressed(MouseEvent e)
- Specified by:
mousePressed
in interface MouseListener
mouseReleased
public void mouseReleased(MouseEvent e)
- Specified by:
mouseReleased
in interface MouseListener
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEntered
in interface MouseListener
mouseExited
public void mouseExited(MouseEvent e)
- Specified by:
mouseExited
in interface MouseListener
Copyright © 2000-2001, Regents of the University of Minnesota. All Rights Reserved.