Class: Renderer

console-base-resource/jgconsole~Renderer()

A base class for implementing a portral renderer. The renderer provides the DOM, based on the initial DOM from the console page.

Constructor

new Renderer()

Source:

Methods

addConletType(conletType, displayNames, renderModes)

Called from the console when a new conlet type is been added.

Parameters:
Name Type Description
conletType string

the conlet type

displayNames Object

the display names by lang

renderModes Array.string

the render modes

Source:

connectionLost()

Called from the console when the connection to the server is lost. The default implementation prints a warning message to the console. Should be overridden by a funtion that displays a notification.

Source:

connectionRestored()

Called from the console when the connection to the server is restored. The default implementation prints a warning message to the console. Should be overridden by a funtion that displays a notification.

Source:

connectionSuspended()

Called from the console when the connection to the server is syspended. The default implementation prints a warning message to the console. Should be overridden by a funtion that displays a modal dialog.

Source:

console() → {Console}

Provides access to the console instance.

Source:
Returns:

the console

Type
Console

consoleConfigured()

Called from the console when the console is configured. The default implementation prints a warning message to the console. Should be overridden by a funtion that displays a modal dialog.

Source:

findConletContainers(conletId) → {NodeList}

Find the HTML elements that display the preview or view of the conlet with the given id.

Parameters:
Name Type Description
conletId string

the conlet id

Source:
Returns:

the elements found

Type
NodeList

findConletPreview(conletId) → {HTMLElement}

Find the HTML element that displays the preview of the conlet with the given id.

Parameters:
Name Type Description
conletId string

the conlet id

Source:
Returns:

the HTML element or null

Type
HTMLElement

findConletView(conletId) → {HTMLElement}

Find the HTML element that displays the view of the conlet with the given id.

Parameters:
Name Type Description
conletId string

the conlet id

Source:
Returns:

the HTML element

Type
HTMLElement

findPreviewIds() → {Array.<string>}

Return the ids of all conlets displayed as preview.

Source:
Returns:
Type
Array.<string>

findViewIds() → {Array.<string>}

Return the ids of all conlets displayed as view.

Source:
Returns:
Type
Array.<string>

formatMemorySize(size, digits, lang)

Utility method to format a memory size to a maximum of 4 digits for the integer part by appending the appropriate unit.

Parameters:
Name Type Description
size integer

the size value to format

digits integer

the number of digits of the factional part

lang string

the language (BCP 47 code, used to determine the delimiter)

Source:

lastConsoleLayout(previewLayout, tabsLayout, xtraInfo)

Called from the console when the console layout is received.

Parameters:
Name Type Description
previewLayout Array.<string>

the conlet ids from top left to bottom right

tabsLayout Array.<string>

the ids of the conlets viewable in tabs

xtraInfo Object

extra information spcific to the console implementation

Source:

notification(content, options)

Displays a notification.

Parameters:
Name Type Description
content string

the content to display

options object

the options

Properties
Name Type Description
error boolean

if this is an error notification (deprecated)

type string

one of "error", "success", "warning", "danger", "info" (default)

closeable boolean

if the notification may be closed by the user

autoClose number

close the notification automatically after the given number of milliseconds

Source:

removeConletDisplays(containers)

Remove the given conlet representations, which may be preview or view containers, from the DOM.

Parameters:
Name Type Description
containers NodeList

the existing containers for the preview or views

Source:

send()

Deprecated:
  • Use console().send() instead.
Source:

sendAddConlet()

Deprecated:
  • Use console().addConlet() instead.
Source:

sendDeleteConlet()

Deprecated:
  • Use console().removePreview() and console().removeView() instead.
Source:

sendLayout()

Deprecated:
  • Use console().updateLayout() instead.
Source:

sendRenderConlet()

Deprecated:
  • Use console().renderConlet() instead.
Source:

sendSetLocale()

Deprecated:
  • Use console().setLocale() instead.
Source:

showEditDialog(container, modes, content)

Opens an edit dialog.

Parameters:
Name Type Description
container HTMLElement

the container for the dialog

modes Array.string

the modes

content string

the content as HTML

Source:

updateConletModes(conletId, modes)

Update the modes of the conlet with the given id.

Parameters:
Name Type Description
conletId string

the conlet id

modes Array.<string>

the modes

Source:

updateConletPreview(isNew, container, modes, content, foreground)

Update the preview of the given conlet.

Parameters:
Name Type Description
isNew boolean

true if it is a new conlet preview

container HTMLElement

the container for the preview, provided as:

<section class='conlet conlet-preview' 
     data-conlet-type='...' data-conlet-id='...' 
     data-conlet-grid-columns='...' data-conlet-grid-rows='   '></section>
modes Array.<string>

the supported conlet modes

content string

the preview content

foreground boolean

true if the preview (i.e. the overview plane) is to be made the active tab

Source:

updateConletTitle(conletId, title)

Update the title of the conlet with the given id.

Parameters:
Name Type Description
conletId string

the conlet id

title string

the new title

Source:

updateConletView(isNew, container, modes, content, foreground)

Update the view of the given conlet.

Parameters:
Name Type Description
isNew boolean

true if it is a new conlet view

container HTMLElement

the container for the view, provided as:

<article class="conlet conlet-view conlet-content 
     data-conlet-type='...' data-conlet-id='...'"></article>"
modes Array.<string>

the supported conlet modes

content string

the view content

foreground boolean

true if the view is to be made the active tab

Source: