silverorange Code


Swat.SwatCheckboxEntryList
/Swat/SwatCheckboxEntryList.php at line 29

Class SwatCheckboxEntryList

SwatObject
└─SwatUIObject
└─SwatWidget
└─SwatControl
└─SwatInputControl
└─SwatOptionControl
└─SwatCheckboxList
└─SwatCheckboxEntryList

public class SwatCheckboxEntryList
extends SwatCheckboxList

A checkbox list widget with entries per option

This widget can be used both to select multiple items from a list of options and to submit an associated text field with each selected option.

Selecting options works just like a normal checkbox list. Accessing the associated text field is done using the SwatCheckboxEntryList::getEntryValue() and SwatCheckboxEntryList::setEntryValue() methods. For setting large numbers of text fields (during initialization, for example) use the SwatCheckboxEntryList::setEntryValuesByArray() method.

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

Field Summary
string

$entry_column_title

An optional title to display above the column of entry widgets.

integer

$entry_maxlength

An optional maximum length to apply to entry widgets.

integer

$entry_size

The size of all the embedded entry widgets.

protected array

$entry_widgets

The entry widgets used by this checkbox entry list.

Fields inherited from Swat.SwatCheckboxList
columns, show_check_all, values
Fields inherited from Swat.SwatOptionControl
options, serialize_values
Fields inherited from Swat.SwatInputControl
required
Constructor Summary

SwatCheckboxEntryList(string id)

Creates a new checkbox entry list.

Method Summary
protected SwatEntry

createEntryWidget(string option_value)

Creates an entry widget of this checkbox entry list.

void

display()

Displays this checkbox list.

protected array

getCSSClassNames()

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

string

getEntryValue(string option_value)

Gets the value of an entry widget in this checkbox entry list.

protected SwatContainer

getEntryWidget(string option_value)

Gets a widget tree for the entry widget of this checkbox entry list.

protected string

getInlineJavaScript()

Gets the inline JavaScript for this checkbox entry list.

array

getMessages()

Gets all messages.

protected boolean

hasEntryWidget(string option_value)

Checks if this checkbox entry list has an entry widget for a given option value.

boolean

hasMessage()

Checks for the presence of messages.

void

process()

Processes this checkbox entry list.

void

setEntryValue(string option_value, string entry_value)

Sets the value of an entry widget in this checkbox entry list.

void

setEntryValuesByArray(array entry_values)

Sets the values of multiple entry widgets.

Methods inherited from Swat.SwatCheckboxList
createCompositeWidgets, display, displayOption, getCSSClassNames, getInlineJavaScript, getLiTag, getState, init, process, processValues, reset, setState
Methods inherited from Swat.SwatOptionControl
addOption, addOptionsByArray, getOption, getOptions, getOptionsByValue, removeOption, removeOptionsByValue
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/SwatCheckboxEntryList.php at line 45

entry_column_title

public string $entry_column_title = null

An optional title to display above the column of entry widgets


/Swat/SwatCheckboxEntryList.php at line 52

entry_maxlength

public integer $entry_maxlength = null

An optional maximum length to apply to entry widgets


/Swat/SwatCheckboxEntryList.php at line 38

entry_size

public integer $entry_size = 30

The size of all the embedded entry widgets


/Swat/SwatCheckboxEntryList.php at line 64

entry_widgets

protected array $entry_widgets = array()

The entry widgets used by this checkbox entry list

This array is indexed by option values of this checkbox entry list.


Constructor Detail

/Swat/SwatCheckboxEntryList.php at line 76

SwatCheckboxEntryList

public SwatCheckboxEntryList(string id)

Creates a new checkbox entry list

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

Method Detail

/Swat/SwatCheckboxEntryList.php at line 423

createEntryWidget

protected SwatEntry createEntryWidget(string option_value)

Creates an entry widget of this checkbox entry list

Subclasses may override this method to create a different widget type.

Parameters:
option_value - the value of the option for which to get the entry widget.
Returns:
the new entry widget for the given option value.

/Swat/SwatCheckboxEntryList.php at line 100

display

public void display()

Displays this checkbox list

See Also:
SwatCheckboxList::display()

/Swat/SwatCheckboxEntryList.php at line 357

getCSSClassNames

protected array getCSSClassNames()

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

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

/Swat/SwatCheckboxEntryList.php at line 257

getEntryValue

public string getEntryValue(string option_value)

Gets the value of an entry widget in this checkbox entry list

Parameters:
option_value - used to indentify the entry widget
Returns:
the value of the specified entry widget or null if no such widget exists.

/Swat/SwatCheckboxEntryList.php at line 397

getEntryWidget

protected SwatContainer getEntryWidget(string option_value)

Gets a widget tree for the entry widget of this checkbox entry list

This is used internally to create the widget tree containing a SwatEntry widget for display and processing.

Parameters:
option_value - the value of the option for which to get the entry widget. If no entry widget exists for the given option value, one is created.
Returns:
the widget tree containing the entry widget for the given option value.

/Swat/SwatCheckboxEntryList.php at line 333

getInlineJavaScript

protected string getInlineJavaScript()

Gets the inline JavaScript for this checkbox entry list

Returns:
the inline JavaScript for this checkbox entry list.

/Swat/SwatCheckboxEntryList.php at line 205

getMessages

public array getMessages()

Gets all messages

Returns:
an array of gathered {@link SwatMessage} objects.
See Also:
SwatWidget::getMessages()

/Swat/SwatCheckboxEntryList.php at line 376

hasEntryWidget

protected boolean hasEntryWidget(string option_value)

Checks if this checkbox entry list has an entry widget for a given option value

Parameters:
option_value - the value of the option to check.
Returns:
true if this checkbox entry list has an entry widget for the given option value and false if it does not.

/Swat/SwatCheckboxEntryList.php at line 229

hasMessage

public boolean hasMessage()

Checks for the presence of messages

Returns:
true if this checkbox list or any of the entry widgets in this checkbox list have one or more messages.
See Also:
SwatWidget::hasMessages()

/Swat/SwatCheckboxEntryList.php at line 184

process

public void process()

Processes this checkbox entry list

Processes the checkboxes as well as each entry widget for each checked checkbox. The entry widgets for unchecked checkboxes are not processed.

See Also:
SwatCheckboxList::process()

/Swat/SwatCheckboxEntryList.php at line 283

setEntryValue

public void setEntryValue(string option_value, string entry_value)

Sets the value of an entry widget in this checkbox entry list

Parameters:
option_value - the value of the option for which to set the entry widget value.
entry_value - the value to set on the entry widget.
Throws:
if the option value does not match an existing option value in this checkbox entry list.

/Swat/SwatCheckboxEntryList.php at line 319

setEntryValuesByArray

public void setEntryValuesByArray(array entry_values)

Sets the values of multiple entry widgets

This is a convenience method to quickly set the entry values for one or more options in this checkbox entry list. This calls SwatCheckboxEntryList::setEntryValue() internally for each entry in the $entry_values array.

Parameters:
entry_values - an array indexed by option values of this checkbox entry list with values of the entry widget values.
Throws:
if any option value (array key) does not match an existing option value in this checkbox entry list.

silverorange Code