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.WrapperHasContextHelp.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, waitsetHeightAuto, setHeightFull, setSizeAuto, setSizeFull, setWidthAuto, setWidthFullpublic 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.BelongToFramepublic void setFrame(@Nullable
Frame frame)
setFrame in interface Component.BelongToFramepublic boolean isResponsive()
ComponentisResponsive in interface Componentpublic void setResponsive(boolean responsive)
ComponentsetResponsive in interface Componentresponsive - responsive flag@Nullable public java.lang.String getId()
Componentid attributepublic void setId(@Nullable
java.lang.String id)
Componentprotected void assignDebugId()
@Nullable public Component getParent()
public void setParent(@Nullable
Component parent)
ComponentComponentContainer.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 AttachNotifierpublic void attached()
AttachNotifierattached in interface AttachNotifierpublic void detached()
AttachNotifierdetached in interface AttachNotifierpublic io.jmix.core.common.event.Subscription addAttachListener(java.util.function.Consumer<AttachEvent> listener)
AttachNotifieraddAttachListener in interface AttachNotifierlistener - a listener to addpublic io.jmix.core.common.event.Subscription addDetachListener(java.util.function.Consumer<DetachEvent> listener)
AttachNotifieraddDetachListener in interface AttachNotifierlistener - a listener to add@Nullable public java.lang.String getDebugId()
getDebugId in interface HasDebugIdpublic void setDebugId(@Nullable
java.lang.String id)
HasDebugIdsetDebugId in interface HasDebugIdpublic java.lang.String getStyleName()
ComponentgetStyleName in interface Componentpublic void setStyleName(@Nullable
java.lang.String name)
ComponentsetStyleName in interface Componentname - one or more style names separated by space.public void addStyleName(java.lang.String styleName)
ComponentaddStyleName in interface ComponentstyleName - one or more style names separated by space.public void removeStyleName(java.lang.String styleName)
ComponentremoveStyleName in interface ComponentstyleName - one or more style names separated by space.public boolean isEnabled()
Componentpublic boolean isEnabledRecursive()
isEnabledRecursive in interface Componentpublic void setEnabled(boolean enabled)
ComponentsetEnabled in interface Componentenabled - enabled flagpublic boolean isVisible()
Componentpublic boolean isVisibleRecursive()
isVisibleRecursive in interface Componentpublic void setVisible(boolean visible)
ComponentsetVisible in interface Componentvisible - visible flagpublic java.lang.String getIcon()
Component.HasIcongetIcon in interface Component.HasIcon@Nullable public java.lang.String getCaption()
getCaption in interface Component.HasCaptionpublic void setCaption(@Nullable
java.lang.String caption)
Component.HasCaptionsetCaption in interface Component.HasCaptioncaption - the new component's captionpublic boolean isCaptionAsHtml()
isCaptionAsHtml in interface HasHtmlCaptiontrue if the caption is rendered as HTML,
false if rendered as plain textpublic void setCaptionAsHtml(boolean captionAsHtml)
HasHtmlCaptionsetCaptionAsHtml in interface HasHtmlCaptioncaptionAsHtml - 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.HasDescriptionpublic void setDescription(@Nullable
java.lang.String description)
Component.HasDescriptionsetDescription in interface Component.HasDescriptiondescription - the new description to setpublic boolean isDescriptionAsHtml()
isDescriptionAsHtml in interface HasHtmlDescriptiontrue if the description is rendered as HTML,
false if rendered as plain textpublic void setDescriptionAsHtml(boolean descriptionAsHtml)
HasHtmlDescriptionsetDescriptionAsHtml in interface HasHtmlDescriptiondescriptionAsHtml - 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.HasIconsetIcon in interface Component.HasIconpublic void setIconFromSet(@Nullable
Icons.Icon icon)
Component.HasIconsetIconFromSet 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()
ComponentComponent.getHeightSizeUnit()public SizeUnit getHeightSizeUnit()
ComponentgetHeightSizeUnit in interface Componentpublic void setHeight(@Nullable
java.lang.String height)
ComponentComponent.getHeightSizeUnit()public float getWidth()
ComponentComponent.getWidthSizeUnit()public SizeUnit getWidthSizeUnit()
ComponentgetWidthSizeUnit in interface Componentpublic void setWidth(@Nullable
java.lang.String width)
ComponentComponent.getWidthSizeUnit()}public Component.Alignment getAlignment()
getAlignment in interface Componentpublic void setAlignment(Component.Alignment alignment)
setAlignment in interface Componentpublic T getComponent()
getComponent in interface Component.Wrapperpublic com.vaadin.ui.Component getComposition()
getComposition in interface Component.Wrapper@Nullable public org.dom4j.Element getXmlDescriptor()
getXmlDescriptor in interface Component.HasXmlDescriptorpublic void setXmlDescriptor(@Nullable
org.dom4j.Element element)
setXmlDescriptor in interface Component.HasXmlDescriptor@Nullable public java.lang.String getContextHelpText()
getContextHelpText in interface HasContextHelppublic void setContextHelpText(@Nullable
java.lang.String contextHelpText)
HasContextHelpsetContextHelpText in interface HasContextHelpcontextHelpText - context help text to be setpublic boolean isContextHelpTextHtmlEnabled()
isContextHelpTextHtmlEnabled in interface HasContextHelppublic void setContextHelpTextHtmlEnabled(boolean enabled)
HasContextHelpsetContextHelpTextHtmlEnabled in interface HasContextHelpenabled - true if field accepts context help text in HTML format, false otherwise@Nullable public java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> getContextHelpIconClickHandler()
getContextHelpIconClickHandler in interface HasContextHelppublic void setContextHelpIconClickHandler(@Nullable
java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> handler)
HasContextHelpsetContextHelpIconClickHandler in interface HasContextHelphandler - the handler to setprotected void onContextHelpIconClick(com.vaadin.ui.Component.HasContextHelp.ContextHelpIconClickEvent e)
public <X> X unwrap(java.lang.Class<X> internalComponentClass)
Componentcom.vaadin.ui.TextField vTextField = textField.unwrap(com.vaadin.ui.TextField.class);
@Nullable public <X> X unwrapOrNull(java.lang.Class<X> internalComponentClass)
Componentnull 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 ComponentX - 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)
Componentaction 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 ComponentX - 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)
Componentcom.vaadin.ui.Layout vLayout = table.unwrapComposition(com.vaadin.ui.Layout.class);
unwrapComposition in interface ComponentX - type of internal classinternalCompositionClass - class of underlying composition implementation based on Vaadin or Swing@Nullable public <X> X unwrapCompositionOrNull(java.lang.Class<X> internalCompositionClass)
ComponentinternalCompositionClass.
Example:
com.vaadin.ui.Layout vLayout = table.unwrapCompositionOrNull(com.vaadin.ui.Layout.class);
unwrapCompositionOrNull in interface ComponentX - 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)
Componentaction.
table.withUnwrappedComposition(com.vaadin.ui.Layout.class, vLayout -> {
// do something
});
withUnwrappedComposition in interface ComponentX - 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 HasHtmlSanitizerpublic void setHtmlSanitizerEnabled(boolean htmlSanitizerEnabled)
HasHtmlSanitizersetHtmlSanitizerEnabled in interface HasHtmlSanitizerhtmlSanitizerEnabled - 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()