Class FormViewElement
java.lang.Object
com.foreach.across.modules.web.ui.elements.ContainerViewElement
com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
com.foreach.across.modules.bootstrapui.elements.FormViewElement
- All Implemented Interfaces:
com.foreach.across.modules.web.ui.elements.HtmlViewElement
,com.foreach.across.modules.web.ui.MutableViewElement
,com.foreach.across.modules.web.ui.ViewElement
public class FormViewElement
extends com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
Represents a HTML form element, supporting a Bootstrap
FormLayout
that will automatically
be applied to all controls of the form that do not have a separate layout specified.- Author:
- Arne Vandamme
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
com.foreach.across.modules.web.ui.elements.HtmlViewElement.Functions
Nested classes/interfaces inherited from interface com.foreach.across.modules.web.ui.MutableViewElement
com.foreach.across.modules.web.ui.MutableViewElement.Functions
Nested classes/interfaces inherited from interface com.foreach.across.modules.web.ui.ViewElement
com.foreach.across.modules.web.ui.ViewElement.Wither<T extends com.foreach.across.modules.web.ui.ViewElement>, com.foreach.across.modules.web.ui.ViewElement.WitherGetter<T extends com.foreach.across.modules.web.ui.ViewElement,
U extends Object>, com.foreach.across.modules.web.ui.ViewElement.WitherRemover<T extends com.foreach.across.modules.web.ui.ViewElement>, com.foreach.across.modules.web.ui.ViewElement.WitherSetter<T extends com.foreach.across.modules.web.ui.ViewElement> -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAttributes
(Map<String, Object> attributes) addChild
(com.foreach.across.modules.web.ui.ViewElement element) addChildren
(Collection<? extends com.foreach.across.modules.web.ui.ViewElement> elements) addCssClass
(String... cssClass) addFirstChild
(com.foreach.across.modules.web.ui.ViewElement element) <U extends com.foreach.across.modules.web.ui.ViewElement>
FormViewElementapplyUnsafe
(Consumer<U> consumer) Set the command object that this form is bound to.org.springframework.validation.Errors
Set the collection ofErrors
for this form.org.springframework.http.HttpMethod
boolean
boolean
remove
(com.foreach.across.modules.web.ui.ViewElement.WitherRemover... functions) removeAttribute
(String attributeName) removeCssClass
(String... cssClass) set
(com.foreach.across.modules.web.ui.ViewElement.WitherSetter... setters) setAcceptCharSet
(String charSet) setAttribute
(String attributeName, Object attributeValue) setAttributes
(Map<String, Object> attributes) setAutoComplete
(boolean autoComplete) setCommandAttribute
(String commandAttribute) Set the attribute name of the command object that this form is for.setCommandObject
(Object commandObject) Set the command object that this form is bound to.setCustomTemplate
(String customTemplate) protected FormViewElement
setElementType
(String elementType) setEncType
(String encType) Set encoding type (enctype attribute) to use for this form.setErrors
(org.springframework.validation.Errors errors) Set the collection ofErrors
for this form.setFormLayout
(FormLayout formLayout) Set theFormLayout
that should be applied to allFormGroupElement
members of this form.setFormName
(String name) Set the HTML name attribute of this form.setMethod
(org.springframework.http.HttpMethod httpMethod) setNoValidate
(boolean noValidate) protected FormViewElement
setTagName
(String tagName) Methods inherited from class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
get, getAttribute, getAttribute, getAttributes, getHtmlId, getTagName, hasAttribute, hasCssClass, returnIfType
Methods inherited from class com.foreach.across.modules.web.ui.elements.ContainerViewElement
elementStream, find, find, findAll, findAll, findAll, findOrSelf, findOrSelf, flatStream, getChildren, getCustomTemplate, getElementType, getName, hasChildren, removeAllFromTree, removeChild, removeFromTree, removeFromTree
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.foreach.across.modules.web.ui.ViewElement
getCustomTemplate, getElementType, getName, matches
-
Field Details
-
ELEMENT_TYPE
- See Also:
-
ENCTYPE_PLAIN
- See Also:
-
ENCTYPE_MULTIPART
- See Also:
-
ENCTYPE_URLENCODED
- See Also:
-
-
Constructor Details
-
FormViewElement
public FormViewElement()
-
-
Method Details
-
getFormLayout
-
setFormLayout
Set theFormLayout
that should be applied to allFormGroupElement
members of this form. Also set the corresponding class.- Parameters:
formLayout
- instance
-
getCommandAttribute
-
setCommandAttribute
Set the attribute name of the command object that this form is for. All form groups within this form will have the control names prefixed and field errors bound. This is basically the equivalent of putting ath:object
attribute on an element in Thymeleaf.- Parameters:
commandAttribute
- instance
-
getMethod
public org.springframework.http.HttpMethod getMethod() -
setMethod
-
getAction
-
setAction
-
setName
- Specified by:
setName
in interfacecom.foreach.across.modules.web.ui.MutableViewElement
- Overrides:
setName
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
getFormName
- Returns:
- name attribute of the form
-
setFormName
Set the HTML name attribute of this form. Defaults toContainerViewElement.getName()
.- Parameters:
name
- attribute to use
-
getEncType
-
setEncType
Set encoding type (enctype attribute) to use for this form.- Parameters:
encType
- value
-
getAcceptCharSet
-
setAcceptCharSet
-
isAutoComplete
public boolean isAutoComplete() -
setAutoComplete
-
isNoValidate
public boolean isNoValidate() -
setNoValidate
-
addCssClass
- Specified by:
addCssClass
in interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement
- Overrides:
addCssClass
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
removeCssClass
- Specified by:
removeCssClass
in interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement
- Overrides:
removeCssClass
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setAttributes
- Specified by:
setAttributes
in interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement
- Overrides:
setAttributes
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setAttribute
- Specified by:
setAttribute
in interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement
- Overrides:
setAttribute
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
addAttributes
- Specified by:
addAttributes
in interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement
- Overrides:
addAttributes
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
removeAttribute
- Specified by:
removeAttribute
in interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement
- Overrides:
removeAttribute
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setCustomTemplate
- Specified by:
setCustomTemplate
in interfacecom.foreach.across.modules.web.ui.MutableViewElement
- Overrides:
setCustomTemplate
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setElementType
- Overrides:
setElementType
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
addChild
- Overrides:
addChild
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
addChildren
public FormViewElement addChildren(Collection<? extends com.foreach.across.modules.web.ui.ViewElement> elements) - Overrides:
addChildren
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
addFirstChild
- Overrides:
addFirstChild
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
clearChildren
- Overrides:
clearChildren
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
apply
public FormViewElement apply(Consumer<com.foreach.across.modules.web.ui.elements.ContainerViewElement> consumer) - Overrides:
apply
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
applyUnsafe
public <U extends com.foreach.across.modules.web.ui.ViewElement> FormViewElement applyUnsafe(Consumer<U> consumer) - Overrides:
applyUnsafe
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setTagName
- Overrides:
setTagName
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setHtmlId
- Specified by:
setHtmlId
in interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement
- Overrides:
setHtmlId
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
set
- Specified by:
set
in interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement
- Specified by:
set
in interfacecom.foreach.across.modules.web.ui.MutableViewElement
- Specified by:
set
in interfacecom.foreach.across.modules.web.ui.ViewElement
- Overrides:
set
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
remove
public FormViewElement remove(com.foreach.across.modules.web.ui.ViewElement.WitherRemover... functions) - Specified by:
remove
in interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement
- Specified by:
remove
in interfacecom.foreach.across.modules.web.ui.MutableViewElement
- Specified by:
remove
in interfacecom.foreach.across.modules.web.ui.ViewElement
- Overrides:
remove
in classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
getCommandObject
Set the command object that this form is bound to. Can be used as an alternative tosetCommandAttribute(String)
if you do not know the model attribute name. In this case the same instance of the object is expected to be present as a request attribute, where its attribute name will be looked for. Note that a value forcommandAttribute
will always take precedence over the actual object. -
setCommandObject
Set the command object that this form is bound to. Can be used as an alternative tosetCommandAttribute(String)
if you do not know the model attribute name. In this case the same instance of the object is expected to be present as a request attribute, where its attribute name will be looked for. Note that a value forcommandAttribute
will always take precedence over the actual object.- Returns:
this
.
-
getErrors
public org.springframework.validation.Errors getErrors()Set the collection ofErrors
for this form. Usually contains theBindingResult
for the object bound to this form. Though setting the object is not strictly required. When set, anycommandAttribute
orcommandObject
will be ignored. -
setErrors
Set the collection ofErrors
for this form. Usually contains theBindingResult
for the object bound to this form. Though setting the object is not strictly required. When set, anycommandAttribute
orcommandObject
will be ignored.- Returns:
this
.
-