silverorange Code


Swat.SwatUIObject
/Swat/SwatUIObject.php at line 22

Class SwatUIObject

SwatObject
└─SwatUIObject

public abstract class SwatUIObject
extends SwatObject

A base class for Swat user-interface elements

TODO: describe our conventions on how CSS classes and XHTML ids are displayed.

Copyright:
2006-2009 silverorange
License:
http://www.gnu.org/copyleft/lesser.html LGPL License 2.1

Field Summary
array

$classes

A user-specified array of CSS classes that are applied to this user-interface object.

protected SwatHtmlHeadEntrySet

$html_head_entry_set

A set of HTML head entries needed by this user-interface element.

SwatUIObject

$parent

The object which contains this object.

boolean

$visible

Visible.

Constructor Summary

SwatUIObject()

Method Summary
void

addComment(string comment, integer package_id)

Adds a comment to the list of HTML head entries needed by this user- interface element.

void

addJavaScript(string java_script, mixed package_id, integer display_order)

Adds a JavaScript include to the list of JavaScript includes needed by this user-interface element.

void

addStyleSheet(string stylesheet, mixed package_id, integer display_order)

Adds a stylesheet to the list of stylesheets needed by this user-iterface element.

void

addTangoAttribution(integer package_id)

Convenience method to add Tango attribution comment.

SwatUIObject

copy(string id_suffix)

Performs a deep copy of the UI tree starting with this UI object.

protected array

getCSSClassNames()

Gets the array of CSS classes that are applied to this user-interface object.

protected final string

getCSSClassString()

Gets the string representation of this user-interface object's list of CSS classes.

mixed

getFirstAncestor(string class_name)

Gets the first ancestor object of a specific class.

SwatHtmlHeadEntrySet

getHtmlHeadEntrySet()

Gets the SwatHtmlHeadEntry objects needed by this UI object.

protected string

getInlineJavaScript()

Gets inline JavaScript used by this user-interface object.

protected final string

getUniqueId()

Generates a unique id for this UI object.

boolean

isVisible()

Gets whether or not this UI object is visible.

Field Detail

/Swat/SwatUIObject.php at line 53

classes

public array $classes = array()

A user-specified array of CSS classes that are applied to this user-interface object

See the class-level documentation for SwatUIObject for details on how CSS classes and XHTML ids are displayed on user-interface objects.


/Swat/SwatUIObject.php at line 66

html_head_entry_set

protected SwatHtmlHeadEntrySet $html_head_entry_set

A set of HTML head entries needed by this user-interface element

Entries are stored in a data object called SwatHtmlHeadEntry. This property contains a set of such objects.


/Swat/SwatUIObject.php at line 31

parent

public SwatUIObject $parent = null

The object which contains this object


/Swat/SwatUIObject.php at line 42

visible

public boolean $visible = true

Visible

Whether this UI object is displayed. All UI objects should respect this.

See Also:
SwatUIObject::isVisible()

Constructor Detail

/Swat/SwatUIObject.php at line 71

SwatUIObject

public SwatUIObject()

Method Detail

/Swat/SwatUIObject.php at line 132

addComment

public void addComment(string comment, integer package_id)

Adds a comment to the list of HTML head entries needed by this user- interface element

Parameters:
comment - the contents of the comment to include.
package_id - the package this comment belongs with.

/Swat/SwatUIObject.php at line 110

addJavaScript

public void addJavaScript(string java_script, mixed package_id, integer display_order)

Adds a JavaScript include to the list of JavaScript includes needed by this user-interface element

Parameters:
java_script - the uri of the JavaScript include.
display_order - the relative order in which to display this JavaScript head entry.

/Swat/SwatUIObject.php at line 87

addStyleSheet

public void addStyleSheet(string stylesheet, mixed package_id, integer display_order)

Adds a stylesheet to the list of stylesheets needed by this user-iterface element

Parameters:
stylesheet - the uri of the style sheet.
display_order - the relative order in which to display this stylesheet head entry.

/Swat/SwatUIObject.php at line 159

addTangoAttribution

public void addTangoAttribution(integer package_id)

Convenience method to add Tango attribution comment

Note: The Tango icons are now public domain and no attribution is needed. This method remains for backwards compatibility.

Parameters:
package_id - the package the tango attribution belongs with.
Deprecated:
The Tango icons are now public domain and no attribution is needed. This method remains for backwards compatibility.

/Swat/SwatUIObject.php at line 280

copy

public SwatUIObject copy(string id_suffix)

Performs a deep copy of the UI tree starting with this UI object

To perform a shallow copy, use PHP's clone keyword.

Parameters:
id_suffix - optional. A suffix to append to copied UI objects in the UI tree. This can be used to ensure object ids are unique for a copied UI tree. If not specified, UI objects in the returned copy will have identical ids to the original tree. This can cause problems if both the original and copy are displayed during the same request.
Returns:
a deep copy of the UI tree starting with this UI object. The returned UI object does not have a parent and can be inserted into another UI tree.

/Swat/SwatUIObject.php at line 302

getCSSClassNames

protected array getCSSClassNames()

Gets the array of CSS classes that are applied to this user-interface object

User-interface objects aggregate the list of user-specified classes and may add static CSS classes of their own in this method.

Returns:
the array of CSS classes that are applied to this user-interface object.
See Also:
SwatUIObject::getCSSClassString()

/Swat/SwatUIObject.php at line 334

getCSSClassString

protected final string getCSSClassString()

Gets the string representation of this user-interface object's list of CSS classes

Returns:
the string representation of the CSS classes that are applied to this user-interface object. If this object has no CSS classes, null is returned rather than a blank string.
See Also:
SwatUIObject::getCSSClassNames()

/Swat/SwatUIObject.php at line 179

getFirstAncestor

public mixed getFirstAncestor(string class_name)

Gets the first ancestor object of a specific class

Retrieves the first ancestor object in the parent path that is a descendant of the specified class name.

Parameters:
class_name - class name to look for.
Returns:
the first ancestor object or null if no matching ancestor is found.
See Also:
SwatUIParent::getFirstDescendant()

/Swat/SwatUIObject.php at line 207

getHtmlHeadEntrySet

public SwatHtmlHeadEntrySet getHtmlHeadEntrySet()

Gets the SwatHtmlHeadEntry objects needed by this UI object

If this UI object is not visible, an empty set is returned to reduce the number of required HTTP requests.

Returns:
the SwatHtmlHeadEntry objects needed by this UI object.

/Swat/SwatUIObject.php at line 315

getInlineJavaScript

protected string getInlineJavaScript()

Gets inline JavaScript used by this user-interface object

Returns:
inline JavaScript used by this user-interface object.

/Swat/SwatUIObject.php at line 358

getUniqueId

protected final string getUniqueId()

Generates a unique id for this UI object

Gets a unique id that may be used for the id property of this UI object. Each time this method id called, a new unique identifier is generated so you should only call this method once and set it to a property of this object.

Returns:
a unique identifier for this UI object.

/Swat/SwatUIObject.php at line 230

isVisible

public boolean isVisible()

Gets whether or not this UI object is visible

Looks at the visible property of the ancestors of this UI object to determine if this UI object is visible.

Returns:
true if this UI object is visible and false if it is not.
See Also:
SwatUIObject::$visible

silverorange Code