silverorange Code


Swat.SwatButton
/Swat/SwatButton.php at line 20

Class SwatButton

SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatInputControl
└─SwatButton

public class SwatButton
extends SwatInputControl

A button widget

This widget displays as an XHTML form submit button, so it must be used within SwatForm.

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

Field Summary
string

$access_key

The access key for this button.

protected boolean

$clicked

Clicked.

string

$confirmation_message

Optional confirmation message to display when this button is clicked.

string

$processing_throbber_message

Optional content to display beside the processing throbber.

boolean

$show_processing_throbber

Whether or not to show a processing throbber when this button is clicked.

protected string

$stock_class

A CSS class set by the stock_id of this button.

string

$stock_id

The stock id of this button.

integer

$tab_index

The ordinal tab index position of the XHTML input tag, or null if the tab index should be automatically set by the browser.

string

$title

The visible text on this button.

Fields inherited from Swat.SwatInputControl
required
Constructor Summary

SwatButton(string id)

Creates a new button.

Method Summary
void

display()

Displays this button.

protected array

getCSSClassNames()

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

protected stirng

getInlineJavaScript()

Gets the inline JavaScript required for this control.

protected string

getJavaScriptClass()

Gets the name of the JavaScript class to instantiate for this button.

boolean

hasBeenClicked()

Returns whether this button has been clicked.

void

init()

Initializes this widget.

void

process()

Does button processing.

void

setFromStock(string stock_id, boolean overwrite_properties)

Sets the values of this button to a stock type.

Methods inherited from Swat.SwatInputControl
getForm, init
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/SwatButton.php at line 50

access_key

public string $access_key = null

The access key for this button

The access key is used for keyboard nagivation and screen readers.


/Swat/SwatButton.php at line 111

clicked

protected boolean $clicked = false

Clicked

This is set to true after processing if this button was clicked. The form will also contain a refernce to the clicked button in the SwatForm::$button class variable.


/Swat/SwatButton.php at line 90

confirmation_message

public string $confirmation_message = null

Optional confirmation message to display when this button is clicked

If this message is specified, users will have to click through a JavaScript confirmation dialog to submit the form. If this is null, no confirmation is performed.


/Swat/SwatButton.php at line 79

processing_throbber_message

public string $processing_throbber_message = ''

Optional content to display beside the processing throbber

See Also:
SwatButton::$show_processing_throbber

/Swat/SwatButton.php at line 70

show_processing_throbber

public boolean $show_processing_throbber = false

Whether or not to show a processing throbber when this button is clicked

Showing a processing throbber is appropriate when this button is used to submit forms that can take a long time to process. By default, the processing throbber is not displayed.


/Swat/SwatButton.php at line 100

stock_class

protected string $stock_class = null

A CSS class set by the stock_id of this button


/Swat/SwatButton.php at line 41

stock_id

public string $stock_id = null

The stock id of this button

Specifying a stock id before the SwatButton::init() method is called causes this button to be initialized with a set of stock values.

See Also:
SwatToolLink::setFromStock()

/Swat/SwatButton.php at line 58

tab_index

public integer $tab_index = null

The ordinal tab index position of the XHTML input tag, or null if the tab index should be automatically set by the browser


/Swat/SwatButton.php at line 29

title

public string $title = null

The visible text on this button


Constructor Detail

/Swat/SwatButton.php at line 123

SwatButton

public SwatButton(string id)

Creates a new button

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

Method Detail

/Swat/SwatButton.php at line 165

display

public void display()

Displays this button

Outputs an XHTML input tag.


/Swat/SwatButton.php at line 303

getCSSClassNames

protected array getCSSClassNames()

Gets the array of CSS classes that are applied to this button

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

/Swat/SwatButton.php at line 347

getInlineJavaScript

protected stirng getInlineJavaScript()

Gets the inline JavaScript required for this control

Returns:
the inline JavaScript required for this control.

/Swat/SwatButton.php at line 334

getJavaScriptClass

protected string getJavaScriptClass()

Gets the name of the JavaScript class to instantiate for this button

Subclasses of this class may want to return a subclass of the default JavaScript button class.

Returns:
the name of the JavaScript class to instantiate for this button. Defaults to 'SwatButton'.

/Swat/SwatButton.php at line 224

hasBeenClicked

public boolean hasBeenClicked()

Returns whether this button has been clicked

Returns:
whether this button has been clicked.

/Swat/SwatButton.php at line 147

init

public void init()

Initializes this widget

Loads properties from stock if $stock_id is set, otherwise sets a default stock title.

See Also:
SwatWidget::init()

/Swat/SwatButton.php at line 204

process

public void process()

Does button processing

Sets whether this button has been clicked and also updates the form this button belongs to with a reference to this button if this button submitted the form.


/Swat/SwatButton.php at line 250

setFromStock

public void setFromStock(string stock_id, boolean overwrite_properties)

Sets the values of this button to a stock type

Valid stock type ids are:

Parameters:
stock_id - the identifier of the stock type to use.
overwrite_properties - whether to overwrite properties if they are already set.
Throws:
SwatUndefinedStockTypeException

silverorange Code