silverorange Code


Swat.SwatListEntry
/Swat/SwatListEntry.php at line 15

Class SwatListEntry

SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatInputControl
└─SwatEntry
└─SwatListEntry

public class SwatListEntry
extends SwatEntry

An input control for entering a delimited list of data

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

Field Summary
string

$delimiter

The delimiter for entries in this list entry.

integer

$max_entries

The maximum number of allowed entries in this list entry.

integer

$min_entries

The minimum number of required entries in this list entry.

boolean

$trim_whitespace

Whether or not to trim whitespace from values between delimiters.

array

$values

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

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.

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

Field Detail

/Swat/SwatListEntry.php at line 37

delimiter

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.


/Swat/SwatListEntry.php at line 64

max_entries

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.


/Swat/SwatListEntry.php at line 79

min_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.

See Also:
SwatInputControl::$required

/Swat/SwatListEntry.php at line 54

trim_whitespace

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'.


/Swat/SwatListEntry.php at line 24

values

public array $values = array()

The values of this list entry


Constructor Detail

/Swat/SwatListEntry.php at line 91

SwatListEntry

public SwatListEntry(string id)

Creates a new list entry widget

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

Method Detail

/Swat/SwatListEntry.php at line 103

display

public void display()

Displays this list entry


/Swat/SwatListEntry.php at line 363

getCSSClassNames

protected array getCSSClassNames()

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

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

/Swat/SwatListEntry.php at line 270

getDisplayValue

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.

Parameters:
value - the value to format for display.
Returns:
the values displayed in the XHTML input.

/Swat/SwatListEntry.php at line 293

getNote

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.

Returns:
an informative note of how to use this list entry.
See Also:
SwatControl::getNote()

/Swat/SwatListEntry.php at line 234

getState

public string getState()

Gets the current state of this entry widget

Returns:
the current state of this entry widget.
See Also:
SwatState::getState()

/Swat/SwatListEntry.php at line 127

process

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.


/Swat/SwatListEntry.php at line 249

setState

public void setState(mixed values, string state)

Sets the current state of this list entry widget

Parameters:
state - the new state of this list entry widget.
See Also:
SwatState::setState()

/Swat/SwatListEntry.php at line 344

splitValues

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.

Parameters:
value - the string to split.
Returns:
the string of delimiter separated values split into an array of values.

silverorange Code