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

Class: TComponentDefinition

Source Location: /TComponentDefinition.php

Class Overview


TComponentDefinition class

Class Details

[line 36]
TComponentDefinition class

TComponentDefinition specifies the definition of a component type. It includes the component property and event definitions, the component template parsing result.

TComponentDefinition can be used to realize a component instance, i.e., setting property intial values, binding event handlers, and creating child components and body content.

Namespace: System




version:  v1.0, last update on 2004/08/13 21:44:52
author:  Qiang Xue <qiang.xue@gmail.com>


[ Top ]

Constants

Methods



Class Methods


constructor __construct [line 108]

TComponentDefinition __construct( string $type)

Constructor.

Builds the definition of the specified component type. Definition of the parent component type will be imported.




Parameters:

string   $type   component type

[ Top ]

method applyTo [line 318]

void applyTo( TComponent $component)

Realizes the definition for a component instance.

The component instance will be initialized for its properties. The child components will be instantiated. The body content will be added.




access:  public


Parameters:

TComponent   $component   the component instance.

[ Top ]

method build [line 280]

void build( )

Builds a component definition.

This method will parse component specification and template, and create corresponding property, event definitions, child components, and body content.




access:  protected


[ Top ]

method canGetProperty [line 207]

boolean canGetProperty( string $name)



return:  whether the property is readable, false if the property doesn't exist
access:  public


Parameters:

string   $name   property name

[ Top ]

method canSetProperty [line 216]

boolean canSetProperty( string $name)



return:  whether the property is writeable, false if the property doesn't exist
access:  public


Parameters:

string   $name   property name

[ Top ]

method configureProperty [line 462]

void configureProperty( TComponent $component, string $name, string $value)

Sets a component's property with a string value.

The string value will be converted to appropriate types before setting the property.




access:  public


Parameters:

TComponent   $component   the component
string   $name   the property name
string   $value   the property value in string format

[ Top ]

method convertPropertyValue [line 432]

mixed convertPropertyValue( string $value, string $type)

Converts a string to a particular type.



return:  the converted result.
access:  public


Parameters:

string   $value   the string representation of a value
string   $type   the target type

[ Top ]

method defineEvent [line 245]

void defineEvent( string $name)

Adds an event definition.



access:  protected


Parameters:

string   $name   event name

[ Top ]

method defineProperty [line 161]

void defineProperty( string $name, string $type, string $getter, string $setter)

Adds a property definition.



access:  protected


Parameters:

string   $name   property name
string   $type   property type
string   $getter   property getter method
string   $setter   property setter method

[ Top ]

method getEvents [line 506]

array getEvents( )



return:  list of defined events
access:  public


[ Top ]

method getMasterPageName [line 268]

void getMasterPageName( )



access:  public


[ Top ]

method getProperties [line 498]

array getProperties( )



return:  list of defined properties
access:  public


[ Top ]

method getPropertyGetter [line 225]

string getPropertyGetter( string $name)



return:  the property getter method, null if property doesn't exist
access:  public


Parameters:

string   $name   property name

[ Top ]

method getPropertySetter [line 234]

string getPropertySetter( string $name)



return:  the property setter method, null if property doesn't exist
access:  public


Parameters:

string   $name   property name

[ Top ]

method getPropertyType [line 198]

string|null getPropertyType( string $name)



return:  the property type, null if the property doesn't exist
access:  public


Parameters:

string   $name   property name

[ Top ]

method getType [line 144]

string getType( )



return:  component type
access:  public


[ Top ]

method hasEvent [line 258]

boolean hasEvent( string $name)



return:  whether the event is defined
access:  public


Parameters:

string   $name   event name

[ Top ]

method hasProperty [line 189]

boolean hasProperty( string $name)



return:  whether the property exists
access:  public


Parameters:

string   $name   property name

[ Top ]

method instantiateTemplate [line 366]

void instantiateTemplate( TComponent $component, array $template)

Instantiates a template for a component.

Components declared in the template will be instantiated and added as children of the component. The container-containee relationship will also be established.




access:  public


Parameters:

TComponent   $component   the owner of the template
array   $template   the parsing result returned by TResourceParser.

[ Top ]

method isProperName [line 136]

boolean isProperName( string $name)

Checks whether a name/ID is in valid format.

This method is used for checking explicit component IDs, property names, and event names.




access:  public


Parameters:

string   $name   the name/ID to be checked

[ Top ]

method setMasterPageName [line 263]

void setMasterPageName( mixed $name)



access:  public


[ Top ]


Class Constants

ENUM_FORMAT = "/^\\(\\w+(,\\w+)*\\)\$/"

[line 45]

Format of property type


[ Top ]

ID_FORMAT = "/^[a-zA-Z]\\w*\$/"

[line 41]

Format of explicit component IDs, property names, and event names.


[ Top ]

TYPE_ARRAY = 'array'

[line 65]

array type for component property, used in property definition


[ Top ]

TYPE_BOOLEAN = 'boolean'

[line 49]

boolean type for component property, used in property definition


[ Top ]

TYPE_FLOAT = 'float'

[line 57]

float type for component property, used in property definition


[ Top ]

TYPE_INTEGER = 'integer'

[line 53]

integer type for component property, used in property definition


[ Top ]

TYPE_OBJECT = 'object'

[line 69]

object type for component property, used in property definition


[ Top ]

TYPE_STRING = 'string'

[line 61]

string type for component property, used in property definition


[ Top ]



© 2004-2005 PRADO Software Group. All Rights Reserved.