Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MaxPopupMenu

Basic popup menu. To add a vertical scrollbar to a given submenu, the following code can be used.

let mxPopupMenuShowMenu = showMenu;
showMenu = ()=>
{
mxPopupMenuShowMenu.apply(this, arguments);

this.div.style.overflowY = 'auto';
this.div.style.overflowX = 'hidden';
this.div.style.maxHeight = '160px';
};

Constructor: mxPopupMenu

Constructs a popupmenu.

Event: mxEvent.SHOW

Fires after the menu has been shown in .

Hierarchy

Implements

  • Partial<PopupMenuItem>

Index

Constructors

constructor

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

Properties

activeRow

activeRow: null | PopupMenuItem = null

autoExpand

autoExpand: boolean = false

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

containsItems

containsItems: boolean = false

div

div: HTMLElement

enabled

enabled: boolean = true

Specifies if events are handled. Default is true.

eventListeners

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

eventReceiver: null | HTMLElement = null

eventSource

eventSource: null | EventTarget = null

Optional source for events. Default is null.

eventsEnabled

eventsEnabled: boolean = true

Specifies if events can be fired. Default is true.

Optional factoryMethod

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

Type declaration

    • (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.

      Parameters

      • handler: PopupMenuItem
      • cell: null | Cell
      • me: MouseEvent

      Returns void

itemCount

itemCount: number = 0

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

labels

labels: boolean = true

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

smartSeparators

smartSeparators: boolean = false

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

submenuImage

submenuImage: string = ...

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

table

table: HTMLElement

tbody

tbody: HTMLElement

useLeftButtonForPopup

useLeftButtonForPopup: boolean = false

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

willAddSeparator

willAddSeparator: boolean = false

zIndex

zIndex: number = 10006

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

Methods

addCheckmark

  • addCheckmark(item: HTMLElement, img: string): void
  • Adds a checkmark to the given menuitem.

    Parameters

    • item: HTMLElement
    • img: string

    Returns void

addItem

  • addItem(title: string, image: null | string, funct: Function, parent?: null | PopupMenuItem, iconCls?: null | string, enabled?: null | boolean, active?: null | boolean, noHover?: null | boolean): PopupMenuItem
  • 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: null | boolean = null
    • active: null | boolean = null
    • noHover: null | boolean = null

    Returns PopupMenuItem

addListener

  • addListener(name: string, funct: Function): void
  • 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

addSeparator

  • addSeparator(parent?: null | PopupMenuItem, force?: boolean): 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

createSubmenu

  • createSubmenu(parent: PopupMenuItem): 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

    • parent: PopupMenuItem

      An item returned by .

    Returns void

destroy

  • destroy(): void

fireEvent

  • fireEvent(evt: EventObject, sender?: null | EventTarget): 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 {@link 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

getEventSource

  • getEventSource(): null | EventTarget

hideMenu

  • hideMenu(): void

hideSubmenu

  • hideSubmenu(parent: PopupMenuItem): void
  • Removes all submenus inside the given parent.

    Parameters

    • parent: PopupMenuItem

      An item returned by .

    Returns void

isEnabled

  • isEnabled(): boolean
  • Returns true if events are handled. This implementation returns .

    Returns boolean

isEventsEnabled

  • isEventsEnabled(): boolean

isMenuShowing

  • isMenuShowing(): boolean

isPopupTrigger

  • Returns true if the given event is a popupmenu trigger for the optional given cell.

    Parameters

    Returns boolean

popup

  • popup(x: number, y: number, cell: null | Cell, evt: MouseEvent): 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

removeListener

  • removeListener(funct: Function): void

setEnabled

  • setEnabled(enabled: boolean): void
  • Enables or disables event handling. This implementation updates .

    Parameters

    • enabled: boolean

    Returns void

setEventSource

  • setEventSource(value: null | EventTarget): void

setEventsEnabled

  • setEventsEnabled(value: boolean): void

showMenu

  • showMenu(): void

showSubmenu

  • showSubmenu(parent: PopupMenuItem, row: PopupMenuItem): void
  • Shows the submenu inside the given parent row.

    Parameters

    • parent: PopupMenuItem
    • row: PopupMenuItem

    Returns void

Generated using TypeDoc