Java Doc for FormField.java in  » HTML-Parser » jericho-html » au » id » jericho » lib » html » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » HTML Parser » jericho html » au.id.jericho.lib.html 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   au.id.jericho.lib.html.FormField

FormField
final public class FormField (Code)
Represents a field in an HTML form, a field being defined as the group of all having the same .

The FormField.getFormControls() method can be used to obtain the collection of this field's constituent FormControl objects.

The FormFields class, which represents a collection of FormField objects, provides the highest level interface for dealing with form fields and controls. For the most common tasks it can be used directly without the need to work with its constituent FormField or FormControl objects.

The FormField class serves two main purposes:

  1. Provide methods for the modification and retrieval of form control submission values while ensuring that the states of all the field's constituent form controls remain consistent with each other.

    The methods available for this purpose are:
    FormField.getValues() Collection getValues()
    FormField.clearValues() void clearValues()
    FormField.setValues(Collection) void setValues(Collection)
    FormField.setValue(CharSequence) boolean setValue(CharSequence)
    FormField.addValue(CharSequence) boolean addValue(CharSequence)

    Although the FormControl class provides methods for directly modifying the submission values of individual form controls, it is generally recommended to use the interface provided by the FormFields class unless there is a specific requirement for the lower level functionality. The FormFields class contains convenience methods providing most of the functionality of the above methods, as well as some higher level functionality such as the ability to set the form submission values as a complete field data set using the FormFields.setDataSet(Map) method.

  2. Provide a means of determining the data structure of the field, allowing a server receiving a submitted form data set to interpret and store the data in an appropriate way.

    The properties available for this purpose are:
    FormField.allowsMultipleValues() boolean allowsMultipleValues()
    FormField.getUserValueCount() int getUserValueCount()
    FormField.getPredefinedValues() Collection getPredefinedValues()

    The FormFields.getColumnLabels and FormFields.getColumnValues(Map) methods utilise these properties to convert data from a form data set (represented as a field data set) into a simple array format, suitable for storage in a tabular format such as a database table or .CSV file.

    The properties need only be utilised directly in the event that a form data set is to be converted from its normal format into some other type of data structure.

A form field which allows user values normally consists of a single user value control, such as a FormControlType.TEXT TEXT control.

When a form field consists of more than one control, these controls are normally all predefined value controls of the same , such as FormControlType.CHECKBOX CHECKBOX controls.

Form fields consisting of more than one control do not necessarily return . A form field consisting of FormControlType.CHECKBOX CHECKBOX controls can return multiple values, whereas a form field consisting of FormControlType.CHECKBOX RADIO controls returns at most one value.

The HTML author can disregard convention and mix all types of controls with the same name in the same form, or include multiple user value controls of the same name. The evidence that such an unusual combination is present is when FormField.getUserValueCount() >1.

FormField instances are created automatically with the creation of a FormFields collection.

The case sensitivity of form field names is determined by the Config.CurrentCompatibilityMode . Config.CompatibilityMode.isFormFieldNameCaseInsensitive FormFieldNameCaseInsensitive property.
See Also:   FormFields
See Also:   FormControl
See Also:   FormControlType



Field Summary
 intcolumnIndex
    

Constructor Summary
 FormField(String name)
     Constructor called from FormFields class.

Method Summary
 voidaddFormControl(FormControl formControl, String predefinedValue)
    
public  booleanaddValue(CharSequence value)
     Adds the specified value to the field submission values of this field.

This is achieved internally by attempting to to every constituent until one "accepts" it.

The return value indicates whether any of the constituent form controls accepted the value. A return value of false implies an error condition as the specified value is not compatible with this field.

In the unusual case that this field consists of multiple form controls, but not all of them are predefined value controls, priority is given to the predefined value controls before attempting to add the value to the user value controls.
Parameters:
  value - the new field submission value to add to this field, must not be null.

 voidaddValues(Collection values)
    
 voidaddValues(CharSequence[] values)
    
public  booleanallowsMultipleValues()
     Indicates whether the field allows multiple values.
public  voidclearValues()
     Clears the submission values of all the constituent in this field.
public  StringgetDebugInfo()
     Returns a string representation of this object useful for debugging purposes.
 FormControlgetFirstFormControl()
    
public  FormControlgetFormControl(String predefinedValue)
     Returns the constituent FormControl with the specified .

Specifying a predefined value of null returns the first control without a predefined value.
Parameters:
  predefinedValue - the predefined value of the control to be returned, or null to return the first control without a predefined value.

public  FormControlgetFormControl()
     Returns the first FormControl from this field.
public  CollectiongetFormControls()
     Returns a collection of all the constituent in this field.
public  StringgetName()
     Returns the control name shared by all of this field's constituent .
public  CollectiongetPredefinedValues()
     Returns a collection of the of all constituent in this field.
public  intgetUserValueCount()
     Returns the number of constituent user value controls in this field.
public  CollectiongetValues()
     Returns a collection of the field submission values.
 voidmerge(FormField formField)
    
public  booleansetValue(CharSequence value)
     Sets the field submission values of this field to the single specified value.

This is equivalent to calling FormField.clearValues() followed by FormField.addValue(CharSequence) addValue(value) .

The return value indicates whether any of the constituent form controls "accepted" the value. A return value of false implies an error condition as the specified value is not compatible with this field.

Specifying a null value is equivalent to calling FormField.clearValues() alone, and always returns true.

See the FormField.addValue(CharSequence value) method for more information.
Parameters:
  value - the new field submission value of this field, or null to the field of all submission values.

public  voidsetValues(Collection values)
     Sets the field submission values of this field to the specified values.
public  StringtoString()
     Returns a string representation of this object useful for debugging purposes.

Field Detail
columnIndex
int columnIndex(Code)




Constructor Detail
FormField
FormField(String name)(Code)
Constructor called from FormFields class.




Method Detail
addFormControl
void addFormControl(FormControl formControl, String predefinedValue)(Code)



addValue
public boolean addValue(CharSequence value)(Code)
Adds the specified value to the field submission values of this field.

This is achieved internally by attempting to to every constituent until one "accepts" it.

The return value indicates whether any of the constituent form controls accepted the value. A return value of false implies an error condition as the specified value is not compatible with this field.

In the unusual case that this field consists of multiple form controls, but not all of them are predefined value controls, priority is given to the predefined value controls before attempting to add the value to the user value controls.
Parameters:
  value - the new field submission value to add to this field, must not be null. true if one of the constituent accepts the value, otherwise false.




addValues
void addValues(Collection values)(Code)



addValues
void addValues(CharSequence[] values)(Code)



allowsMultipleValues
public boolean allowsMultipleValues()(Code)
Indicates whether the field allows multiple values.

Returns false in any one of the following circumstances:

  • The field consists of only one control (unless it is a with more than one option)
  • The field consists entirely of
  • The field consists entirely of buttons
If none of these three conditions are met, the method returns true. true if the field allows multiple values, otherwise false.



clearValues
public void clearValues()(Code)
Clears the submission values of all the constituent in this field.
See Also:   FormControl.clearValues



getDebugInfo
public String getDebugInfo()(Code)
Returns a string representation of this object useful for debugging purposes. a string representation of this object useful for debugging purposes.



getFirstFormControl
FormControl getFirstFormControl()(Code)



getFormControl
public FormControl getFormControl(String predefinedValue)(Code)
Returns the constituent FormControl with the specified .

Specifying a predefined value of null returns the first control without a predefined value.
Parameters:
  predefinedValue - the predefined value of the control to be returned, or null to return the first control without a predefined value. the constituent FormControl with the specified , or null if none exists.
See Also:   FormField.getFormControl()
See Also:   FormField.getFormControls()




getFormControl
public FormControl getFormControl()(Code)
Returns the first FormControl from this field. the first FormControl from this field, guaranteed not null.
See Also:   FormField.getFormControl(String predefinedValue)
See Also:   FormField.getFormControls()



getFormControls
public Collection getFormControls()(Code)
Returns a collection of all the constituent in this field.

An iterator over this collection returns the controls in the order of appearance in the source. a collection of all the constituent in this field.
See Also:   FormField.getFormControl()
See Also:   FormField.getFormControl(String predefinedValue)




getName
public String getName()(Code)
Returns the control name shared by all of this field's constituent .

If Config.CurrentCompatibilityMode . Config.CompatibilityMode.isFormFieldNameCaseInsensitive isFormFieldNameCaseInsensitive() is true, the grouping of the controls by name is case insensitive and this method always returns the name in lower case.

Since a form field is simply a group of controls with the same name, the terms control name and field name are for the most part synonymous, with only a possible difference in case differentiating them. the control name shared by all of this field's constituent .
See Also:   FormControl.getName




getPredefinedValues
public Collection getPredefinedValues()(Code)
Returns a collection of the of all constituent in this field.

All objects in the returned collection are of type String, with no null entries.

An interator over this collection returns the values in the order of appearance in the source document. a collection of the of all constituent in this field, or null if none.
See Also:   FormControl.getPredefinedValues




getUserValueCount
public int getUserValueCount()(Code)
Returns the number of constituent user value controls in this field. This should in most cases be either 0 or 1.

A value of 0 indicates the field values consist only of , which is the case when the field consists only of predefined value controls.

A value of 1 indicates the field values consist of at most one value set by the user. It is still possible in this case to receive multiple values in the unlikely event that the HTML author mixed controls of different types with the same name, but any other values would consist only of .

A value greater than 1 indicates that the HTML author has included more than one user value control with the same name. This would nearly always indicate an unintentional error in the HTML source document, in which case your application can either log a warning that a poorly designed form has been encountered, or take special action to try to interpret the multiple user values that might be submitted. the number of constituent user value controls in this field.




getValues
public Collection getValues()(Code)
Returns a collection of the field submission values.

The term field submission values is used in this library to refer to the aggregate of all the submission values of a field's constituent .

All objects in the returned collection are of type CharSequence, with no null entries. a collection of the field submission values, guaranteed not null.




merge
void merge(FormField formField)(Code)
only called from FormFields class



setValue
public boolean setValue(CharSequence value)(Code)
Sets the field submission values of this field to the single specified value.

This is equivalent to calling FormField.clearValues() followed by FormField.addValue(CharSequence) addValue(value) .

The return value indicates whether any of the constituent form controls "accepted" the value. A return value of false implies an error condition as the specified value is not compatible with this field.

Specifying a null value is equivalent to calling FormField.clearValues() alone, and always returns true.

See the FormField.addValue(CharSequence value) method for more information.
Parameters:
  value - the new field submission value of this field, or null to the field of all submission values. true if one of the constituent accepts the value, otherwise false.
See Also:   FormFields.setValue(String fieldNameCharSequence value)




setValues
public void setValues(Collection values)(Code)
Sets the field submission values of this field to the specified values.

This is equivalent to calling FormField.clearValues() followed by FormField.addValue(CharSequence) addValue(value) for each value in the specified collection.

The specified collection must not contain any null values.
Parameters:
  values - the new field submission values of this field.
See Also:   FormField.addValue(CharSequence value)




toString
public String toString()(Code)
Returns a string representation of this object useful for debugging purposes.

This is equivalent to FormField.getDebugInfo() . a string representation of this object useful for debugging purposes.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.