SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatInputControl
└─SwatButton
public class SwatButton
extends SwatInputControl
| Field Summary | |
|---|---|
| string | The access key for this button. |
| protected boolean | Clicked. |
| string | Optional confirmation message to display when this button is clicked. |
| string | Optional content to display beside the processing throbber. |
| boolean | Whether or not to show a processing throbber when this button is clicked. |
| protected string | A CSS class set by the stock_id of this button. |
| string | The stock id of this button. |
| integer | The ordinal tab index position of the XHTML input tag, or null if the tab index should be automatically set by the browser. |
| string | 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 | Gets the array of CSS classes that are applied to this button. |
| protected stirng | Gets the inline JavaScript required for this control. |
| protected string | Gets the name of the JavaScript class to instantiate for this button. |
| boolean | 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 | |
public string $access_key = null
The access key for this button
The access key is used for keyboard nagivation and screen readers.
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.
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.
public string $processing_throbber_message = ''
Optional content to display beside the 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.
protected string $stock_class = null
A CSS class set by the stock_id of this button
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.
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
public string $title = null
The visible text on this button
public SwatButton(string id)
Creates a new button
id - a non-visible unique id for this widget.public void display()
Displays this button
Outputs an XHTML input tag.
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
Subclasses of this class may want to return a subclass of the default JavaScript button class.
public boolean hasBeenClicked()
Returns whether this button has been clicked
public void init()
Initializes this widget
Loads properties from stock if $stock_id is set, otherwise sets a default stock title.
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.
public void setFromStock(string stock_id, boolean overwrite_properties)
Sets the values of this button 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.
A button widget
This widget displays as an XHTML form submit button, so it must be used within
SwatForm.