APIs

Show:

The class generates the UI for a template (a.k.a Screen Division) that is a selectable widget including the drawing of each viewer (division) within the screen, as well as firing related click events on action.

Constructor

ScreenTemplateFactory

(
  • i_screenTemplateData
  • i_type
  • i_owner
)

Parameters:

  • i_screenTemplateData Object

    hold data as instructions for factory creation component

  • i_type String

    the type of widget that we will create. This includes VIEWER_SELECTABLE as well as ENTIRE_SELECTABLE with respect to the ability to select the components viewers individually or the entire screen division

  • i_owner Object

    the owner of this class (parent) that we can query at the listening end, to examine if the event is of any interest to the listener.

Methods

_deselectViewers

()

Deselect all viewers, thus change their colors back to default.

Returns:

none

_getColor

(
  • color
)

Get current selection color depnding on theme of light / daek

Parameters:

  • color String

    _getColor: function(){ if (BB.CONSTS['THEME']=='light') return '#428ac9 '; return '#eb7c66'; },

_mouseOverEffect

()

When enabled, _mouseOverEffect will highlight viewers when mouse is hovered over them.

Returns:

none

_onViewSelected

(
  • e
  • i_caller
)
Boolean

Method is called when an entire screen frame of the UI is clicked, in contrast to when a single viewer is selected. The difference in dispatch of the event depends on how the factory created this instance.

Parameters:

  • e Event
  • i_caller Object

Returns:

Boolean:

false

create

() Object

Create will produce the actual SVG based Template (screen) with inner viewers and return HTML snippet to the caller.

Returns:

Object:

html element produced by this factory

deselectDivisons

()

The public method version of _deselectViewers, which de-selects all viewers

destroy

()

Release all members to allow for garbage collection.

Returns:

none

getDivisions

() Array

Create all the screen divisions (aka viewers) as svg snippets and push them into an array

Returns:

Array:

f array of all svg divisions

getOwner

() Object

Get the owner (parent) of this instance, i.e., the one who created this. We use the owner attribute as a way to distinguish what type of instance this was created as.

Returns:

Object:

m_owner

initialize

()

Constructor

selectableFrame

()

When enabled, selectableFrame will allow for UI mouse / click of the outer frame of the template (screen) and not individual viewers.

Returns:

none

selectDivison

(
  • i_campaign_timeline_board_viewer_id
)

Select a division (aka viewer) using it's viewer_id, only applicable when class represents an actual timelime > board > viewer_id

Parameters:

  • i_campaign_timeline_board_viewer_id Number

Events

ON_VIEWER_SELECTED

final static

This is a key event in the framework as many different instances subscribe to ON_VIEWER_SELECTED to reconfigure themselves. The event is fired when a viewer (i.e.: a screen division) is selected inside a Template (i.e. Screen). The key to remember is that the Factory instance (this) is always created with respect to it's owner (i_owner), so when ON_VIEWER_SELECTED is fired, the owner is carried with the event so listeners can act accordingly, and only if the owner is of interest to a subscribed listener.

Event Payload:

  • caller This
  • screenData Object

    event params

  • json ScreenData

    encapsulated data of entire configuration of instance