com.sas.servlet.tbeans.form
Class BaseFormElement

com.sas.servlet.tbeans.form.BaseFormElement
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.lang.ObjectDataInterface, FormElementModificationEventInterface, com.sas.servlet.tbeans.form.JavaScriptObjectCreationInterface, com.sas.servlet.tbeans.JavaScriptEventHandlerInterface, RenderableInterface, TransformationInterface, GenericValidatorInterface, com.sas.util.WriteToPrintWriterInterface, java.io.Serializable
Direct Known Subclasses:
BaseCheckBox, BaseChoiceBox, BaseHidden, BaseImage, BaseInput, BaseListBox, BasePushButton, BaseRadio, BaseTextArea

public abstract class BaseFormElement
implements FormElementModificationEventInterface, GenericValidatorInterface, com.sas.servlet.tbeans.JavaScriptEventHandlerInterface, com.sas.servlet.tbeans.form.JavaScriptObjectCreationInterface

The BaseFormElement is an abstract TransformationBean™ used to create the Form Element.

Note that subclasses of this bean actually provide the markup rendering used in/with Servlet and JavaServer Pages technologies. If you need to add support for a markup language that is not explicitly provided with AppDev Studio, then you must extend this class.

For More Information:

JSP custom tags provide an alternative to using the TransformationBeans™. Visit the Custom Tag Library Reference for additional information on the sas:Form custom tag.

Note: A snapshot of the AppDev Studio Developers Site is installed on your local Web server when you install AppDev Studio. To access the site from webAF, select Help -> Developer Site .

See Also:
Serialized Form

Field Summary
static java.lang.String RB_KEY
          Key used to lookup resources in the resource bundle.
 
Constructor Summary
BaseFormElement()
          Construct a new BaseFormElement object
 
Method Summary
 java.lang.String getAccessKey()
          Gets the accesskey of the form element.
 GenericErrorHandlerInterface getErrorHandler()
          Returns the errorHandler or null if none is set
 java.lang.String getModificationEventName()
          Gets the modification event name.
 java.lang.String getName()
          Gets the name that will be used to identify the content when it is submitted to the server
 java.lang.String getOnBlur()
          Gets the onBlur event for the form element.
 java.lang.String getOnChange()
          Gets the onChange event for the form element.
 java.lang.String getOnClick()
          Gets the onClick event for the form element.
 java.lang.String getOnDblClick()
          Gets the onDblClick event for the form element
 java.lang.String getOnFocus()
          Gets the onFocus event for the form element.
 java.lang.String getOnKeyDown()
          Gets the onKeyDown event for the form element
 java.lang.String getOnKeyPress()
          Gets the onKeyPress event for the form element
 java.lang.String getOnKeyUp()
          Gets the onKeyUp event for the form element
 java.lang.String getOnMouseDown()
          Gets the onMouseDown event for the form element.
 java.lang.String getOnMouseMove()
          Gets the onMouseMove event for the form element.
 java.lang.String getOnMouseOut()
          Gets the onMouseOut event for the form element.
 java.lang.String getOnMouseOver()
          Gets the onMouseOver event for the form element.
 java.lang.String getOnMouseUp()
          Gets the onMouseUp event for the form element
 java.lang.String getOnSelect()
          Gets the onSelect event for the form element.
 StyleInfo getStyleInfo()
          Returns the style info for this form element.
 java.lang.String getTabIndex()
          Gets the tabindex of the form element.
 java.lang.String getTitle()
          Gets the title of the form element.
protected  java.lang.String getValidationFunctions(ValidationInterface validator, boolean conditional)
           
 ValidationInterface getValidator()
          Returns the name of the validator or null if none is set
 boolean isEnabled()
          Determines the enabled value associated with the form element.
 boolean isValid()
          Routine that checks if a validator is set.
protected  boolean isValidationEnabled()
           
 void setAccessKey(java.lang.String value)
          Sets the accesskey of the form element.
 void setEnabled(boolean value)
          Sets the enabled attribute associated with the form element.
 void setErrorHandler(GenericErrorHandlerInterface errorHandler)
          Sets the errorHandler for validation.
 void setId(java.lang.String value)
          Sets the id.
 void setModificationEventName(java.lang.String eventName)
          Sets the modification event name for the form element.
 void setName(java.lang.String value)
          Sets the name that will be used to identify the content when it is submitted to the server
 void setOnBlur(java.lang.String value)
          Sets the onBlur event for the form element.
 void setOnChange(java.lang.String value)
          Sets the onChange event for the form element.
 void setOnClick(java.lang.String value)
          Sets the onClick event for the form element.
 void setOnDblClick(java.lang.String value)
          Sets the onDblClick event for the form element.
 void setOnFocus(java.lang.String value)
          Sets the onFocus event for the form element.
 void setOnKeyDown(java.lang.String value)
          Sets the onKeyDown event for the form element.
 void setOnKeyPress(java.lang.String value)
          Sets the onKeyPress event for the form element.
 void setOnKeyUp(java.lang.String value)
          Sets the onKeyUp event for the form element.
 void setOnMouseDown(java.lang.String value)
          Sets the onMouseDown event for the form element.
 void setOnMouseMove(java.lang.String value)
          Sets the onMouseMove event for the form element.
 void setOnMouseOut(java.lang.String value)
          Sets the onMouseOut event for the form element.
 void setOnMouseOver(java.lang.String value)
          Sets the onMouseOver event for the form element.
 void setOnMouseUp(java.lang.String value)
          Sets the onMouseUp event for the form element.
 void setOnSelect(java.lang.String value)
          Sets the onSelect event for the form element.
 void setStyleInfo(StyleInfo styleInfo)
          Sets the style info for this form element.
 void setTabIndex(java.lang.String value)
          Sets the tabindex of the form element.
 void setTitle(java.lang.String value)
          Sets the title for the form element.
 void setValidator(ValidationInterface validator)
          Sets a validator for a form element.
 void write(java.io.PrintWriter out)
          Writes the attributes of the object.
protected  void writeJavaScriptObject(java.io.PrintWriter out)
           
protected  void writeJavaScriptObjectValidate(java.io.PrintWriter out)
           
protected  void writeJavaScriptValidatorObject(java.io.PrintWriter out)
           
protected  void writeValidationScript(java.io.PrintWriter out)
           
 
Methods inherited from class com.sas.servlet.tbeans.BaseTransformation
addPropertyChangeListener, addPropertyChangeListener, cleanUpResources, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getCustomAttributes, getDescription, getId, getInputTransform, getLocale, getObjectData, getObjectDataProperty, getOutputTransform, getRequest, getResponse, getTagEpilog, getTagProlog, hasListeners, isCleanUpResourcesOn, isVisible, removePropertyChangeListener, removePropertyChangeListener, setCleanUpResourcesOn, setCustomAttributes, setDescription, setInputTransform, setLocale, setLocaleDependentProperties, setObjectData, setObjectDataProperty, setOutputTransform, setRequest, setResponse, setTagEpilog, setTagProlog, setVisible, toString, write, write, write
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
Key used to lookup resources in the resource bundle.

See Also:
Constant Field Values
Constructor Detail

BaseFormElement

public BaseFormElement()
Construct a new BaseFormElement object

Method Detail

setId

public void setId(java.lang.String value)
Sets the id.

Specified by:
setId in interface TransformationInterface
Overrides:
setId in class BaseTransformation
Parameters:
value - The id

setName

public void setName(java.lang.String value)
Sets the name that will be used to identify the content when it is submitted to the server

Specified by:
setName in interface TransformationInterface
Overrides:
setName in class BaseTransformation
Parameters:
value - The name
See Also:
BaseTransformation.setId(java.lang.String)

getName

public java.lang.String getName()
Gets the name that will be used to identify the content when it is submitted to the server

Specified by:
getName in interface TransformationInterface
Overrides:
getName in class BaseTransformation
Returns:
The name
See Also:
BaseTransformation.getId()

setTabIndex

public void setTabIndex(java.lang.String value)
Sets the tabindex of the form element. This attribute specifies the position of the current element in the tabbing order for the current document. The tabbing order defines the order in which elements will receive focus when navigated by the user via the keyboard.

Parameters:
value - The form element tabindex

getTabIndex

public java.lang.String getTabIndex()
Gets the tabindex of the form element.

Returns:
tabindex - The tabindex of the form element

setAccessKey

public void setAccessKey(java.lang.String value)
Sets the accesskey of the form element. This attribute assigns an access key to an element. An access key is a single character from the document character set. Pressing an access key assigned to an element gives focus to the element. The action that occurs when an element receives focus depends on the element. For example, when a user activates a link defined by the A element, the user agent generally follows the link. When a user activates a radio button, the user agent changes the value of the radio button. When the user activates a text field, it allows input, etc.

Parameters:
value - The accesskey of the form element

getAccessKey

public java.lang.String getAccessKey()
Gets the accesskey of the form element.

Returns:
accesskey - The accesskey of the form element

setModificationEventName

public void setModificationEventName(java.lang.String eventName)
Sets the modification event name for the form element. The modification event name is the name of the event that fires when the form element has been modified.

Specified by:
setModificationEventName in interface FormElementModificationEventInterface
Parameters:
eventName - The modification event name

getModificationEventName

public java.lang.String getModificationEventName()
Gets the modification event name.

Specified by:
getModificationEventName in interface FormElementModificationEventInterface
Returns:
The modification event name

setOnBlur

public void setOnBlur(java.lang.String value)
Sets the onBlur event for the form element. The onBlur event handler executes the specified JavaScript code or function on the occurance of a blur event. This is when a form element loses focus. This can be caused by the user clicking outside of the form element, by using the TAB key to cycle through the various elements on screen, or a call to the blur method on the form element.

Specified by:
setOnBlur in interface com.sas.servlet.tbeans.JavaScriptEventHandlerInterface
Parameters:
value - The onBlur event

getOnBlur

public java.lang.String getOnBlur()
Gets the onBlur event for the form element.

Specified by:
getOnBlur in interface com.sas.servlet.tbeans.JavaScriptEventHandlerInterface
Returns:
The onBlur event

setOnChange

public void setOnChange(java.lang.String value)
Sets the onChange event for the form element. The onChange event handler executes the specified JavaScript code or function on the occurance of a change event. This is when the data in form element is altered by the user. This is used frequently to validate the data that has been entered by the user by calling a specified JavaScript function. This event handler works with the CheckBoxList, ChoiceBox, ComboBoxView, ListBox, ListBoxView, RadioBoxList, TextEntry, and TextArea.

Specified by:
setOnChange in interface com.sas.servlet.tbeans.JavaScriptEventHandlerInterface
Parameters:
value - The onChange event

getOnChange

public java.lang.String getOnChange()
Gets the onChange event for the form element.

Specified by:
getOnChange in interface com.sas.servlet.tbeans.JavaScriptEventHandlerInterface
Returns:
The onChange event

setOnClick

public void setOnClick(java.lang.String value)
Sets the onClick event for the form element. The onClick event handler executes the specified JavaScript code or function on the occurance of a click event. When used with checkboxes, links, radio, reset and submit buttons, onClick can return a false value which cancels the normal action associated with the click event. With form objects that have default actions this works as follows: Radio buttons and checkboxes - nothing is set Submit buttons - submission of the form is cancelled. Reset buttons - resetting of the form is cancelled.

Parameters:
value - The onClick event

getOnClick

public java.lang.String getOnClick()
Gets the onClick event for the form element.

Returns:
The onClick event

setOnDblClick

public void setOnDblClick(java.lang.String value)
Sets the onDblClick event for the form element. The onDblClick event handler executes the specified JavaScript code or function on the occurance of a double click event.

Parameters:
value - The onDblClick event

getOnDblClick

public java.lang.String getOnDblClick()
Gets the onDblClick event for the form element

Returns:
The onDblClick event

setOnFocus

public void setOnFocus(java.lang.String value)
Sets the onFocus event for the form element. The onFocus event handler executes the specified JavaScript code or function on the occurance of a focus event. This is when a form element is given focus. This can be caused by the user clicking on the form element, by using the TAB key to cycle through the various elements on screen, or by a call to the focus method on the element.

Specified by:
setOnFocus in interface com.sas.servlet.tbeans.JavaScriptEventHandlerInterface
Parameters:
value - The onFocus event

getOnFocus

public java.lang.String getOnFocus()
Gets the onFocus event for the form element.

Specified by:
getOnFocus in interface com.sas.servlet.tbeans.JavaScriptEventHandlerInterface
Returns:
The onFocus event

setOnMouseOut

public void setOnMouseOut(java.lang.String value)
Sets the onMouseOut event for the form element. The onMouseOut event handler is used to execute specified Javascript code whenever the user moves the mouse out of a form element from inside that form element.

Parameters:
value - The onMouseOut event

getOnMouseOut

public java.lang.String getOnMouseOut()
Gets the onMouseOut event for the form element.

Returns:
The onMouseOut event

setOnMouseOver

public void setOnMouseOver(java.lang.String value)
Sets the onMouseOver event for the form element. The onMouseOver event handler is used to execute specified Javascript code whenever the user moves the mouse over a form element from outside that form element.

Parameters:
value - The onMouseOver event

getOnMouseOver

public java.lang.String getOnMouseOver()
Gets the onMouseOver event for the form element.

Returns:
The onMouseOver event

setOnMouseDown

public void setOnMouseDown(java.lang.String value)
Sets the onMouseDown event for the form element. The onMouseDown event handler is used to execute specified Javascript code whenever the user depresses a mouse button.

Parameters:
value - The onMouseDown event

getOnMouseDown

public java.lang.String getOnMouseDown()
Gets the onMouseDown event for the form element.

Returns:
The onMouseDown event

setOnMouseUp

public void setOnMouseUp(java.lang.String value)
Sets the onMouseUp event for the form element. The onMouseUp event handler is used to execute specified JavaScript code whenever the user releases the mouse button.

Parameters:
value - The onMouseUp event

getOnMouseUp

public java.lang.String getOnMouseUp()
Gets the onMouseUp event for the form element

Returns:
The onMouseUp event

setOnMouseMove

public void setOnMouseMove(java.lang.String value)
Sets the onMouseMove event for the form element. The onMouseMove event handler is used to execute specified Javascript code whenever the mouse is moved.

Parameters:
value - The onMouseMove event

getOnMouseMove

public java.lang.String getOnMouseMove()
Gets the onMouseMove event for the form element.

Returns:
The onMouseMove event

setOnKeyDown

public void setOnKeyDown(java.lang.String value)
Sets the onKeyDown event for the form element. The onKeyDown event handler executes the specified JavaScript code or function on the occurance of a KeyDown event. A KeyDown event occurs when the user depresses a key.

Parameters:
value - The onKeyDown event

getOnKeyDown

public java.lang.String getOnKeyDown()
Gets the onKeyDown event for the form element

Returns:
The onKeyDown event

setOnKeyPress

public void setOnKeyPress(java.lang.String value)
Sets the onKeyPress event for the form element. The onKeyPress event handler executes the specified JavaScript code or function on the occurance of a KeyPress event. A KeyPress event occurs when the user presses or holds down a key.

Parameters:
value - The onKeyPress event

getOnKeyPress

public java.lang.String getOnKeyPress()
Gets the onKeyPress event for the form element

Returns:
The onKeyPress event

setOnKeyUp

public void setOnKeyUp(java.lang.String value)
Sets the onKeyUp event for the form element. The onKeyUp event handler executes the specified JavaScript code or function on the occurance of a KeyUp event. A KeyUp event occurs when the user releases a key from its depressed position.

Parameters:
value - The onKeyUp event

getOnKeyUp

public java.lang.String getOnKeyUp()
Gets the onKeyUp event for the form element

Returns:
The onKeyUp event

setOnSelect

public void setOnSelect(java.lang.String value)
Sets the onSelect event for the form element. The onSelect event handler is used to execute specified JavaScript code whenever the user selects some of the text within a TextEntry or TextArea field. This event handler is valid only on TextEntry and TextArea.

Parameters:
value - The onSelect event

getOnSelect

public java.lang.String getOnSelect()
Gets the onSelect event for the form element.

Returns:
The onSelect event

setTitle

public void setTitle(java.lang.String value)
Sets the title for the form element. This attribute offers advisory information about the element for which it is set.

Parameters:
value - The title of the form element

getTitle

public java.lang.String getTitle()
Gets the title of the form element.

Returns:
The title of the form element

setValidator

public void setValidator(ValidationInterface validator)
Sets a validator for a form element. If the criteria in the validator is not satisfied, an appropriate error message can be displayed if an error handler has been set through the setErrorHandler(errorHandler) method. Validators must implement the ValidationInterface.

Specified by:
setValidator in interface GenericValidatorInterface
Parameters:
validator - validator
See Also:
getValidator()

getValidator

public ValidationInterface getValidator()
Returns the name of the validator or null if none is set

Specified by:
getValidator in interface GenericValidatorInterface
Returns:
validator
See Also:
setValidator(com.sas.util.validators.ValidationInterface)

isValid

public boolean isValid()
Routine that checks if a validator is set. If a validator is set, values are passed to the validator for validation.

Specified by:
isValid in interface GenericValidatorInterface
Returns:
Whether a validator is set or not.
See Also:
setValidator(com.sas.util.validators.ValidationInterface), setErrorHandler(com.sas.util.errorhandlers.GenericErrorHandlerInterface)

setErrorHandler

public void setErrorHandler(GenericErrorHandlerInterface errorHandler)
Sets the errorHandler for validation. Error handlers can display an appropriate error message when validation fails ErrorHandlers must implement the GenericErrorHandlerInterface.

Specified by:
setErrorHandler in interface GenericValidatorInterface
Parameters:
errorHandler - name of an errorHandler
See Also:
setValidator(com.sas.util.validators.ValidationInterface)

getErrorHandler

public GenericErrorHandlerInterface getErrorHandler()
Returns the errorHandler or null if none is set

Specified by:
getErrorHandler in interface GenericValidatorInterface
Returns:
errorHandler
See Also:
setErrorHandler(com.sas.util.errorhandlers.GenericErrorHandlerInterface)

getStyleInfo

public StyleInfo getStyleInfo()
Returns the style info for this form element.

Returns:
style used for this form element

setStyleInfo

public void setStyleInfo(StyleInfo styleInfo)
Sets the style info for this form element.

Parameters:
styleInfo - The style for this form element

setEnabled

public void setEnabled(boolean value)
Sets the enabled attribute associated with the form element. True by default. Setting to false will disabled the form element.

Parameters:
value - The enabled value

isEnabled

public boolean isEnabled()
Determines the enabled value associated with the form element.

Returns:
The enabled value

writeValidationScript

protected void writeValidationScript(java.io.PrintWriter out)
                              throws java.io.IOException
Throws:
java.io.IOException

isValidationEnabled

protected boolean isValidationEnabled()

getValidationFunctions

protected java.lang.String getValidationFunctions(ValidationInterface validator,
                                                  boolean conditional)

writeJavaScriptObject

protected void writeJavaScriptObject(java.io.PrintWriter out)
                              throws java.io.IOException
Throws:
java.io.IOException

writeJavaScriptValidatorObject

protected void writeJavaScriptValidatorObject(java.io.PrintWriter out)

writeJavaScriptObjectValidate

protected void writeJavaScriptObjectValidate(java.io.PrintWriter out)

write

public void write(java.io.PrintWriter out)
           throws java.io.IOException
Writes the attributes of the object. All transformation beans should overwrite this method and call SUPER.

Specified by:
write in interface TransformationInterface
Specified by:
write in interface com.sas.util.WriteToPrintWriterInterface
Overrides:
write in class BaseTransformation
Parameters:
out - The output stream
Throws:
java.io.IOException - Thrown if some type of I/O error occurs



Copyright © 2009 SAS Institute Inc. All Rights Reserved.