Class: GraphBuilder

GraphBuilder

new GraphBuilder($svg)

Parameters:
Name Type Description
$svg
Source:

Members

(static, constant) BOX

Source:

(static, constant) HALF_BOX

Source:

(static, constant) MAX_HOSTS

Source:

(static, constant) START_OFFSET

Source:

(static, constant) Y_SPACING

Source:

Methods

addHost() → {GraphBuilderHost}

Creates and adds a host to this GraphBuilder
Source:
Returns:
the newly created and added host
Type
GraphBuilderHost

bindHost(host)

Handles user interaction with host squares in the graph builder
Parameters:
Name Type Description
host GraphBuilderHost The host to bind events to
Source:

bindNodes()

Handles all user interaction with nodes in the graph builder, including:
  • Add node on click
  • Drag to add two connected nodes
  • Drag from existing node to new connected node
  • Drag from existing node to existing node to add connection
  • Drag existing node out of drawing area to remove
  • Double click existing node to remove
Source:

clear()

Resets the GraphBuilder to its original state.
Source:

convertFromBG(bg)

Replaces the contents of this graph builder with the provided BuilderGraph
Parameters:
Name Type Description
bg BuilderGraph
Source:

convertToBG() → {BuilderGraph}

Converts the drawn graph in this graph builder to a BuilderGraph
Source:
Returns:
the resulting BuilderGraph
Type
BuilderGraph

getHostByNode(node) → {GraphBuilderHost}

Retrieves the host that contains the specified node
Parameters:
Name Type Description
node GraphBuilderNode the node whose host you want to find
Source:
Returns:
the host that contains the specified node
Type
GraphBuilderHost

getHostByX(x) → {GraphBuilderHost}

Retrieves the host whose x coordinate is the one provided
Parameters:
Name Type Description
x Number the x-coord
Source:
Returns:
the host with the specified x-coordinate
Type
GraphBuilderHost

getHosts() → {Array.<GraphBuilderHost>}

Retrieves all graph builder hosts associated with this graph builder
Source:
Returns:
All hosts
Type
Array.<GraphBuilderHost>

getMaxNodeHeight()

Gets the maximum y-coordinate among the nodes in this graphBuilder
Source:

getMaxNodeWidth()

Gets the maximum x-coordinate among the nodes in this graphBuilder
Source:

getNodeByCoord(x, y) → {GraphBuilderNode}

Retrieves the node whose coordinates match the specified coordinates
Parameters:
Name Type Description
x Number the x-coordinate
y Number the y-coordinate
Source:
Returns:
the node with the specified coordinates
Type
GraphBuilderNode

getNodes() → {Array.<GraphBuilderNode>}

Gets all of the nodes contained in this graph builder as an array
Source:
Returns:
the nodes in this graph builder
Type
Array.<GraphBuilderNode>

getSVG() → {$}

Gets the svg associated with this GraphBuilder as a JQuery object. The svg is what the graph builder is drawn to
Source:
Returns:
The svg as a JQuery object
Type
$

handleHostClick(host)

Handles the click event on a host box in a custom structured search by showing the constraint dialog box
Parameters:
Name Type Description
host GraphBuilderHost The host whose host box was clicked on
Source:

handleHostDblClick(host)

Handles the double click event on a host box in a custom structured search by removing the host
Parameters:
Name Type Description
host GraphBuilderHost The host whose host box was double clicked on
Source:

invokeUpdateCallback()

Invokes the update callback function
Source:

isCleared() → {Boolean}

Retrieves the cleared field for this GraphBuilder
Source:
Returns:
True if this GraphBuilder was reset, false otherwise
Type
Boolean

removeHost(host)

Removes the provided host from this graph builder
Parameters:
Name Type Description
host GraphBuilderHost the host to remove
Source:

setCleared(cleared)

Sets the cleared field for this GraphBuilder
Parameters:
Name Type Description
cleared Boolean The boolean value to set
Source:

setUpdateCallback(fn)

Sets the update callback function. The update callback function will be called whenever a change is made to this graph builder
Parameters:
Name Type Description
fn function a function of zero parameters
Source: