Class FormGroupElement
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.FormGroupElement
- 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 FormGroupElement
extends com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
A form group element usually represents a single form control, with associated
label and description texts. It is a helper for automatic styling of forms
based on a general form layout.
- 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>
FormGroupElementapplyUnsafe
(Consumer<U> consumer) Stream<com.foreach.across.modules.web.ui.ViewElement>
com.foreach.across.modules.web.ui.ViewElement
<V extends com.foreach.across.modules.web.ui.ViewElement>
VgetControl
(Class<V> elementType) com.foreach.across.modules.web.ui.ViewElement
<V extends com.foreach.across.modules.web.ui.ViewElement>
VgetDescriptionBlock
(Class<V> elementType) String[]
com.foreach.across.modules.web.ui.ViewElement
<V extends com.foreach.across.modules.web.ui.ViewElement>
VgetHelpBlock
(Class<V> elementType) com.foreach.across.modules.web.ui.ViewElement
getLabel()
<V extends com.foreach.across.modules.web.ui.ViewElement>
Vcom.foreach.across.modules.web.ui.ViewElement
<V extends com.foreach.across.modules.web.ui.ViewElement>
VgetTooltip
(Class<V> elementType) boolean
boolean
remove
(com.foreach.across.modules.web.ui.ViewElement.WitherRemover... functions) removeAttribute
(String attributeName) boolean
removeChild
(com.foreach.across.modules.web.ui.ViewElement element) removeCssClass
(String... cssClass) set
(com.foreach.across.modules.web.ui.ViewElement.WitherSetter... setters) setAttribute
(String attributeName, Object attributeValue) setAttributes
(Map<String, Object> attributes) setControl
(com.foreach.across.modules.web.ui.ViewElement control) setCustomTemplate
(String customTemplate) setDescriptionBlock
(com.foreach.across.modules.web.ui.ViewElement descriptionBlock) Set the description block that should be rendered above the control, usually between the label and the control.setDetectFieldErrors
(boolean detectFieldErrors) When rendering, should field errors be detected from the bound object based on the control in this form group.protected FormGroupElement
setElementType
(String elementType) setFieldErrorsToShow
(String... fieldNames) Additional field names for which errors should be detected from the bound object.setFormLayout
(FormLayout formLayout) setHelpBlock
(com.foreach.across.modules.web.ui.ViewElement helpBlock) setLabel
(com.foreach.across.modules.web.ui.ViewElement label) setRequired
(boolean required) protected FormGroupElement
setTagName
(String tagName) setTooltip
(com.foreach.across.modules.web.ui.ViewElement tooltip) Set a tooltip element.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
find, find, findAll, findAll, findAll, findOrSelf, findOrSelf, flatStream, getChildren, getCustomTemplate, getElementType, getName, hasChildren, removeAllFromTree, 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:
-
-
Constructor Details
-
FormGroupElement
public FormGroupElement()
-
-
Method Details
-
getLabel
-
getControl
-
getHelpBlock
public <V extends com.foreach.across.modules.web.ui.ViewElement> V getHelpBlock(Class<V> elementType) -
getDescriptionBlock
public <V extends com.foreach.across.modules.web.ui.ViewElement> V getDescriptionBlock(Class<V> elementType) -
getTooltip
-
setFieldErrorsToShow
Additional field names for which errors should be detected from the bound object. These errors will be rendered no matter the setting ofisDetectFieldErrors()
. The latter will only auto-detect the field errors for the attached control. TheErrors
object attached to the bound object will be queried for the field errors with the given names.- Parameters:
fieldNames
- field names
-
elementStream
- Overrides:
elementStream
in classcom.foreach.across.modules.web.ui.elements.ContainerViewElement
-
removeChild
public boolean removeChild(com.foreach.across.modules.web.ui.ViewElement element) - Overrides:
removeChild
in classcom.foreach.across.modules.web.ui.elements.ContainerViewElement
-
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
-
setName
- Specified by:
setName
in interfacecom.foreach.across.modules.web.ui.MutableViewElement
- Overrides:
setName
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 FormGroupElement 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 FormGroupElement 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> FormGroupElement 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 FormGroupElement 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
-
getLabel
public com.foreach.across.modules.web.ui.ViewElement getLabel() -
getControl
public com.foreach.across.modules.web.ui.ViewElement getControl() -
getHelpBlock
public com.foreach.across.modules.web.ui.ViewElement getHelpBlock() -
getTooltip
public com.foreach.across.modules.web.ui.ViewElement getTooltip() -
getDescriptionBlock
public com.foreach.across.modules.web.ui.ViewElement getDescriptionBlock() -
getFormLayout
-
isRequired
public boolean isRequired() -
isDetectFieldErrors
public boolean isDetectFieldErrors() -
getFieldErrorsToShow
-
setLabel
- Returns:
this
.
-
setControl
- Returns:
this
.
-
setHelpBlock
- Returns:
this
.
-
setTooltip
Set a tooltip element. This will be inserted inside the label, after the label text.- Returns:
this
.
-
setDescriptionBlock
public FormGroupElement setDescriptionBlock(com.foreach.across.modules.web.ui.ViewElement descriptionBlock) Set the description block that should be rendered above the control, usually between the label and the control.- Returns:
this
.
-
setFormLayout
- Returns:
this
.
-
setRequired
- Returns:
this
.
-
setDetectFieldErrors
When rendering, should field errors be detected from the bound object based on the control in this form group. Iftrue
(default) the controlName of the form control will be used as property name of the bound object, if no such property, an exception will occur when rendering.- Returns:
this
.
-