Options
All
  • Public
  • Public/Protected
  • All
Menu

@maxgraph/core

Index

Namespaces

Classes

Variables

Functions

Variables

HierarchicalEdgeStyle

HierarchicalEdgeStyle: { CURVE: number; ORTHOGONAL: number; POLYLINE: number; STRAIGHT: number } = ...

Type declaration

  • CURVE: number
  • ORTHOGONAL: number
  • POLYLINE: number
  • STRAIGHT: number

Functions

Const error

  • error(message: string, width: number, close: boolean, icon?: null | string): MaxWindow
  • Displays the given error message in a new of the given width. If close is true then an additional close button is added to the window. The optional icon specifies the icon to be used for the window. Default is {@link Utils#errorImage}.

    Parameters

    • message: string

      String specifying the message to be displayed.

    • width: number

      Integer specifying the width of the window.

    • close: boolean

      Optional boolean indicating whether to add a close button.

    • icon: null | string = null

      Optional icon for the window decoration.

    Returns MaxWindow

Const get

  • get(url: string, onload?: null | Function, onerror?: null | Function, binary?: boolean, timeout?: null | number, ontimeout?: null | Function, headers?: null | {}): MaxXmlRequest
  • Loads the specified URL asynchronously and invokes the given functions depending on the request status. Returns the in use. Both functions take the as the only parameter. See {@link Utils#load} for a synchronous implementation.

    Example:

    mxUtils.get(url, (req)=>
    {
    let node = req.getDocumentElement();
    // Process XML DOM...
    });

    So for example, to load a diagram into an existing graph model, the following code is used.

    mxUtils.get(url, (req)=>
    {
    let node = req.getDocumentElement();
    let dec = new Codec(node.ownerDocument);
    dec.decode(node, graph.getDataModel());
    });

    Parameters

    • url: string

      URL to get the data from.

    • onload: null | Function = null

      Optional function to execute for a successful response.

    • onerror: null | Function = null

      Optional function to execute on error.

    • binary: boolean = false

      Optional boolean parameter that specifies if the request is binary.

    • timeout: null | number = null

      Optional timeout in ms before calling ontimeout.

    • ontimeout: null | Function = null

      Optional function to execute on timeout.

    • headers: null | {} = null

      Optional with headers, eg. {'Authorization': 'token xyz'}

    Returns MaxXmlRequest

Const getAll

  • getAll(urls: string[], onload: (arg0: any) => void, onerror: () => void): void
  • Loads the URLs in the given array asynchronously and invokes the given function if all requests returned with a valid 2xx status. The error handler is invoked once on the first error or invalid response.

    Parameters

    • urls: string[]

      Array of URLs to be loaded.

    • onload: (arg0: any) => void

      Callback with array of {@link XmlRequests}.

        • (arg0: any): void
        • Parameters

          • arg0: any

          Returns void

    • onerror: () => void

      Optional function to execute on error.

        • (): void
        • Returns void

    Returns void

Const load

  • Loads the specified URL synchronously and returns the . Throws an exception if the file cannot be loaded. See {@link Utils#get} for an asynchronous implementation.

    Example:

    try
    {
    let req = mxUtils.load(filename);
    let root = req.getDocumentElement();
    // Process XML DOM...
    }
    catch (ex)
    {
    mxUtils.alert('Cannot load '+filename+': '+ex);
    }

    Parameters

    • url: string

      URL to get the data from.

    Returns MaxXmlRequest

Const popup

  • popup(content: string, isInternalWindow?: boolean): void
  • Shows the specified text content in a new or a new browser window if isInternalWindow is false.

    Parameters

    • content: string

      String that specifies the text to be displayed.

    • isInternalWindow: boolean = false

      Optional boolean indicating if an MaxWindow should be used instead of a new browser window. Default is false.

    Returns void

Const post

  • post(url: string, params?: null | string, onload: Function, onerror?: null | Function): void
  • Posts the specified params to the given URL asynchronously and invokes the given functions depending on the request status. Returns the in use. Both functions take the as the only parameter. Make sure to use encodeURIComponent for the parameter values.

    Example:

    mxUtils.post(url, 'key=value', (req)=>
    {
    mxUtils.alert('Ready: '+req.isReady()+' Status: '+req.getStatus());
    // Process req.getDocumentElement() using DOM API if OK...
    });

    Parameters

    • url: string

      URL to get the data from.

    • params: null | string = null

      Parameters for the post request.

    • onload: Function

      Optional function to execute for a successful response.

    • onerror: null | Function = null

      Optional function to execute on error.

    Returns void

Const submit

  • submit(url: string, params: string, doc: XMLDocument, target: string): void
  • Submits the given parameters to the specified URL using <MaxXmlRequest.simulate> and returns the . Make sure to use encodeURIComponent for the parameter values.

    Parameters

    • url: string

      URL to get the data from.

    • params: string

      Parameters for the form.

    • doc: XMLDocument

      Document to create the form in.

    • target: string

      Target to send the form result to.

    Returns void

Generated using TypeDoc