# WRTKit UIManager Class

## Description

The UIManager class manages a set of views and related user interface elements such as the scrollbar that indicates the scroll position for the current view, as well as notification popup dialogs.

A typical WRTKit user interface consists of one or more views that are commanded to be displayed using the UIManager. When a view is commanded to be shown, the UIManager will remove the currently displayed view (if any) and attach the requested view. The UIManager creates and maintains the state of a scrollbar so that it matches the scrolling position and viewport extent at any given time, regardless of what goes on in the view (e.g. added or removed content), screen rotations and resizes, etc.

Parent topic: WRTKit API Reference

## Constructor

### Syntax

    [UIManager] new UIManager(HTMLElement viewParentElement, HTMLElement scrollbarParentElement)

### Description

Creates a new instance of the ContentPanel class.

### Arguments

- viewParentElement

  The HTML element to attachs views to. Normally this argument would be omitted, which causes the UIManager to create its own view parent alement that attaches to the document body element. You only need to supply an HTML element to this argument in rare cases when it's not desirable to have views take up the entire document area.

- scrollbarParentElement

  The HTML element to attachs the scrollbar to. Normally this argument would be omitted, which causes the UIManager to create its own scrollbar parent alement that attaches to the document body element. You only need to supply an HTML element to this argument in rare cases when it's not desirable to have the scrollbar in its default location.

### Return value

A new instance of the UIManager class.

## getView()

### Syntax

    [String] UIManager.getView(void)

### Description

Retrieves the current view.

### Arguments

This method does not take any arguments.

### Return value

The current view or null if none.

## setView()

### Syntax

    [void] UIManager.setView(View view)

### Description

Sets the view to display. Calling this method removes the current view and displays the specified one instead. If null is passed as the argument to this method then the current view is removed but no new view is displayed instead.

### Arguments

- view

  The new view to display or null to simply remove the current view.

### Return value

This method does not return a value.

## showNotification()

### Syntax

    [void] UIManager.showNotification(Integer displayTime, String type, String text, Float progress)

### Description

Displays a notification popup dialog. If a dialog is already showing then calling this method again will change the content of the already displayed notification popup.

### Arguments

- displayTime

  The duration that the dialog should be displayed before automatically hiding. Specified in milliseconds (i.e. 1000ms = 1s). If the notification dialog should not automatically hide then a negative value can be specified.

- type

  Type of notification to display. This argument affects the look of the dialog and should have a value of either "info", "warning" or "wait". "Info" should be used for informational popups, "warning" for errors and other warning messages and "wait" for progress dialogs. If the argument is null then no type icon will be shown in the dialog.

- text

  The text to display in the popup dialog. If the argument is null then no text will be shown, however this is not recommended as it would be unclear to the user.

- progress

  This argument should be omitted except when a progress dialog is desired, i.e. when used with the "wait" type. The value of progress should be a floating point number between 0.0 and 1.0, where 0.0 means "0% progress" and 1.0 means "100% progress". A negative number means "unknown progress" and results in a different progress bar style than for known progress.

### Return value

This method does not return a value.

## hideNotification()

### Syntax

    [void] UIManager.hideNotification()

### Description

Hides the currently displayed notification popup dialog, if any. If this method is called when no notification dialog is displayed then the method call is simply ignored but no harm is done.

### Arguments

This method does not take any arguments.

### Return value

This method does not return a value.