VariantsTree

The VariantsTree Control enables users to create and interact with a layered view. The view contains the following default layers:

  • TreeVisualization
  • GroupVisualization

The view is scalable. Context menus are supported.

Constructor

The Constructor supports one composite parameter that can contain the properties described in the following table:

Name Type Description
connectIdStringMandatory property. It contains the DOM element container ID for the VariantsTree control. The Element should exist in the document. The VariantsTree DOM will be placed as a child into container. The default is ‘variantsTreeContainer’.
layerVisualizationParametersObjectOptional composite parameter. It contains a collection of additional visual settings for view layers, which can be loaded into view. Collection key = layer id. Example: { ‘groups’: { labelWidth: 200 } }

Public Fields

NameTypeDescription
layeredViewObject, MultiLayeredViewReference to MultiLayeredView control. Most parts of the VariantsTree functionality are based on this core control. It is initialized in the constructor.

Public Methods

This section describes the public methods.

loadTree

The loadtree method creates TreeLayer and GroupLayer instances, loads them into the control and then centers the view. The TreeLayer instance is initialized with the treeData input parameter. TreeLayer gets the ‘variantsTree’ ID and GroupLayer gets the ‘groups’ ID. The Method can be overridden in order to change the list of loaded layers. Input parameters

NameTypeDescription
treeDataObjectHierarchical object data structure with a single root, where the next level children are placed into property children.

isTreeLoaded

This method verifies that the default view layers are already created and loaded into the view control (loadTree method was called). Return value Boolean

getParentNode

Returns the SVG Node related to the control. Return value DOM Node

setGroupsLayerVisibility

Allows the Groups layer to be either shown or hidden. Input parameters

NameTypeDescription
isVisibleBooleanRequired layer visibility state.

setTreeLayerData

Sets new data for the layer. Input parameters

NameTypeDescription
layerIdString | NumberLayer id or index, which should be updated.
newDataAnyNew layer data.

getLeafDataNodesCount

Gets count of leaf data items from TreeLayer. Return value Number of leafs.

setScale

Gets count of leaf data items from TreeLayer. Input parameters

NameTypeDescription
newScaleNumberSets new scale value for layered view control.

getScale

Get count of leaf data items from TreeLayer. Return value Number

setSpacing

Sets new spacing value for Tree layer. This parameter effects distance between rendered item nodes, which are on adjacent hierarchy levels (horizontal distance). Input parameters

NameTypeDescription
spacingValueNumberSpacing distance in pixels

centerView

Calculates and sets the optimal view scale when layers content fits client viewport.

adjustViewBounds

Recalculates SVG node size based on current view content bounds and scale. This is a complex operation, which should be used after scaling or significant content changes.

Events

The following sections describe the events that can be used as part of the VariantsTree Control.

onScaleChanged

Event fires when view scale is changed. Input parameters

NameTypeDescription
newScaleNumberScale value that was applied.

onGroupsSwitched

Event fires when view scale is changed. Input parameters

NameTypeDescription
newScaleNumberScale value that was applied.

Context Menu Events

The events described in this section belong to the dojo context menu widget. Use the dojo.connect and dojo.on modules to attach handlers for them.

onTreeMenuInit

Event handler for onMenuInit, which generates array of descriptors for all available context menu actions. Return value Array of menu items descriptors.

onTreeMenuSetup

Event handler for setup context menu item’s state based on target layer and node. Input parameters

Name Type Description
menuControlObject, MenuWidgetMenu control, which should be updated.
targetLayerObject, VisualizationLayerLayer that contains Node for which menu should be displayed.
targetDataNodeObjectData object that bound to the target DOM Node.

onMenuItemClick

Handler for onMenuItemClick event.
Input parameters

NameTypeDescription
commandIdStringMenu item id.
targetDataNodeObjectData object that is bounded to the target DOM Node.