public abstract class AbstractFormFieldComponent extends AbstractComponent
| Modifier and Type | Field and Description |
|---|---|
static String |
OPT_CONSTRAINT_TYPE_DATE |
static String |
OPT_CONSTRAINT_TYPE_EMAIL |
static String |
OPT_CONSTRAINT_TYPE_NAME |
static String |
OPT_CONSTRAINT_TYPE_NUMERIC |
static String |
PROP_CONSTRAINT_MESSAGE |
static String |
PROP_CONSTRAINT_TYPE |
static String |
PROP_DEFAULT_VALUE |
static String |
PROP_DESCRIPTION |
static String |
PROP_ELEMENT_NAME |
static String |
PROP_HIDE_TITLE |
static String |
PROP_REQUIRED |
static String |
PROP_REQUIRED_MESSAGE |
static String |
PROP_STYLING_CSS |
static String |
PROP_TITLE |
changeProperties, client, componentPath, DEFAULT_LOCATION, jsonNode, location, pagePath| Constructor and Description |
|---|
AbstractFormFieldComponent(ComponentClient client,
String pagePath,
String location,
String nameHint)
The constructor stores all the component path information like parentPage, name etc.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.sling.testing.clients.util.FormEntityBuilder |
getCreateFormEntity(String order)
Returns the FormEntityBuilder used for the create request in
AbstractComponent.create(String,int...). |
String |
getElementName()
Get the elements name.
|
void |
setConstraint(String requiredMessage,
String constraintMessage,
String constraintType)
Configures the constraint that should apply to this form field.
|
void |
setDefaultValue(String defaultValue)
Set the default value for a form field.
|
void |
setDescription(String description)
Set the description for the text input field
|
void |
setElementName(String elementName)
Set the name of the form field element.
|
void |
setHideTitle(boolean hideTitle)
Defines if the title for this form field should be shown or not.
|
void |
setStylingCss(String css)
Sets the CSS value on the Styling tab for this form field.
|
void |
setTitle(String title)
Sets the title to be shown for this form field.
|
void |
setUseConstraint(boolean useConstraints)
Defines if constraints should be applied to this field or not
|
create, getClient, getComponentNode, getComponentPath, getFirstChild, getLocation, getName, getNext, getNextNodePath, getPagePath, getParentPath, getPrevious, getPreviousNodePath, getProperty, getPropertyAsString, getPropertyAsStringArray, getResourceType, reorder, save, setProperty, setPropertypublic static final String PROP_DESCRIPTION
public static final String PROP_TITLE
public static final String PROP_HIDE_TITLE
public static final String PROP_ELEMENT_NAME
public static final String PROP_DEFAULT_VALUE
public static final String PROP_REQUIRED
public static final String PROP_REQUIRED_MESSAGE
public static final String PROP_CONSTRAINT_TYPE
public static final String PROP_CONSTRAINT_MESSAGE
public static final String OPT_CONSTRAINT_TYPE_DATE
public static final String OPT_CONSTRAINT_TYPE_EMAIL
public static final String OPT_CONSTRAINT_TYPE_NAME
public static final String OPT_CONSTRAINT_TYPE_NUMERIC
public static final String PROP_STYLING_CSS
public AbstractFormFieldComponent(ComponentClient client, String pagePath, String location, String nameHint)
client - The ComponentClient that will be used for sending the requests.pagePath - path to the page that will contain the component.location - relative location to the parent node inside the page that will contain the component node.nameHint - name to be used for the component node. Might get altered by the server if a naming conflict
occurs. The AbstractComponent.getName() method will return the correct name after (order,int...) has been called.public org.apache.sling.testing.clients.util.FormEntityBuilder getCreateFormEntity(String order)
AbstractComponentAbstractComponent.create(String,int...). This method can be
overridden in a subclass to extend the parameters that need to sent with the creation request.getCreateFormEntity in class AbstractComponentorder - Defines where the component should be added in relation to its siblings. Possible values
are first, last, before [nodeName], after [nodeName]._charset_,./sling:resourceType and
:nameHint set.public void setElementName(String elementName)
elementName - element name to be set.public String getElementName()
public void setDefaultValue(String defaultValue)
defaultValue - the default string value to be set for this form fieldpublic void setUseConstraint(boolean useConstraints)
useConstraints - true to apply defined constraint, otherwise falsepublic void setConstraint(String requiredMessage, String constraintMessage, String constraintType)
setUseConstraint(boolean). This is the default implementation. If the extended form field has
more or less fields either override this method or create a new one.requiredMessage - The message that describes whats expected for this fieldconstraintMessage - The error message shown when the contstraint check failsconstraintType - what type of constraint it is. Constraints are implemented as components. e.g.
OPT_CONSTRAINT_TYPE_EMAIL ("foundation/components/form/constraints/email").public void setStylingCss(String css)
css - css valuepublic void setDescription(String description)
description - The description textpublic void setTitle(String title)
title - title text.public void setHideTitle(boolean hideTitle)
hideTitle - true to hide the title, otherwise falseCopyright © 2018. All rights reserved.