GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • @maxgraph/core

This view

  • Original page
  • New address

GeezerVison is showing maxgraph.github.io — SelectionCellsHandler | @maxgraph/core

  • SelectionCellsHandler

Class SelectionCellsHandler

An event handler that manages cell handlers and invokes their mouse event processing functions.

Events

InternalEvent.ADD

Fires if a cell has been added to the selection. The state property contains the CellState that has been added.

InternalEvent.REMOVE

Fires if a cell has been remove from the selection. The state property contains the CellState that has been removed.

Hierarchy (View Summary)

  • EventSource
    • SelectionCellsHandler

Implements

  • GraphPlugin
  • MouseListenerSet
  • Defined in view/plugin/SelectionCellsHandler.ts:60
Index

Constructors

constructor

Properties

enabled eventListeners eventsEnabled eventSource graph handlers maxHandlers refreshHandler pluginId

Methods

addListener createEdgeHandler createHandler destroy fireEvent getEventSource getHandledSelectionCells getHandler isEnabled isEventsEnabled isHandled isHandlerActive mouseDown mouseMove mouseUp onDestroy refresh removeListener reset setEdgeHandlerFactory setEdgeHandlerFactoryForAllKinds setEnabled setEventsEnabled setEventSource setVertexHandlerFactory updateHandler

Constructors

constructor

  • new SelectionCellsHandler(graph: AbstractGraph): SelectionCellsHandler

    Parameters

    • graph: AbstractGraph

    Returns SelectionCellsHandler

    Overrides EventSource.constructor

    • Defined in view/plugin/SelectionCellsHandler.ts:76

Properties

enabled

enabled: boolean = true

Specifies if events are handled.

Default

true
  • Defined in view/plugin/SelectionCellsHandler.ts:109

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.

Inherited from EventSource.eventListeners

  • Defined in view/event/EventSource.ts:58

eventsEnabled

eventsEnabled: boolean = true

Specifies if events can be fired. Default is true.

Inherited from EventSource.eventsEnabled

  • Defined in view/event/EventSource.ts:63

eventSource

eventSource: EventTarget | null = null

Optional source for events.

Default

null

Inherited from EventSource.eventSource

  • Defined in view/event/EventSource.ts:69

graph

graph: AbstractGraph

Reference to the enclosing AbstractGraph.

  • Defined in view/plugin/SelectionCellsHandler.ts:103

handlers

handlers: Map<Cell, CellHandler>

Maps from cells to handlers.

  • Defined in view/plugin/SelectionCellsHandler.ts:125

maxHandlers

maxHandlers: number = 100

Defines the maximum number of handlers to paint individually.

Default

100
  • Defined in view/plugin/SelectionCellsHandler.ts:120

refreshHandler

refreshHandler: (sender: EventSource, evt: EventObject) => void

Keeps a reference to an event listener for later removal.

  • Defined in view/plugin/SelectionCellsHandler.ts:114

Static ReadonlypluginId

pluginId: "SelectionCellsHandler" = 'SelectionCellsHandler'
  • Defined in view/plugin/SelectionCellsHandler.ts:61

Methods

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

    Inherited from EventSource.addListener

    • Defined in view/event/EventSource.ts:105

createEdgeHandler

  • createEdgeHandler(
        state: CellState,
        edgeStyle: EdgeStyleFunction | null,
    ): EdgeHandler

    Hooks to create a new EdgeHandler for the given CellState.

    This method relies on the registered elements in EdgeStyleRegistry to know which EdgeHandler to create. If the EdgeStyle is not registered, it will return the EdgeHandler registered under the 'default' handler kind.

    Parameters

    • state: CellState

      CellState to create the handler for.

    • edgeStyle: EdgeStyleFunction | null

      the EdgeStyleFunction that let choose the actual edge handler.

    Returns EdgeHandler

    Since

    0.25.0

    • Defined in view/plugin/SelectionCellsHandler.ts:269

createHandler

  • createHandler(state: CellState): CellHandler

    Hooks to create a new handler for the given cell state.

    This implementation returns a new EdgeHandler if the corresponding cell is an edge, otherwise it returns an VertexHandler.

    Parameters

    • state: CellState

      CellState whose handler should be created.

    Returns CellHandler

    Since

    0.25.0

    • Defined in view/plugin/SelectionCellsHandler.ts:241

destroy

  • destroy(): void

    Clears all registered event listeners.

    Subclasses with a destroy method should call super.destroy() at the end of their own cleanup to ensure no stale listeners remain.

    Returns void

    Inherited from EventSource.destroy

    • Defined in view/event/EventSource.ts:166

fireEvent

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

    Example:

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

    Parameters

    • evt: EventObject

      EventObject that represents the event.

    • sender: EventTarget | null = null

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

    Returns void

    Inherited from EventSource.fireEvent

    • Defined in view/event/EventSource.ts:139

getEventSource

  • getEventSource(): EventTarget | null

    Returns eventSource.

    Returns EventTarget | null

    Inherited from EventSource.getEventSource

    • Defined in view/event/EventSource.ts:88

getHandledSelectionCells

  • getHandledSelectionCells(): Cell[]

    Reloads or updates all handlers.

    Returns Cell[]

    • Defined in view/plugin/SelectionCellsHandler.ts:167

getHandler

  • getHandler(cell: Cell): CellHandler | undefined

    Returns the handler for the given cell.

    Parameters

    • cell: Cell

    Returns CellHandler | undefined

    • Defined in view/plugin/SelectionCellsHandler.ts:144

isEnabled

  • isEnabled(): boolean

    Returns enabled.

    Returns boolean

    • Defined in view/plugin/SelectionCellsHandler.ts:130

isEventsEnabled

  • isEventsEnabled(): boolean

    Returns eventsEnabled.

    Returns boolean

    Inherited from EventSource.isEventsEnabled

    • Defined in view/event/EventSource.ts:74

isHandled

  • isHandled(cell: Cell): boolean

    Returns true if the given cell has a handler.

    Parameters

    • cell: Cell

    Returns boolean

    • Defined in view/plugin/SelectionCellsHandler.ts:151

isHandlerActive

  • isHandlerActive(handler: CellHandler): boolean

    Returns true if the given handler is active and should not be redrawn.

    Parameters

    • handler: CellHandler

    Returns boolean

    • Defined in view/plugin/SelectionCellsHandler.ts:353

mouseDown

  • mouseDown(sender: EventSource, me: InternalMouseEvent): void

    Redirects the given event to the handlers.

    Parameters

    • sender: EventSource
    • me: InternalMouseEvent

    Returns void

    Implementation of MouseListenerSet.mouseDown

    • Defined in view/plugin/SelectionCellsHandler.ts:383

mouseMove

  • mouseMove(sender: EventSource, me: InternalMouseEvent): void

    Redirects the given event to the handlers.

    Parameters

    • sender: EventSource
    • me: InternalMouseEvent

    Returns void

    Implementation of MouseListenerSet.mouseMove

    • Defined in view/plugin/SelectionCellsHandler.ts:394

mouseUp

  • mouseUp(sender: EventSource, me: InternalMouseEvent): void

    Redirects the given event to the handlers.

    Parameters

    • sender: EventSource
    • me: InternalMouseEvent

    Returns void

    Implementation of MouseListenerSet.mouseUp

    • Defined in view/plugin/SelectionCellsHandler.ts:405

onDestroy

  • onDestroy(): void

    Destroys the handler and all its resources and DOM nodes.

    Returns void

    Implementation of GraphPlugin.onDestroy

    • Defined in view/plugin/SelectionCellsHandler.ts:416

refresh

  • refresh(): void

    Reloads or updates all handlers.

    Returns void

    • Defined in view/plugin/SelectionCellsHandler.ts:174

removeListener

  • removeListener(funct: Function): void

    Removes all occurrences of the given listener from eventListeners.

    Parameters

    • funct: Function

    Returns void

    Inherited from EventSource.removeListener

    • Defined in view/event/EventSource.ts:112

reset

  • reset(): void

    Resets all handlers.

    Returns void

    • Defined in view/plugin/SelectionCellsHandler.ts:158

setEdgeHandlerFactory

  • setEdgeHandlerFactory(
        handlerKind: EdgeStyleHandlerKind,
        factory: EdgeHandlerFactory,
    ): void

    Sets the factory used by createEdgeHandler to instantiate the handler of a selected edge whose EdgeStyle is registered under the given EdgeStyleHandlerKind in EdgeStyleRegistry.

    Use it to have maxGraph create a custom EdgeHandler subclass, instead of subclassing this plugin:

    const selectionCellsHandler = graph.getPlugin<SelectionCellsHandler>('SelectionCellsHandler')!;
    selectionCellsHandler.setEdgeHandlerFactory('elbow', (state) => new MyElbowEdgeHandler(state));

    The three built-in kinds are 'default', 'elbow' and 'segment'. Custom kinds are supported: register the EdgeStyle with EdgeStyleRegistry.add(name, edgeStyle, { handlerKind: 'my-kind' }), then declare the matching factory here. Edge styles whose kind has no factory fall back to the 'default' one.

    The factory only affects handlers created after this call.

    Parameters

    • handlerKind: EdgeStyleHandlerKind

      the EdgeStyleHandlerKind the factory applies to.

    • factory: EdgeHandlerFactory

      creates the EdgeHandler for the CellState it receives.

    Returns void

    Since

    0.25.0

    • Defined in view/plugin/SelectionCellsHandler.ts:316

setEdgeHandlerFactoryForAllKinds

  • setEdgeHandlerFactoryForAllKinds(factory: EdgeHandlerFactory): void

    Sets a single factory used by createEdgeHandler for every EdgeStyleHandlerKind, whatever the EdgeStyle of the selected edge.

    Use it when the same EdgeHandler implementation fits all edges, instead of repeating setEdgeHandlerFactory for each kind:

    const selectionCellsHandler = graph.getPlugin<SelectionCellsHandler>('SelectionCellsHandler')!;
    selectionCellsHandler.setEdgeHandlerFactoryForAllKinds((state) => new MyEdgeHandler(state));

    This also covers the kinds registered in EdgeStyleRegistry after this call, as any kind without a dedicated factory falls back to the 'default' one.

    Parameters

    • factory: EdgeHandlerFactory

      creates the EdgeHandler for the CellState it receives.

    Returns void

    Since

    0.25.0

    Remarks

    This discards all factories previously set with setEdgeHandlerFactory, including those declared for custom kinds. Call it before declaring any per-kind factory, not after.

    • Defined in view/plugin/SelectionCellsHandler.ts:344

setEnabled

  • setEnabled(value: boolean): void

    Sets enabled.

    Parameters

    • value: boolean

    Returns void

    • Defined in view/plugin/SelectionCellsHandler.ts:137

setEventsEnabled

  • setEventsEnabled(value: boolean): void

    Sets eventsEnabled.

    Parameters

    • value: boolean

    Returns void

    Inherited from EventSource.setEventsEnabled

    • Defined in view/event/EventSource.ts:81

setEventSource

  • setEventSource(value: EventTarget | null): void

    Sets eventSource.

    Parameters

    • value: EventTarget | null

    Returns void

    Inherited from EventSource.setEventSource

    • Defined in view/event/EventSource.ts:95

setVertexHandlerFactory

  • setVertexHandlerFactory(factory: VertexHandlerFactory): void

    Sets the factory used by createHandler to instantiate the handler of a selected vertex.

    Use it to have maxGraph create a custom VertexHandler subclass, instead of subclassing this plugin:

    const selectionCellsHandler = graph.getPlugin<SelectionCellsHandler>('SelectionCellsHandler')!;
    selectionCellsHandler.setVertexHandlerFactory((state) => new MyVertexHandler(state));

    It only affects handlers created after this call, so set it before the first selection occurs.

    Parameters

    • factory: VertexHandlerFactory

      creates the VertexHandler for the CellState it receives.

    Returns void

    Since

    0.25.0

    • Defined in view/plugin/SelectionCellsHandler.ts:292

updateHandler

  • updateHandler(state: CellState): void

    Updates the handler for the given shape if one exists.

    Parameters

    • state: CellState

    Returns void

    • Defined in view/plugin/SelectionCellsHandler.ts:360

Settings

Member Visibility
  • Protected
  • Inherited
Theme

On This Page

Events
  • InternalEvent.ADD
  • InternalEvent.REMOVE
Constructors
constructor
Properties
enabledeventListenerseventsEnabledeventSourcegraphhandlersmaxHandlersrefreshHandlerpluginId
Methods
addListenercreateEdgeHandlercreateHandlerdestroyfireEventgetEventSourcegetHandledSelectionCellsgetHandlerisEnabledisEventsEnabledisHandledisHandlerActivemouseDownmouseMovemouseUponDestroyrefreshremoveListenerresetsetEdgeHandlerFactorysetEdgeHandlerFactoryForAllKindssetEnabledsetEventsEnabledsetEventSourcesetVertexHandlerFactoryupdateHandler
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.