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.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>
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.ViewElementgetLabel()<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) booleanbooleanremove(com.foreach.across.modules.web.ui.ViewElement.WitherRemover... functions) removeAttribute(String attributeName) booleanremoveChild(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 FormGroupElementsetElementType(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 FormGroupElementsetTagName(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, returnIfTypeMethods 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, 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:
-
-
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. TheErrorsobject attached to the bound object will be queried for the field errors with the given names.- Parameters:
fieldNames- field names
-
elementStream
- Overrides:
elementStreamin classcom.foreach.across.modules.web.ui.elements.ContainerViewElement
-
removeChild
public boolean removeChild(com.foreach.across.modules.web.ui.ViewElement element) - Overrides:
removeChildin classcom.foreach.across.modules.web.ui.elements.ContainerViewElement
-
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
-
setName
- Specified by:
setNamein interfacecom.foreach.across.modules.web.ui.MutableViewElement- Overrides:
setNamein 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 FormGroupElement 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 FormGroupElement 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> FormGroupElement 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 FormGroupElement 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
-
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.
-