Class

ToolUI

ToolUI(tool)

Constructor

new ToolUI(tool)

This module helps control and manage the user interface. You can add viewable pages, menus or display error messages.
Parameters:
Name Type Description
tool TTVTool

View Source mod/toolui.js, line 13

Members

String

currentPage

Contains the page name of the current page.

View Source mod/toolui.js, line 37

HTMLElement

loadingElement

When loading this contains the loading HTML element with the animation and stuff.

View Source mod/toolui.js, line 47

String

pageBefore

Contains the page name that was open before the current. Has no use anymore.

View Source mod/toolui.js, line 32

Array.<UIPage>

pages

Contains an array with UIPage elements. Please use addPage() to add pages!

View Source mod/toolui.js, line 42

Methods

addMenu(menuitem)

Adds a new menuitem to the application menu.
Parameters:
Name Type Description
menuitem MenuItem The menu item you want to add

View Source mod/toolui.js, line 299

addPage(page)

Adds a page and creates a menu entry.
Parameters:
Name Type Description
page UIPage The page you want to add

View Source mod/toolui.js, line 230

findPage(name) → {null|UIPage}

Finds a page by its name.
Parameters:
Name Type Description
name String The name of the page you want

View Source mod/toolui.js, line 189

null | UIPage

getMenuItemById(menuitemid, menuopt) → {null|MenuItem}

Finds and returns a menu item by its id. Optionally you can pass a menu that should be searched. Submenus are being searched automatically.
Parameters:
Name Type Attributes Description
menuitemid String The menu item id you want to get
menu Menu <optional>
The menu that is being searched. If non is given the application menu is searched.

View Source mod/toolui.js, line 311

Returns null if no menu item with the id is found
null | MenuItem

openPage(name)

Opens a page by its name. If no page is found by this name nothing happens.
Parameters:
Name Type Description
name String The name of the page you want to open

View Source mod/toolui.js, line 277

showErrorMessage(error, autohideopt, showbuttonopt) → {HTMLElement}

Creates and displays a error message as an modal overlay and returns the created element.
Parameters:
Name Type Attributes Default Description
error Error The error you want to display. If an invalid error is given an unknown error message is shown.
autohide Boolean <optional>
false If this is set to true the message is being hidden after 5 seconds. Defaults to false.
showbutton Boolean <optional>
true If this is set to false the OK button is not displayed. Defaults to true.

View Source mod/toolui.js, line 379

HTMLElement

startLoading(pageopt)

Displays the loading overlay.
Parameters:
Name Type Attributes Description
page UIPage <optional>
The page that is currently loading, so the loading screen is only visible for the loading page

View Source mod/toolui.js, line 344

stopLoading()

Removes the loading overlay.

View Source mod/toolui.js, line 363