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
  • Field Details

  • Constructor Details

    • FormGroupElement

      public FormGroupElement()
  • Method Details

    • getLabel

      public <V extends com.foreach.across.modules.web.ui.ViewElement> V getLabel(Class<V> elementType)
    • getControl

      public <V extends com.foreach.across.modules.web.ui.ViewElement> V getControl(Class<V> elementType)
    • 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

      public <V extends com.foreach.across.modules.web.ui.ViewElement> V getTooltip(Class<V> elementType)
    • setFieldErrorsToShow

      public FormGroupElement setFieldErrorsToShow(String... fieldNames)
      Additional field names for which errors should be detected from the bound object. These errors will be rendered no matter the setting of isDetectFieldErrors(). The latter will only auto-detect the field errors for the attached control.

      The Errors object attached to the bound object will be queried for the field errors with the given names.

      Parameters:
      fieldNames - field names
    • elementStream

      public Stream<com.foreach.across.modules.web.ui.ViewElement> elementStream()
      Overrides:
      elementStream in class com.foreach.across.modules.web.ui.elements.ContainerViewElement
    • removeChild

      public boolean removeChild(com.foreach.across.modules.web.ui.ViewElement element)
      Overrides:
      removeChild in class com.foreach.across.modules.web.ui.elements.ContainerViewElement
    • addCssClass

      public FormGroupElement addCssClass(String... cssClass)
      Specified by:
      addCssClass in interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
      Overrides:
      addCssClass in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • removeCssClass

      public FormGroupElement removeCssClass(String... cssClass)
      Specified by:
      removeCssClass in interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
      Overrides:
      removeCssClass in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • setAttributes

      public FormGroupElement setAttributes(Map<String,Object> attributes)
      Specified by:
      setAttributes in interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
      Overrides:
      setAttributes in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • setAttribute

      public FormGroupElement setAttribute(String attributeName, Object attributeValue)
      Specified by:
      setAttribute in interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
      Overrides:
      setAttribute in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • addAttributes

      public FormGroupElement addAttributes(Map<String,Object> attributes)
      Specified by:
      addAttributes in interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
      Overrides:
      addAttributes in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • removeAttribute

      public FormGroupElement removeAttribute(String attributeName)
      Specified by:
      removeAttribute in interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
      Overrides:
      removeAttribute in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • setName

      public FormGroupElement setName(String name)
      Specified by:
      setName in interface com.foreach.across.modules.web.ui.MutableViewElement
      Overrides:
      setName in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • setCustomTemplate

      public FormGroupElement setCustomTemplate(String customTemplate)
      Specified by:
      setCustomTemplate in interface com.foreach.across.modules.web.ui.MutableViewElement
      Overrides:
      setCustomTemplate in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • setElementType

      protected FormGroupElement setElementType(String elementType)
      Overrides:
      setElementType in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • addChild

      public FormGroupElement addChild(com.foreach.across.modules.web.ui.ViewElement element)
      Overrides:
      addChild in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • addChildren

      public FormGroupElement addChildren(Collection<? extends com.foreach.across.modules.web.ui.ViewElement> elements)
      Overrides:
      addChildren in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • addFirstChild

      public FormGroupElement addFirstChild(com.foreach.across.modules.web.ui.ViewElement element)
      Overrides:
      addFirstChild in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • clearChildren

      public FormGroupElement clearChildren()
      Overrides:
      clearChildren in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • apply

      public FormGroupElement apply(Consumer<com.foreach.across.modules.web.ui.elements.ContainerViewElement> consumer)
      Overrides:
      apply in class com.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 class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • setTagName

      protected FormGroupElement setTagName(String tagName)
      Overrides:
      setTagName in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • setHtmlId

      public FormGroupElement setHtmlId(String htmlId)
      Specified by:
      setHtmlId in interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
      Overrides:
      setHtmlId in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • set

      public FormGroupElement set(com.foreach.across.modules.web.ui.ViewElement.WitherSetter... setters)
      Specified by:
      set in interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
      Specified by:
      set in interface com.foreach.across.modules.web.ui.MutableViewElement
      Specified by:
      set in interface com.foreach.across.modules.web.ui.ViewElement
      Overrides:
      set in class com.foreach.across.modules.web.ui.elements.AbstractNodeViewElement
    • remove

      public FormGroupElement remove(com.foreach.across.modules.web.ui.ViewElement.WitherRemover... functions)
      Specified by:
      remove in interface com.foreach.across.modules.web.ui.elements.HtmlViewElement
      Specified by:
      remove in interface com.foreach.across.modules.web.ui.MutableViewElement
      Specified by:
      remove in interface com.foreach.across.modules.web.ui.ViewElement
      Overrides:
      remove in class com.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

      public FormLayout getFormLayout()
    • isRequired

      public boolean isRequired()
    • isDetectFieldErrors

      public boolean isDetectFieldErrors()
    • getFieldErrorsToShow

      public String[] getFieldErrorsToShow()
    • setLabel

      public FormGroupElement setLabel(com.foreach.across.modules.web.ui.ViewElement label)
      Returns:
      this.
    • setControl

      public FormGroupElement setControl(com.foreach.across.modules.web.ui.ViewElement control)
      Returns:
      this.
    • setHelpBlock

      public FormGroupElement setHelpBlock(com.foreach.across.modules.web.ui.ViewElement helpBlock)
      Returns:
      this.
    • setTooltip

      public FormGroupElement setTooltip(com.foreach.across.modules.web.ui.ViewElement tooltip)
      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

      public FormGroupElement setFormLayout(FormLayout formLayout)
      Returns:
      this.
    • setRequired

      public FormGroupElement setRequired(boolean required)
      Returns:
      this.
    • setDetectFieldErrors

      public FormGroupElement setDetectFieldErrors(boolean detectFieldErrors)
      When rendering, should field errors be detected from the bound object based on the control in this form group. If true (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.