ToolUI

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

Members

currentPage :String

Contains the page name of the current page.

loadingElement :HTMLElement

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

pageBefore :String

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

pages :Array.<UIPage>

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

Methods

addMenu(menuitem)

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

addPage(page)

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

findPage(name) → {null|UIPage}

Finds a page by its name.
Parameters:
Name Type Description
name String The name of the page you want
Returns:
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.
Returns:
null | MenuItem - Returns null if no menu item with the id is found

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

showErrorMessage(error, autohideopt) → {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.
Returns:
HTMLElement

startLoading()

Displays the loading overlay.

stopLoading()

Removes the loading overlay.