Package org.cxbox.core.dto.rowmeta
Class FieldsDictionaryMeta<T extends org.cxbox.api.data.dto.DataResponseDTO>
java.lang.Object
org.cxbox.api.data.dto.rowmeta.FieldsDTO
org.cxbox.core.dto.rowmeta.RowDependentFieldsCommonMeta<T>
org.cxbox.core.dto.rowmeta.RowDependentFieldsDictionaryDeprecatedMeta<T>
org.cxbox.core.dto.rowmeta.RowDependentFieldsDictionaryMeta<T>
org.cxbox.core.dto.rowmeta.RowDependentFieldsMeta<T>
org.cxbox.core.dto.rowmeta.FieldsCommonMeta<T>
org.cxbox.core.dto.rowmeta.FieldsDictionaryDeprecatedMeta<T>
org.cxbox.core.dto.rowmeta.FieldsDictionaryMeta<T>
- All Implemented Interfaces:
Iterable<org.cxbox.api.data.dto.rowmeta.FieldDTO>
- Direct Known Subclasses:
FieldsGroupingHierarchyMeta
public class FieldsDictionaryMeta<T extends org.cxbox.api.data.dto.DataResponseDTO>
extends FieldsDictionaryDeprecatedMeta<T>
-
Field Summary
Fields inherited from class org.cxbox.core.dto.rowmeta.RowDependentFieldsCommonMeta
objectMapperFields inherited from class org.cxbox.api.data.dto.rowmeta.FieldsDTO
fields -
Constructor Summary
ConstructorsConstructorDescriptionFieldsDictionaryMeta(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Optional<DictionaryProvider> dictionaryProvider) -
Method Summary
Modifier and TypeMethodDescriptionfinal <V extends Dictionary>
voidsetDictionaryFilterValues(DtoField<? super T, V> field)
Fills dictionary fieldfilerdrop-down (List widget field duringfilerediting) withallvalues fromdictionary typefinal <V extends Dictionary>
voidsetDictionaryFilterValues(DtoField<? super T, V> field, @NonNull Collection<V> variants)
final <V extends Dictionary>
voidsetDictionaryIcons(DtoField<? super T, V> field, @NonNull Map<V, org.cxbox.api.data.dto.rowmeta.Icon> valueIconMap)
Adds icons for fields having "type":"dictionary" in widget.json
Usually one will provide mapping of ALL dictionary values to their icons here.final <T extends org.cxbox.api.data.dto.DataResponseDTO,E extends Enum<?>>
voidsetEnumFilterValues(@NonNull FieldsMeta<T> fieldsMeta, DtoField<? super T, E> field, @NonNull E... values) final <E extends Enum<?>>
voidsetEnumIcons(DtoField<? super T, E> field, @NonNull Map<E, org.cxbox.api.data.dto.rowmeta.Icon> valueIconMap)
Same assetDictionaryIcons(org.cxbox.constgen.DtoField<? super T, V>, java.util.Map<V, org.cxbox.api.data.dto.rowmeta.Icon>)but for Enum based dictionary fieldsMethods inherited from class org.cxbox.core.dto.rowmeta.FieldsDictionaryDeprecatedMeta
setAllFilterValuesByLovType, setAllFilterValuesByLovType, setAllValuesWithIcons, setAllValuesWithIconsMethods inherited from class org.cxbox.core.dto.rowmeta.FieldsCommonMeta
addConcreteFilterValue, enableFilter, enableSort, setConcreteFilterValues, setEphemeral, setFileAccept, setForceActiveMethods inherited from class org.cxbox.core.dto.rowmeta.RowDependentFieldsDictionaryMeta
setDictionaryValues, setDictionaryValues, setEnumValuesMethods inherited from class org.cxbox.core.dto.rowmeta.RowDependentFieldsDictionaryDeprecatedMeta
setDictionaryTypeWithAllValues, setDictionaryTypeWithAllValues, setDictionaryTypeWithConcreteValues, setDictionaryTypeWithConcreteValues, setDictionaryTypeWithConcreteValues, setDictionaryTypeWithConcreteValuesFromList, setDictionaryTypeWithCustomValuesMethods inherited from class org.cxbox.core.dto.rowmeta.RowDependentFieldsCommonMeta
addConcreteValue, disable, disableFields, get, getCurrentValue, hidden, isFieldChangedNow, required, setConcreteValues, setCurrentValue, setDisabled, setDisabled, setDrilldown, setDrilldowns, setDrilldownWithFilter, setEnabled, setHidden, setNotHidden, setNotRequired, setPlaceholder, setRequiredMethods inherited from class org.cxbox.api.data.dto.rowmeta.FieldsDTO
add, get, iterator, ofMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
FieldsDictionaryMeta
public FieldsDictionaryMeta(@Qualifier("cxboxObjectMapper") com.fasterxml.jackson.databind.ObjectMapper objectMapper, Optional<DictionaryProvider> dictionaryProvider)
-
-
Method Details
-
setDictionaryFilterValues
Fills dictionary fieldfilerdrop-down (List widget field duringfilerediting) withallvalues fromdictionary type- Type Parameters:
V- - dictionary class. Usually class name determines dictionary type, that is used to convert keys to values for UI (seeDictionary.getDictionaryType())- Parameters:
field- - widget dictionary field
-
setDictionaryFilterValues
public final <V extends Dictionary> void setDictionaryFilterValues(@Nullable DtoField<? super T, V> field, @NonNull @NonNull Collection<V> variants)
- Type Parameters:
V- - dictionary class. Usually class name determines dictionary type, that is used to convert keys to values for UI (seeDictionary.getDictionaryType())- Parameters:
field- - widget dictionary fieldvariants- - variants to be shown in fieldfilerdrop-down (List widget field duringfilerediting)
-
setDictionaryIcons
public final <V extends Dictionary> void setDictionaryIcons(@Nullable DtoField<? super T, V> field, @NonNull @NonNull Map<V, org.cxbox.api.data.dto.rowmeta.Icon> valueIconMap)
Adds icons for fields having "type":"dictionary" in widget.json
Usually one will provide mapping of ALL dictionary values to their icons here.- Type Parameters:
V- - dictionary class. Usually class name determines dictionary type, that is used to convert keys to values for UI (seeDictionary.getDictionaryType())- Parameters:
field- - widget dictionary fieldvalueIconMap- <V, Icon> values, that one want to have icons in UI.
-
setEnumFilterValues
public final <T extends org.cxbox.api.data.dto.DataResponseDTO,E extends Enum<?>> void setEnumFilterValues(@NonNull @NonNull FieldsMeta<T> fieldsMeta, @Nullable DtoField<? super T, E> field, @NonNull @NonNull E... values) -
setEnumIcons
public final <E extends Enum<?>> void setEnumIcons(@Nullable DtoField<? super T, E> field, @NonNull @NonNull Map<E, org.cxbox.api.data.dto.rowmeta.Icon> valueIconMap)
Same assetDictionaryIcons(org.cxbox.constgen.DtoField<? super T, V>, java.util.Map<V, org.cxbox.api.data.dto.rowmeta.Icon>)but for Enum based dictionary fields- Parameters:
field- dto fieldvalueIconMap- <extends Enum, Icon> Enum to icon mapping
Example 1:@RequiredArgsConstructor @Getter public enum IconsEnum implements Icon { ARROW_UP("arrow-up #0cbfe9"), WATERMELON("watermelon"), DOWN("down"); private final String icon; }
Add to buildIndependentMeta@Getter @AllArgsConstructor public enum CustomFieldDictionaryEnum { HIGH("High", IconsEnum.ARROW_UP), MIDDLE("Middle", IconsEnum.DOWN), LOW("Low", IconsEnum.WATERMELON); @JsonValue private final String value; private final Icon icon; public static Map<CustomFieldDictionaryEnum, Icon> iconMap() { return Arrays.stream(CustomFieldDictionaryEnum.values()) .filter(e -> e.icon != null) .collect(Collectors.toMap(e -> e, e -> e.icon)); } }fields.setEnumIcons(MyExampleDTO_.customFieldDictionary, CustomFieldDictionaryEnum.iconMap());
-