SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatMenuItem
public class SwatMenuItem
extends SwatControl
| Field Summary | |
|---|---|
| string | The URI-reference (see RFC2396) linked by this menu item. |
| protected string | A CSS class set by the stock_id of this menu item. |
| string | The stock id of this menu item. |
| protected SwatAbstractMenu | The sub menu of this menu item. |
| string | The user-visible title of this menu item. |
| array|string | A value or array of values to substitute into the link property of this menu item. |
| Method Summary | |
|---|---|
| void | addChild(SwatAbstractMenu child) Adds a child object. |
| SwatUIObject | copy(string id_suffix) Performs a deep copy of the UI tree starting with this UI object. |
| void | display() Displays this menu item. |
| protected void | Displays this menu item's sub-menu. |
| protected array | Gets the array of CSS classes that are applied to this menu item. |
| array | Gets descendant states. |
| array | getDescendants(string class_name) Gets descendant UI-objects. |
| SwatUIObject | getFirstDescendant(string class_name) Gets the first descendant UI-object of a specific class. |
| void | init() Initializes this menu item. |
| void | setDescendantStates(array states) Sets descendant states. |
| void | setFromStock(string stock_id, boolean overwrite_properties) Sets the values of this menu item to a stock type. |
| void | setSubMenu(SwatAbstractMenu menu) Sets the sub-menu of this menu item. |
| Methods inherited from Swat.SwatControl | |
|---|---|
| addMessage, getNote, printWidgetTree | |
| Methods inherited from Swat.SwatWidget | |
|---|---|
| addCompositeWidget, addMessage, confirmCompositeWidgets, copy, createCompositeWidgets, display, displayHtmlHeadEntries, getCSSClassNames, getCompositeWidget, getCompositeWidgets, getFocusableHtmlId, getHtmlHeadEntrySet, getMessages, hasMessage, init, isDisplayed, isInitialized, isProcessed, isSensitive, printWidgetTree, process, replaceWithContainer | |
| Methods inherited from Swat.SwatUIObject | |
|---|---|
| addComment, addJavaScript, addStyleSheet, addTangoAttribution, copy, getCSSClassNames, getCSSClassString, getFirstAncestor, getHtmlHeadEntrySet, getInlineJavaScript, getUniqueId, isVisible | |
public string $link
The URI-reference (see RFC2396) linked by this menu item
If no link is specified, this menu item does not link to anything.
Optionally uses vsprintf() syntax, for example:
<?php
$item->link = 'MySection/MyPage/%s?id=%s';
?>
protected string $stock_class = null
A CSS class set by the stock_id of this menu item
public string $stock_id = null
The stock id of this menu item
Specifying a stock id initializes this menu item with a set of stock values.
protected SwatAbstractMenu $sub_menu
The sub menu of this menu item
public string $title
The user-visible title of this menu item
public array|string $value
A value or array of values to substitute into the link property of this menu item
The value property may be specified either as an array of values or as
a single value. If an array is passed, a call to vsprintf() is done
on the SwatMenuItem::$link property. If the value is a string
a single sprintf() call is made.
public void addChild(SwatAbstractMenu child)
Adds a child object
This method fulfills the SwatUIParent interface. It is used
by SwatUI when building a widget tree and should not need to be
called elsewhere. To set the sub-menu for a menu item, use
SwatMenuItem::setSubMenu().
child - the child object to add.public SwatUIObject copy(string id_suffix)
Performs a deep copy of the UI tree starting with this UI object
id_suffix - optional. A suffix to append to copied UI objects in the UI tree.public void display()
Displays this menu item
If this item has a sub-menu, the sub-menu is also displayed.
protected void displaySubMenu()
Displays this menu item's sub-menu
protected array getCSSClassNames()
Gets the array of CSS classes that are applied to this menu item
public array getDescendantStates()
Gets descendant states
Retrieves an array of states of all stateful UI-objects in the widget subtree below this menu item.
public array getDescendants(string class_name)
Gets descendant UI-objects
class_name - optional class name. If set, only UI-objects that are instances of $class_name are returned.public SwatUIObject getFirstDescendant(string class_name)
Gets the first descendant UI-object of a specific class
class_name - class name to look for.public void init()
Initializes this menu item
public void setDescendantStates(array states)
Sets descendant states
Sets states on all stateful UI-objects in the widget subtree below this menu item.
states - an array of UI-object states with UI-object identifiers as array keys.public void setFromStock(string stock_id, boolean overwrite_properties)
Sets the values of this menu item to a stock type
Valid stock type ids are:
stock_id - the identifier of the stock type to use.overwrite_properties - whether to overwrite properties if they are already set.public void setSubMenu(SwatAbstractMenu menu)
Sets the sub-menu of this menu item
menu - the sub-menu for this menu item.
An item in a menu
SwatMenuItem objects may be added to
SwatMenuorSwatMenuGroupwidgets.