public class FieldHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
addDescription(SlingHttpServletRequest req,
FieldDescription desc)
Add a field description for the field.
|
static void |
checkConstraint(SlingHttpServletRequest request,
SlingHttpServletResponse response,
FieldDescription desc)
Convenience method to check the constraint of a field element.
|
static boolean |
checkRequired(SlingHttpServletRequest request,
FieldDescription desc)
Convenience method to check the required flag of a field element.
|
static FieldDescription |
createDefaultDescription(SlingHttpServletRequest req,
Resource rsrc)
Create a default field description for the field.
|
static java.lang.String |
getClientFieldQualifier(SlingHttpServletRequest request,
FieldDescription desc)
Get the full qualified path to the field to be used in client java script.
|
static java.lang.String |
getClientFieldQualifier(SlingHttpServletRequest request,
FieldDescription desc,
java.lang.String suffix)
Get the full qualified path to a suffixed field (e.g.
|
static FieldDescription |
getConstraintFieldDescription(SlingHttpServletRequest req)
Return the current field description.
|
static java.lang.String |
getConstraintMessage(FieldDescription desc,
SlingHttpServletRequest request)
Return the error message for the constraint of the field.
|
static FieldDescription[] |
getFieldDescriptions(SlingHttpServletRequest req,
Resource rsrc)
Return all field descriptions associated with this field.
|
static void |
initializeField(SlingHttpServletRequest req,
SlingHttpServletResponse res,
Resource rsrc)
Call the initialize script for the field.
|
static void |
writeClientConstraintCheck(SlingHttpServletRequest request,
SlingHttpServletResponse response,
FieldDescription desc)
Write the client java script code to check a constraint on
form submit.
|
static void |
writeClientRegexpText(SlingHttpServletRequest request,
SlingHttpServletResponse response,
FieldDescription desc,
java.lang.String regexp)
Write client regexp text.
|
static void |
writeClientRequiredCheck(SlingHttpServletRequest request,
SlingHttpServletResponse response,
FieldDescription desc)
Write the client java script code to check a required field on
form submit.
|
public static FieldDescription createDefaultDescription(SlingHttpServletRequest req, Resource rsrc)
FieldDescription.FieldDescription(Resource)
and associates this with the resource.
If this method is invoked twice for the same resource
and request combination, the default description is
added twice as well!req
- The current request.rsrc
- The field resource.public static void addDescription(SlingHttpServletRequest req, FieldDescription desc)
req
- The current request.desc
- The new field description.public static FieldDescription[] getFieldDescriptions(SlingHttpServletRequest req, Resource rsrc)
req
- The current request.rsrc
- The field resource.public static void initializeField(SlingHttpServletRequest req, SlingHttpServletResponse res, Resource rsrc) throws ServletException, java.io.IOException
req
- The current request.res
- The current response.rsrc
- The field resource.ServletException
- if given resource can not be includedjava.io.IOException
- if given resource can not be includedpublic static java.lang.String getClientFieldQualifier(SlingHttpServletRequest request, FieldDescription desc)
request
- requestdesc
- descriptionpublic static java.lang.String getClientFieldQualifier(SlingHttpServletRequest request, FieldDescription desc, java.lang.String suffix)
request
- The requestdesc
- The field descriptionsuffix
- The suffixpublic static FieldDescription getConstraintFieldDescription(SlingHttpServletRequest req)
req
- requestpublic static void writeClientRequiredCheck(SlingHttpServletRequest request, SlingHttpServletResponse response, FieldDescription desc) throws java.io.IOException
request
- requestresponse
- responsedesc
- field descriptionjava.io.IOException
- if write caused an errorpublic static java.lang.String getConstraintMessage(FieldDescription desc, SlingHttpServletRequest request)
desc
- The field description.request
- The current request.public static void writeClientRegexpText(SlingHttpServletRequest request, SlingHttpServletResponse response, FieldDescription desc, java.lang.String regexp) throws java.io.IOException
request
- requestresponse
- responsedesc
- field descriptionregexp
- regexp textjava.io.IOException
- if write caused an errorpublic static void writeClientConstraintCheck(SlingHttpServletRequest request, SlingHttpServletResponse response, FieldDescription desc) throws java.io.IOException, ServletException
request
- requestresponse
- responsedesc
- field descriptionjava.io.IOException
- if write caused an errorServletException
- if write caused an errorpublic static void checkConstraint(SlingHttpServletRequest request, SlingHttpServletResponse response, FieldDescription desc) throws java.io.IOException, ServletException
request
- The current request.response
- The current response.desc
- The field description.java.io.IOException
- if check caused an errorServletException
- if check caused an errorpublic static boolean checkRequired(SlingHttpServletRequest request, FieldDescription desc)
request
- The current element.desc
- The field description.Copyright © 2010 - 2020 Adobe. All Rights Reserved