silverorange Code


Swat.SwatActions
/Swat/SwatActions.php at line 23

Class SwatActions

SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatActions

public class SwatActions
extends SwatControl

Actions widget

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

Field Summary
protected array

$action_items_by_id

The available actions for this actions selector indexed by id.

boolean

$auto_reset

Auto-reset.

SwatActionItem

$selected

Selected action.

boolean

$show_blank

Show blank.

Constructor Summary

SwatActions(string id)

Creates a new actions list.

Method Summary
void

addActionItem(SwatActionItem item)

Adds an action item.

void

addChild(SwatActionItem child)

Adds a child object.

SwatUIObject

copy(string id_suffix)

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

protected void

createCompositeWidgets()

Creates and the composite flydown and button widgets of this actions control.

void

display()

Displays this list of actions.

protected void

displayButton()

Displays the button for this action list.

array

getActionItems()

Gets the array of current SwatActions.

protected array

getCSSClassNames()

Gets the array of CSS classes that are applied to this actions list.

array

getDescendantStates()

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.

SwatHtmlHeadEntrySet

getHtmlHeadEntrySet()

Gets the SwatHtmlHeadEntry objects needed by this actions list.

protected string

getInlineJavaScript()

Gets inline JavaScript required to show and hide selected action items.

protected string

getInlineJavaScriptTranslations()

Gets translatable string resources for the JavaScript object for this widget.

void

init()

Initializes this action item.

void

process()

Figures out what action item is selected.

void

setDescendantStates(array states)

Sets descendant states.

void

setViewSelector(SwatView view, SwatViewSelector selector)

Sets the optional view and selector of this actions control.

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

Field Detail

/Swat/SwatActions.php at line 65

action_items_by_id

protected array $action_items_by_id = array()

The available actions for this actions selector indexed by id

This array only contains actions that have a non-null id.


/Swat/SwatActions.php at line 53

auto_reset

public boolean $auto_reset = true

Auto-reset

Whether to auto reset the action flydown to the default action after processing.


/Swat/SwatActions.php at line 34

selected

public SwatActionItem $selected = null

Selected action

The currently selected action item, or null.


/Swat/SwatActions.php at line 43

show_blank

public boolean $show_blank = true

Show blank

Whether to show an inital blank option in the flydown.


Constructor Detail

/Swat/SwatActions.php at line 105

SwatActions

public SwatActions(string id)

Creates a new actions list

Parameters:
id - a non-visible unique id for this widget.
See Also:
SwatWidget::__construct()

Method Detail

/Swat/SwatActions.php at line 252

addActionItem

public void addActionItem(SwatActionItem item)

Adds an action item

Adds a SwatActionItem to this SwatActions widget.

Parameters:
item - a reference to the item to add.
See Also:
SwatActionItem

/Swat/SwatActions.php at line 279

addChild

public void addChild(SwatActionItem 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 an action item to an actions object use SwatActions::addActionItem().

Parameters:
child - a reference to a child object to add.
Throws:
SwatInvalidClassException
See Also:
SwatUIParent
SwatActions::addActionItem()

/Swat/SwatActions.php at line 495

copy

public SwatUIObject copy(string id_suffix)

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

Parameters:
id_suffix - optional. A suffix to append to copied UI objects in the UI tree.
Returns:
a deep copy of the UI tree starting with this UI object.
See Also:
SwatUIObject::copy()

/Swat/SwatActions.php at line 535

createCompositeWidgets

protected void createCompositeWidgets()

Creates and the composite flydown and button widgets of this actions control


/Swat/SwatActions.php at line 144

display

public void display()

Displays this list of actions

Internal widgets are automatically created if they do not exist. Javascript is displayed, then the display methods of the internal widgets are called.


/Swat/SwatActions.php at line 521

displayButton

protected void displayButton()

Displays the button for this action list

Subclasses may override this method to display more buttons.


/Swat/SwatActions.php at line 320

getActionItems

public array getActionItems()

Gets the array of current SwatActions

Returns:
of SwatActionItems
See Also:
SwatActionItem

/Swat/SwatActions.php at line 628

getCSSClassNames

protected array getCSSClassNames()

Gets the array of CSS classes that are applied to this actions list

Returns:
the array of CSS classes that are applied to this actions list.
See Also:
SwatUIObject::getCSSClassString()

/Swat/SwatActions.php at line 413

getDescendantStates

public array getDescendantStates()

Gets descendant states

Retrieves an array of states of all stateful UI-objects in the widget subtree below this actions widget.

Returns:
an array of UI-object states with UI-object identifiers as array keys.

/Swat/SwatActions.php at line 341

getDescendants

public array getDescendants(string class_name)

Gets descendant UI-objects

Parameters:
class_name - optional class name. If set, only UI-objects that are instances of $class_name are returned.
Returns:
the descendant UI-objects of this actions widget. If descendant objects have identifiers, the identifier is used as the array key.
See Also:
SwatUIParent::getDescendants()

/Swat/SwatActions.php at line 378

getFirstDescendant

public SwatUIObject getFirstDescendant(string class_name)

Gets the first descendant UI-object of a specific class

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

/Swat/SwatActions.php at line 300

getHtmlHeadEntrySet

public SwatHtmlHeadEntrySet getHtmlHeadEntrySet()

Gets the SwatHtmlHeadEntry objects needed by this actions list

Returns:
the SwatHtmlHeadEntry objects needed by this actions list.
See Also:
SwatWidget::getHtmlHeadEntrySet()

/Swat/SwatActions.php at line 555

getInlineJavaScript

protected string getInlineJavaScript()

Gets inline JavaScript required to show and hide selected action items

Returns:
inline JavaScript required to show and hide selected action items.

/Swat/SwatActions.php at line 600

getInlineJavaScriptTranslations

protected string getInlineJavaScriptTranslations()

Gets translatable string resources for the JavaScript object for this widget

Returns:
translatable JavaScript string resources for this widget.

/Swat/SwatActions.php at line 126

init

public void init()

Initializes this action item

This initializes the action items contained in this actions list.


/Swat/SwatActions.php at line 222

process

public void process()

Figures out what action item is selected

This method creates internal widgets if they do not exist, and then determines what SwatActionItem was selected by the user by calling the process methods of the internal widgets.


/Swat/SwatActions.php at line 435

setDescendantStates

public void setDescendantStates(array states)

Sets descendant states

Sets states on all stateful UI-objects in the widget subtree below this actions widget.

Parameters:
states - an array of UI-object states with UI-object identifiers as array keys.

/Swat/SwatActions.php at line 462

setViewSelector

public void setViewSelector(SwatView view, SwatViewSelector selector)

Sets the optional view and selector of this actions control

If a view and selector are specified for this actions control, submitting the form is prevented until one or more items in the view are selected by the selector.

Parameters:
view - the view items must be selected in. Specify null to remove any existing view selector.
selector - optional. The selector in the view that must select the items. If not specified, the first selector in the view is used.
Throws:
if no selector is specified and the the specified view does not have a selector.

silverorange Code