Options
All
  • Public
  • Public/Protected
  • All
Menu

A base class for implementing a web console renderer. The renderer creates the DOM for the SPA, usually based on some initial DOM from the console page. It also provides methods for the management of the conlets' representations in the DOM tree.

Hierarchy

  • Renderer

Index

Constructors

Properties

_console: Console

Accessors

Methods

  • addConletType(conletType: string, displayNames: Map<string, string>, renderModes: RenderMode[]): void
  • Called from the Console when a new conlet type is added.

    Parameters

    • conletType: string

      the conlet type

    • displayNames: Map<string, string>

      the display names for the conlet type by lang

    • renderModes: RenderMode[]

      the render modes

    Returns void

  • connectionLost(): void
  • Called by the console instance when the connection to the server is lost. The default implementation logs a warning message. Should be overridden by a method that displays a notification.

    Returns void

  • connectionRestored(): void
  • Called from the console when the connection to the server is restored. The default implementation logs a warning message. Should be overridden by a method that displays a notification.

    Returns void

  • connectionSuspended(resume: () => void): void
  • Called from the console when the connection to the server is suspended. The default implementation logs a warning message. Should be overridden by a method that displays a modal dialog.

    The connection can be resumed by invoking the function passed as argument.

    Parameters

    • resume: () => void

      called when resuming

        • (): void
        • Returns void

    Returns void

  • consoleConfigured(): void
  • Called from the console when the consoleConfigured notification is received from the server.

    The default implementation logs a warning message. Should be overridden by a method that displays a modal dialog.

    Returns void

  • findConletComponents(): NodeListOf<HTMLElement>
  • Find the HTML elements that display a conlet component. The default implementation returns all nodes that match body .conlet.conlet-component.

    Returns NodeListOf<HTMLElement>

    the elements found

  • findConletPreview(conletId: string): null | HTMLElement
  • Find the HTML element that displays the preview of the conlet with the given id. The default implementation returns all nodes with .conlet-preview[data-conlet-id='<conletId>'.

    Parameters

    • conletId: string

      the conlet id

    Returns null | HTMLElement

    the HTML element or null

  • findConletView(conletId: string): null | HTMLElement
  • Find the HTML element that displays the view of the conlet with the given id. The default implementation returns all nodes with .conlet-view[data-conlet-id='<conletId>'.

    Parameters

    • conletId: string

      the conlet id

    Returns null | HTMLElement

    the HTML element

  • findConlets(conletId: string): NodeListOf<HTMLElement>
  • Find the HTML elements that display the preview or view of the conlet with the given id. The default implementation returns all nodes with .conlet[data-conlet-id='<conletId>'.

    Parameters

    • conletId: string

      the conlet id

    Returns NodeListOf<HTMLElement>

    the elements found

  • findPreviewIds(): string[]
  • Return the ids of all conlets displayed as preview. The default implementation returns the values of data-conlet-id from all elements with .conlet-preview[data-conlet-id].

    Returns string[]

  • findViewIds(): (null | string)[]
  • Return the ids of all conlets displayed as view. The default implementation returns the values of data-conlet-id from all nodes with .conlet-view[data-conlet-id].

    Returns (null | string)[]

  • init(options: any): void
  • lastConsoleLayout(previewLayout: string[], tabsLayout: string[], xtraInfo: Object): void
  • Called from the Console when the console layout is received from the server.

    Parameters

    • previewLayout: string[]

      the conlet ids from top left to bottom right

    • tabsLayout: string[]

      the ids of the conlets viewable in tabs

    • xtraInfo: Object

      extra information spcific to the console implementation

    Returns void

  • removeConletDisplays(containers: HTMLElement[]): void
  • Called by the Console to remove the given conlet representations, which may be preview or view containers, from the DOM.

    Parameters

    • containers: HTMLElement[]

      the existing containers for the preview or views

    Returns void

  • removeConletType(conletType: string): void
  • Called from the Console when a conlet type is removed.

    The expected action of the renderer is to remove the conlet type from e.g. a menu that allows adding conlets. However, front-ends can also force a reload of the application.

    Parameters

    • conletType: string

      the conlet type

    Returns void

  • showEditDialog(container: HTMLElement, modes: RenderMode[], content: string): void
  • Called by the Console to open an edit dialog.

    Parameters

    • container: HTMLElement

      the container for the dialog

    • modes: RenderMode[]

      the modes

    • content: string

      the content as HTML

    Returns void

  • updateConletComponent(container: HTMLElement, content: string): void
  • Called from the Console to update a conlet that is used as component. The default implementation removes all children from the container and inserts the new content.

    Parameters

    • container: HTMLElement

      the container, i.e. a HTMLElement returned from Renderer.findConletComponents

    • content: string

      the component content as received from the server, usually inserted into the container

    Returns void

  • updateConletModes(conletId: string, modes: RenderMode[]): void
  • Called by the Console to update the modes of the conlet with the given id.

    Parameters

    • conletId: string

      the conlet id

    • modes: RenderMode[]

      the modes

    Returns void

  • updateConletPreview(isNew: boolean, container: HTMLElement, modes: RenderMode[], content: string, foreground: boolean): void
  • Called from the Console to update the preview of the given conlet. If the preview is new (no preview with the given conlet id exists), the console provides DOM for the container as a convenience. Implementations of this method are free to extract the data from the container argument and provide their own markup for a new container.

    Parameters

    • isNew: boolean

      true if it is a new (not yet existing) conlet preview

    • container: HTMLElement

      the container for the preview. Either the result from Renderer.findConletPreview, if an existing preview is updated, or a prepared 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: RenderMode[]

      the supported conlet modes

    • content: string

      the preview content as received from the server, usually inserted into the container

    • foreground: boolean

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

    Returns void

  • updateConletTitle(conletId: string, title: string): void
  • Called bythe Console to update the title of the conlet with the given id.

    Parameters

    • conletId: string

      the conlet id

    • title: string

      the new title

    Returns void

  • updateConletView(isNew: boolean, container: HTMLElement, modes: RenderMode[], content: string, foreground: boolean): void
  • Called from the Console to pdate the view of the given conlet. If the view is new (no view with the given conlet id exists), the console provides DOM for the container as a convenience. Implementations of this method are free to extract the data from the conatiner argument and provide their own markup for a new container

    Parameters

    • isNew: boolean

      true if it is a new conlet view

    • container: HTMLElement

      a prepared container for the view. Either the result from Renderer.findConletView, if an existing preview is updated, or a new container provided as:

      <article class="conlet conlet-view conlet-content 
      data-conlet-type='...' data-conlet-id='...'"></article>"
    • modes: RenderMode[]

      the supported conlet modes

    • content: string

      the view content, usually inserted into the container

    • foreground: boolean

      true if the view is to be made the active tab

    Returns void

Generated using TypeDoc