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
(private) _runMonitoring()
Runs monitoring event loop
- Source:
(private) activateItems(items, forceopt)
activate (select) specified item
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
items |
Array | array of items names |
|
force |
boolean |
<optional> |
if specified, all required sub-levels will be opened |
(private) addItemHtml()
Create item html code
- Source:
(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 |
(private) canDisplay()
Checks if item can be displayed with given draw option
- Source:
(private) canExpandItem()
Check if item can be (potentially) expand
- Source:
(private) changeDarkMode()
Handle changes of dark mode
- Source:
(private) checkResize()
Process resize event
- Source:
cleanup()
Cleanup hierarchy painter
- Description:
clear drawing and browser
- Source:
(private) cleanupFrame()
method called when MDI element is cleaned up
- Description:
hook to perform extra actions when frame is cleaned
- Source:
(private) clearDrop()
Remove all drop handlers on the frame
- Source:
(private) clearHierarchy()
Cleanup all items in hierarchy
- Source:
(async) createBrowser() → {Promise}
Create browser elements
- Source:
Returns:
when completed
- Type
- Promise
createButtons()
Create shortcut buttons
- Source:
(async, private) createCustomDisplay(itemname, custom_kind) → {Promise}
If possible, creates custom MDIDisplay for given item
- Source:
Parameters:
Name | Type | Description |
---|---|---|
itemname |
name of item, for which drawing is created |
|
custom_kind |
display kind |
Returns:
with mdi object created
- Type
- Promise
(async, private) createDisplay() → {Promise}
Creates configured MDIDisplay object
- Source:
Returns:
when ready
- Type
- Promise
(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
(private) direct_contextmenu()
alternative context menu, used in the object inspector
- Source:
(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
(async, private) displayItems() → {Promise}
Display all provided elements
- Source:
Returns:
when drawing finished
- Type
- Promise
(async, private) dropItem() → {Promise}
Drop item on specified element for drawing
- Source:
Returns:
when completed
- Type
- Promise
(private) enableDrag()
Enable drag of the element
- Source:
(private) enableDrop()
Enable drop on the frame
- Source:
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
(private) fileHierarchy()
Create file hierarchy
- Source:
(private) fillOnlineMenu()
Fill context menu for online item
- Source:
(private) fillSettingsMenu()
Fills settings menu items
- Source:
(private) findItem(arg)
Search item in the hierarchy
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arg |
object | string | item name or object with arguments Properties
|
(private) findRootFileForItem()
Find ROOT file which corresponds to provided item name
- Source:
(async, private) focusOnItem(hitem) → {Promise}
Focus on hierarchy item
- Description:
all parents to the item will be opened first
- Source:
Parameters:
Name | Type | Description |
---|---|---|
hitem |
Object | string | item to open or its name |
Returns:
when done
- Type
- Promise
(private) forEachItem(func, topopt)
Iterate over all items in hierarchy
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
func |
function | function called for every item |
|
top |
object |
<optional> |
top item to start from |
(private) forEachJsonFile()
Call function for each item which corresponds to JSON file
- Source:
(private) forEachRootFile()
Call function for each item which corresponds to ROOT file
- Source:
getDisplay()
Returns actual MDI display object
- Description:
It should an instance of
MDIDisplay
class
- Source:
(private) getFileProp()
Provides information about file item
- Source:
getLayout()
Returns configured layout
- Source:
getMonitoringInterval()
Returns configured monitoring interval in ms
- Source:
(async, private) getObject(arg, options) → {Promise}
Get object item with specified name
- Description:
depending from provided option, same item can generate different object types
- Source:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
arg |
Object | item name or config object Properties
|
|||||||||
options |
string | supposed draw options |
Returns:
with object like { item, obj, itemname }
- Type
- Promise
(async, private) getOnlineItem() → {Promise}
method used to request object from the http server
- Source:
Returns:
with requested object
- Type
- Promise
(private) getOnlineItemUrl()
Provides URL for online item
- Description:
Such URL can be used to request data from the server
- Source:
Returns:
string or null if item is not online
(private) getOnlineProp()
Get properties for online item - server name and relative name
- Source:
(private) getTopOnlineItem()
Return main online item
- Source:
hasStatusLine()
Returns true if status is exists
- Source:
(async, private) importModule() → {Promise}
Dynamic module import, supports special shortcuts from core or draw_tree
- Source:
Returns:
with module
- Type
- Promise
initializeBrowser()
Initialize browser elements
- Source:
isItemDisplayed(itemname)
Returns true if given item displayed
- Source:
Parameters:
Name | Type | Description |
---|---|---|
itemname |
string | item name |
(private) isLastSibling()
returns true if item is last in parent childs list
- Source:
isMonitoring()
Returns true when monitoring is enabled
- Source:
(private) isOnlineItem()
Returns true if item is online
- Source:
(private) itemFullName(node, uptoparentopt, compactopt) → {string}
Produce full string name for item
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
node |
Object | item element |
|
uptoparent |
Object |
<optional> |
up to which parent to continue |
compact |
boolean |
<optional> |
if specified, top parent is not included |
Returns:
produced name
- Type
- string
(async) listServerDir()
Create list of files for specified directory
- Source:
(async, private) loadScripts()
Load and execute scripts, kept to support v6 applications
- 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
(private) prepareGuiDiv()
Prepare div element - create layout and buttons
- Source:
(private) redrawObject()
Redraw hierarchy
- Description:
works only when inspector or streamer info is displayed
- Source:
(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
(private) removePainter()
Remove painter reference from hierarchy
- Source:
(private) setBasicColors()
Set basic colors
- Source:
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 |
(private) setHierarchy()
Assign existing hierarchy to the painter and refresh HTML code
- Source:
setMonitoring(interval, flag)
Configures monitoring interval
- Source:
Parameters:
Name | Type | Description |
---|---|---|
interval |
number | repetition interval in ms |
flag |
boolean | initial monitoring state |
(async, private) startGUI() → {Promise}
Start GUI
- Source:
Returns:
when ready
- Type
- Promise
(private) toggleDarkMode()
Toggle dark mode
- Source:
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
(private) tree_click()
Handler for click event of item in the hierarchy
- Source:
(private) tree_contextmenu()
Handle context menu in the hierarchy
- Source:
(private) tree_mouseover()
Handler for mouse-over event
- Source:
(private) updateBackground()
Update item background
- Source:
(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
(private) updateOnOtherFrames()
function updates object drawings for other painters
- Source:
(private) updateTreeNode()
Update item node
- Source: