Interface: DvtDiagramLayoutContext

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

oj. DvtDiagramLayoutContext

Version:
  • 3.2.0

Pluggable layout code must conform to the pluggable layout contract. The following steps outline a simple pluggable layout.

  1. Diagram calls layout engine with layout context.
  2. Layout engine loops over nodes using getNodeCount and getNodeByIndex()
    • layout engine gets dimensions of node by calling getBounds()
    • layout engine sets position on node by calling setPosition()
  3. Layout engine loops over links using getLinkCount and getLinkByIndex()
    • layout engine gets start and end nodes by calling getStartId()/getEndId() on a link object
    • layout engine analyzes nodes position and dimensions by calling getPosition() and getBounds() on each node and finds connection points for the link start/end
    • layout engine creates a link path by calling setPoints() on a link object
  4. Diagram applies node positions from layout context

The DvtDiagramLayoutContext interface defines the context for a layout call.

Source:

Methods

getCommonContainer(nodeId1, nodeId2) → {string}

The function retrieves nearest common ancestor container for two nodes.
Parameters:
Name Type Description
nodeId1 string first node id
nodeId2 string second node id
Source:
Returns:
Id for the first common ancestor container or null for top level diagram
Type
string

getComponentSize() → {Object}

Get the size of the Diagram.
Properties:
Name Type Description
x number x-coordinate
y number y-coordinate
w number width
h number height
Source:
Returns:
An object containing properties of the diagram size
Type
Object

getCurrentViewport() → {Object}

Get the current viewport used by the component in the layout's coordinate system for the diagram
Properties:
Name Type Description
x number x-coordinate
y number y-coordinate
w number width
h number height
Source:
Returns:
An object containing properties of the current viewport
Type
Object

getLinkById(id) → {oj.DvtDiagramLayoutContextLink}

Get a link context by id.
Parameters:
Name Type Description
id string id of link context to get
Source:
Returns:
Type
oj.DvtDiagramLayoutContextLink

getLinkByIndex(index) → {oj.DvtDiagramLayoutContextLink}

Get a link context by index.
Parameters:
Name Type Description
index number index of link context to get
Source:
Returns:
Type
oj.DvtDiagramLayoutContextLink

getLinkCount() → {number}

Get the number of links to layout.
Source:
Returns:
Type
number

getNodeById(id) → {oj.DvtDiagramLayoutContextNode}

Get a node context by id.
Parameters:
Name Type Description
id string id of node context to get
Source:
Returns:
Type
oj.DvtDiagramLayoutContextNode

getNodeByIndex(index) → {oj.DvtDiagramLayoutContextNode}

Get a node context by index.
Parameters:
Name Type Description
index number index of node context to get
Source:
Returns:
Type
oj.DvtDiagramLayoutContextNode

getNodeCount() → {number}

Get the number of nodes to layout.
Source:
Returns:
Type
number

getViewport() → {Object}

Get the viewport the component should use after the layout, in the layout's coordinate system.
Properties:
Name Type Description
x number x-coordinate
y number y-coordinate
w number width
h number height
Source:
Returns:
An object containing properties of the viewport
Type
Object

isLocaleR2L() → {boolean}

Get whether the reading direction for the locale is right-to-left.
Source:
Returns:
Type
boolean

setViewport(viewport)

Set the viewport the component should use after the layout, in the layout's coordinate system.
Parameters:
Name Type Description
viewport Object An object containing properties of the viewport that the component should use after the layout
Properties:
Name Type Description
x number x-coordinate
y number y-coordinate
w number width
h number height
Source: