public class FieldHelper extends 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 String |
getClientFieldQualifier(SlingHttpServletRequest request,
FieldDescription desc)
Get the full qualified path to the field to be used in client java script.
|
static String |
getClientFieldQualifier(SlingHttpServletRequest request,
FieldDescription desc,
String suffix)
Get the full qualified path to a suffixed field (e.g.
|
static FieldDescription |
getConstraintFieldDescription(SlingHttpServletRequest req)
Return the current field description.
|
static 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,
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 javax.servlet.ServletException, IOException
req
- The current request.res
- The current response.rsrc
- The field resource.javax.servlet.ServletException
IOException
public static String getClientFieldQualifier(SlingHttpServletRequest request, FieldDescription desc)
public static String getClientFieldQualifier(SlingHttpServletRequest request, FieldDescription desc, String suffix)
request
- The requestdesc
- The field descritpionsuffix
- The suffixpublic static FieldDescription getConstraintFieldDescription(SlingHttpServletRequest req)
public static void writeClientRequiredCheck(SlingHttpServletRequest request, SlingHttpServletResponse response, FieldDescription desc) throws IOException
IOException
public static String getConstraintMessage(FieldDescription desc, SlingHttpServletRequest request)
desc
- The field description.request
- The current request.public static void writeClientRegexpText(SlingHttpServletRequest request, SlingHttpServletResponse response, FieldDescription desc, String regexp) throws IOException
IOException
public static void writeClientConstraintCheck(SlingHttpServletRequest request, SlingHttpServletResponse response, FieldDescription desc) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public static void checkConstraint(SlingHttpServletRequest request, SlingHttpServletResponse response, FieldDescription desc) throws IOException, javax.servlet.ServletException
request
- The current request.response
- The current response.desc
- The field description.IOException
javax.servlet.ServletException
public static boolean checkRequired(SlingHttpServletRequest request, FieldDescription desc)
request
- The current element."Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"