PAJES 3.0.21

org.pajes.html
Class Select

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

public abstract class Select
extends Input
implements InputMandatoryValidation, InputValidation

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

See Also:
Option, OptionGroup, Serialized Form

Field Summary
static java.lang.String NULL_ENTRY
          The value returned by a select list item if it represents a null.
 
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
Select()
          Creates a select list.
 
Method Summary
 boolean getMultipleSelectAllowed()
          Gets whether multiple items may be selected simultaneously.
protected  Option getNull()
          Returns the default null entry, or null if no null entry is to be generated for this list.
protected abstract  java.util.Iterator<? extends OptionItem> getOptions()
          Returns an Iterator of Option instances.
 int getRowsToDisplay()
          Gets the number of rows to display when the user clicks on the list.
 InputString getSearchField()
          Returns an field that can be used to search a long select list for matching entries.
 boolean isMandatory()
          Determines if this field is mandatory
 Select setGenerateNull(int size)
          Determines whether a null entry should be generated for this list.
 Select setGenerateNull(java.lang.String text, int size)
          Determines whether a null entry should be generated for this list.
 Select setIndexToIgnoreInMandatoryCheck(int indexToIgnore)
          Sets the zero-based index of an element to be ignored when performing the isMandatory check.
 Input setMandatory(boolean valueIsRequired)
          Sets validation to ensure the user selects an item in the list
 Select setMultipleSelectAllowed(boolean allowMultipleItemsToBeSelected)
          Sets whether multiple items may be selected simultaneously.
 Select setRowsToDisplay(int rowsToDisplay)
          Sets the number of rows to display when the user clicks on the list.
 void write(Browser browser)
          Writes the <select> tags and contained <OPTION> tags to the browser.
protected  void writeContent(Browser browser)
          Called by the write(org.pajes.servlet.Browser) method to write the content between the start and end tags.
protected  void writeSearchField(Browser browser)
          Should be called by sub-class write methods to display the search field.
 
Methods inherited from class org.pajes.html.Input
addClientValidation, addContent, clone, 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, setValue
 
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.InputValidation
getClientValidation, getDOMReference, getName, isRequiringValidation, setOnBlurValidation
 

Field Detail

NULL_ENTRY

public static final java.lang.String NULL_ENTRY
The value returned by a select list item if it represents a null.

See Also:
Constant Field Values
Constructor Detail

Select

public Select()
Creates a select list.

Method Detail

getMultipleSelectAllowed

public boolean getMultipleSelectAllowed()
Gets whether multiple items may be selected simultaneously.

Returns:
true if multiple items are allowed to be selected.

getRowsToDisplay

public int getRowsToDisplay()
Gets the number of rows to display when the user clicks on the list.

Returns:
the number of rows shown when the user clicks on the select list.

getSearchField

public InputString getSearchField()
Returns an field that can be used to search a long select list for matching entries. As keystrokes are entered into the field, the next matching entry in the list that starts with the characters entered will be automatically selected.

The default setting for the field is setWritable(false). Therefore, to use the field, it should be retrieved using this method and its setWritable set to true. Other parameters such as the input length may/should also be set.

Care should be taken with field positioning. If visible, the input field will be placed on the page, followed by a <BR> tag, and then the select list. Therefore, placing the list in a table cell is highly recommended.

Returns:
the search field.

isMandatory

public boolean isMandatory()
Determines if this field is mandatory

Specified by:
isMandatory in interface InputMandatoryValidation
Returns:
true if this field is mandatory, or false if it is not.

setGenerateNull

public Select setGenerateNull(int size)
Determines whether a null entry should be generated for this list.

Parameters:
size - the number of spaces to display as the null entry. If size is less than 1, no null entry will be generated
Returns:
the modified Select object.

setGenerateNull

public Select setGenerateNull(java.lang.String text,
                              int size)
Determines whether a null entry should be generated for this list.

Parameters:
text - the text to display on the null entry.
size - the length to which the text will be padded with spaces. If size is less than 1, no null entry will be generated
Returns:
the modified Select object.

setIndexToIgnoreInMandatoryCheck

public Select setIndexToIgnoreInMandatoryCheck(int indexToIgnore)
Sets the zero-based index of an element to be ignored when performing the isMandatory check. (ie if the specifed index is selected, no item in the list will be considered to be selected.)

Parameters:
indexToIgnore - the zero-indexed item in the select list to be ignored when determining if a value has been selected from the list.
Returns:
the modified SelectListFromJavaScript object.
Throws:
TagException - if the index to ignore is less than zero.

setMandatory

public Input setMandatory(boolean valueIsRequired)
Sets validation to ensure the user selects an item in the list

Specified by:
setMandatory in interface InputMandatoryValidation
Parameters:
valueIsRequired - true if a value is mandatory.
Returns:
the modified Input object.

setMultipleSelectAllowed

public Select setMultipleSelectAllowed(boolean allowMultipleItemsToBeSelected)
Sets whether multiple items may be selected simultaneously.

Parameters:
allowMultipleItemsToBeSelected - true allows multiple items to be selected.
Returns:
the modified Select object.

setRowsToDisplay

public Select setRowsToDisplay(int rowsToDisplay)
Sets the number of rows to display when the user clicks on the list.

Parameters:
rowsToDisplay - number of rows shown when the user clicks on the select list.
Returns:
the modified Select object.

write

public void write(Browser browser)
           throws java.io.IOException
Writes the <select> tags and contained <OPTION> tags to the browser.

Specified by:
write in interface HTML
Overrides:
write in class Input
Parameters:
browser - the browser to which the results are to be output.
Throws:
java.io.IOException - if an IO exception occurs
See Also:
Tag.setWriteEndTag(boolean), Tag.writeContent(org.pajes.servlet.Browser)

getNull

protected Option getNull()
Returns the default null entry, or null if no null entry is to be generated for this list.

Returns:
the default null entry, or null if no null entry is to be generated for this list.

getOptions

protected abstract java.util.Iterator<? extends OptionItem> getOptions()
Returns an Iterator of Option instances.

Returns:
an Iterator of Option instances.

writeContent

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

Overrides:
writeContent in class Tag
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)

writeSearchField

protected void writeSearchField(Browser browser)
                         throws java.io.IOException
Should be called by sub-class write methods to display the search field. This method must be called before writing the list to the browser.

Parameters:
browser - the browser to which the results are to be output.
Throws:
java.io.IOException - if an IO exception occurs
See Also:
getSearchField()

PAJES 3.0.21

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