Public Member Functions | |
__call ($name, $args) | |
Implements dynamic function calls for, e.g., setXxx(). | |
__clone () | |
Clones this component and subcomponents for reuse. | |
__construct () | |
INSERT BRIEF DESCRIPTION HERE. | |
& | __get ($fldName) |
Allows simpler syntax for getting properties. | |
__isset ($fldName) | |
Determines whether property or event exists. | |
__set ($fldName, $value) | |
Allows simpler syntax for setting properties and events. | |
__toString () | |
Converts object to a string suitable for debugging purposes. | |
append ($fldName, $value, $pre=false) | |
Appends a value to a property. | |
appendMany ($fields) | |
Performs multiple append operations at once. | |
eventExists ($eventName) | |
Gets whether an event exists on this object. | |
exists ($fld) | |
Returns whether a property exists. | |
& | get ($fldName) |
Retrieves a given property. | |
getId () | |
Retrieves the object's unique ID. | |
getProperties ($values=false) | |
Returns a list of all the properties this object has. | |
getTheme () | |
Retrieves the currently active theme for this object. | |
getThemeClass () | |
Retrieves the current theme class for this object. | |
render () | |
Converts this component (and any children) to HTML. | |
set ($fldName, $value) | |
Sets a property. | |
setAction ($eventName, $action) | |
Associates an action with an event. | |
setId ($id) | |
Sets a new ID for the object. | |
setMany ($fields) | |
Calls set() many times. | |
setTheme ($theme) | |
Sets the toolkit theme for this object. | |
setThemeClass ($class) | |
Sets the theme class for this object. | |
Public Attributes | |
const | PROP_ARRAY |
Property is an array. | |
const | PROP_BOOLEAN |
Property is a boolean. | |
const | PROP_CLASS |
Property is a class array (flat list of classes). | |
const | PROP_NUMERIC |
Property is numeric (integer or float). | |
const | PROP_OBJECT |
Property is an object. | |
const | PROP_STRING |
Property is a string. | |
const | PROP_STYLE |
Property is a style array (associative array of CSS style => value elements). |
This class is an abstract class and thus cannot be instantiated. It provides most of the functionality used by components and containers, and also some functionality for making the toolkit work with PageRender2.
array
: CSS class(es) to be used for this object array
: CSS styles in attribute => value pairs to be used for this object string
: ALT tag text for this object
TKComponent::__construct | ( | ) |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
Reimplemented from SObject.
Reimplemented in TKBorderPanel, TKHBox, TKNullBox, TKScrollPane, TKTree, TKVBox, and TKContainer.
TKComponent::__call | ( | $ | name, | |
$ | args | |||
) |
Implements dynamic function calls for, e.g., setXxx().
This method allows you to call, e.g., setStyle(...)
instead of set('style', ...)
. See the main documentation for this class for more on the dynamic functions.
This method implements setXxx(), getXxx(), appendXxx() and existsXxx() corresponding to set(), get(), append(), exists().
$name | [string]: name of method | |
$args | [array]: arguments to method |
Reimplemented in TKContainer.
TKComponent::__clone | ( | ) |
Clones this component and subcomponents for reuse.
Once a component has been rendered, it is not safe to re-use the HTML generated because it may contain unique IDs, events, etc. This method attempts to clone this component so that it can be reused with its configuration. It is NOT safe for use at the moment because of many sticky details in properly cloning components and espcially containers.
Reimplemented in TKContainer.
& TKComponent::__get | ( | $ | fldName | ) |
Allows simpler syntax for getting properties.
This method allows you to say
$oc = $component->outer_class;
$oc = $component->get('outer_class');
The same rules apply for getting via this mechanism as for using the get() method or the dynamic function calls (e.g., getStyle()). If the property given is "html", then render() is called and the HTML for this component is returned.
$fldName | [string]: name of parameter |
TKComponent::__isset | ( | $ | fldName | ) |
Determines whether property or event exists.
This method first checks to see if an event by the given name exists, otherwise it checks to see if the property by the given name exists. Don't give events and properties the same names to prevent problems with this mechanism.
$fldName | [string]: name of property or event whose existence to check |
TKComponent::__set | ( | $ | fldName, | |
$ | value | |||
) |
Allows simpler syntax for setting properties and events.
This method allows you to say
$component->outer_class = array('whatever');
$component->set('outer_class', array('whatever'));
The same rules apply for setting via this mechanism as for using the set() method or the dynamic function calls (e.g., setStyle()). The benefit of this mechanism, though, is that it detects whether the field to set is actually an event, and if so, calls setAction() instead of set().
$fldName | [string]: name of parameter or event | |
$value | [mixed]: new value for parameter or event |
TKComponent::__toString | ( | ) |
Converts object to a string suitable for debugging purposes.
All this really does is print out the type of component and its ID. Child classes may (and should) override this method to provide more interesting information.
TKComponent::append | ( | $ | fldName, | |
$ | value, | |||
$ | pre = false | |||
) |
Appends a value to a property.
Appending means different things for different types. For numeric types, appending simply adds the two values together. This does not always make sense, so be careful when appending numeric types. Strings are concatenated. Arrays are more complicated. If the value to be appended is an array, then it is array_merge'd with the current value. If the value is not an array, then it is array_push'ed onto the end of the current value. Objects and booleans cannot be appended and an error message will be displayed.
If the $pre
parameter is true, then values are prepended to the existing value. For strings, the concatenation order is reversed. Numeric values are added the same as with a false $pre
. Arrays are merged or pushed onto at the opposite end, as expected.
$fldName | [string]: name of property | |
$value | [mixed]: value to be appended to property | |
$pre | [boolean]: if true, value is prepended, rather than appended |
TKComponent::appendMany | ( | $ | fields | ) |
Performs multiple append operations at once.
Pass in an array of property => value pairs and each pair will result in a call to append(). Note that you cannot affect the $pre
flag of append()
.
$fields | [array]: array of property => value pairs |
TKComponent::eventExists | ( | $ | eventName | ) |
Gets whether an event exists on this object.
$eventName | [string]: name of event to check for |
TKComponent::exists | ( | $ | fld | ) |
Returns whether a property exists.
$fld | [string]: name of property to check existence for |
& TKComponent::get | ( | $ | fldName | ) |
Retrieves a given property.
You can also use $obj->prop
instead of $obj->get('prop')
. Additionally, there is $obj->getProp()
.
$fldName | [string]: name of property to retrieve |
TKComponent::getId | ( | ) |
Retrieves the object's unique ID.
TKComponent::getProperties | ( | $ | values = false |
) |
Returns a list of all the properties this object has.
TKComponent::getTheme | ( | ) |
Retrieves the currently active theme for this object.
TKComponent::getThemeClass | ( | ) |
Retrieves the current theme class for this object.
TKComponent::render | ( | ) |
Converts this component (and any children) to HTML.
This will only actually generate the HTML once. If render() has been called before, this will only return the results of the previous render operation.
Reimplemented in TKCSERDClassicReview, TKSDRResourceResultMetadata, and TKSDRResourceResultSet.
TKComponent::set | ( | $ | fldName, | |
$ | value | |||
) |
Sets a property.
Each property has a type, of which there are five:
$fldName | [string]: name of property | |
$value | [mixed]: new value of property |
TKComponent::setAction | ( | $ | eventName, | |
$ | action | |||
) |
Associates an action with an event.
This function sets an action to happen when an event occurs. Read more about events and actions at Themes. Note that more than one action can be associated with an event and multiple actions will be executed in the order that they were assigned with setAction(). You can also use the shorthand notation to set events: $comp->onclick = new TKSomeAction(...)
instead of setAction()
.
The action can be an instance of TKAction or its children, or it can be a string of JavaScript, or an array of two strings. The first string is JavaScript that will be inserted into the header of the page. The second string is JavaScript that will go directly in the event handler.
$eventName | [string]: name of event | |
$action | [TKAction]: action to be associated with event (can also be string or array. |
TKComponent::setId | ( | $ | id | ) |
Sets a new ID for the object.
The ID should be unique, or the HTML generated will not be valid (although it will likely work). What won't work is any JavaScript based on the objects that have non-unique IDs. This function will also *try* to update any references to the ID in use. Unfortunately, the ID may be used in places out of direct control of this object, such as generated JS, so it is best to avoid calling this method if you are using strange TK actions or some other strange set up. Be prepared for subtle bugs, as well.
$id | [string]: new ID for object |
TKComponent::setMany | ( | $ | fields | ) |
Calls set() many times.
You pass in an array where the keys are properties to set and the values are the new values for those properties.
$fields | [array]: property names and the associated values |
TKComponent::setTheme | ( | $ | theme | ) |
Sets the toolkit theme for this object.
To change the theme for all objects, call TKComponent::setDefaultTheme() or PageRender2::setToolkitTheme(). See Themes for more information on themes.
$theme | [TKTheme] new theme object |
TKComponent::setThemeClass | ( | $ | class | ) |
Sets the theme class for this object.
The theme class is basically a way of specifying a category of objects within a given component class. For example, while there is only the TKLabel class, we might still want to have multiple types of TKLabel's, for themeing purposes.
$class | [string]: theme class name |