PAJES 3.0.21

org.pajes.html
Class SelectList

java.lang.Object
  extended by org.pajes.html.Tag
      extended by org.pajes.html.Input
          extended by org.pajes.html.Select
              extended by org.pajes.html.SelectList
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HTML, InputMandatoryValidation, InputValidation, Traversable

public class SelectList
extends Select
implements Traversable

Generates the <SELECT> and associated <OPTION> tags to create list boxes and drop-down lists.

See Also:
Option, OptionGroup, Serialized Form

Field Summary
 
Fields inherited from class org.pajes.html.Select
NULL_ENTRY
 
Fields inherited from class org.pajes.html.Input
TYPE_ATTRIBUTE
 
Fields inherited from class org.pajes.html.Tag
ON_CLICK_ATTRIBUTE, TAG_CLOSE, TAG_LEFT, TAG_RIGHT
 
Constructor Summary
SelectList()
          Default constructor creates an empty select list.
SelectList(Form form, java.lang.String name)
          Create a drop down list or select box.
SelectList(Form form, java.lang.String name, boolean allowMultipleItemsToBeSelected)
          Create a drop down list or select box.
SelectList(Form form, java.lang.String name, boolean allowMultipleItemsToBeSelected, int rowsToDisplay)
          Create a drop down list or select box.
SelectList(Form form, java.lang.String name, boolean allowMultipleItemsToBeSelected, int rowsToDisplay, boolean isRequired)
          Create a drop down list or select box.
SelectList(Form form, java.lang.String name, int rowsToDisplay)
          Create a drop down list or select box.
SelectList(Form form, java.lang.String name, int rowsToDisplay, boolean allowMultipleItemsToBeSelected, boolean isRequired, int indexToIgnore)
          Create a drop down list or select box.
 
Method Summary
 Traversable add(HTML htmlObject)
          Adds an HTML object to the current container
 SelectList add(java.util.List<?> options)
          Adds options from a List.
 SelectList add(OptionItem option)
          Adds an option item to the list.
 SelectList add(Option option, java.lang.String label)
          Adds an option item to an OptionGroup.
 SelectList add(java.lang.String option)
          Adds an option to the drop down list.
 SelectList add(java.lang.String[] options)
          Adds options from an array of Strings.
 SelectList add(java.lang.String[][] options)
          Adds options from an array of Strings.
 SelectList add(java.lang.String option, java.lang.String value)
          Adds an option to the drop down list.
 SelectList add(java.lang.String option, java.lang.String value, boolean selected)
          Adds an option to the drop down list.
 Select clearDefaultValues()
          Clears the default selected values for the list.
 java.lang.Object clone()
          Allows a tag to be cloned.
 Traversable delete(java.lang.Object htmlObject)
          Deletes the specified HTML object from the container.
 HTML get(int position)
          Gets the HTML object from the specified position in the container.
 void getAll(java.util.Map<java.lang.String,Tag[]> ids, java.util.Map<java.lang.String,Input[]> names)
          Accepts two Maps as parameters, and returns them populated with all objects within this container that have ID and NAME attributes.
 Input[] getFieldByName(java.lang.String name)
          Locates Input instances in this container or any containers it contains, using the case-insensitive field name.
 Input getFirstFieldByName(java.lang.String name)
          Locates the first Input instance in this container or any containers it contains, using the case-insensitive field name.
 Tag getFirstTagByAttribute(java.lang.String name, java.lang.String value)
          Locates the first Tag instance in this container or any containers it contains that has the specified attribute name with the specified value.
 Tag getFirstTagByClass(java.lang.Class<? extends Tag> c)
          Locates the first Tag instance in this container or any containers it contains, that is an instance of the specified Class.
 Tag getFirstTagByID(java.lang.String id)
          Locates the first Tag instance in this container or any containers it contains, using the style sheet id, which is common to all HTML tags.
 Tag getFirstTagByName(java.lang.String name)
          Locates the first Tag instance in this container or any containers it contains, using the tag name (e.g.
protected  Option getNull()
          Returns the default null entry, or null if no null entry is to be generated for this list.
 java.util.Iterator<OptionItem> getOptions()
          Returns an Iterator of OptionItem instances.
 java.lang.String[] getSelectedOptions()
          Returns an array of the currently selected options.
 Tag[] getTagByAttribute(java.lang.String name, java.lang.String value)
          Locates Tag instances in this container or any containers it contains that have the specified attribute name and value.
 Tag[] getTagByClass(java.lang.Class<?> c)
          Locates Tag instances in this container or any containers it contains, that are an instance of the specified Class.
 Tag[] getTagByID(java.lang.String id)
          Locates Tag instances in this container or any containers it contains, using the style sheet id, which is common to all HTML tags.
 Tag[] getTagByName(java.lang.String name)
          Locates Tag instances in this container or any containers it contains, using the tag name (e.g.
 void remove()
          Removes all the options currently stored in the select list.
 Traversable set(HTML htmlObject, int position)
          Sets an HTML object at a specified position in the container.
 Input setValue(java.lang.String value)
          Sets the default value to be initially selected.
 Traversable setWritable(boolean visible, boolean cascade)
          Determines if this object and its contents should be returned to the browser.
 int size()
          Returns the number of HTML objects in the current container.
protected  void writeContent(Browser browser)
          Called to write the content between the start and end tags.
 
Methods inherited from class org.pajes.html.Select
getMultipleSelectAllowed, getRowsToDisplay, getSearchField, isMandatory, setGenerateNull, setGenerateNull, setIndexToIgnoreInMandatoryCheck, setMandatory, setMultipleSelectAllowed, setRowsToDisplay, write, writeSearchField
 
Methods inherited from class org.pajes.html.Input
addClientValidation, addContent, getClientValidation, getClientValidation, getDOMReference, getFieldNameForErrorMessage, getForm, getInstance, getLabel, getName, getOnBlurHandler, getOnChangeHandler, getOnFocusHandler, getOnSelectHandler, getReadOnlyStyleSheetClass, getTabIndex, getType, getValue, isChangeFlagEnabled, isDisabled, isReadOnly, isRequiringValidation, logNoFormWarning, removeClientValidation, removeClientValidation, removeClientValidation, removeMandatoryClientValidation, setChanged, setChangedFlag, setContent, setDisabled, setFieldNameInErrorMessage, setFieldNameInErrorMessage, setForm, setId, setLabel, setName, setOnBlurHandler, setOnBlurValidation, setOnChangeHandler, setOnClickHandler, setOnFocusHandler, setOnSelectHandler, setReadOnly, setReadOnlyStyleSheetClass, setTabIndex, setTabIndex, setTabIndex
 
Methods inherited from class org.pajes.html.Tag
addAttribute, addAttributes, addAttributes, clearAttribute, clearAttributes, destroy, getAttribute, getAttributes, getAttributeSet, getContainer, getContent, getDocument, getId, getOnClickHandler, getOnDBLClickHandler, getOnKeyDownHandler, getOnKeyPressHandler, getOnKeyUpHandler, getOnMouseDownHandler, getOnMouseOutHandler, getOnMouseOverHandler, getOnMouseUpHandler, getParent, getStyle, getStyleSheetClass, getTagName, getTitle, getWritePermission, hasAttribute, init, initAttributes, isChildOf, isChildOf, isWritable, isWritable, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setContainer, setContent, setOnDBLClickHandler, setOnKeyDownHandler, setOnKeyPressHandler, setOnKeyUpHandler, setOnMouseDownHandler, setOnMouseOutHandler, setOnMouseOverHandler, setOnMouseUpHandler, setParent, setStyle, setStyleSheetClass, setTagName, setTitle, setWritable, setWriteAttributes, setWriteEndTag, setWritelnAfter, setWritelnAfterContent, setWritelnBefore, setWritelnBeforeContent, setWritePermission, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pajes.html.Traversable
isWritable
 
Methods inherited from interface org.pajes.html.HTML
addContent, destroy, getContainer, getDocument, getId, getParent, getWritePermission, isChildOf, isChildOf, setContainer, setContent, setParent, setWritePermission, write
 
Methods inherited from interface org.pajes.html.InputValidation
getClientValidation, getDOMReference, getName, isRequiringValidation, setOnBlurValidation
 

Constructor Detail

SelectList

public SelectList()
Default constructor creates an empty select list.


SelectList

public SelectList(Form form,
                  java.lang.String name)
Create a drop down list or select box.

Parameters:
form - the form on which this input field will appear. Note that the element must still be added to the form - this reference is used by the getDOMReference() method to determine the fully qualified element name.
name - the name of the list box.

SelectList

public SelectList(Form form,
                  java.lang.String name,
                  boolean allowMultipleItemsToBeSelected)
Create a drop down list or select box.

Parameters:
form - the form on which this input field will appear. Note that the element must still be added to the form - this reference is used by the getDOMReference() method to determine the fully qualified element name.
name - the name of the list box.
allowMultipleItemsToBeSelected - true if multiple items are selectable

SelectList

public SelectList(Form form,
                  java.lang.String name,
                  boolean allowMultipleItemsToBeSelected,
                  int rowsToDisplay)
Create a drop down list or select box.

Parameters:
form - the form on which this input field will appear. Note that the element must still be added to the form - this reference is used by the getDOMReference() method to determine the fully qualified element name.
name - the name of the list box.
allowMultipleItemsToBeSelected - true is multiple items are selectable
rowsToDisplay - the number of rows that are shown when the user clicks on the select list

SelectList

public SelectList(Form form,
                  java.lang.String name,
                  boolean allowMultipleItemsToBeSelected,
                  int rowsToDisplay,
                  boolean isRequired)
Create a drop down list or select box.

Parameters:
form - the form on which this input field will appear. Note that the element must still be added to the form - this reference is used by the getDOMReference() method to determine the fully qualified element name.
name - the name of the list box.
allowMultipleItemsToBeSelected - true is multiple items are selectable
rowsToDisplay - the number of rows that are shown when the user clicks on the select list
isRequired - true if an item must be selected from the list

SelectList

public SelectList(Form form,
                  java.lang.String name,
                  int rowsToDisplay)
Create a drop down list or select box.

Parameters:
form - the form on which this input field will appear. Note that the element must still be added to the form - this reference is used by the getDOMReference() method to determine the fully qualified element name.
name - the name of the list box.
rowsToDisplay - the number of rows that are shown when the user clicks on the select list

SelectList

public SelectList(Form form,
                  java.lang.String name,
                  int rowsToDisplay,
                  boolean allowMultipleItemsToBeSelected,
                  boolean isRequired,
                  int indexToIgnore)
Create a drop down list or select box.

Parameters:
form - the form on which this input field will appear. Note that the element must still be added to the form - this reference is used by the getDOMReference() method to determine the fully qualified element name.
name - the name of the list box.
rowsToDisplay - the number of rows that are shown when the user clicks on the select list
allowMultipleItemsToBeSelected - true is multiple items are selectable
isRequired - true if an item must be selected from the list
indexToIgnore - a zero-indexed item in the select list to be ignored when determining if a value has been selected from the list.
Method Detail

add

public Traversable add(HTML htmlObject)
Description copied from interface: Traversable
Adds an HTML object to the current container

Specified by:
add in interface Traversable
Parameters:
htmlObject - - the Object to add (eg. doc.add(new htmlBody);)
Returns:
the modified Container object;
See Also:
Traversable.add(org.pajes.html.HTML)

add

public SelectList add(java.util.List<?> options)
Adds options from a List. Each element within the List may contain:

Parameters:
options - the List object containing the options.
Returns:
the modified SelectList object.

add

public SelectList add(Option option,
                      java.lang.String label)
Adds an option item to an OptionGroup. If the specified OptionGroup does not exist, it will be created.

Parameters:
option - - The Option to be added.
label - - The label of the OptionGroup to which the option should be added.
Returns:
the modified SelectList object.

add

public SelectList add(OptionItem option)
Adds an option item to the list.

Parameters:
option - - The Option or OptionGroup
Returns:
the modified SelectList object.

add

public SelectList add(java.lang.String option)
Adds an option to the drop down list.

Parameters:
option - - The Text to display in the select list - the Text will be returned as the value when selected
Returns:
the modified SelectList object.

add

public SelectList add(java.lang.String option,
                      java.lang.String value)
Adds an option to the drop down list.

Parameters:
option - - The Text to display in the select list
value - - the value to be returned when the item is selected
Returns:
the modified SelectList object.

add

public SelectList add(java.lang.String option,
                      java.lang.String value,
                      boolean selected)
Adds an option to the drop down list.

Parameters:
option - the Text to display in the select list
value - the value to be returned when the item is selected
selected - set to true if this is the default value
Returns:
the modified SelectList object.

add

public SelectList add(java.lang.String[] options)
Adds options from an array of Strings. Each element in the array will be used as the value and the description.

Parameters:
options - the array containing the String options.
Returns:
the modified SelectList object.

add

public SelectList add(java.lang.String[][] options)
Adds options from an array of Strings. Each element in the array is a two element array where element 0 is the option description and element 1 is the option value.

Parameters:
options - the array containing the String options.
Returns:
the modified SelectList object.

clearDefaultValues

public Select clearDefaultValues()
Clears the default selected values for the list.

Returns:
the modified Select object.
See Also:
setValue(java.lang.String)

clone

public java.lang.Object clone()
Allows a tag to be cloned. Over-rides the clone() method in Tag to do a deep clone: all the objects contained in this object will be cloned individually.

Specified by:
clone in interface HTML
Overrides:
clone in class Input
Returns:
The new SelectList instance.

delete

public Traversable delete(java.lang.Object htmlObject)
Description copied from interface: Traversable
Deletes the specified HTML object from the container.

Specified by:
delete in interface Traversable
Parameters:
htmlObject - the object to be deleted.
Returns:
the modified Container object.
See Also:
Traversable.delete(java.lang.Object)

get

public HTML get(int position)
Gets the HTML object from the specified position in the container.

Specified by:
get in interface Traversable
Parameters:
position - the position to get the html object
Returns:
the object at the specified location

getAll

public void getAll(java.util.Map<java.lang.String,Tag[]> ids,
                   java.util.Map<java.lang.String,Input[]> names)
Accepts two Maps as parameters, and returns them populated with all objects within this container that have ID and NAME attributes.

Either of the Maps may be null.

Specified by:
getAll in interface Traversable
Parameters:
ids - a Map that will be populated with all Tag instances where HTML.getId() returns a non-null value. The key in the HashMap is the String ID, and the value is an array of Tag instances.
names - a Map that will be populated with all Input instances where Input.getName() returns a non-null value. The key in the HashMap is the String NAME, and the value is an array of Input instances.

getFieldByName

public Input[] getFieldByName(java.lang.String name)
                       throws FieldNotFoundException
Locates Input instances in this container or any containers it contains, using the case-insensitive field name.

Specified by:
getFieldByName in interface Traversable
Parameters:
name - the field name to locate.
Returns:
an array of fields.
Throws:
FieldNotFoundException - if no matching fields were found.

getFirstFieldByName

public Input getFirstFieldByName(java.lang.String name)
                          throws FieldNotFoundException
Locates the first Input instance in this container or any containers it contains, using the case-insensitive field name.

Specified by:
getFirstFieldByName in interface Traversable
Parameters:
name - the field name to locate.
Returns:
the Input instance with the specified name.
Throws:
FieldNotFoundException - if no matching field was found.

getFirstTagByAttribute

public Tag getFirstTagByAttribute(java.lang.String name,
                                  java.lang.String value)
                           throws TagNotFoundException
Locates the first Tag instance in this container or any containers it contains that has the specified attribute name with the specified value.

Specified by:
getFirstTagByAttribute in interface Traversable
Parameters:
name - the case-insensitive name of the attribute.
value - the case-insensitive value of the attribute.
Returns:
an array of Tag instances.
Throws:
TagNotFoundException - of no matching tags were found.

getFirstTagByClass

public Tag getFirstTagByClass(java.lang.Class<? extends Tag> c)
                       throws TagNotFoundException
Locates the first Tag instance in this container or any containers it contains, that is an instance of the specified Class.

Specified by:
getFirstTagByClass in interface Traversable
Parameters:
c - the Class of Tag required.
Returns:
the Tag which is an instance of the specified class.
Throws:
TagNotFoundException - of no matching tags were found.

getFirstTagByID

public Tag getFirstTagByID(java.lang.String id)
                    throws TagNotFoundException
Locates the first Tag instance in this container or any containers it contains, using the style sheet id, which is common to all HTML tags.

Specified by:
getFirstTagByID in interface Traversable
Parameters:
id - the case-insensitive StyleSheet ID to locate.
Returns:
the Tag instance with the specified id.
Throws:
TagNotFoundException - of no matching id was found.

getFirstTagByName

public Tag getFirstTagByName(java.lang.String name)
                      throws TagNotFoundException
Locates the first Tag instance in this container or any containers it contains, using the tag name (e.g. "script" or "table" or "tr").

Specified by:
getFirstTagByName in interface Traversable
Parameters:
name - the case-insensitive name of the tag.
Returns:
the Tag with the specified name.
Throws:
TagNotFoundException - of no matching tags were found.

getOptions

public java.util.Iterator<OptionItem> getOptions()
Returns an Iterator of OptionItem instances.

Specified by:
getOptions in class Select
Returns:
an Iterator of OptionItem instances.

getSelectedOptions

public java.lang.String[] getSelectedOptions()
Returns an array of the currently selected options.

Returns:
an array of the currently selected options.

getTagByAttribute

public Tag[] getTagByAttribute(java.lang.String name,
                               java.lang.String value)
                        throws TagNotFoundException
Locates Tag instances in this container or any containers it contains that have the specified attribute name and value.

Specified by:
getTagByAttribute in interface Traversable
Parameters:
name - the case-insensitive name of the attribute.
value - the case-insensitive value of the attribute.
Returns:
an array of Tag instances.
Throws:
TagNotFoundException - of no matching tags were found.

getTagByClass

public Tag[] getTagByClass(java.lang.Class<?> c)
                    throws TagNotFoundException
Locates Tag instances in this container or any containers it contains, that are an instance of the specified Class.

Specified by:
getTagByClass in interface Traversable
Parameters:
c - the Class of Tag required.
Returns:
an array of Tag instances.
Throws:
TagNotFoundException - of no matching tags were found.

getTagByID

public Tag[] getTagByID(java.lang.String id)
                 throws TagNotFoundException
Locates Tag instances in this container or any containers it contains, using the style sheet id, which is common to all HTML tags.

Specified by:
getTagByID in interface Traversable
Parameters:
id - the case-insensitive StyleSheet ID to locate.
Returns:
an array of Tag instances.
Throws:
TagNotFoundException - of no matching ids were found.

getTagByName

public Tag[] getTagByName(java.lang.String name)
                   throws TagNotFoundException
Locates Tag instances in this container or any containers it contains, using the tag name (e.g. "script" or "table" or "tr").

Specified by:
getTagByName in interface Traversable
Parameters:
name - the case-insensitive name of the tag.
Returns:
an array of Tag instances.
Throws:
TagNotFoundException - of no matching tags were found.

remove

public void remove()
Removes all the options currently stored in the select list.


set

public Traversable set(HTML htmlObject,
                       int position)
Sets an HTML object at a specified position in the container.

Specified by:
set in interface Traversable
Parameters:
htmlObject - the Object to add.
position - the position at which to place the html object.
Returns:
the modified Traversable object.

setValue

public Input setValue(java.lang.String value)
Sets the default value to be initially selected.

Overrides:
setValue in class Input
Parameters:
value - the value to set as the default.
Returns:
the modified Input object.

setWritable

public Traversable setWritable(boolean visible,
                               boolean cascade)
Determines if this object and its contents should be returned to the browser.

Specified by:
setWritable in interface Traversable
Parameters:
visible - true if this element should be returned to the browser, or false if it should not.
cascade - true if any contained elements should be returned to the browser, or false if they should not. Note that this option does not affect any tags that would not normally return their contents if they themselves are not writable (e.g. Table tags).
Returns:
the modified Traversable object
See Also:
Tag.setWritable(boolean)

size

public int size()
Returns the number of HTML objects in the current container.

Specified by:
size in interface Traversable
Returns:
the number of HTML objects in the current container.

getNull

protected Option getNull()
Description copied from class: Select
Returns the default null entry, or null if no null entry is to be generated for this list.

Overrides:
getNull in class Select
Returns:
the default null entry, or null if no null entry is to be generated for this list.
See Also:
Select.getNull()

writeContent

protected void writeContent(Browser browser)
                     throws java.io.IOException
Called to write the content between the start and end tags.

Overrides:
writeContent in class Select
Parameters:
browser - the browser to which the results are to be output.
Throws:
java.io.IOException - if an I/O error occurs writing to the browser.
See Also:
Tag.setWriteEndTag(boolean)

PAJES 3.0.21

Copyright © 1998-2007 Viridian Pty Limited. All Rights Reserved.