Class PopupMenuHandler

Event handler that creates popupmenus.

Relates to MaxPopupMenu.

Hierarchy (view full)

Implements

Constructors

Properties

activeRow: null | PopupMenuItem = null
autoExpand: boolean = false

Specifies if submenus should be expanded on mouseover. Default is false.

clearSelectionOnBackground: boolean = true

Specifies if cells should be deselected if a popupmenu is displayed for the diagram background. Default is true.

containsItems: boolean = false
div: HTMLElement
enabled: boolean = true

Specifies if events are handled. Default is true.

eventListeners: EventListenerObject[] = []

Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.

eventReceiver: null | HTMLElement = null
eventsEnabled: boolean = true

Specifies if events can be fired. Default is true.

eventSource: null | EventTarget = null

Optional source for events. Default is null.

factoryMethod?: ((handler: PopupMenuItem, cell: null | Cell, me: MouseEvent) => void)

Function that is used to create the popup menu. The function takes the current panning handler, the under the mouse and the mouse event that triggered the call as arguments.

gestureHandler: ((sender: EventSource, eo: EventObject) => void)
graph: Graph

Reference to the enclosing Graph.

inTolerance: boolean = false
itemCount: number = 0

Contains the number of times has been called for a new menu.

labels: boolean = true

Specifies if any labels should be visible. Default is true.

popupTrigger: boolean = false
screenX: null | number = null

Screen X-coordinate of the mouse down event.

screenY: null | number = null

Screen Y-coordinate of the mouse down event.

selectOnPopup: boolean = true

Specifies if cells should be selected if a popupmenu is displayed for them. Default is true.

smartSeparators: boolean = false

Specifies if separators should only be added if a menu item follows them. Default is false.

submenuImage: string = ...

URL of the image to be used for the submenu icon.

table: HTMLElement
tbody: HTMLElement
triggerX: null | number = null

X-coordinate of the mouse down event.

triggerY: null | number = null

Y-coordinate of the mouse down event.

useLeftButtonForPopup: boolean = false

Specifies if popupmenus should be activated by clicking the left mouse button. Default is false.

willAddSeparator: boolean = false
zIndex: number = 10006

Specifies the zIndex for the popupmenu and its shadow. Default is 1006.

pluginId: string = 'PopupMenuHandler'

Methods

  • Adds the given item to the given parent item. If no parent item is specified then the item is added to the top-level menu. The return value may be used as the parent argument, ie. as a submenu item. The return value is the table row that represents the item.

    Paramters:

    title - String that represents the title of the menu item. image - Optional URL for the image icon. funct - Function associated that takes a mouseup or touchend event. parent - Optional item returned by . iconCls - Optional string that represents the CSS class for the image icon. IconsCls is ignored if image is given. enabled - Optional boolean indicating if the item is enabled. Default is true. active - Optional boolean indicating if the menu should implement any event handling. Default is true. noHover - Optional boolean to disable hover state.

    Parameters

    • title: string
    • image: null | string
    • funct: Function
    • parent: null | PopupMenuItem = null
    • iconCls: null | string = null
    • enabled: boolean = true
    • active: boolean = true
    • noHover: boolean = false

    Returns PopupMenuItem

  • Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.

    The parameters of the listener are the sender and an EventObject.

    Parameters

    • name: string
    • funct: Function

    Returns void

  • Adds a horizontal separator in the given parent item or the top-level menu if no parent is specified.

    Parameters

    • parent: null | PopupMenuItem = null

      Optional item returned by .

    • force: boolean = false

      Optional boolean to ignore . Default is false.

    Returns void

  • Creates the nodes required to add submenu items inside the given parent item. This is called in if a parent item is used for the first time. This adds various DOM nodes and a to the parent.

    Parameters

    Returns void

  • Dispatches the given event to the listeners which are registered for the event. The sender argument is optional. The current execution scope ("this") is used for the listener invocation (see Utils#bind).

    Example:

    fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))
    

    Parameters

    • evt: EventObject

      EventObject that represents the event.

    • sender: null | EventTarget = null

      Optional sender to be passed to the listener. Default value is the return value of .

    Returns void

  • Shows the popup menu for the given event and cell.

    Example:

    graph.getPlugin('PanningHandler').popup(x, y, cell, evt)
    {
    mxUtils.alert('Hello, World!');
    }

    Parameters

    • x: number
    • y: number
    • cell: null | Cell
    • evt: MouseEvent

    Returns void