WACT_COMPONENT
[ class tree: WACT_COMPONENT ] [ index: WACT_COMPONENT ] [ all elements ]

Class: Component

Source Location: /framework/template/template.inc.php

http://wact.sourceforge.net/index.php/Component

Class Overview


Base class for runtime components.

Variables

Methods


Child classes:

TagComponent
Base class for runtime components that output XML tags
DataSourceComponent
Base class for runtime components that hold data
BlockComponent
The block tag can be used to show or hide the contents of the block.
CoreCssComponent
The CoreCssComponent allows CSS dynamically generated at runtime via the CoreCssTag
CoreScriptComponent
The CoreScriptComponentallows JavaScript dynamically generated at runtime via the CoreScriptTag
DataColumnComponent
run-time component for the Data:Column tag
DataGroupComponent
run-time component for the Data:Group tag
HtmlBBCodeComponent
The HtmlBBCodeComponent provides a runtime API for the html:BBCode tag.
HtmlAnchorComponent
Provides runtime API for HTML Anchor components, with simple event handling (EXPERIMENTAL)
PageNavigatorComponent
Represents a page navigator at runtime.
TextWidget
Allows plain text to be added Widgets are runtime components which have no compile time template tag.

Inherited Variables

Inherited Methods


Class Details

Base class for runtime components.

Note that components that output XML tags should not inherit directly from Component but rather the child TagComponent
Note that in the comments for this class, the terms parent and child refer to the given components relative position in a template's hierarchy, not to the PHP class hierarchy

abstract:  
access:  public
see:  http://wact.sourceforge.net/index.php/Component

Class Variables


$children = array()

Array of child components
var:  of component objects
access:  private
Type:   array

$id =

ID of component, corresponding to it's ID attribute in the template
access:  private
Type:   string

$IsDynamicallyRendered = FALSE

Does this component support dynamic rendering?
var:  object
access:  private
Type:   component

$parent =

Parent component - "parent" refers to nesting in template not to class hierarchy.
var:  object
access:  private
Type:   component

Class Methods


method addChild

Adds a reference to a child component to this component, using it's ID attribute as the child array key

void addChild( object &$Child, [string $ServerId = NULL])

API Tags:

access:  public

Overridden in child classes as:

TagWidget::addChild()
Override parent method to prevent use of children
TextWidget::addChild()
Override parent method to prevent use of children

Parameters:

object   &$Child   child component
string   $ServerId   value for ID attribute

method findChild

Returns a child component given it's ID.

Note this is a potentially expensive operation if dealing with many components, as it calls the findChild method of children based on alphanumeric order: strcasecmp(). Attempt to call it via the nearest known component to the required child.



mixed &findChild( string $ServerId)

API Tags:

return:  refernce to child component object or FALSE if not found
access:  public

Parameters:

string   $ServerId   id

method findChildByClass

Returns the first child component matching the supplied WACT_TEMPLATE Component PHP class name


mixed &findChildByClass( string $class)

API Tags:

return:  reference to child component object or FALSE if not found
access:  public

Parameters:

string   $class   component class name

method findParentByClass

Recursively searches through parents of this component searching for a given WACT_TEMPLATE component PHP class name

mixed &findParentByClass( string $class)

API Tags:

return:  reference to parent component object or FALSE if not found
access:  public

Parameters:

string   $class   component class name

method getChild

Same as find child, except raises error if child is not found

refernce &getChild( string $ServerId)

API Tags:

return:  to child component object
access:  public

Parameters:

string   $ServerId   id

method getServerId

Returns the ID of the component, as defined in the template tags ID attribute

string getServerId( )

API Tags:

access:  public

method render

Outputs the component, rendering any child components as well This method will only ever be called on components that support Dynamic rendering.

void render( )

API Tags:

access:  public

Overridden in child classes as:

TagWidget::render()
Outputs the tag
TagContainerWidget::render()
Outputs the tag, rendering any child components as well
OutputCacheComponent::render()
Returns the output to be displayed
DataColumnComponent::render()
render the cell
TextWidget::render()
Outputs the text Widget.


method setChildDataSource

set the data source of a child component, or raise an error if the child is not found.

void setChildDataSource( string $path, DataSource &$datasource)

API Tags:

access:  public

Parameters:

string   $path   path
DataSource   &$datasource   object
WACT: Copyright 2003 Procata, Inc. Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html)
Documentation generated on Sun, 28 Nov 2004 19:50:43 -0800 by phpDocumentor 1.2.3