com.levigo.jadice.swing.tool
Class PopupMenuTool

java.lang.Object
  extended by com.levigo.jadice.swing.tool.Tool
      extended by com.levigo.jadice.swing.tool.PopupMenuTool
All Implemented Interfaces:
MenuContributor

public class PopupMenuTool
extends Tool

A 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:


Nested Class Summary
 
Nested classes/interfaces inherited from class com.levigo.jadice.swing.tool.Tool
Tool.ActivationRequest
 
Field Summary
 
Fields inherited from class com.levigo.jadice.swing.tool.Tool
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY
 
Constructor Summary
PopupMenuTool()
           
 
Method Summary
 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.
 
Methods inherited from class com.levigo.jadice.swing.tool.Tool
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopupMenuTool

public PopupMenuTool()
Method Detail

handleMouseClicked

protected void handleMouseClicked(MouseEditEvent e,
                                  boolean isActive)
Description copied from class: Tool
Invoked when the mouse button has been clicked (pressed and released) on a component.

Overrides:
handleMouseClicked in class Tool
isActive - whether this tool is currently active

handleMousePressed

protected void handleMousePressed(MouseEditEvent e,
                                  boolean isActive)
Description copied from class: Tool
Invoked when a mouse button has been pressed on a component.

Overrides:
handleMousePressed in class Tool
isActive - whether this tool is currently active

handleMouseReleased

protected void handleMouseReleased(MouseEditEvent e,
                                   boolean isActive)
Description copied from class: Tool
Invoked when a mouse button has been released on a component.

Overrides:
handleMouseReleased in class Tool
isActive - whether this tool is currently active

postprocessMenu

protected void postprocessMenu(BasicMenuBuilder.Menu rootMenu)
After the menu to be displayed has been created, this method is called. By default it doesn't do anything. Subclasses may overwrite it in order to make changes to the menu structure before it is displayed.

Parameters:
rootMenu - the BasicMenuBuilder.Menu to be displayed by this tool

getFixedContributors

public 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. 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.

Returns:
the List of MenuContributors asked for contributions when this Tool is preparing a menu to be displayed.
Throws:
IllegalStateException - if the calling thread is not the event dispatch thread


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.