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.FunctionsNested classes/interfaces inherited from interface com.foreach.across.modules.web.ui.MutableViewElement
com.foreach.across.modules.web.ui.MutableViewElement.FunctionsNested 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
Fields -
Constructor Summary
Constructors -
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.ErrorsSet the collection ofErrorsfor this form.org.springframework.http.HttpMethodbooleanbooleanremove(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 FormViewElementsetElementType(String elementType) setEncType(String encType) Set encoding type (enctype attribute) to use for this form.setErrors(org.springframework.validation.Errors errors) Set the collection ofErrorsfor this form.setFormLayout(FormLayout formLayout) Set theFormLayoutthat should be applied to allFormGroupElementmembers of this form.setFormName(String name) Set the HTML name attribute of this form.setMethod(org.springframework.http.HttpMethod httpMethod) setNoValidate(boolean noValidate) protected FormViewElementsetTagName(String tagName) Methods inherited from class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
get, getAttribute, getAttribute, getAttributes, getHtmlId, getTagName, hasAttribute, hasCssClass, returnIfTypeMethods 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, removeFromTreeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 theFormLayoutthat should be applied to allFormGroupElementmembers 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:objectattribute on an element in Thymeleaf.- Parameters:
commandAttribute- instance
-
getMethod
public org.springframework.http.HttpMethod getMethod() -
setMethod
-
getAction
-
setAction
-
setName
- Specified by:
setNamein interfacecom.foreach.across.modules.web.ui.MutableViewElement- Overrides:
setNamein 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:
addCssClassin interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement- Overrides:
addCssClassin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
removeCssClass
- Specified by:
removeCssClassin interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement- Overrides:
removeCssClassin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setAttributes
- Specified by:
setAttributesin interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement- Overrides:
setAttributesin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setAttribute
- Specified by:
setAttributein interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement- Overrides:
setAttributein classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
addAttributes
- Specified by:
addAttributesin interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement- Overrides:
addAttributesin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
removeAttribute
- Specified by:
removeAttributein interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement- Overrides:
removeAttributein classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setCustomTemplate
- Specified by:
setCustomTemplatein interfacecom.foreach.across.modules.web.ui.MutableViewElement- Overrides:
setCustomTemplatein classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setElementType
- Overrides:
setElementTypein classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
addChild
- Overrides:
addChildin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
addChildren
public FormViewElement addChildren(Collection<? extends com.foreach.across.modules.web.ui.ViewElement> elements) - Overrides:
addChildrenin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
addFirstChild
- Overrides:
addFirstChildin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
clearChildren
- Overrides:
clearChildrenin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
apply
public FormViewElement apply(Consumer<com.foreach.across.modules.web.ui.elements.ContainerViewElement> consumer) - Overrides:
applyin 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:
applyUnsafein classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setTagName
- Overrides:
setTagNamein classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
setHtmlId
- Specified by:
setHtmlIdin interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement- Overrides:
setHtmlIdin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
set
- Specified by:
setin interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement- Specified by:
setin interfacecom.foreach.across.modules.web.ui.MutableViewElement- Specified by:
setin interfacecom.foreach.across.modules.web.ui.ViewElement- Overrides:
setin classcom.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
-
remove
public FormViewElement remove(com.foreach.across.modules.web.ui.ViewElement.WitherRemover... functions) - Specified by:
removein interfacecom.foreach.across.modules.web.ui.elements.HtmlViewElement- Specified by:
removein interfacecom.foreach.across.modules.web.ui.MutableViewElement- Specified by:
removein interfacecom.foreach.across.modules.web.ui.ViewElement- Overrides:
removein 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 forcommandAttributewill 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 forcommandAttributewill always take precedence over the actual object.- Returns:
this.
-
getErrors
public org.springframework.validation.Errors getErrors()Set the collection ofErrorsfor this form. Usually contains theBindingResultfor the object bound to this form. Though setting the object is not strictly required. When set, anycommandAttributeorcommandObjectwill be ignored. -
setErrors
Set the collection ofErrorsfor this form. Usually contains theBindingResultfor the object bound to this form. Though setting the object is not strictly required. When set, anycommandAttributeorcommandObjectwill be ignored.- Returns:
this.
-