public abstract class AbstractComponent<T extends com.vaadin.ui.Component> extends java.lang.Object implements Component, Component.Wrapper, Component.HasXmlDescriptor, Component.BelongToFrame, Component.HasIcon, Component.HasCaption, HasDebugId, HasContextHelp, HasHtmlCaption, HasHtmlDescription, AttachNotifier, HasHtmlSanitizer
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
HasContextHelp.ContextHelpIconClickEvent
Modifier and Type | Field and Description |
---|---|
protected Component.Alignment |
alignment |
protected org.springframework.context.ApplicationContext |
applicationContext |
protected T |
component |
protected java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> |
contextHelpIconClickHandler |
protected com.vaadin.shared.Registration |
contextHelpIconClickListener |
protected boolean |
descriptionAsHtml |
protected org.dom4j.Element |
element |
protected Frame |
frame |
protected java.lang.Boolean |
htmlSanitizerEnabled |
protected java.lang.String |
icon |
static java.lang.String |
ICON_STYLE |
protected java.lang.String |
id |
protected Component |
parent |
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Constructor and Description |
---|
AbstractComponent() |
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addAttachListener(java.util.function.Consumer<AttachEvent> listener)
Registers a new attached listener.
|
io.jmix.core.common.event.Subscription |
addDetachListener(java.util.function.Consumer<DetachEvent> listener)
Registers a new detached listener.
|
void |
addStyleName(java.lang.String styleName)
Adds one or more style names to this component.
|
protected void |
assignDebugId() |
void |
attached()
Notifies all listeners that component has been attached.
|
void |
detached()
Notifies all listeners that component has been detached.
|
Component.Alignment |
getAlignment() |
java.lang.String |
getCaption() |
T |
getComponent() |
com.vaadin.ui.Component |
getComposition() |
java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> |
getContextHelpIconClickHandler() |
java.lang.String |
getContextHelpText() |
java.lang.String |
getDebugId() |
java.lang.String |
getDescription() |
protected io.jmix.core.common.event.EventHub |
getEventHub() |
Frame |
getFrame() |
float |
getHeight()
Get component height in
Component.getHeightSizeUnit() |
SizeUnit |
getHeightSizeUnit()
Gets the height property units.
|
protected HtmlSanitizer |
getHtmlSanitizer() |
java.lang.String |
getIcon()
Get icon source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.
|
protected java.lang.String |
getIconName(Icons.Icon icon) |
protected com.vaadin.server.Resource |
getIconResource(java.lang.String icon) |
java.lang.String |
getId()
Component ID as defined in
id attribute |
Component |
getParent() |
java.lang.String |
getStyleName()
Styles implementation is client-type-specific.
|
protected UiComponentProperties |
getUiComponentProperties() |
protected UiProperties |
getUiProperties() |
float |
getWidth()
Get component width in
Component.getWidthSizeUnit() |
SizeUnit |
getWidthSizeUnit()
Gets the width property units.
|
org.dom4j.Element |
getXmlDescriptor() |
protected boolean |
hasSubscriptions(java.lang.Class<?> eventClass) |
protected boolean |
hasValidationError() |
boolean |
isAttached() |
boolean |
isCaptionAsHtml() |
boolean |
isContextHelpTextHtmlEnabled() |
boolean |
isDescriptionAsHtml() |
boolean |
isEnabled()
Is the component enabled?
Note that this method only returns the status of the component and does not take parents into account. |
boolean |
isEnabledRecursive() |
boolean |
isHtmlSanitizerEnabled() |
boolean |
isResponsive()
Is the component responsive?
|
boolean |
isVisible()
Is the component visible?
A component is visible only if all its parents are also visible. |
boolean |
isVisibleRecursive() |
protected void |
onContextHelpIconClick(com.vaadin.ui.Component.HasContextHelp.ContextHelpIconClickEvent e) |
protected <E> void |
publish(java.lang.Class<E> eventType,
E event) |
void |
removeStyleName(java.lang.String styleName)
Removes one or more style names from component.
|
protected java.lang.String |
sanitize(java.lang.String html) |
void |
setAlignment(Component.Alignment alignment) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setCaption(java.lang.String caption)
Sets the component's caption.
|
void |
setCaptionAsHtml(boolean captionAsHtml)
Sets whether the caption is rendered as HTML.
|
void |
setContextHelpIconClickHandler(java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> handler)
Sets a context help icon click handler.
|
void |
setContextHelpText(java.lang.String contextHelpText)
Sets context help text.
|
void |
setContextHelpTextHtmlEnabled(boolean enabled)
Defines if context help text can be presented as HTML.
|
void |
setDebugId(java.lang.String id)
INTERNAL.
|
void |
setDescription(java.lang.String description)
Sets the component's description.
|
void |
setDescriptionAsHtml(boolean descriptionAsHtml)
Sets whether the description is rendered as HTML.
|
void |
setEnabled(boolean enabled)
Sets the component enabled state.
|
void |
setFrame(Frame frame) |
void |
setHeight(java.lang.String height)
Set component height in
Component.getHeightSizeUnit() |
void |
setHtmlSanitizerEnabled(boolean htmlSanitizerEnabled)
Sets whether html sanitizer is enabled or not.
|
void |
setIcon(java.lang.String icon)
Set an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.
|
void |
setIconFromSet(Icons.Icon icon)
Set an icon from an icon set.
|
void |
setId(java.lang.String id)
Set component ID
|
void |
setParent(Component parent)
INTERNAL.
ComponentContainer.add(Component) is normally used for adding components
to a parent and the used method will call this method implicitly. |
void |
setResponsive(boolean responsive)
Sets component to be responsive by width and height.
|
void |
setStyleName(java.lang.String name)
Sets one or more style names of the component, replacing any
previous styles.
|
protected void |
setValidationError(java.lang.String errorMessage) |
void |
setVisible(boolean visible)
Sets visibility value for the component.
|
void |
setWidth(java.lang.String width)
Set component width in
Component.getWidthSizeUnit() } |
void |
setXmlDescriptor(org.dom4j.Element element) |
protected <E> boolean |
unsubscribe(java.lang.Class<E> eventType,
java.util.function.Consumer<E> listener) |
<X> X |
unwrap(java.lang.Class<X> internalComponentClass)
Get client specific component instance.
|
<X> X |
unwrapComposition(java.lang.Class<X> internalCompositionClass)
Get the outmost external container of client specific component instance.
|
<X> X |
unwrapCompositionOrNull(java.lang.Class<X> internalCompositionClass)
Get the outmost external container of client specific component instance.
|
<X> X |
unwrapOrNull(java.lang.Class<X> internalComponentClass)
Get client specific component instance.
|
<X> void |
withUnwrapped(java.lang.Class<X> internalComponentClass,
java.util.function.Consumer<X> action)
Performs the given
action with underlying component if it can be casted to the given
internalComponentClass . |
<X> void |
withUnwrappedComposition(java.lang.Class<X> internalCompositionClass,
java.util.function.Consumer<X> action)
Get the outmost external container of client specific component instance and performs the given
action . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setHeightAuto, setHeightFull, setSizeAuto, setSizeFull, setWidthAuto, setWidthFull
public static final java.lang.String ICON_STYLE
protected java.lang.String id
protected T extends com.vaadin.ui.Component component
protected org.dom4j.Element element
protected Frame frame
protected Component parent
protected Component.Alignment alignment
protected java.lang.String icon
protected boolean descriptionAsHtml
protected java.lang.Boolean htmlSanitizerEnabled
protected java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> contextHelpIconClickHandler
protected com.vaadin.shared.Registration contextHelpIconClickListener
protected org.springframework.context.ApplicationContext applicationContext
@Autowired public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
protected io.jmix.core.common.event.EventHub getEventHub()
protected <E> void publish(java.lang.Class<E> eventType, E event)
protected boolean hasSubscriptions(java.lang.Class<?> eventClass)
protected <E> boolean unsubscribe(java.lang.Class<E> eventType, java.util.function.Consumer<E> listener)
@Nullable public Frame getFrame()
getFrame
in interface Component.BelongToFrame
public void setFrame(@Nullable Frame frame)
setFrame
in interface Component.BelongToFrame
public boolean isResponsive()
Component
isResponsive
in interface Component
public void setResponsive(boolean responsive)
Component
setResponsive
in interface Component
responsive
- responsive flag@Nullable public java.lang.String getId()
Component
id
attributepublic void setId(@Nullable java.lang.String id)
Component
protected void assignDebugId()
@Nullable public Component getParent()
public void setParent(@Nullable Component parent)
Component
ComponentContainer.add(Component)
is normally used for adding components
to a parent and the used method will call this method implicitly.public boolean isAttached()
isAttached
in interface AttachNotifier
public void attached()
AttachNotifier
attached
in interface AttachNotifier
public void detached()
AttachNotifier
detached
in interface AttachNotifier
public io.jmix.core.common.event.Subscription addAttachListener(java.util.function.Consumer<AttachEvent> listener)
AttachNotifier
addAttachListener
in interface AttachNotifier
listener
- a listener to addpublic io.jmix.core.common.event.Subscription addDetachListener(java.util.function.Consumer<DetachEvent> listener)
AttachNotifier
addDetachListener
in interface AttachNotifier
listener
- a listener to add@Nullable public java.lang.String getDebugId()
getDebugId
in interface HasDebugId
public void setDebugId(@Nullable java.lang.String id)
HasDebugId
setDebugId
in interface HasDebugId
public java.lang.String getStyleName()
Component
getStyleName
in interface Component
public void setStyleName(@Nullable java.lang.String name)
Component
setStyleName
in interface Component
name
- one or more style names separated by space.public void addStyleName(java.lang.String styleName)
Component
addStyleName
in interface Component
styleName
- one or more style names separated by space.public void removeStyleName(java.lang.String styleName)
Component
removeStyleName
in interface Component
styleName
- one or more style names separated by space.public boolean isEnabled()
Component
public boolean isEnabledRecursive()
isEnabledRecursive
in interface Component
public void setEnabled(boolean enabled)
Component
setEnabled
in interface Component
enabled
- enabled flagpublic boolean isVisible()
Component
public boolean isVisibleRecursive()
isVisibleRecursive
in interface Component
public void setVisible(boolean visible)
Component
setVisible
in interface Component
visible
- visible flagpublic java.lang.String getIcon()
Component.HasIcon
getIcon
in interface Component.HasIcon
@Nullable public java.lang.String getCaption()
getCaption
in interface Component.HasCaption
public void setCaption(@Nullable java.lang.String caption)
Component.HasCaption
setCaption
in interface Component.HasCaption
caption
- the new component's captionpublic boolean isCaptionAsHtml()
isCaptionAsHtml
in interface HasHtmlCaption
true
if the caption is rendered as HTML,
false
if rendered as plain textpublic void setCaptionAsHtml(boolean captionAsHtml)
HasHtmlCaption
setCaptionAsHtml
in interface HasHtmlCaption
captionAsHtml
- true
if the caption is rendered as HTML,
false
if rendered as plain textComponent.HasCaption.setCaption(String)
@Nullable public java.lang.String getDescription()
getDescription
in interface Component.HasDescription
public void setDescription(@Nullable java.lang.String description)
Component.HasDescription
setDescription
in interface Component.HasDescription
description
- the new description to setpublic boolean isDescriptionAsHtml()
isDescriptionAsHtml
in interface HasHtmlDescription
true
if the description is rendered as HTML,
false
if rendered as plain textpublic void setDescriptionAsHtml(boolean descriptionAsHtml)
HasHtmlDescription
setDescriptionAsHtml
in interface HasHtmlDescription
descriptionAsHtml
- true
if the description is rendered as HTML,
false
if rendered as plain textComponent.HasDescription.setDescription(String)
public void setIcon(@Nullable java.lang.String icon)
Component.HasIcon
setIcon
in interface Component.HasIcon
public void setIconFromSet(@Nullable Icons.Icon icon)
Component.HasIcon
setIconFromSet
in interface Component.HasIcon
@Nullable protected com.vaadin.server.Resource getIconResource(java.lang.String icon)
@Nullable protected java.lang.String getIconName(@Nullable Icons.Icon icon)
public float getHeight()
Component
Component.getHeightSizeUnit()
public SizeUnit getHeightSizeUnit()
Component
getHeightSizeUnit
in interface Component
public void setHeight(@Nullable java.lang.String height)
Component
Component.getHeightSizeUnit()
public float getWidth()
Component
Component.getWidthSizeUnit()
public SizeUnit getWidthSizeUnit()
Component
getWidthSizeUnit
in interface Component
public void setWidth(@Nullable java.lang.String width)
Component
Component.getWidthSizeUnit()
}public Component.Alignment getAlignment()
getAlignment
in interface Component
public void setAlignment(Component.Alignment alignment)
setAlignment
in interface Component
public T getComponent()
getComponent
in interface Component.Wrapper
public com.vaadin.ui.Component getComposition()
getComposition
in interface Component.Wrapper
@Nullable public org.dom4j.Element getXmlDescriptor()
getXmlDescriptor
in interface Component.HasXmlDescriptor
public void setXmlDescriptor(@Nullable org.dom4j.Element element)
setXmlDescriptor
in interface Component.HasXmlDescriptor
@Nullable public java.lang.String getContextHelpText()
getContextHelpText
in interface HasContextHelp
public void setContextHelpText(@Nullable java.lang.String contextHelpText)
HasContextHelp
setContextHelpText
in interface HasContextHelp
contextHelpText
- context help text to be setpublic boolean isContextHelpTextHtmlEnabled()
isContextHelpTextHtmlEnabled
in interface HasContextHelp
public void setContextHelpTextHtmlEnabled(boolean enabled)
HasContextHelp
setContextHelpTextHtmlEnabled
in interface HasContextHelp
enabled
- true if field accepts context help text in HTML format, false otherwise@Nullable public java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> getContextHelpIconClickHandler()
getContextHelpIconClickHandler
in interface HasContextHelp
public void setContextHelpIconClickHandler(@Nullable java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> handler)
HasContextHelp
setContextHelpIconClickHandler
in interface HasContextHelp
handler
- the handler to setprotected void onContextHelpIconClick(com.vaadin.ui.Component.HasContextHelp.ContextHelpIconClickEvent e)
public <X> X unwrap(java.lang.Class<X> internalComponentClass)
Component
com.vaadin.ui.TextField vTextField = textField.unwrap(com.vaadin.ui.TextField.class);
@Nullable public <X> X unwrapOrNull(java.lang.Class<X> internalComponentClass)
Component
null
if underlying component cannot be casted to the given internalComponentClass
.
Example:
com.vaadin.ui.TextField vTextField = textField.unwrapOrNull(com.vaadin.ui.TextField.class);
unwrapOrNull
in interface Component
X
- type of internal classinternalComponentClass
- class of underlying component implementation based on Vaadin or Swingpublic <X> void withUnwrapped(java.lang.Class<X> internalComponentClass, java.util.function.Consumer<X> action)
Component
action
with underlying component if it can be casted to the given
internalComponentClass
.
Example:
textField.withUnwrapped(com.vaadin.ui.TextField.class, vTextField -> { // do something });
withUnwrapped
in interface Component
X
- type of internal classinternalComponentClass
- class of underlying component implementation based on Vaadin or Swingaction
- action to perform if underlying component can be casted to given classpublic <X> X unwrapComposition(java.lang.Class<X> internalCompositionClass)
Component
com.vaadin.ui.Layout vLayout = table.unwrapComposition(com.vaadin.ui.Layout.class);
unwrapComposition
in interface Component
X
- type of internal classinternalCompositionClass
- class of underlying composition implementation based on Vaadin or Swing@Nullable public <X> X unwrapCompositionOrNull(java.lang.Class<X> internalCompositionClass)
Component
internalCompositionClass
.
Example:
com.vaadin.ui.Layout vLayout = table.unwrapCompositionOrNull(com.vaadin.ui.Layout.class);
unwrapCompositionOrNull
in interface Component
X
- type of internal classinternalCompositionClass
- class of underlying composition implementation based on Vaadin or Swingpublic <X> void withUnwrappedComposition(java.lang.Class<X> internalCompositionClass, java.util.function.Consumer<X> action)
Component
action
.
table.withUnwrappedComposition(com.vaadin.ui.Layout.class, vLayout -> { // do something });
withUnwrappedComposition
in interface Component
X
- type of internal classinternalCompositionClass
- class of underlying composition implementation based on Vaadin or Swingaction
- to perform if underlying composition can be casted to given classprotected boolean hasValidationError()
protected void setValidationError(@Nullable java.lang.String errorMessage)
public boolean isHtmlSanitizerEnabled()
isHtmlSanitizerEnabled
in interface HasHtmlSanitizer
public void setHtmlSanitizerEnabled(boolean htmlSanitizerEnabled)
HasHtmlSanitizer
setHtmlSanitizerEnabled
in interface HasHtmlSanitizer
htmlSanitizerEnabled
- specifies whether html sanitizer is enabled@Nullable protected java.lang.String sanitize(@Nullable java.lang.String html)
protected UiProperties getUiProperties()
protected UiComponentProperties getUiComponentProperties()
protected HtmlSanitizer getHtmlSanitizer()