Class SwingPopupMenuBuilder
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.action.AbstractPopupMenuBuilder
-
- net.sf.jguiraffe.gui.platform.swing.builder.action.SwingPopupMenuBuilder
-
- All Implemented Interfaces:
net.sf.jguiraffe.gui.builder.action.PopupMenuBuilder
public class SwingPopupMenuBuilder extends net.sf.jguiraffe.gui.builder.action.AbstractPopupMenuBuilderA specialized implementation of the
PopupMenuBuilderinterface for constructing Swing popup menus.This implementation creates a
javax.swing.JPopupMenuobject when a new builder instance is created. The severaladd()methods populate this menu. They expect that objects compatible with Swing are passed as parameters (e.g. Swing actions or Swing menu components).The
create()method returns the current popup menu. It also displays the menu for the affected component (this component and the location where to display the popup must be specified at construction time).- Version:
- $Id: SwingPopupMenuBuilder.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description SwingPopupMenuBuilder(MouseEvent event)Deprecated.Use the constructor which expects information about anActionManager; this constructor only creates a partly initialized object.SwingPopupMenuBuilder(net.sf.jguiraffe.gui.builder.action.ActionManager actMan, net.sf.jguiraffe.gui.builder.action.ActionBuilder builder, MouseEvent event)Creates a new instance ofSwingPopupMenuBuilderand initializes it with information about the action manager to be delegated to and the mouse event that triggered the invocation of this builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectcreate()Displays the popup menu constructed by this builder.protected JPopupMenugetMenu()Returns the menu that is constructed by this builder.protected ObjectgetMenuUnderConstruction()MouseEventgetTriggeringEvent()Returns the event that triggered the invocation of this builder.protected voidshowMenu(JPopupMenu m)Displays the specified popup menu.
-
-
-
Constructor Detail
-
SwingPopupMenuBuilder
public SwingPopupMenuBuilder(net.sf.jguiraffe.gui.builder.action.ActionManager actMan, net.sf.jguiraffe.gui.builder.action.ActionBuilder builder, MouseEvent event)Creates a new instance ofSwingPopupMenuBuilderand initializes it with information about the action manager to be delegated to and the mouse event that triggered the invocation of this builder.- Parameters:
actMan- theActionManagerbuilder- theActionBuilderevent- the triggering event (must not be null)- Throws:
IllegalArgumentException- if the event is null
-
SwingPopupMenuBuilder
@Deprecated public SwingPopupMenuBuilder(MouseEvent event)
Deprecated.Use the constructor which expects information about anActionManager; this constructor only creates a partly initialized object.Creates a new instance ofSwingPopupMenuBuilderand initializes it with the triggering mouse event.- Parameters:
event- the triggering event (must not be null)- Throws:
IllegalArgumentException- if the event is null
-
-
Method Detail
-
getTriggeringEvent
public MouseEvent getTriggeringEvent()
Returns the event that triggered the invocation of this builder.- Returns:
- the triggering mouse event
-
create
public Object create()
Displays the popup menu constructed by this builder. This method must be called when the construction of the menu is complete.- Returns:
- the popup menu
-
getMenu
protected JPopupMenu getMenu()
Returns the menu that is constructed by this builder.- Returns:
- the current menu
-
showMenu
protected void showMenu(JPopupMenu m)
Displays the specified popup menu. This method is called bycreate()with the current menu. This implementation displays the popup menu as specified by the triggering event.- Parameters:
m- the menu to display
-
getMenuUnderConstruction
protected Object getMenuUnderConstruction()
- Specified by:
getMenuUnderConstructionin classnet.sf.jguiraffe.gui.builder.action.AbstractPopupMenuBuilder
-
-