PAJES 3.0.21

org.pajes.html
Class Input

java.lang.Object
  extended by org.pajes.html.Tag
      extended by org.pajes.html.Input
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, HTML
Direct Known Subclasses:
Button, InputChecked, InputField, InputHidden, InputRadioButtonSet, ResetButton, Select, Submit

public abstract class Input
extends Tag

Base Class for all form input elements. This class provides the default methods applicable to all for input elements.

See Also:
Serialized Form

Field Summary
protected static java.lang.String TYPE_ATTRIBUTE
          The type attribute name.
 
Fields inherited from class org.pajes.html.Tag
ON_CLICK_ATTRIBUTE, TAG_CLOSE, TAG_LEFT, TAG_RIGHT
 
Constructor Summary
Input(java.lang.String type)
          Creates an input field.
 
Method Summary
 void addClientValidation(ValidationFunction rule)
          Adds a client validation rule for this input element.
 void addContent(java.lang.String content)
          Sets the value attribute of this INPUT tag.
 java.lang.Object clone()
          Performs a deep clone, cloning and replacing the validation functions.
 ValidationFunction[] getClientValidation()
          Returns all the client validation rules defined for this input element.
 java.lang.String getClientValidation(Browser browser)
          Returns the client validation rules applicable to this input element as a string.
 java.lang.String getDOMReference(Browser browser)
          Returns the Document Object Model reference for the INPUT element.
 java.lang.String getFieldNameForErrorMessage()
          Returns the name of the field to display in an error message.
 Form getForm()
          Returns the form reference of this INPUT element.
static Input getInstance(Form form, java.lang.String name, int dataType)
          Creates an appropriate Input instance to handle the specified SQL data type.
 Label getLabel()
          Returns the Label associated with this Input element.
 java.lang.String getName()
          Returns the name attribute of this input element.
 java.lang.String getOnBlurHandler(Browser browser)
          Returns the JavaScript handler for return this.event.
 java.lang.String getOnChangeHandler(Browser browser)
          Returns the JavaScript handler for return this.event.
 java.lang.String getOnFocusHandler(Browser browser)
          Returns the JavaScript handler for return this.event.
 java.lang.String getOnSelectHandler(Browser browser)
          Returns the JavaScript handler for return this.event.
 java.lang.String getReadOnlyStyleSheetClass()
          Returns the CLASS attribute of the tag when this Input element is defined as read-only.
 java.lang.Integer getTabIndex()
          Returns the position of this element in the tabbing order, or null if no position has been assigned.
 java.lang.String getType()
          Returns the type attribute of this input element.
 java.lang.String getValue()
          Returns the value attribute of this INPUT element.
 boolean isChangeFlagEnabled()
          Determines whether the JavaScript flag to indicate that a form has been changed will be set when this item is changed.
 boolean isDisabled()
          Determines if this element is disabled.
 boolean isReadOnly()
          Determines if this element is read-only.
 boolean isRequiringValidation()
          Determines if this element requires validation.
protected  void logNoFormWarning(Browser browser)
          Logs a detailed warning message when an Input element appers outside a Form.
 void removeClientValidation()
          Removes all validation rules.
 void removeClientValidation(java.lang.String className)
          Removes any validation rule that is a matching instance of the specified ValidationFunction.
 void removeClientValidation(ValidationFunction instance)
          Removes any validation rule that is a matching instance of the specified ValidationFunction.
 void removeMandatoryClientValidation()
          Remove the mandatory rule from any input validation defined for this input element.
protected  void setChanged(Browser browser)
          Called by the write(org.pajes.servlet.Browser)method to set the changed JavaScript flag variable to true
 Input setChangedFlag(boolean on)
          Sets whether the JavaScript flag to indicate that a form has been changed will be set when this item is changed.
 void setContent(java.lang.String content)
          Sets the value attribute of this INPUT tag.
 Input setDisabled(boolean disabled)
          Sets whether this field is disabled or not.
 Input setFieldNameInErrorMessage(Container container)
          Sets the field name to be displayed in any error messages, by extracting the contents of a specified container instance.
 Input setFieldNameInErrorMessage(java.lang.String fieldName)
          Sets the field name to be displayed in any error messages.
 Input setForm(Form form)
          Sets the form on which this INPUT element will appear.
 Tag setId(java.lang.String id)
          Sets the ID attribute of the current tag.
 Input setLabel(Label label)
          Sets the Label associated with this Input element.
 Input setName(java.lang.String name)
          Sets the name of this INPUT tag.
 Input setOnBlurHandler(java.lang.String onBlurHandler)
          Sets the JavaScript handler for this event.
 Input setOnBlurValidation(boolean validateOnBlur)
          Turns on or off validation on field blur.
 Input setOnChangeHandler(java.lang.String onChangeHandler)
          Sets the JavaScript handler for this event.
 Tag setOnClickHandler(java.lang.String onClickHandler)
          Sets the JavaScript handler for this event.
 Input setOnFocusHandler(java.lang.String onFocusHandler)
          Sets the JavaScript handler for this event.
 Input setOnSelectHandler(java.lang.String onSelectHandler)
          Sets the JavaScript handler for this event.
 Input setReadOnly(boolean readOnly)
          Sets whether this field is read only or not.
 Input setReadOnlyStyleSheetClass(java.lang.String styleSheetClass)
          Sets the CLASS attribute of the tag when this Input element is defined as read-only.
 Input setTabIndex(int position)
          Sets the position of this element in the tabbing order.
 Input setTabIndex(java.lang.Integer position)
          Sets the position of this element in the tabbing order.
 Input setTabIndex(java.lang.String position)
          Sets the position of this element in the tabbing order.
 Input setValue(java.lang.String value)
          Sets the value attribute of this INPUT tag.
 void write(Browser browser)
          Writes the <input> tag to the browser.
 
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, writeContent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_ATTRIBUTE

protected static final java.lang.String TYPE_ATTRIBUTE
The type attribute name.

See Also:
Constant Field Values
Constructor Detail

Input

public Input(java.lang.String type)
Creates an input field.

Parameters:
type - the type attribute of the <input> tag.
Method Detail

getInstance

public static Input getInstance(Form form,
                                java.lang.String name,
                                int dataType)
Creates an appropriate Input instance to handle the specified SQL data type.

Parameters:
form - the form on which the INPUT element will appear.
name - the name to apply to the input object.
dataType - the SQL data type (from java.sql.Types).
Returns:
an appropriate Input instance to handle the specified SQL data type.

addClientValidation

public void addClientValidation(ValidationFunction rule)
Adds a client validation rule for this input element. Validation rules are JavaScript functions that return false if a validation fails.

Parameters:
rule - The feature to be added to the ClientValidation attribute

addContent

public void addContent(java.lang.String content)
Sets the value attribute of this INPUT tag. (Required by HTML.setContent(java.lang.String) but meaningless in this context.)

Specified by:
addContent in interface HTML
Overrides:
addContent in class Tag
Parameters:
content - the value to assign.
See Also:
setContent(java.lang.String)

clone

public java.lang.Object clone()
Performs a deep clone, cloning and replacing the validation functions.

Specified by:
clone in interface HTML
Overrides:
clone in class Tag
Returns:
Description of the Returned Value

getClientValidation

public ValidationFunction[] getClientValidation()
Returns all the client validation rules defined for this input element.

Returns:
the client validation rules.

getClientValidation

public java.lang.String getClientValidation(Browser browser)
Returns the client validation rules applicable to this input element as a string.

Parameters:
browser - the browser to which the output is being sent.
Returns:
the client validation rules as a string.

getDOMReference

public java.lang.String getDOMReference(Browser browser)
Returns the Document Object Model reference for the INPUT element.

Parameters:
browser - the browser to which the reference refers.
Returns:
the Document Object Model reference for the INPUT element.
Throws:
TagException - if the form or name have not beed defined.

getFieldNameForErrorMessage

public java.lang.String getFieldNameForErrorMessage()
Returns the name of the field to display in an error message.

Returns:
the name of the field to display in an error message.

getForm

public Form getForm()
Returns the form reference of this INPUT element.

Returns:
the form reference of this INPUT element.

getLabel

public Label getLabel()
Returns the Label associated with this Input element.

Returns:
the Label associated with this Input element, or null if no label has been defined and it cannot be located.

getName

public java.lang.String getName()
Returns the name attribute of this input element.

Returns:
the name attribute of this input element.

getOnBlurHandler

public java.lang.String getOnBlurHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the browser to which the output is being sent.
Returns:
the JavaScript handler string.

getOnChangeHandler

public java.lang.String getOnChangeHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the browser to which the output is being sent.
Returns:
the JavaScript handler string.

getOnFocusHandler

public java.lang.String getOnFocusHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the browser to which the output is being sent.
Returns:
the JavaScript handler string.

getOnSelectHandler

public java.lang.String getOnSelectHandler(Browser browser)
Returns the JavaScript handler for return this.event.

Parameters:
browser - the browser to which the output is being sent.
Returns:
the JavaScript handler string.

getReadOnlyStyleSheetClass

public java.lang.String getReadOnlyStyleSheetClass()
Returns the CLASS attribute of the tag when this Input element is defined as read-only. The class will only be applied if no class has previously been defined.

Returns:
The read-only style sheet class attribute.

getTabIndex

public java.lang.Integer getTabIndex()
Returns the position of this element in the tabbing order, or null if no position has been assigned.

Returns:
the position of this element in the tabbing order.

getType

public java.lang.String getType()
Returns the type attribute of this input element.

Returns:
the name attribute of this input element.

getValue

public java.lang.String getValue()
Returns the value attribute of this INPUT element.

Returns:
the value attribute of this INPUT element.

isChangeFlagEnabled

public boolean isChangeFlagEnabled()
Determines whether the JavaScript flag to indicate that a form has been changed will be set when this item is changed.

Returns:
true if this form element will participate in the check for changed fields, or false if not.

isDisabled

public boolean isDisabled()
Determines if this element is disabled.

Returns:
true if this element is disabled.

isReadOnly

public boolean isReadOnly()
Determines if this element is read-only.

Returns:
true if this element is read-only.

isRequiringValidation

public boolean isRequiringValidation()
Determines if this element requires validation.

Returns:
true if this element requires validation.

removeClientValidation

public void removeClientValidation()
Removes all validation rules. Validation rules are JavaScript functions that return false if a validation fails.


removeClientValidation

public void removeClientValidation(java.lang.String className)
Removes any validation rule that is a matching instance of the specified ValidationFunction. Validation rules are JavaScript functions that return false if a validation fails.

Parameters:
className - the specifed class name will be compared to all existing rules and if any matching classes are found they will be removed.

removeClientValidation

public void removeClientValidation(ValidationFunction instance)
Removes any validation rule that is a matching instance of the specified ValidationFunction. Validation rules are JavaScript functions that return false if a validation fails.

Parameters:
instance - the specifed instance will be compared to all existing rules and if any matching classes are found they will be removed.

removeMandatoryClientValidation

public void removeMandatoryClientValidation()
Remove the mandatory rule from any input validation defined for this input element.


setChangedFlag

public Input setChangedFlag(boolean on)
Sets whether the JavaScript flag to indicate that a form has been changed will be set when this item is changed.

Parameters:
on - true if this form element will participate in the check for changed fields, or false if not.
Returns:
the updated Input instance.

setContent

public void setContent(java.lang.String content)
Sets the value attribute of this INPUT tag.

Specified by:
setContent in interface HTML
Overrides:
setContent in class Tag
Parameters:
content - the value to assign.
See Also:
Tag.getContent(), Tag.setContent(org.pajes.html.HTML)

setDisabled

public Input setDisabled(boolean disabled)
Sets whether this field is disabled or not.

Parameters:
disabled - true if the field is to be disabled, or false if it is active.
Returns:
the modified Input object.

setFieldNameInErrorMessage

public Input setFieldNameInErrorMessage(Container container)
Sets the field name to be displayed in any error messages, by extracting the contents of a specified container instance. Only instances of TextContainer will contribute their text to the field name.

Parameters:
container - the Container instance which contains the field name to be displayed.
Returns:
the modified InputField object.

setFieldNameInErrorMessage

public Input setFieldNameInErrorMessage(java.lang.String fieldName)
Sets the field name to be displayed in any error messages.

Parameters:
fieldName - is the name of the field to display in the error message.
Returns:
the modified InputField object.

setForm

public Input setForm(Form form)
Sets the form on which this INPUT element will appear. NOTE: This method does NOT add the element to the specified Form.

Parameters:
form - the form on which this INPUT element will appear.
Returns:
the modified Input object.

setId

public Tag setId(java.lang.String id)
Description copied from class: Tag
Sets the ID attribute of the current tag. An ID uniquely indentifies an element within a document.

Overrides:
setId in class Tag
Parameters:
id - the unique ID of the tag
Returns:
the modified Tag object
See Also:
Tag.setId(java.lang.String)

setLabel

public Input setLabel(Label label)
Sets the Label associated with this Input element.

Parameters:
label - the Label associated with this Input element.
Returns:
the modified Input object.

setName

public Input setName(java.lang.String name)
Sets the name of this INPUT tag. Also, sets the field name to be displayed in error messages (if it has not already been set) to this name.

Parameters:
name - the name to apply to the input object.
Returns:
the modified Input object.

setOnBlurHandler

public Input setOnBlurHandler(java.lang.String onBlurHandler)
Sets the JavaScript handler for this event.

Parameters:
onBlurHandler - The new onBlurHandler value
Returns:
the modified Input object.

setOnBlurValidation

public Input setOnBlurValidation(boolean validateOnBlur)
Turns on or off validation on field blur.

Parameters:
validateOnBlur - true if validation of this field should occur on loss of focus.
Returns:
the modified Input object.

setOnChangeHandler

public Input setOnChangeHandler(java.lang.String onChangeHandler)
Sets the JavaScript handler for this event.

Parameters:
onChangeHandler - The new onChangeHandler value
Returns:
the modified Input object.
Throws:
TagException - if this input type is not a field.

setOnClickHandler

public Tag setOnClickHandler(java.lang.String onClickHandler)
Sets the JavaScript handler for this event.

Overrides:
setOnClickHandler in class Tag
Parameters:
onClickHandler - The new onClickHandler value
Returns:
the modified Tag object.
Throws:
TagException - if this input type is a field.

setOnFocusHandler

public Input setOnFocusHandler(java.lang.String onFocusHandler)
Sets the JavaScript handler for this event.

Parameters:
onFocusHandler - The new onFocusHandler value
Returns:
the modified Input object.

setOnSelectHandler

public Input setOnSelectHandler(java.lang.String onSelectHandler)
Sets the JavaScript handler for this event.

Parameters:
onSelectHandler - The new onSelectHandler value
Returns:
the modified Input object.

setReadOnly

public Input setReadOnly(boolean readOnly)
Sets whether this field is read only or not.

Parameters:
readOnly - true if the field is to be read-only, or false if it is able to be edited.
Returns:
the modified Input object.

setReadOnlyStyleSheetClass

public Input setReadOnlyStyleSheetClass(java.lang.String styleSheetClass)
Sets the CLASS attribute of the tag when this Input element is defined as read-only. The class will only be applied if no class has previously been defined.

If not specified, the default class name will "readOnlyInput".

Parameters:
styleSheetClass - The new read-only style sheet class attribute.
Returns:
the modified Input object.

setTabIndex

public Input setTabIndex(int position)
Sets the position of this element in the tabbing order.

Parameters:
position - the position of this element in the tabbing order. This value must be greater than or equal to zero.
Returns:
the modified Input object.

setTabIndex

public Input setTabIndex(java.lang.Integer position)
Sets the position of this element in the tabbing order.

Parameters:
position - the position of this element in the tabbing order. This value must be greater than or equal to zero. It may slo be null, in which case the attribbute will be cleared.
Returns:
the modified Input object.

setTabIndex

public Input setTabIndex(java.lang.String position)
Sets the position of this element in the tabbing order.

Parameters:
position - the position of this element in the tabbing order. This value must be greater than or equal to zero. It may slo be null, in which case the attribbute will be cleared.
Returns:
the modified Input object.

setValue

public Input setValue(java.lang.String value)
Sets the value attribute of this INPUT tag.

Parameters:
value - the value to assign.
Returns:
the modified Input object.

write

public void write(Browser browser)
           throws java.io.IOException
Writes the <input> tag to the browser.

Specified by:
write in interface HTML
Overrides:
write 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), Tag.writeContent(org.pajes.servlet.Browser)

logNoFormWarning

protected void logNoFormWarning(Browser browser)
Logs a detailed warning message when an Input element appers outside a Form.

Parameters:
browser - the browser to which the page is being written.

setChanged

protected void setChanged(Browser browser)
Called by the write(org.pajes.servlet.Browser)method to set the changed JavaScript flag variable to true

Parameters:
browser - the browser to which the tag is being written.

PAJES 3.0.21

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