Class IconLoaderSupport
java.lang.Object
io.jmix.flowui.xml.layout.support.IconLoaderSupport
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
@Component("flowui_IconLoaderSupport")
@Scope("prototype")
public class IconLoaderSupport
extends Object
implements org.springframework.context.ApplicationContextAware
Utility class for loading component icons.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected ComponentLoader.Contextprotected static final Stringprotected Iconsprotected LayoutLoaderprotected LoaderSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IconsgetIcons()protected LayoutLoaderprotected LoaderSupportOptional<com.vaadin.flow.component.Component>loadIcon(org.dom4j.Element element) Loads an icon component from the given XMLelement.Optional<com.vaadin.flow.component.Component>Loads an icon component from the given XMLelement.Optional<com.vaadin.flow.component.Component>Loads an icon component from the given XMLelement.voidloadIcon(org.dom4j.Element element, String iconElementName, String iconAttributeName, Consumer<com.vaadin.flow.component.Component> setter) Loads an icon component from the given XMLelementand applies it using the providedsetter.voidloadIcon(org.dom4j.Element element, String iconElementName, Consumer<com.vaadin.flow.component.Component> setter) Loads an icon component from the given XMLelementand applies it using the providedsetter.voidLoads an icon component from the given XMLelementand applies it using the providedsetter.protected Optional<com.vaadin.flow.component.Component>loadIconComponent(org.dom4j.Element iconElement) voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
Field Details
-
DEFAULT_ICON_ELEMENT_NAME
- See Also:
-
context
-
layoutLoader
-
loaderSupport
-
icons
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext
-
-
Constructor Details
-
IconLoaderSupport
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
loadIcon
public void loadIcon(org.dom4j.Element element, Consumer<com.vaadin.flow.component.Component> setter) Loads an icon component from the given XMLelementand applies it using the providedsetter. The method first attempts to find the nested icon element with the default name within the given element. If the icon element is found, an icon component is loaded and passed to thesetter. Otherwise, it attempts to load an icon from the fallback attribute with the default name.- Parameters:
element- the XML element to load the icon fromsetter- the setter used to process the loaded icon
-
loadIcon
public void loadIcon(org.dom4j.Element element, String iconElementName, Consumer<com.vaadin.flow.component.Component> setter) Loads an icon component from the given XMLelementand applies it using the providedsetter. The method first attempts to find the nested icon element with the given name within the given element. If the icon element is found, an icon component is loaded and passed to thesetter. Otherwise, it attempts to load an icon from the fallback attribute the same name as the given icon element name.- Parameters:
element- the XML element to load the icon fromiconElementName- the name of the child element that stores the iconsetter- the setter used to process the loaded icon
-
loadIcon
public void loadIcon(org.dom4j.Element element, String iconElementName, String iconAttributeName, Consumer<com.vaadin.flow.component.Component> setter) Loads an icon component from the given XMLelementand applies it using the providedsetter. The method first attempts to find the nested icon element with the given name within the given element. If the icon element is found, an icon component is loaded and passed to thesetter. Otherwise, it attempts to load an icon from the specified fallback attribute of the given element.- Parameters:
element- the XML element to load the icon fromiconElementName- the name of the child element that stores the iconiconAttributeName- the name of the fallback attribute that represents the icon if no icon element is foundsetter- the setter used to process the loaded icon
-
loadIcon
Loads an icon component from the given XMLelement. The method first attempts to find the nested icon element with the default name within the given element. If the icon element is found, the icon component is loaded from it. Otherwise, it attempts to load an icon from the fallback attribute with the default name. -
loadIcon
public Optional<com.vaadin.flow.component.Component> loadIcon(org.dom4j.Element element, String iconElementName) Loads an icon component from the given XMLelement. The method first attempts to find the nested icon element with the given name within the given element. If the icon element is found, the icon component is loaded from it. Otherwise, it attempts to load an icon from the fallback attribute with the same name as the given icon element name. If no icon is found, an emptyOptionalis returned. -
loadIcon
public Optional<com.vaadin.flow.component.Component> loadIcon(org.dom4j.Element element, String iconElementName, String iconAttributeName) Loads an icon component from the given XMLelement. The method first attempts to find the nested icon element with the given name within the given element. If the icon element is found, the icon component is loaded from it. Otherwise, it attempts to load an icon from the given fallback attribute. If no icon is found, an emptyOptionalis returned.- Parameters:
element- the XML element to load the icon fromiconElementName- the name of the child element that stores the iconiconAttributeName- the name of the fallback attribute that represents the icon if no icon element is found- Returns:
- an
Optionalcontaining the loaded iconComponent, or an emptyOptionalif no icon could be loaded
-
loadIconComponent
protected Optional<com.vaadin.flow.component.Component> loadIconComponent(org.dom4j.Element iconElement) -
loaderSupport
-
getLayoutLoader
-
getIcons
-