Class Component

Description

This is a generic implementation of the Component interface that allows the user to output an arbitrary string (content).



  1. Components
are the basic units that can be displayed on the screen. The main method
  1. render()
which renders the component on the screen.

  • version: $Id: Component.class.php,v 1.21 2007/09/04 20:25:21 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/GUIManager/Component.class.php (line 21)

ComponentInterface
   |
   --Component
Direct descendents
Class Description
Blank This is a simple implementation of a Blank component. Blank components do not have any content and naturally have their type set to
  1. BLANK
.
Block This is a simple implementation of a Block component. Block components are very simple, and in reality do not differ much from the generic component.
Footer Footer components are identical to Block components with the only exception that their type is set to
  1. FOOTER
.
Header Header components are identical to Block components with the only exception that their type is set to
  1. HEADER
.
Heading Heading components are identical to Block components with the only exception that their type is set to
  1. HEADING
.
MenuItem
  1. MenuItem
components are a direct implementation of the
MenuItemHeading
  1. MenuItemHeading
components are a direct implementation of the
  1. MenuItem
interface. Their functionality is limited to having display names.
MenuItemLink The
  1. MenuItemLink
class is an extension of the
  1. MenuItem
interface adding support for attaching extra data like URL, target window, an access key (shortcut), a toolTip, etc.
UnstyledBlock This is a simple implementation of a Block component. Block components are very simple, and in reality do not differ much from the generic component.
Container This is a generic
  1. Container
implementation that should be sufficient for all means and purposes.
Variable Summary
string $_content
string $_id
integer $_index
string $_postHTML
string $_preHTML
integer $_type
Method Summary
Component Component (string $content, integer $type, integer $index, optional 3)
ref addStyle (ref $styleCollection)
string getId ()
integer getIndex ()
string getPostHTML (ref $theme, [string $tabs = ""])
string getPreHTML (ref $theme, [string $tabs = ""])
ref getStyle (string $selector)
array getStyles ()
integer getType ()
ref removeStyle (string $selector)
void render (ref $theme, [string $tabs = ""])
void setId (string $id)
void setPostHTML (string $html)
void setPreHTML (string $html)
Variables
string $_content (line 28)

The content of this component.

  • var: _content
  • access: private
string $_id = null (line 78)
  • var: The id of this component. (Optional
  • since: 1/30/06
  • access: private
integer $_index (line 55)

The index of this component. The index has no semantic meaning:

you can think of the index as 'level' of the component. Alternatively, the index could serve as means of distinguishing between components with the same type. Most often one would use the index in conjunction with the

  1. getStylesForComponentType()
and
  1. addStyleForComponentType()
methods.

  • var: _index
  • access: private
string $_postHTML (line 71)
  • var: HTML text to surround the component. Useful for properly nexting form tags.
  • since: 7/15/05
  • access: private
string $_preHTML (line 63)
  • var: HTML text to surround the component. Useful for properly nexting form tags.
  • since: 7/15/05
  • access: private
array $_styleCollections (line 36)

This is an array of the style collections that have been applied to this component.

  • var: _styleCollections
  • access: private
integer $_type (line 43)

The type of this

  1. Component
.

  • var: _type
  • access: private
Methods
Constructor Component (line 99)

The constructor.

  • access: public
Component Component (string $content, integer $type, integer $index, optional 3)
  • optional 3: object StyleCollections styles,... Zero, one, or more StyleCollection objects that will be added to the newly created Component. Warning, this will result in copying the objects instead of referencing them as using
    1. addStyle()
    would do.
  • string $content: content This is an arbitrary string that will be printed, whenever the user calls the
    1. render()
    method. If
    1. null
    , then the component will have no content.
  • integer $type: type The type of this component. One of BLANK, HEADING, HEADER, FOOTER, BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
  • integer $index: index The index of this component. The index has no semantic meaning: you can think of the index as 'level' of the component. Alternatively, the index could serve as means of distinguishing between components with the same type. Most often one would use the index in conjunction with the
    1. getStylesForComponentType()
    and
    1. addStyleForComponentType()
    methods.
addStyle (line 134)

Adds a new

  1. StyleCollection
to this component. The component

can have 0 or more style collections attached; each of the latter will affect the appearance of the component. The uniqueness of the collections is enforce by their selector (i.e., you can't have two collections with the same selector). If a style collection has been registered with the Theme for this Component's type and level, then the new style collection will take precedence.

  • return: object The style collection that was just added.
  • access: public
ref addStyle (ref $styleCollection)
  • ref $styleCollection: object styleCollection The
    1. StyleCollection
    to add to this component.

Redefinition of:
ComponentInterface::addStyle()
Adds a new
  1. StyleCollection
to this component. The component
getId (line 382)

Answer the Id of this component

  • return: or null if not set
  • since: 1/30/06
  • access: public
string getId ()
getIndex (line 204)

Returns the index of this component. The index has no semantic meaning:

you can think of the index as 'level' of the component. Alternatively, the index could serve as means of distinguishing between components with the same type. Most often one would use the index in conjunction with the

  1. getStylesForComponentType()
and
  1. addStyleForComponentType()
Theme methods.

  • return: The index of the component.
  • access: public
integer getIndex ()

Redefinition of:
ComponentInterface::getIndex()
Returns the index of this component. The index has no semantic meaning:
getPostHTML (line 286)

Returns any post HTML code that needs to be printed. This method should be called at the end of

  1. render()
.

  • return: The HTML string.
  • access: public
string getPostHTML (ref $theme, [string $tabs = ""])
  • ref $theme: object theme The Theme object to use in producing the result of this method.
  • string $tabs: tabs This is a string (normally a bunch of tabs) that will be prepended to each text line. This argument is optional but its usage is highly recommended in order to produce a nicely formatted HTML output.

Redefinition of:
ComponentInterface::getPostHTML()
Returns any post HTML code that needs to be printed. This method should be called at the end of
  1. render()
.
getPreHTML (line 219)

Returns any pre HTML code that needs to be printed. This method should be called at the beginnig of

  1. render()
.

  • return: The HTML string.
  • access: public
string getPreHTML (ref $theme, [string $tabs = ""])
  • ref $theme: object theme The Theme object to use in producing the result of this method.
  • string $tabs: tabs This is a string (normally a bunch of tabs) that will be prepended to each text line. This argument is optional but its usage is highly recommended in order to produce a nicely formatted HTML output.

Redefinition of:
ComponentInterface::getPreHTML()
Returns any pre HTML code that needs to be printed. This method should be called at the beginnig of
  1. render()
.
getStyle (line 163)

Returns the style collection with the specified selector.

  • return: object The style collection.
  • access: public
ref getStyle (string $selector)
  • string $selector: selector The selector.

Redefinition of:
ComponentInterface::getStyle()
Returns the style collection with the specified selector.
getStyles (line 190)

Returns all style collections for this component.

  • return: An array of style collections; the key corresponds to the selector of each collection.
  • access: public
array getStyles ()

Redefinition of:
ComponentInterface::getStyles()
Returns all style collections for this component.
getType (line 359)

Returns the type of this component.

  • return: The type of this component.
  • access: public
integer getType ()

Redefinition of:
ComponentInterface::getType()
Returns the type of this component. One of BLANK, HEADING, FOOTER, BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER.
removeStyle (line 177)

Remove the given StyleCollection from this Component.

  • return: object The style collection that was removed.
    1. NULL
    if it could not be found.
  • access: public
ref removeStyle (string $selector)
  • string $selector: selector The selector of the style collection to remove.

Redefinition of:
ComponentInterface::removeStyle()
Remove the given StyleCollection from this Component.
render (line 346)

Renders the component on the screen.

  • access: public
void render (ref $theme, [string $tabs = ""])
  • ref $theme: object theme The Theme object to use in producing the result of this method.
  • string $tabs: tabs This is a string (normally a bunch of tabs) that will be prepended to each text line. This argument is optional but its usage is highly recommended in order to produce a nicely formatted HTML output.

Redefinition of:
ComponentInterface::render()
Renders the component on the screen.

Redefined in descendants as:
setId (line 371)

Set the (HTML) id of this component

  • since: 1/30/06
  • access: public
void setId (string $id)
  • string $id
setPostHTML (line 333)

Set post HTML code that needs to surround this compontent. This is used to properly nest form-tags around tables/divs to generate valid XHTML.

  • since: 7/15/05
  • access: public
void setPostHTML (string $html)
  • string $html

Redefinition of:
ComponentInterface::setPostHTML()
Set post HTML code that needs to surround this compontent. This is used to properly nest form-tags around tables/divs to generate valid XHTML.
setPreHTML (line 271)

Set pre HTML code that needs to surround this compontent. This is used to properly nest form-tags around tables/divs to generate valid XHTML.

  • since: 7/15/05
  • access: public
void setPreHTML (string $html)
  • string $html

Redefinition of:
ComponentInterface::setPreHTML()
Set pre HTML code that needs to surround this compontent. This is used to properly nest form-tags around tables/divs to generate valid XHTML.

Inherited Methods

Inherited From ComponentInterface

ComponentInterface::addStyle()
ComponentInterface::getIndex()
ComponentInterface::getPostHTML()
ComponentInterface::getPreHTML()
ComponentInterface::getStyle()
ComponentInterface::getStyles()
ComponentInterface::getType()
ComponentInterface::removeStyle()
ComponentInterface::render()
ComponentInterface::setPostHTML()
ComponentInterface::setPreHTML()

Documentation generated on Wed, 19 Sep 2007 10:22:06 -0400 by phpDocumentor 1.3.0RC3