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

  • CellRenderer

Class CellRenderer

Renders Cells into a document object model.

In general, the CellRenderer is in charge of creating, redrawing and destroying the shape and label associated with a cell state, as well as some other graphical objects, namely controls and overlays.

The shape hierarchy in the display (i.e. the hierarchy in which the DOM nodes appear in the document) does not reflect the cell hierarchy. The shapes are a (flat) sequence of shapes and labels inside the draw pane of the GraphView, with some exceptions, namely the HTML labels being placed directly inside the graph container for certain browsers.

  • Defined in view/cell/CellRenderer.ts:63
Index

Constructors

constructor

Properties

antiAlias defaultEdgeShape defaultTextShape defaultVertexShape forceControlClickHandler legacyControlPosition legacySpacing minSvgStrokeWidth

Methods

checkPlaceholderStyles configureOverlayShape configureShape createCellOverlays createControl createControlClickHandler createIndicatorShape createLabel createOverlayShape createShape destroy doRedrawShape getControlBounds getLabelBounds getLabelValue getShape getShapeConstructor getShapesForState getTextScale initControl initializeLabel initializeOverlay initializeShape insertStateAfter installCellOverlayListeners installListeners isLabelEvent isShapeEvent isShapeInvalid isTextShapeInvalid postConfigureShape redraw redrawCellOverlays redrawControl redrawLabel redrawLabelShape redrawShape resolveColor rotateLabelBounds

Constructors

constructor

  • new CellRenderer(): CellRenderer

    Returns CellRenderer

Properties

antiAlias

antiAlias: boolean = true

Antialiasing option for new shapes.

Default

true.
  • Defined in view/cell/CellRenderer.ts:98

defaultEdgeShape

defaultEdgeShape: ShapeConstructor = ConnectorShape

Defines the default shape for edges.

Default

ConnectorShape

  • Defined in view/cell/CellRenderer.ts:68

defaultTextShape

defaultTextShape: typeof TextShape = TextShape

Defines the default shape for labels.

Default

TextShape.

  • Defined in view/cell/CellRenderer.ts:80

defaultVertexShape

defaultVertexShape: ShapeConstructor = RectangleShape

Defines the default shape for vertices.

Default

RectangleShape.

  • Defined in view/cell/CellRenderer.ts:74

forceControlClickHandler

forceControlClickHandler: boolean = false

Specifies if the enabled state of the graph should be ignored in the control click handler (to allow folding in disabled graphs).

Default

false.
  • Defined in view/cell/CellRenderer.ts:110

legacyControlPosition

legacyControlPosition: boolean = true

Specifies if the folding icon should ignore the horizontal orientation of a swimlane.

Default

true.
  • Defined in view/cell/CellRenderer.ts:86

legacySpacing

legacySpacing: boolean = true

Specifies if spacing and label position should be ignored if overflow is fill or width.

Default

true for backwards compatibility.
  • Defined in view/cell/CellRenderer.ts:92

minSvgStrokeWidth

minSvgStrokeWidth: number = 1

Minimum stroke width for SVG output.

  • Defined in view/cell/CellRenderer.ts:103

Methods

checkPlaceholderStyles

  • checkPlaceholderStyles(state: CellState): boolean

    Check if style properties supporting placeholders requires resolution.

    Parameters

    • state: CellState

    Returns boolean

    • Defined in view/cell/CellRenderer.ts:213

ProtectedconfigureOverlayShape

  • configureOverlayShape(
        _state: CellState,
        cellOverlay: CellOverlay,
        overlayShape: Shape,
    ): void

    Configure the Shape of the overlay. Generally, it is used to configure the DOM node of the Shape

    The default implementation set the cursor in the DOM node of the Shape based on the CellOverlay.cursor.

    Parameters

    • _state: CellState

      CellState for which the overlay shape should be created.

    • cellOverlay: CellOverlay

      CellOverlay used to create the Shape of the overlay.

    • overlayShape: Shape

      the Shape of the overlay.

    Returns void

    Since

    0.16.0

    • Defined in view/cell/CellRenderer.ts:531

configureShape

  • configureShape(state: CellState): void

    Configures the shape for the given cell state.

    Parameters

    • state: CellState

      CellState for which the shape should be configured.

    Returns void

    • Defined in view/cell/CellRenderer.ts:177

createCellOverlays

  • createCellOverlays(state: CellState): void

    Creates the actual shape for showing the overlay for the given cell state.

    Parameters

    • state: CellState

      CellState for which the overlay should be created.

    Returns void

    • Defined in view/cell/CellRenderer.ts:425

createControl

  • createControl(state: CellState): void

    Creates the control for the given cell state.

    Parameters

    • state: CellState

      CellState for which the control should be created.

    Returns void

    • Defined in view/cell/CellRenderer.ts:546

createControlClickHandler

  • createControlClickHandler(state: CellState): (evt: Event) => void

    Hook for creating the click handler for the folding icon.

    Parameters

    • state: CellState

      CellState whose control click handler should be returned.

    Returns (evt: Event) => void

    • Defined in view/cell/CellRenderer.ts:575

createIndicatorShape

  • createIndicatorShape(state: CellState): void

    Creates the indicator shape for the given cell state.

    Parameters

    • state: CellState

      CellState for which the indicator shape should be created.

    Returns void

    • Defined in view/cell/CellRenderer.ts:146

createLabel

  • createLabel(state: CellState, value: string): void

    Creates the label for the given cell state.

    Parameters

    • state: CellState

      CellState for which the label should be created.

    • value: string

      the label value.

    Returns void

    • Defined in view/cell/CellRenderer.ts:299

ProtectedcreateOverlayShape

  • createOverlayShape(_state: CellState, cellOverlay: CellOverlay): Shape

    Create the Shape of the overlay.

    Parameters

    • _state: CellState

      CellState for which the overlay shape should be created.

    • cellOverlay: CellOverlay

      CellOverlay used to create the Shape of the overlay.

    Returns Shape

    Since

    0.16.0

    • Defined in view/cell/CellRenderer.ts:463

createShape

  • createShape(state: CellState): Shape

    Creates and returns the shape for the given cell state.

    Parameters

    • state: CellState

      CellState for which the shape should be created.

    Returns Shape

    • Defined in view/cell/CellRenderer.ts:131

destroy

  • destroy(state: CellState): void

    Destroys the shapes associated with the given cell state.

    Parameters

    • state: CellState

      CellState for which the shapes should be destroyed.

    Returns void

    • Defined in view/cell/CellRenderer.ts:1453

doRedrawShape

  • doRedrawShape(state: CellState): void

    Invokes redraw on the shape of the given state.

    Parameters

    • state: CellState

    Returns void

    • Defined in view/cell/CellRenderer.ts:1431

getControlBounds

  • getControlBounds(state: CellState, w: number, h: number): Rectangle | null

    Returns the bounds to be used to draw the control (folding icon) of the given state.

    Parameters

    • state: CellState
    • w: number
    • h: number

    Returns Rectangle | null

    • Defined in view/cell/CellRenderer.ts:1154

getLabelBounds

  • getLabelBounds(state: CellState): Rectangle

    Returns the bounds to be used to draw the label of the given state.

    Parameters

    • state: CellState

      CellState whose label bounds should be returned.

    Returns Rectangle

    • Defined in view/cell/CellRenderer.ts:937

getLabelValue

  • getLabelValue(state: CellState): string | null

    Returns the value to be used for the label.

    Parameters

    • state: CellState

      CellState for which the label should be created.

    Returns string | null

    • Defined in view/cell/CellRenderer.ts:288

getShape

  • getShape(name?: string | null): ShapeConstructor | null

    Returns the shape for the given name from ShapeRegistry.

    Parameters

    • Optionalname: string | null

    Returns ShapeConstructor | null

    • Defined in view/cell/CellRenderer.ts:155

getShapeConstructor

  • getShapeConstructor(state: CellState): ShapeConstructor

    Returns the constructor to be used for creating the shape.

    Parameters

    • state: CellState

    Returns ShapeConstructor

    • Defined in view/cell/CellRenderer.ts:162

getShapesForState

  • getShapesForState(
        state: CellState,
    ): [Shape | null, TextShape | null, Shape | null]

    Returns the Shapes for the given cell state in the order in which they should appear in the DOM.

    Parameters

    • state: CellState

      CellState whose shapes should be returned.

    Returns [Shape | null, TextShape | null, Shape | null]

    • Defined in view/cell/CellRenderer.ts:1296

getTextScale

  • getTextScale(state: CellState): number

    Returns the scaling used for the label of the given state

    Parameters

    • state: CellState

      CellState whose label scale should be returned.

    Returns number

    • Defined in view/cell/CellRenderer.ts:928

initControl

  • initControl(
        state: CellState,
        control: Shape,
        handleEvents: boolean,
        clickHandler: EventListener,
    ): Element | null

    Initializes the given control and returns the corresponding DOM node.

    Parameters

    • state: CellState

      CellState for which the control should be initialized.

    • control: Shape

      Shape to be initialized.

    • handleEvents: boolean

      Boolean indicating if mousedown and mousemove should fire events via the graph.

    • clickHandler: EventListener

      Optional function to implement clicks on the control.

    Returns Element | null

    • Defined in view/cell/CellRenderer.ts:595

initializeLabel

  • initializeLabel(state: CellState, shape: Shape): void

    Initializes the label with a suitable container.

    Parameters

    • state: CellState

      CellState whose label should be initialized.

    • shape: Shape

      Shape that represents the label.

    Returns void

    • Defined in view/cell/CellRenderer.ts:411

initializeOverlay

  • initializeOverlay(state: CellState, overlay: Shape): void

    Initializes the given overlay.

    Parameters

    • state: CellState

      CellState for which the overlay should be created.

    • overlay: Shape

      Shape that represents the overlay.

    Returns void

    • Defined in view/cell/CellRenderer.ts:475

initializeShape

  • initializeShape(state: CellState): void

    Initializes the shape in the given state by calling its init method with the correct container after configuring it using configureShape.

    Parameters

    • state: CellState

      CellState for which the shape should be initialized.

    Returns void

    • Defined in view/cell/CellRenderer.ts:118

insertStateAfter

  • insertStateAfter(
        state: CellState,
        node: HTMLElement | SVGElement | null,
        htmlNode: HTMLElement | SVGElement | null,
    ): (HTMLElement | SVGElement | null)[]

    Inserts the given CellState after the given nodes in the DOM.

    Parameters

    • state: CellState

      CellState to be inserted.

    • node: HTMLElement | SVGElement | null

      Node in GraphView.drawPane after which the shapes should be inserted.

    • htmlNode: HTMLElement | SVGElement | null

      Node in the graph container after which the shapes should be inserted that will not go into the GraphView.drawPane (e.g. HTML labels without foreignObjects).

    Returns (HTMLElement | SVGElement | null)[]

    • Defined in view/cell/CellRenderer.ts:1219

installCellOverlayListeners

  • installCellOverlayListeners(
        state: CellState,
        overlay: CellOverlay,
        shape: Shape,
    ): void

    Installs the listeners for the given CellState , CellOverlay and Shape that represents the overlay.

    Parameters

    • state: CellState
    • overlay: CellOverlay
    • shape: Shape

    Returns void

    • Defined in view/cell/CellRenderer.ts:482

installListeners

  • installListeners(state: CellState): void

    Installs the event listeners for the given cell state.

    Parameters

    • state: CellState

      CellState for which the event listeners should be isntalled.

    Returns void

    • Defined in view/cell/CellRenderer.ts:710

isLabelEvent

  • isLabelEvent(state: CellState, evt: MouseEvent): boolean

    Returns true if the event is for the label of the given state.

    This implementation always returns true.

    Parameters

    • state: CellState

      CellState whose label fired the event.

    • evt: MouseEvent

      Mouse event which was fired.

    Returns boolean

    • Defined in view/cell/CellRenderer.ts:701

isShapeEvent

  • isShapeEvent(state: CellState, evt: MouseEvent): boolean

    Returns true if the event is for the shape of the given state.

    This implementation always returns true.

    Parameters

    • state: CellState

      CellState whose shape fired the event.

    • evt: MouseEvent

      Mouse event which was fired.

    Returns boolean

    • Defined in view/cell/CellRenderer.ts:689

isShapeInvalid

  • isShapeInvalid(state: CellState, shape: Shape): boolean

    Returns true if the given shape must be repainted.

    Parameters

    • state: CellState
    • shape: Shape

    Returns boolean

    • Defined in view/cell/CellRenderer.ts:1438

isTextShapeInvalid

  • isTextShapeInvalid(state: CellState, shape: TextShape): boolean

    Returns true if the style for the text shape has changed.

    Parameters

    • state: CellState

      CellState whose label should be checked.

    • shape: TextShape

      Text shape to be checked.

    Returns boolean

    • Defined in view/cell/CellRenderer.ts:870

postConfigureShape

  • postConfigureShape(state: CellState): void

    Replaces any reserved words used for attributes, eg. inherit, indicated or swimlane for colors in the shape for the given state. This implementation resolves these keywords on the fill, stroke and gradient color keys.

    Parameters

    • state: CellState

    Returns void

    • Defined in view/cell/CellRenderer.ts:200

redraw

  • redraw(state: CellState, force?: boolean, rendering?: boolean): void

    Updates the bounds or points and scale of the shapes for the given cell state. This is called in mxGraphView.validatePoints as the last step of updating all cells.

    Parameters

    • state: CellState

      CellState for which the shapes should be updated.

    • force: boolean = false

      Optional boolean that specifies if the cell should be reconfiured and redrawn without any additional checks.

    • rendering: boolean = true

      Optional boolean that specifies if the cell should actually be drawn into the DOM. If this is false then redraw and/or reconfigure will not be called on the shape.

    Returns void

    • Defined in view/cell/CellRenderer.ts:1312

redrawCellOverlays

  • redrawCellOverlays(state: CellState, forced?: boolean): void

    Redraws the overlays for the given cell state.

    Parameters

    • state: CellState

      CellState whose overlays should be redrawn.

    • forced: boolean = false

    Returns void

    • Defined in view/cell/CellRenderer.ts:1077

redrawControl

  • redrawControl(state: CellState, forced?: boolean): void

    Redraws the control for the given cell state.

    Parameters

    • state: CellState

      CellState whose control should be redrawn.

    • forced: boolean = false

    Returns void

    • Defined in view/cell/CellRenderer.ts:1125

redrawLabel

  • redrawLabel(state: CellState, forced: boolean): void

    Redraws the label for the given cell state.

    Parameters

    • state: CellState

      CellState whose label should be redrawn.

    • forced: boolean

    Returns void

    • Defined in view/cell/CellRenderer.ts:787

redrawLabelShape

  • redrawLabelShape(shape: TextShape): void

    Called to invoked redraw on the given text shape.

    Parameters

    • shape: TextShape

      Text shape to be redrawn.

    Returns void

    • Defined in view/cell/CellRenderer.ts:919

redrawShape

  • redrawShape(state: CellState, force?: boolean, rendering?: boolean): boolean

    Redraws the shape for the given cell state.

    Parameters

    • state: CellState

      CellState whose label should be redrawn.

    • force: boolean = false
    • rendering: boolean = true

    Returns boolean

    • Defined in view/cell/CellRenderer.ts:1327

resolveColor

  • resolveColor(state: CellState, field: string, key: string): void

    Resolves special keywords 'inherit', 'indicated' and 'swimlane' and sets the respective color on the shape.

    Parameters

    • state: CellState
    • field: string
    • key: string

    Returns void

    • Defined in view/cell/CellRenderer.ts:227

rotateLabelBounds

  • rotateLabelBounds(state: CellState, bounds: Rectangle): void

    Adds the shape rotation to the given label bounds and applies the alignment and offsets.

    Parameters

    • state: CellState

      CellState whose label bounds should be rotated.

    • bounds: Rectangle

      Rectangle the rectangle to be rotated.

    Returns void

    • Defined in view/cell/CellRenderer.ts:1012

Settings

Member Visibility
  • Protected
  • Inherited
Theme

On This Page

Constructors
constructor
Properties
antiAliasdefaultEdgeShapedefaultTextShapedefaultVertexShapeforceControlClickHandlerlegacyControlPositionlegacySpacingminSvgStrokeWidth
Methods
checkPlaceholderStylesconfigureOverlayShapeconfigureShapecreateCellOverlayscreateControlcreateControlClickHandlercreateIndicatorShapecreateLabelcreateOverlayShapecreateShapedestroydoRedrawShapegetControlBoundsgetLabelBoundsgetLabelValuegetShapegetShapeConstructorgetShapesForStategetTextScaleinitControlinitializeLabelinitializeOverlayinitializeShapeinsertStateAfterinstallCellOverlayListenersinstallListenersisLabelEventisShapeEventisShapeInvalidisTextShapeInvalidpostConfigureShaperedrawredrawCellOverlaysredrawControlredrawLabelredrawLabelShaperedrawShaperesolveColorrotateLabelBounds
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.