Yahoo! UI Library

Container  2.3.0

Yahoo! UI Library > container > YAHOO.widget.Module

Show Private Show Protected

Class YAHOO.widget.Module

Module is a JavaScript representation of the Standard Module Format. Standard Module Format is a simple standard for markup containers where child nodes representing the header, body, and footer of the content are denoted using the CSS classes "hd", "bd", and "ft" respectively. Module is the base class for all other classes in the YUI Container package.

Constructor

YAHOO.widget.Module ( el , userConfig )
Parameters:
el <String> The element ID representing the Module OR
el <HTMLElement> The element representing the Module
userConfig <Object> The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.

Properties

body - HTMLElement

The body element, denoted with CSS class "bd"

browser - String

String representing the user-agent of the browser
Deprecated: Use YAHOO.env.ua

cfg - YAHOO.util.Config

The Module's Config object used for monitoring configuration properties.

contructor - Function

The class's constructor function

DEFAULT_CONFIG - private final Object

Constant representing the Module's configuration properties

element - HTMLElement

The main module element that contains the header, body, and footer

EVENT_TYPES - private final Object

Constant representing the name of the Module's events

footer - HTMLElement

The footer element, denoted with CSS class "ft"

header - HTMLElement

The header element, denoted with CSS class "hd"

id - String

The id of the element

imageRoot - String

A string representing the root path for all images created by a Module instance.
Deprecated: It is recommend that any images for a Module be applied via CSS using the "background-image" property.

isSecure - Boolean

Boolean representing whether or not the current browsing context is secure (https)

platform - String

String representing the current user-agent platform

YAHOO.widget.Module.CSS_BODY - static final String

Constant representing the module body

YAHOO.widget.Module.CSS_FOOTER - static final String

Constant representing the module footer

YAHOO.widget.Module.CSS_HEADER - static final String

Constant representing the module header

YAHOO.widget.Module.CSS_MODULE - static final String

Constant for the default CSS class name that represents a Module

YAHOO.widget.Module.IMG_ROOT - static final String

Constant representing the prefix path to use for non-secure images

YAHOO.widget.Module.IMG_ROOT_SSL - static final String

Constant representing the prefix path to use for securely served images

YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL - static final String

Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size

Methods

appendToBody

void appendToBody ( element )
Appends the passed element to the body. If no body is present, one will be automatically created.
Parameters:
element <HTMLElement> The element to append to the body
Returns: void

appendToFooter

void appendToFooter ( element )
Appends the passed element to the footer. If no footer is present, one will be automatically created.
Parameters:
element <HTMLElement> The element to append to the footer
Returns: void

appendToHeader

void appendToHeader ( element )
Appends the passed element to the header. If no header is present, one will be automatically created.
Parameters:
element <HTMLElement> The element to append to the header
Returns: void

configMonitorResize

void configMonitorResize ( type , args , obj )
Default event handler for the "monitorresize" configuration property
Parameters:
type <String> The CustomEvent type (usually the property name)
args <Object[]> The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
obj <Object> The scope object. For configuration handlers, this will usually equal the owner.
Returns: void

configVisible

void configVisible ( type , args , obj )
Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none". This method is responsible for firing showEvent and hideEvent.
Parameters:
type <String> The CustomEvent type (usually the property name)
args <Object[]> The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
obj <Object> The scope object. For configuration handlers, this will usually equal the owner.
Returns: void

destroy

void destroy ( )
Removes the Module element from the DOM and sets all child elements to null.
Returns: void

hide

void hide ( )
Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
Returns: void

init

void init ( el , userConfig )
The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
Parameters:
el <String> The element ID representing the Module OR
el <HTMLElement> The element representing the Module
userConfig <Object> The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
Returns: void

initDefaultConfig

void initDefaultConfig ( )
Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
Returns: void

initEvents

void initEvents ( )
Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
Returns: void

initResizeMonitor

void initResizeMonitor ( )
Initialized an empty IFRAME that is placed out of the visible area that can be used to detect text resize.
Returns: void

onDomResize

void onDomResize ( e , obj )
Event handler fired when the resize monitor element is resized.
Parameters:
e <DOMEvent> The DOM resize event
obj <Object> The scope object passed to the handler
Returns: void

render

Boolean render ( appendToNode , moduleElement )
Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
Parameters:
appendToNode <String> The element id to which the Module should be appended to prior to rendering OR
appendToNode <HTMLElement> The element to which the Module should be appended to prior to rendering
moduleElement <HTMLElement> OPTIONAL. The element that represents the actual Standard Module container.
Returns: Boolean
Success or failure of the render

setBody

void setBody ( bodyContent )
Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
Parameters:
bodyContent <String> The HTML used to set the body OR
bodyContent <HTMLElement> The HTMLElement to append to the body
Returns: void

setFooter

void setFooter ( footerContent )
Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
Parameters:
footerContent <String> The HTML used to set the footer OR
footerContent <HTMLElement> The HTMLElement to append to the footer
Returns: void

setHeader

void setHeader ( headerContent )
Sets the Module's header content to the HTML specified, or appends the passed element to the header. If no header is present, one will be automatically created.
Parameters:
headerContent <String> The HTML used to set the header OR
headerContent <HTMLElement> The HTMLElement to append to the header
Returns: void

show

void show ( )
Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
Returns: void

toString

String toString ( )
Returns a String representation of the Object.
Returns: String
The string representation of the Module

Events

appendEvent

appendEvent ( )
CustomEvent fired when the Module is appended to the DOM

beforeHideEvent

beforeHideEvent ( )
CustomEvent fired before the Module is hidden

beforeInitEvent

beforeInitEvent ( classRef )
CustomEvent fired prior to class initalization.
Parameters:
classRef <class> class reference of the initializing class, such as this.beforeInitEvent.fire(Module)

beforeRenderEvent

beforeRenderEvent ( )
CustomEvent fired before the Module is rendered

beforeShowEvent

beforeShowEvent ( )
CustomEvent fired before the Module is shown

changeBodyEvent

changeBodyEvent ( content )
CustomEvent fired when the body content of the Module is modified
Parameters:
content <String/HTMLElement> String/element representing the new body content

changeContentEvent

changeContentEvent ( )
CustomEvent fired when the content of the Module is modified

changeFooterEvent

changeFooterEvent ( content )
CustomEvent fired when the footer content of the Module is modified
Parameters:
content <String/HTMLElement> String/element representing the new footer content

changeHeaderEvent

changeHeaderEvent ( content )
CustomEvent fired when the header content of the Module is modified
Parameters:
content <String/HTMLElement> String/element representing the new header content

destroyEvent

destroyEvent ( )
CustomEvent fired when the Module is destroyed

hideEvent

hideEvent ( )
CustomEvent fired after the Module is hidden

initEvent

initEvent ( classRef )
CustomEvent fired after class initalization.
Parameters:
classRef <class> class reference of the initializing class, such as this.beforeInitEvent.fire(Module)

renderEvent

renderEvent ( )
CustomEvent fired after the Module is rendered

showEvent

showEvent ( )
CustomEvent fired after the Module is shown

YAHOO.widget.Module.textResizeEvent

YAHOO.widget.Module.textResizeEvent ( )
Singleton CustomEvent fired when the font size is changed in the browser. Opera's "zoom" functionality currently does not support text size detection.

Configuration Attributes

effect - Object

Object or array of objects representing the ContainerEffect classes that are active for animating the container.
Default Value: null

monitorresize - Boolean

Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
Default Value: true

visible - Boolean

Specifies whether the Module is visible on the page.
Default Value: true


Copyright © 2007 Yahoo! Inc. All rights reserved.