public class PopupMenuTool extends Tool
Tool
implementation which allows to display context menus on a ViewComponent
.
All entries to the menu must come from instances of MenuContributor
. In particular, the
following contributors are asked for their contributions:
Tool
registered with this Tool
's ToolManager
getFixedContributors()
ViewComponent
this Tool
is linked up to via its ToolManager
Tool.ActivationRequest
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
PopupMenuTool() |
Modifier and Type | Method and Description |
---|---|
List<MenuContributor> |
getFixedContributors()
Returns a
List which holds instances of MenuContributor
that will be given the opportunity to contribute entries to the menu
created by this Tool . |
protected void |
handleMouseClicked(MouseEditEvent e,
boolean isActive)
Invoked when the mouse button has been clicked (pressed and released) on a component.
|
protected void |
handleMousePressed(MouseEditEvent e,
boolean isActive)
Invoked when a mouse button has been pressed on a component.
|
protected void |
handleMouseReleased(MouseEditEvent e,
boolean isActive)
Invoked when a mouse button has been released on a component.
|
protected void |
postprocessMenu(BasicMenuBuilder.Menu rootMenu)
After the menu to be displayed has been created, this method is called.
|
contribute, getActivationFeedback, getActivationRequest, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getCursor, getDispatchPriority, getManager, getRenderPriority, handleEditEvent, handleKeyPressed, handleKeyReleased, handleKeyTyped, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseMoved, handleMouseWheelMoved, propagatePropertyChange, render, setActive, setCursor, setEnabled, setManager, setStatusFeedback
protected void handleMouseClicked(MouseEditEvent e, boolean isActive)
Tool
handleMouseClicked
in class Tool
isActive
- whether this tool is currently activeprotected void handleMousePressed(MouseEditEvent e, boolean isActive)
Tool
handleMousePressed
in class Tool
isActive
- whether this tool is currently activeprotected void handleMouseReleased(MouseEditEvent e, boolean isActive)
Tool
handleMouseReleased
in class Tool
isActive
- whether this tool is currently activeprotected void postprocessMenu(BasicMenuBuilder.Menu rootMenu)
rootMenu
- the BasicMenuBuilder.Menu
to be displayed by this toolpublic List<MenuContributor> getFixedContributors()
List
which holds instances of MenuContributor
that will be given the opportunity to contribute entries to the menu
created by this Tool
. Users may add contributors to the
List
being returned, which will afterwards be asked for their
contributions as well. In the same way, those contributors which shall no
longer be asked for contributions may be removed from the list.
This method must be called on the Event Dispatch Thread
.
The List
returned by this method must also be accessed on the
Event Dispatch Thread
exclusively.
List
of MenuContributor
s asked for
contributions when this Tool
is preparing a menu to be
displayed.IllegalStateException
- if the calling thread is not the
event dispatch thread
Copyright © 2024 levigo holding gmbh. All rights reserved.