Class TextField
- java.lang.Object
-
- org.symphonyoss.symphony.messageml.elements.Element
-
- org.symphonyoss.symphony.messageml.elements.FormElement
-
- org.symphonyoss.symphony.messageml.elements.TextField
-
- All Implemented Interfaces:
LabelableElement,MinMaxLengthElement,RegexElement,SplittableElement,TooltipableElement
public class TextField extends FormElement implements RegexElement, LabelableElement, TooltipableElement, MinMaxLengthElement
Class representing a Text Field inside a Form.- Since:
- 06/07/2019
- Author:
- Lucas Macedo
-
-
Field Summary
Fields Modifier and Type Field Description static StringELEMENT_IDstatic StringMESSAGEML_TAGstatic StringPRESENTATIONML_INPUT_TYPE-
Fields inherited from class org.symphonyoss.symphony.messageml.elements.FormElement
INPUT_TAG, NAME_ATTR, TYPE_ATTR
-
Fields inherited from class org.symphonyoss.symphony.messageml.elements.Element
CLASS_ATTR, format, ID_ATTR, ID_MAX_LENGTH, MAPPER, STYLE_ATTR
-
Fields inherited from interface org.symphonyoss.symphony.messageml.elements.LabelableElement
LABEL, LABEL_FOR, LABEL_MAX_LENGTH, LABEL_TOO_LONG_ERR
-
Fields inherited from interface org.symphonyoss.symphony.messageml.elements.MinMaxLengthElement
ALL_MIN_MAX_ATTRS, MAXLENGTH_ATTR, MINLENGTH_ATTR
-
Fields inherited from interface org.symphonyoss.symphony.messageml.elements.RegexElement
ALL_REGEX_ATTRS, ATTRIBUTE_MANDATORY_WHEN_ATTRIBUTE_DEFINED_ERR, ATTRIBUTE_TOO_LONG_ERR, PATTERN_ATTR, PATTERN_ERROR_MESSAGE_ATTR, PATTERN_ERROR_MESSAGE_MAX_LENGTH, PATTERN_MAX_LENGTH, PRESENTATIONML_PATTERN_ERROR_MESSAGE_ATTR, REGEX_NOT_VALID_ERR
-
Fields inherited from interface org.symphonyoss.symphony.messageml.elements.SplittableElement
PRESENTATIONML_DIV_FLAG
-
Fields inherited from interface org.symphonyoss.symphony.messageml.elements.TooltipableElement
DATA_TARGET_ID, DATA_TITLE, TITLE, TOOLTIP_CLASS, TOOLTIP_MAX_LENGTH, TOOLTIP_TOO_LONG_ERR, TOOLTIPABLE_PRESENTATIONML
-
-
Constructor Summary
Constructors Constructor Description TextField(Element parent, FormatEnum messageFormat)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareNestedElementsAllowed()Return true if nested elements are allowed By default true, override to false for elements that dont support nested elementsorg.commonmark.node.NodeasMarkdown()voidbuildAll(MessageMLParser parser, Element element)Process a DOM element, descending into its children, and construct the output MessageML tree.protected voidbuildAttribute(MessageMLParser parser, Node item)StringgetAttributeValue(String attributeName)StringgetElementId()StringgetElementInitialValue()StringgetElementType()IntegergetMaxValueAllowed()IntegergetMinValueAllowed()Map<String,String>getOtherAttributes()StringgetPresentationMLTag()Return the element's PresentationML tag.booleanhasElementInitialValue()voidupdateBiContext(BiContext context)voidvalidate()-
Methods inherited from class org.symphonyoss.symphony.messageml.elements.Element
addChild, asText, buildNode, countChildrenOfType, countNonTextNodesInNodeList, findElements, findElements, findElements, getAttribute, getAttributes, getChild, getChildren, getFormat, getMessageMLTag, getParent, getStringAttribute, hasExactNumberOfChildren, hasIdAttribute, putIntegerIfPresent, putOneIfPresent, putStringIfPresent, size, throwInvalidInputException
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.symphonyoss.symphony.messageml.elements.LabelableElement
getLabelAttribute, getPresentationMLLabelTag, isLabel, isLabelNode, validateLabel
-
Methods inherited from interface org.symphonyoss.symphony.messageml.elements.MinMaxLengthElement
getAttributeAsInteger, getDefaultValueIfCurrentIsNull, getLengthErrorMessage, isLengthOutOfRange, isMinAndMaxLengthCombinationValid, isTextBiggerThanMaxLength, isTextSmallerThanMinLength, validateInitialValueIfFound, validateMinAndMaxLengths
-
Methods inherited from interface org.symphonyoss.symphony.messageml.elements.RegexElement
getAttribute, getAttributes, getFormat, getRegexAttrForPresentationML, validateRegex
-
Methods inherited from interface org.symphonyoss.symphony.messageml.elements.SplittableElement
fillAttributes, fillAttributes, getAttribute, getAttributes, getStringAttribute, isSplittable, isSplittableNodeComponent, splittableAsPresentationML, splittableRemove, validateSplittable
-
Methods inherited from interface org.symphonyoss.symphony.messageml.elements.TooltipableElement
getPresentationMLTooltipTag, getTooltipAttributes, isTooltip, validateTooltip
-
-
-
-
Field Detail
-
MESSAGEML_TAG
public static final String MESSAGEML_TAG
- See Also:
- Constant Field Values
-
ELEMENT_ID
public static final String ELEMENT_ID
- See Also:
- Constant Field Values
-
PRESENTATIONML_INPUT_TYPE
public static final String PRESENTATIONML_INPUT_TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TextField
public TextField(Element parent, FormatEnum messageFormat)
-
-
Method Detail
-
validate
public void validate() throws InvalidInputException- Overrides:
validatein classFormElement- Throws:
InvalidInputException
-
buildAll
public void buildAll(MessageMLParser parser, Element element) throws InvalidInputException, ProcessingException
Description copied from class:ElementProcess a DOM element, descending into its children, and construct the output MessageML tree.- Overrides:
buildAllin classElement- Throws:
InvalidInputExceptionProcessingException
-
asMarkdown
public org.commonmark.node.Node asMarkdown()
-
buildAttribute
protected void buildAttribute(MessageMLParser parser, Node item) throws InvalidInputException
- Throws:
InvalidInputException
-
getOtherAttributes
public Map<String,String> getOtherAttributes()
- Specified by:
getOtherAttributesin interfaceRegexElement- Returns:
- all element's attributes that are not regex related
-
updateBiContext
public void updateBiContext(BiContext context)
-
getPresentationMLTag
public String getPresentationMLTag()
Description copied from class:ElementReturn the element's PresentationML tag. By default is equals to MessageML tag, override when needed- Overrides:
getPresentationMLTagin classElement
-
areNestedElementsAllowed
public boolean areNestedElementsAllowed()
Description copied from class:ElementReturn true if nested elements are allowed By default true, override to false for elements that dont support nested elements- Overrides:
areNestedElementsAllowedin classElement
-
getElementId
public String getElementId()
- Specified by:
getElementIdin interfaceSplittableElement- Returns:
- the name used to build unique element id
-
getElementType
public String getElementType()
- Specified by:
getElementTypein interfaceMinMaxLengthElement- Returns:
- the type of the element
-
hasElementInitialValue
public boolean hasElementInitialValue()
- Specified by:
hasElementInitialValuein interfaceMinMaxLengthElement- Returns:
- true if the element has an initial value
-
getElementInitialValue
public String getElementInitialValue()
- Specified by:
getElementInitialValuein interfaceMinMaxLengthElement- Returns:
- the initial value found in the element
-
getAttributeValue
public String getAttributeValue(String attributeName)
- Specified by:
getAttributeValuein interfaceMinMaxLengthElement- Parameters:
attributeName- we want to retrieve- Returns:
- the value corresponding to the attributeName given in input
-
getMinValueAllowed
public Integer getMinValueAllowed()
- Specified by:
getMinValueAllowedin interfaceMinMaxLengthElement- Returns:
- minimum value allowed for the minLength attribute
-
getMaxValueAllowed
public Integer getMaxValueAllowed()
- Specified by:
getMaxValueAllowedin interfaceMinMaxLengthElement- Returns:
- maximum value allowed for the maxLength attribute
-
-