Class BaseWidget

Version
0.1
Defined in
jswidgets-0.1.js

This is the object that defines the base functionality from which all other JSWidgets will extend.

Class Summary
Constructor Attributes Constructor Name and Description
 
BaseWidget(id, mgr, opts)
This is the base widget from which all others extend
Field Summary
Field Attributes Field Name and Description
 
Configuration of the current widget.
 
The name of the current widget (should be overwritten by all child classes).
Method Summary
Method Attributes Method Name and Description
 
Appends the content as a new line to the widget's content area
 
Destroy the current widget from the DOM and cleanup
 
Returns the configured title of this widget.
 
Defines the content to replace into the current widget
 
 
setTitle(val)
Set the content for the title region of the widget
 
setUid(id)
Set the object's UID to the provided id
 
An accessor method that allows this widget to remove itself from the manager implicitly.
 
 
validate(opts)
Validate the bare minimum opts are present This method should be overridden by all widgets
Event Summary
Event Attributes Event Name and Description
 
load(w)
Load event is triggered when the widget has completed loading.
Class Detail
BaseWidget(id, mgr, opts)
This is the base widget from which all others extend
Author: Garth Henson (Guahan Web).
Parameters:
{string} id
The div (or element) ID attribute of the widget
{JSWidgets} mgr
The JSWidgets manager to which this widget should be assigned
{object} opts
Additional options for the widget
Field Detail
{Object} config
Configuration of the current widget. This is loaded by the opts parameter in the object constructor. Valid configuration options are:
  • listeners - event handlers for the following custom events:
    • load - executed once the widget has loaded
  • title_selector - defaults to '.title'
  • content_selector - defaults to '.content'
  • title - defaults to the widget name

{String} name
The name of the current widget (should be overwritten by all child classes).
Method Detail
appendContent(val)
Appends the content as a new line to the widget's content area
Parameters:
{string} val
The value to append
destroy()
Destroy the current widget from the DOM and cleanup
{string} getTitle()
Returns the configured title of this widget. Defaults to the widget name if no title has been set.
Returns:
{string} The widget's title
setContent(val)
Defines the content to replace into the current widget
Parameters:
{String} val
The raw markup to be inserted into the content region
setManager(mgr)
Parameters:
mgr
setTitle(val)
Set the content for the title region of the widget
Parameters:
{string} val
The new title to display
setUid(id)
Set the object's UID to the provided id
Parameters:
{int} id
The new UID
unregister()
An accessor method that allows this widget to remove itself from the manager implicitly.
valid()
{boolean} validate(opts)
Validate the bare minimum opts are present This method should be overridden by all widgets
Parameters:
opts
Returns:
{boolean} Whether or not this widget is valid
Event Detail
load(w)
Load event is triggered when the widget has completed loading.
Parameters:
{BaseWidget} w
The widget object which was loaded