HierarchyPainter

HierarchyPainter

new HierarchyPainter(name, frameid, backgropt)

Painter of hierarchical structures

Source:
Example
import { HierarchyPainter } from 'https://root.cern/js/latest/modules/gui/HierarchyPainter.mjs';
// create hierarchy painter in 'myTreeDiv'
let h = new HierarchyPainter('example', 'myTreeDiv');
// configure 'simple' layout in 'myMainDiv'
// one also can specify 'grid2x2' or 'flex' or 'tabs'
h.setDisplay('simple', 'myMainDiv');
// open file and display element
h.openRootFile('https://root.cern/js/files/hsimple.root').then(() => h.display('hpxpy;1','colz'));
Parameters:
Name Type Attributes Description
name string

symbolic name

frameid string

element id where hierarchy is drawn

backgr string <optional>

background color

Methods

(async) applyStyle(style)

Apply loaded TStyle object

Description:
  • One also can specify item name of JSON file name where style is loaded

Source:
Parameters:
Name Type Description
style object | string

either TStyle object of item name where object can be load

cleanup()

Cleanup hierarchy painter

Description:
  • clear drawing and browser

Source:

(async) createBrowser() → {Promise}

Create browser elements

Source:
Returns:

when completed

Type
Promise

createButtons()

Create shortcut buttons

Source:

(async) createStatusLine(heightopt, modeopt) → {Promise}

Create status line

Source:
Parameters:
Name Type Attributes Description
height number <optional>

size of the status line

mode <optional>

false / true / 'toggle'

Returns:

when ready

Type
Promise

(async) display(itemname, drawoptopt, domopt, interactiveopt) → {Promise}

Display specified item

Source:
Parameters:
Name Type Attributes Default Description
itemname string

item name

drawopt string <optional>

draw option for the item

dom string | Object <optional>
null

place where to draw item, same as for @ref draw function

interactive boolean <optional>
false

if display was called in interactive mode, will activate selected drawing

Returns:

with created painter object

Type
Promise

enableMonitoring()

Enable monitoring mode

Source:

(async, protected) exapndToLevel()

Expand to specified level

Source:

(async) executeCommand(itemname, elemopt, arg1opt, arg2opt) → {Promise}

Executes item marked as 'Command'

Description:
  • If command requires additional arguments, they could be specified as extra arguments arg1, arg2, ...

Source:
Parameters:
Name Type Attributes Description
itemname String

name of command item

elem Object <optional>

HTML element for command execution

arg1 <optional>

first optional argument

arg2 <optional>

second optional argument and so on

Returns:

with command result

Type
Promise

(async) expandItem(itemname) → {Promise}

expand specified item

Source:
Parameters:
Name Type Description
itemname String

item name

Returns:

when ready

Type
Promise

getDisplay()

Returns actual MDI display object

Description:
Source:

getLayout()

Returns configured layout

Source:

getMonitoringInterval()

Returns configured monitoring interval in ms

Source:

hasStatusLine()

Returns true if status is exists

Source:

initializeBrowser()

Initialize browser elements

Source:

isItemDisplayed(itemname)

Returns true if given item displayed

Source:
Parameters:
Name Type Description
itemname string

item name

isMonitoring()

Returns true when monitoring is enabled

Source:

(async) listServerDir()

Create list of files for specified directory

Source:

(async) openJsonFile(filepath) → {Promise}

Open JSON file

Source:
Parameters:
Name Type Description
filepath string

URL to JSON file

Returns:

when object ready

Type
Promise

(async) openOnline(server_address) → {Promise}

Access THttpServer with provided address

Source:
Parameters:
Name Type Description
server_address string

URL to server like 'http://localhost:8090/'

Returns:

when ready

Type
Promise

(async) openRootFile(filepath) → {Promise}

Open ROOT file

Source:
Parameters:
Name Type Description
filepath string

URL to ROOT file, argument for openFile

Returns:

when file is opened

Type
Promise

(async) player(itemname, optionopt) → {Promise}

Starts player for specified item

Description:
  • Same as 'Player' context menu

Source:
Parameters:
Name Type Attributes Description
itemname string

item name for which player should be started

option string <optional>

extra options for the player

Returns:

when ready

Type
Promise

(async) refreshHtml() → {Promise}

Refresh HTML code of hierarchy painter

Source:
Returns:

when done

Type
Promise

(async) reload() → {Promise}

Reload hierarchy and refresh html code

Source:
Returns:

when completed

Type
Promise

setDisplay(layout, frameid)

Assign default layout and place where drawing will be performed

Source:
Parameters:
Name Type Description
layout string

layout like 'simple' or 'grid2x2'

frameid string

DOM element id where object drawing will be performed

setMonitoring(interval, flag)

Configures monitoring interval

Source:
Parameters:
Name Type Description
interval number

repetition interval in ms

flag boolean

initial monitoring state

toggleOpenState(isopen) → {boolean}

Toggle open state of the item

Description:
  • Used with 'expand all' / 'collapse all' buttons in normal GUI

Source:
Parameters:
Name Type Description
isopen boolean

if items should be expand or closed

Returns:

true when any item was changed

Type
boolean

(async) updateItems(arg) → {Promise}

Update specified items

Description:
  • Method can be used to fetch new objects and update all existing drawings

Source:
Parameters:
Name Type Description
arg string | array | boolean

either item name or array of items names to update or true if only automatic items will be updated

Returns:

when ready

Type
Promise