SwatObject
└─SwatUIObject
public abstract class SwatUIObject
extends SwatObject
| Field Summary | |
|---|---|
| array | A user-specified array of CSS classes that are applied to this user-interface object. |
| protected SwatHtmlHeadEntrySet | A set of HTML head entries needed by this user-interface element. |
| SwatUIObject | The object which contains this object. |
| boolean | Visible. |
| Constructor Summary | |
|---|---|
| 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 | Gets the array of CSS classes that are applied to this user-interface object. |
| protected final string | 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 | Gets the SwatHtmlHeadEntry objects needed by this UI object. |
| protected string | Gets inline JavaScript used by this user-interface object. |
| protected final string | Generates a unique id for this UI object. |
| boolean | Gets whether or not this UI object is visible. |
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.
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.
public SwatUIObject $parent = null
The object which contains this object
public boolean $visible = true
Visible
Whether this UI object is displayed. All UI objects should respect this.
public SwatUIObject()
public void addComment(string comment, integer package_id)
Adds a comment to the list of HTML head entries needed by this user- interface element
comment - the contents of the comment to include.package_id - the package this comment belongs with.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
java_script - the uri of the JavaScript include.display_order - the relative order in which to display this JavaScript head entry.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
stylesheet - the uri of the style sheet.display_order - the relative order in which to display this stylesheet head entry.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.
package_id - the package the tango attribution belongs with.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.
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.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.
protected final string getCSSClassString()
Gets the string representation of this user-interface object's list of CSS classes
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.
class_name - class name to look for.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.
protected string getInlineJavaScript()
Gets inline JavaScript used by this user-interface object
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.
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.
A base class for Swat user-interface elements
TODO: describe our conventions on how CSS classes and XHTML ids are displayed.