public abstract class BootstrapElementUtils extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
BootstrapElementUtils() |
| Modifier and Type | Method and Description |
|---|---|
static FormControlElement |
getFormControl(com.foreach.across.modules.web.ui.ViewElement viewElement)
Will search for the first
FormControlElement instance that is not an InputGroupFormElement. |
static <V extends FormControlElement> |
getFormControl(com.foreach.across.modules.web.ui.ViewElement viewElement,
Class<V> expectedType)
Will search for the first
FormControlElement instance that matches the expected type. |
static <T extends com.foreach.across.modules.web.ui.ViewElement> |
prefixControlNames(@NonNull String prefix)
Create
ControlNamePrefixAdjuster preconfigured to prefix all control names with the given prefix,
ignoring any first underscore character, adding dot separators and recursing through all children
in case the control is a container. |
static void |
prefixControlNames(@NonNull String prefix,
@NonNull com.foreach.across.modules.web.ui.elements.ContainerViewElement container)
Prefix all controls in a container.
|
static <T extends com.foreach.across.modules.web.ui.ViewElement> |
replaceControlNamesPrefix(@NonNull String prefixToReplace,
@NonNull String newPrefix)
Create
ControlNamePrefixAdjuster preconfigured to update all control names that match the initial
prefix, and replace said prefix with the new value. |
static void |
replaceControlNamesPrefix(@NonNull String prefixToReplace,
@NonNull String newPrefix,
@NonNull com.foreach.across.modules.web.ui.elements.ContainerViewElement container)
Updates any control having a control name starting with a given prefix.
|
public static FormControlElement getFormControl(com.foreach.across.modules.web.ui.ViewElement viewElement)
FormControlElement instance that is not an InputGroupFormElement.
It is possible that the instance itself is returned. This method will recurse through
ContainerViewElement types until an instance is returned.viewElement - instancenull if not foundpublic static <V extends FormControlElement> V getFormControl(com.foreach.across.modules.web.ui.ViewElement viewElement, Class<V> expectedType)
FormControlElement instance that matches the expected type.
It is possible that the instance itself is returned. This method will recurse through
ContainerViewElement types until an instance is returned.viewElement - instanceexpectedType - the control should havenull if not foundpublic static void prefixControlNames(@NonNull
@NonNull String prefix,
@NonNull
@NonNull com.foreach.across.modules.web.ui.elements.ContainerViewElement container)
FormInputElement controls and ensure they are prefixed only once.
When it encounters a FormControlElement.Proxy it will also exclude the
target ViewElement from control name updating.
This method will insert a . between the prefix and the original control name, unless
the control name starts with a special character.
See prefixControlNames(String) and ControlNamePrefixAdjuster if you want to customize.prefix - to apply to any input elementcontainer - in which to find all input elementsprefixControlNames(String),
ControlNamePrefixAdjusterpublic static void replaceControlNamesPrefix(@NonNull
@NonNull String prefixToReplace,
@NonNull
@NonNull String newPrefix,
@NonNull
@NonNull com.foreach.across.modules.web.ui.elements.ContainerViewElement container)
prefixControlNames(String, ContainerViewElement)
this method should handle different form control elements correctly.
See replaceControlNamesPrefix(String, String) and ControlNamePrefixAdjuster if you want to customize.prefixToReplace - prefix that should be replacednewPrefix - prefix that should be used insteadcontainer - in which to find all input elementsreplaceControlNamesPrefix(String, String),
ControlNamePrefixAdjusterpublic static <T extends com.foreach.across.modules.web.ui.ViewElement> ControlNamePrefixAdjuster<T> prefixControlNames(@NonNull @NonNull String prefix)
ControlNamePrefixAdjuster preconfigured to prefix all control names with the given prefix,
ignoring any first underscore character, adding dot separators and recursing through all children
in case the control is a container.
The return value is both a Consumer and ViewElementPostProcessor.prefix - to addpublic static <T extends com.foreach.across.modules.web.ui.ViewElement> ControlNamePrefixAdjuster<T> replaceControlNamesPrefix(@NonNull @NonNull String prefixToReplace, @NonNull @NonNull String newPrefix)
ControlNamePrefixAdjuster preconfigured to update all control names that match the initial
prefix, and replace said prefix with the new value. Like prefixControlNames(String) the return
value is preconfigured to recurse through container members, ignore underscores and add dot separators
where necessary.
The return value is both a Consumer and ViewElementPostProcessor.prefixToReplace - prefix that should be replacednewPrefix - prefix that should be used insteadCopyright © 2020. All rights reserved.