HThemeManager

Description

A single instance class. The theme manager knows the name of the currently loaded theme and handles the loading of theme specific markup snippets and style declarations.

Instance variables

themePath Default root path of the themes path, should contain at least the default theme.
currentTheme The name of the theme currently in use. Initially the default unnamed theme is used.

Inherits from:

Singleton Methods

implement( interface )

Inherited from: HClass

Description

Copies the members of interface to a HClass or a class inherited from HClass.

Usage:

Defines an interface:
// Create an interface class that calculates the area
var AreaInterface = HClass.extend({
  constructor: null,
  area: function() {
    return this.getWidth() * this.getHeight();
  }
});

// Create a class that contains the coordinates of a rectangle. var Rectangle = HClass.extend({ constructor: function( x, y, width, height ) { this.x = x; this.y = y; this.width = width; this.height = height; }, getWidth: function() { return this.width; }, getHeight: function() { return this.height; } });

// Makes the Rectangle class implement the AreaInterface Rectangle.implement( AreaInterface );


setMarkup( themeName, componentName, markup )

Description

Sets the html template for the theme and component name combination.

Parameters

themeName The name of the template to use..
componentName The name of the component template.
markup The content of the html markup.


getThemeGfxPath( )

Returns the theme/component -specific path, called from inside css themes, a bit kludgy approach to tell the theme graphics file paths.


restoreDefaultTheme( )

Sets the default theme ( HDefaultTheme ) to be the active theme.


setThemePath( path )


loadMarkup( themeName, componentName, themePath )

Description

Loads HTML templates of components. Handles caching independently and intelligently.

Parameters

themeName The name of the template to use.
componentName The name of the component template (css/html) to load.
themePath Optional, parameter to override the global theme path.

Returns

The Pre-Evaluated HTML Template.


getThemeGfxFile( fileName )

Description

Returns the full path of the fileName given. Uses the default theme.


getCssFilePath( fileName )

Description

Returns the theme/component -specific graphics file path with proper css wrappers. Used from inside css themes, a bit kludgy approach to tell the file name path.

Parameters

fileName The File name to load.


fetch( url, contentType, callBack, async )

Description

Loads a template file and returns its contents. If errors occurred, calls the error management functions.

Parameters

url A valid local file path or http url pointing to the resource to load.
contentType An optional parameter, specifies the content type wanted, defaults to text/html.

Returns

The contents of the path.


useCSS( cssText )


init( )


loadCSS( url )

Description

Loads a css file based on the given url (or file path). Evaluates the css data. Makes sure the browser uses the data for component styles.

Parameter

url A valid url that points to a valid css file.

Returns

The source of the url.


setTheme( theme )

Description

Sets the active theme.

Parameters

theme The name of the theme to be set as the active theme.


getMarkup( themeName, componentName, themePath )

Description

Loads CSS and HTML templates of components. Called from HView#loadMarkup. Returns the HTML Template as text. Manages file caches independently and intelligently.

Parameters

themeName The name of the template to use.
componentName The name of the component template (css/html) to load.
themePath Optional, parameter to override the global theme path.

Returns

The Pre-Evaluated HTML Template.


toString( )

Inherited from: HClass

Protected instance method, returns the instance represented as a String.


valueOf( )

Inherited from: HClass

Protected instance method, returns the value of an instance.


base( )

Inherited from: HClass

This method can be called from any other method to invoke that method's parent



Other Singleton Members

constructor = null


prototype = { }

Inherited from: Object

Description

The prototype member of Object defines the instance members. These are copied to the instance object when the new keyword is called.