SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatContainer
public class SwatContainer
extends SwatWidget
| Field Summary | |
|---|---|
| protected array | Children widgets. |
| protected array | Children widgets indexed by id. |
| Fields inherited from Swat.SwatWidget | |
|---|---|
| displayed, id, initialized, messages, processed, requires_id, sensitive, stylesheet | |
| Fields inherited from Swat.SwatUIObject | |
|---|---|
| classes, html_head_entry_set, parent, visible | |
| Method Summary | |
|---|---|
| void | add(SwatWidget widget) Adds a widget. |
| void | addChild(SwatWidget 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 container by calling SwatWidget::display() on all children. |
| protected void | Displays the child widgets of this container. |
| SwatWidget | getChild(string id) Gets a child widget. |
| array | getChildren(string class_name) Gets all child widgets. |
| array | Gets descendant states. |
| array | getDescendants(string class_name) Gets descendant UI-objects. |
| SwatWidget | getFirst() Gets the first child widget. |
| SwatUIObject | getFirstDescendant(string class_name) Gets the first descendant UI-object of a specific class. |
| string | Gets the id attribute of the XHTML element displayed by this widget that should receive focus. |
| SwatHtmlHeadEntrySet | Gets the SwatHtmlHeadEntry objects needed by this container. |
| array | Gets all messages. |
| boolean | Checks for the presence of messages. |
| void | init() Initializes this widget. |
| protected void | notifyOfAdd(SwatWidget widget) Notifies this widget that a widget was added. |
| void | packEnd(SwatWidget widget) Adds a widget to end. |
| void | packStart(SwatWidget widget) Adds a widget to start. |
| void | |
| void | process() Processes this container by calling SwatWidget::process() on all children. |
| SwatWidget | remove(SwatWidget widget) Removes a widget. |
| SwatWidget | replace(SwatWidget widget, mixed new_widget) Replace a widget. |
| protected void | sendAddNotifySignal(SwatWidget widget) Sends the notification signal up the widget tree. |
| void | setDescendantStates(array states) Sets descendant states. |
| 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 | |
protected array $children = array()
Children widgets
An array containing the widgets that belong to this container.
protected array $children_by_id = array()
Children widgets indexed by id
An array containing widgets indexed by their id. This array only contains widgets that have a non-null id.
public void add(SwatWidget widget)
Adds a widget
Adds a widget as a child of this container. The widget must not have a parent already. The parent of the added widget is set to reference this container.
widget - a reference to the widget to add.public void addChild(SwatWidget 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 add a widget to a container use
SwatContainer::add().
child - a reference to 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 container by calling SwatWidget::display() on all
children
protected void displayChildren()
Displays the child widgets of this container
Subclasses that override the display method will typically call this method to display child widgets.
public SwatWidget getChild(string id)
Gets a child widget
Retrieves a widget from the list of widgets in the container based on the unique identifier of the widget.
id - the unique id of the widget to look for.public array getChildren(string class_name)
Gets all child widgets
Retrieves an array of all widgets directly contained by this container.
class_name - optional class name. If set, only widgets that are instances of $class_name are returned.public array getDescendantStates()
Gets descendant states
Retrieves an array of states of all stateful UI-objects in the widget subtree below this container.
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 SwatWidget getFirst()
Gets the first child widget
Retrieves the first child widget from the list of widgets in the container.
public SwatUIObject getFirstDescendant(string class_name)
Gets the first descendant UI-object of a specific class
class_name - class name to look for.public string getFocusableHtmlId()
Gets the id attribute of the XHTML element displayed by this widget that should receive focus
public SwatHtmlHeadEntrySet getHtmlHeadEntrySet()
Gets the SwatHtmlHeadEntry objects needed by this container
public array getMessages()
Gets all messages
public boolean hasMessage()
Checks for the presence of messages
public void init()
protected void notifyOfAdd(SwatWidget widget)
Notifies this widget that a widget was added
This widget may want to adjust itself based on the widget added or any of the widgets children.
widget - the widget that has been added.public void packEnd(SwatWidget widget)
Adds a widget to end
Adds a widget to the end of the list of widgets in this container.
widget - a reference to the widget to add.public void packStart(SwatWidget widget)
Adds a widget to start
Adds a widget to the start of the list of widgets in this container.
widget - a reference to the widget to add.public void printWidgetTree()
public void process()
Processes this container by calling SwatWidget::process() on all
children
public SwatWidget remove(SwatWidget widget)
Removes a widget
Removes a child widget from this container. The parent of the widget is set to null.
widget - a reference to the widget to remove.public SwatWidget replace(SwatWidget widget, mixed new_widget)
Replace a widget
Replaces a child widget in this container. The parent of the removed widget is set to null.
widget - a reference to the widget to be replaced.widget - a reference to the new widget.protected void sendAddNotifySignal(SwatWidget widget)
Sends the notification signal up the widget tree
This container is notified of the added widget and then this method is called on the container parent.
widget - the widget that has been added.public void setDescendantStates(array states)
Sets descendant states
Sets states on all stateful UI-objects in the widget subtree below this container.
states - an array of UI-object states with UI-object identifiers as array keys.
Swat container widget
Used as a base class for widgets which contain other widgets.