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 — GraphSelectionModel | @maxgraph/core

  • GraphSelectionModel

Class GraphSelectionModel

Implements the selection model for a graph.

Here is a listener that handles all removed selection cells.

graph.getSelectionModel().addListener(InternalEvent.CHANGE, function(sender, evt) {
const cells = evt.getProperty('added');
for (const cell of cells) {
// Handle cell...
}
});

Events

InternalEvent.UNDO

Fires after the selection was changed in changeSelection. The edit property contains the UndoableEdit which contains the SelectionChange.

InternalEvent.CHANGE

Fires after the selection changes by executing an SelectionChange.

WARN: the event's added and removed properties contain arrays of cells that have been added to or removed from the selection, respectively. The names are inverted due to historic reasons.

See the SelectionChange class for more details.

Hierarchy (View Summary)

  • EventSource
    • GraphSelectionModel
  • Defined in view/GraphSelectionModel.ts:60
Index

Constructors

constructor

Properties

cells doneResource eventListeners eventsEnabled eventSource graph singleSelection updatingSelectionResource

Methods

addCell addCells addListener cellAdded cellRemoved changeSelection clear destroy fireEvent getEventSource getFirstSelectableCell isEmpty isEventsEnabled isSelected isSingleSelection removeCell removeCells removeListener setCell setCells setEventsEnabled setEventSource setSingleSelection

Constructors

constructor

  • new GraphSelectionModel(graph: AbstractGraph): GraphSelectionModel

    Constructs a new graph selection model for the given AbstractGraph.

    Parameters

    • graph: AbstractGraph

      Reference to the enclosing AbstractGraph.

    Returns GraphSelectionModel

    Overrides EventSource.constructor

    • Defined in view/GraphSelectionModel.ts:65

Properties

cells

cells: Cell[]
  • Defined in view/GraphSelectionModel.ts:72

doneResource

doneResource: string = ...

Specifies the resource key for the status message after a long operation. If the resource for this key does not exist, then the value is used as the status message.

Default

'done'
  • Defined in view/GraphSelectionModel.ts:80

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
  • Defined in view/GraphSelectionModel.ts:71

singleSelection

singleSelection: boolean = false

Specifies if only one selected item at a time is allowed.

Default

false.
  • Defined in view/GraphSelectionModel.ts:94

updatingSelectionResource

updatingSelectionResource: string = ...

Specifies the resource key for the status message while the selection is being updated. If the resource for this key does not exist, then the value is used as the status message.

Default

'updatingSelection'
  • Defined in view/GraphSelectionModel.ts:88

Methods

addCell

  • addCell(cell: Cell): void

    Adds the given Cell to the selection and fires a InternalEvent.CHANGE event.

    Parameters

    • cell: Cell

      Cell to add to the selection.

    Returns void

    • Defined in view/GraphSelectionModel.ts:173

addCells

  • addCells(cells: Cell[]): void

    Adds the given array of Cell to the selection and fires a InternalEvent.CHANGE event.

    Parameters

    • cells: Cell[]

      Array of Cell to add to the selection.

    Returns void

    • Defined in view/GraphSelectionModel.ts:182

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

cellAdded

  • cellAdded(cell: Cell): void

    Inner callback to add the specified Cell to the selection. No event is fired in this implementation.

    Parameters

    • cell: Cell

      Cell to add to the selection.

    Returns void

    • Defined in view/GraphSelectionModel.ts:242

cellRemoved

  • cellRemoved(cell: Cell): void

    Inner callback to remove the specified Cell from the selection. No event is fired in this implementation.

    Parameters

    • cell: Cell

      Cell to remove from the selection.

    Returns void

    • Defined in view/GraphSelectionModel.ts:254

changeSelection

  • changeSelection(added?: Cell[] | null, removed?: Cell[] | null): void

    Adds/removes the specified arrays of Cell to/from the selection.

    Parameters

    • added: Cell[] | null = null

      Array of Cell to add to the selection.

    • removed: Cell[] | null = null

      Array of Cell to remove from the selection.

    Returns void

    • Defined in view/GraphSelectionModel.ts:224

clear

  • clear(): void

    Clears the selection and fires a InternalEvent.CHANGE event if the selection was not empty.

    Returns void

    • Defined in view/GraphSelectionModel.ts:129

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

getFirstSelectableCell

  • getFirstSelectableCell(cells: Cell[]): Cell | null

    Returns the first selectable cell in the given array of cells.

    Parameters

    • cells: Cell[]

    Returns Cell | null

    the first cell for which AbstractGraph.isCellSelectable returns true, or null if no such cell exists (including when cells is empty).

    • Defined in view/GraphSelectionModel.ts:164

isEmpty

  • isEmpty(): boolean

    Returns true if no cells are currently selected.

    Returns boolean

    • Defined in view/GraphSelectionModel.ts:122

isEventsEnabled

  • isEventsEnabled(): boolean

    Returns eventsEnabled.

    Returns boolean

    Inherited from EventSource.isEventsEnabled

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

isSelected

  • isSelected(cell: Cell): boolean

    Returns true if the given Cell is selected.

    Parameters

    • cell: Cell

    Returns boolean

    • Defined in view/GraphSelectionModel.ts:115

isSingleSelection

  • isSingleSelection(): boolean

    Returns singleSelection as a boolean.

    Returns boolean

    • Defined in view/GraphSelectionModel.ts:99

removeCell

  • removeCell(cell: Cell): void

    Removes the specified Cell from the selection and fires a InternalEvent.CHANGE event for the remaining cells.

    Parameters

    • cell: Cell

      Cell to remove from the selection.

    Returns void

    • Defined in view/GraphSelectionModel.ts:203

removeCells

  • removeCells(cells: Cell[]): void

    Removes the specified Cell from the selection and fires a InternalEvent.CHANGE event for the remaining cells.

    Parameters

    • cells: Cell[]

      Cells to remove from the selection.

    Returns void

    • Defined in view/GraphSelectionModel.ts:213

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

setCell

  • setCell(cell: Cell | null): void

    Selects the specified Cell using setCells.

    Parameters

    • cell: Cell | null

      Cell to be selected.

    Returns void

    • Defined in view/GraphSelectionModel.ts:138

setCells

  • setCells(cells: Cell[]): void

    Selects the given array of Cell and fires a InternalEvent.CHANGE event.

    Parameters

    • cells: Cell[]

      Array of Cell to be selected.

    Returns void

    • Defined in view/GraphSelectionModel.ts:147

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

setSingleSelection

  • setSingleSelection(singleSelection: boolean): void

    Sets the singleSelection flag.

    Parameters

    • singleSelection: boolean

      the new value for singleSelection.

    Returns void

    • Defined in view/GraphSelectionModel.ts:108

Settings

Member Visibility
  • Protected
  • Inherited
Theme

On This Page

Events
Constructors
constructor
Properties
cellsdoneResourceeventListenerseventsEnabledeventSourcegraphsingleSelectionupdatingSelectionResource
Methods
addCelladdCellsaddListenercellAddedcellRemovedchangeSelectioncleardestroyfireEventgetEventSourcegetFirstSelectableCellisEmptyisEventsEnabledisSelectedisSingleSelectionremoveCellremoveCellsremoveListenersetCellsetCellssetEventsEnabledsetEventSourcesetSingleSelection
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.