SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatInputControl
└─SwatEntry
└─SwatListEntry
public class SwatListEntry
extends SwatEntry
| Field Summary | |
|---|---|
| string | The delimiter for entries in this list entry. |
| integer | The maximum number of allowed entries in this list entry. |
| integer | The minimum number of required entries in this list entry. |
| boolean | Whether or not to trim whitespace from values between delimiters. |
| array | The values of this list entry. |
| Fields inherited from Swat.SwatEntry | |
|---|---|
| access_key, autocomplete, maxlength, minlength, nonce, read_only, size, tab_index, value | |
| Fields inherited from Swat.SwatInputControl | |
|---|---|
| required | |
| Constructor Summary | |
|---|---|
SwatListEntry(string id) Creates a new list entry widget. |
|
| Method Summary | |
|---|---|
| void | display() Displays this list entry. |
| protected array | Gets the array of CSS classes that are applied to this entry. |
| protected string | getDisplayValue(array value) Gets the value displayed in the XHTML input. |
| SwatMessage | getNote() Gets a note describing the rules on this list entry. |
| string | getState() Gets the current state of this entry widget. |
| void | process() Processes this list entry widget. |
| void | setState(mixed values, string state) Sets the current state of this list entry widget. |
| private array | splitValues(string value) Splits a value string with entries separated by delimiters into an array. |
| Methods inherited from Swat.SwatEntry | |
|---|---|
| display, getCSSClassNames, getDisplayValue, getFocusableHtmlId, getInputTag, getNonce, getRawValue, getState, getValidationMessage, hasRawValue, process, setState | |
| 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 $delimiter = ','
The delimiter for entries in this list entry
This may be a single character or a string of characters. The delimiter
is used to separate list entries. Entries in the
SwatListEntry::$values array do not include the delimiter.
By default, the delimiter is a comma.
public integer $max_entries = null
The maximum number of allowed entries in this list entry
If this value is set to null or 0 then there is no maximum number of allowed entries.
public integer $min_entries = 1
The minimum number of required entries in this list entry
If SwatInputControl::$required is set to true for this list
entry this property specifies the minimum number of entries the user
must enter.
Note: If SwatInputControl::$required is set to false, this
property has no effect.
public boolean $trim_whitespace = true
Whether or not to trim whitespace from values between delimiters
If this is true, whitespace before or after the delimiter is removed from entries in the array of values. If this is false, whitespace is maintained.
For example, if the user enters 'orange, apple' in form
data and {SwatListEntry::$trim_whitespace} is true, the second entry in
SwatListEntry::$values array will be 'apple'. In the same
example if SwatListEntry::$trim_whitespace is false, the second
entry in the array will be ' apple'.
public array $values = array()
The values of this list entry
public SwatListEntry(string id)
Creates a new list entry widget
id - a non-visible unique id for this widget.public void display()
Displays this list entry
protected array getCSSClassNames()
Gets the array of CSS classes that are applied to this entry
protected string getDisplayValue(array value)
Gets the value displayed in the XHTML input
For list entry, this is a delimiter separated string containing the
elements of SwatListEntry::$values.
value - the value to format for display.public SwatMessage getNote()
Gets a note describing the rules on this list entry
This note informs the user what numbers of entries are valid for this list entry. This note does not mention anything about what type of delimiter is used. Developers are responsible for ensuring that users are notified what type of delimiters are used.
public string getState()
Gets the current state of this entry widget
public void process()
Processes this list entry widget
The user entered values are split into an array of values and stored in
the SwatListEntry::$values array.
public void setState(mixed values, string state)
Sets the current state of this list entry widget
state - the new state of this list entry widget.private array splitValues(string value)
Splits a value string with entries separated by delimiters into an array
If SwatListEntry::$trim_whitespace is set to true, whitespace
is not included in the split values.
value - the string to split.
An input control for entering a delimited list of data